OSDN Git Service

skin 用に <NONSPAMMINESS/> を追加。
[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                 ViewNoButton: TToolButton;
259                 IconToolButton: TToolButton;
260                 UpFolderButton: TToolButton;
261                 Sepa01ToolButton: TToolButton;
262                 AllItemToolButton: TToolButton;
263                 LogItemToolButton: TToolButton;
264                 NewItemToolButton: TToolButton;
265                 ListDownloadToolButton: TToolButton;
266                 ListThreadDownloadToolButton: TToolButton;
267                 ToolButton2: TToolButton;
268                 ToolButton1: TToolButton;
269                 BrowserCoolBar: TGikoCoolBar;
270                 BrowserToolBar: TToolBar;
271                 BrowserSizeButton: TToolButton;
272                 ToolButton3: TToolButton;
273                 TopButton: TToolButton;
274                 LastBotton: TToolButton;
275                 NewButton: TToolButton;
276                 KokoButton: TToolButton;
277                 ToolButton9: TToolButton;
278                 EditorButton: TToolButton;
279                 ToolButton11: TToolButton;
280                 IEButton: TToolButton;
281                 ToolButton5: TToolButton;
282                 ItemReloadButton: TToolButton;
283                 ListNameToolBar: TToolBar;
284                 ListNameLabel: TLabel;
285                 FolderImage: TImage;
286                 BrowserNameToolBar: TToolBar;
287                 ItemBoardImage: TImage;
288                 BrowserBoardNameLabel: TLabel;
289                 ItemImage: TImage;
290                 BrowserNameLabel: TLabel;
291                 ActiveLogDeleteAction: TAction;
292                 D3: TMenuItem;
293                 N25: TMenuItem;
294                 N26: TMenuItem;
295                 ListNameBarVisibleAction: TAction;
296                 D4: TMenuItem;
297                 BrowserNameBarVisibleAction: TAction;
298                 S3: TMenuItem;
299                 R2: TMenuItem;
300                 TreeSelectNameURLCopy: TAction;
301                 TreeSelectNameURLPupupMenu: TMenuItem;
302                 N27: TMenuItem;
303                 H3: TMenuItem;
304                 PaneInitAction: TAction;
305                 I1: TMenuItem;
306                 BrowserTabToolBar: TToolBar;
307                 BrowserTab: TTabControl;
308                 ToolButton7: TToolButton;
309                 BrowserMinAction: TAction;
310                 About1: TMenuItem;
311                 N28: TMenuItem;
312                 SelectTextClearAction: TAction;
313                 MailTextClearAction: TAction;
314                 NameTextClearAction: TAction;
315                 S4: TMenuItem;
316                 N29: TMenuItem;
317                 N30: TMenuItem;
318                 LeftmostTabSelectAction: TAction;
319                 LeftTabSelectAction: TAction;
320                 RightTabSelectAction: TAction;
321                 RightmostTabSelectAction: TAction;
322                 N31: TMenuItem;
323                 L5: TMenuItem;
324                 L6: TMenuItem;
325                 A7: TMenuItem;
326                 R3: TMenuItem;
327                 FavoriteMenu: TMenuItem;
328                 FavoriteAddAction: TAction;
329                 N32: TMenuItem;
330                 BoardFavoriteAddMenu: TMenuItem;
331                 BoardFavoriteAddAction: TAction;
332                 ThreadFavoriteAddAction: TAction;
333                 ThreadFavoriteAddMenu: TMenuItem;
334                 TreeSelectFavoriteAddAction: TAction;
335                 N33: TMenuItem;
336                 TreeSelectFavoriteAddPupupMenu: TMenuItem;
337                 FavoriteArrangeAction: TAction;
338                 FavoriteTreeView: TTreeView;
339                 StateIconImageList: TImageList;
340                 TopPanel: TPanel;
341                 TopRightPanel: TPanel;
342                 AnimePanel: TPanel;
343                 Animate: TAnimate;
344                 TopCoolPanel: TPanel;
345                 MainCoolBar: TGikoCoolBar;
346                 MenuToolBar: TToolBar;
347                 StdToolBar: TToolBar;
348                 RoundToolButton: TToolButton;
349                 ToolButton6: TToolButton;
350                 ToolButton4: TToolButton;
351                 ToolButton13: TToolButton;
352                 AbortToolButton: TToolButton;
353                 LoginToolButton: TToolButton;
354                 AddressToolBar: TToolBar;
355                 AddressComboBox: TComboBox;
356                 MoveToToolButton: TToolButton;
357                 MoveToAction: TAction;
358                 AddressImageList: TImageList;
359                 AddressBarVisibleAction: TAction;
360                 AddressToolBarMenu: TMenuItem;
361                 T4: TMenuItem;
362                 BrowserTabVisibleAction: TAction;
363                 Show1: TMenuItem;
364                 N34: TMenuItem;
365                 BrowserTabTopAction: TAction;
366                 BrowserTabBottomAction: TAction;
367                 T5: TMenuItem;
368                 B5: TMenuItem;
369                 N35: TMenuItem;
370                 BrowserTabTabStyleAction: TAction;
371                 BrowserTabButtonStyleAction: TAction;
372                 BrowserTabFlatStyleAction: TAction;
373                 A8: TMenuItem;
374                 U2: TMenuItem;
375                 F1: TMenuItem;
376                 PreviewTimer: TTimer;
377                 MonazillaWebPageAction: TAction;
378                 MonazillaWebPageAction1: TMenuItem;
379                 GikoHelpAction: TAction;
380                 N36: TMenuItem;
381                 H4: TMenuItem;
382                 KotehanAction: TAction;
383                 K3: TMenuItem;
384                 LinkBarVisibleAction: TAction;
385                 L7: TMenuItem;
386                 N37: TMenuItem;
387                 A9: TMenuItem;
388                 ChevronPopupMenu: TPopupMenu;
389                 BBS2chWebPageAction: TAction;
390                 N2N1: TMenuItem;
391                 N38: TMenuItem;
392                 GikoFolderOpenAction: TAction;
393                 F2: TMenuItem;
394                 LinkToolBar: TToolBar;
395                 a10: TMenuItem;
396                 ToolButton8: TToolButton;
397                 ToolButton10: TToolButton;
398                 ThreadEditorAction: TAction;
399                 N39: TMenuItem;
400                 T6: TMenuItem;
401                 N40: TMenuItem;
402                 LinkBarPopupMenu: TPopupMenu;
403                 ToolBarSettingAction: TAction;
404                 T7: TMenuItem;
405                 ToolButton12: TToolButton;
406                 ToolButton14: TToolButton;
407                 ThreadPopupMenu: TPopupMenu;
408                 MenuItem4: TMenuItem;
409                 MenuItem5: TMenuItem;
410                 MenuItem6: TMenuItem;
411                 T8: TMenuItem;
412                 NameCopyAction: TAction;
413                 BoardIEAction: TAction;
414                 URLN3: TMenuItem;
415                 SelectItemNameCopyAction: TAction;
416                 SelectItemNameCopyAction1: TMenuItem;
417                 B6: TMenuItem;
418                 T9: TMenuItem;
419                 C2: TMenuItem;
420                 SelectComboBox: TComboBox;
421                 MainCoolBarPopupMenu: TPopupMenu;
422                 StdToolBarVisiblePMenu: TMenuItem;
423                 AddressToolBarVisiblePMenu: TMenuItem;
424                 LinkToolBarVisiblePMenu: TMenuItem;
425                 NG1: TMenuItem;
426                 NG2: TMenuItem;
427                 N43: TMenuItem;
428                 N44: TMenuItem;
429                 L9: TMenuItem;
430                 I3: TMenuItem;
431                 N45: TMenuItem;
432                 B9: TMenuItem;
433                 R5: TMenuItem;
434                 T12: TMenuItem;
435                 Show3: TMenuItem;
436                 N46: TMenuItem;
437                 T13: TMenuItem;
438                 B10: TMenuItem;
439                 N47: TMenuItem;
440                 A12: TMenuItem;
441                 U4: TMenuItem;
442                 F4: TMenuItem;
443                 N48: TMenuItem;
444                 T14: TMenuItem;
445                 SelectItemToolButton: TToolButton;
446                 SelectResToolButton: TToolButton;
447                 SelectResAction: TAction;
448                 ToolButton16: TToolButton;
449                 AllResAction: TAction;
450                 N50: TMenuItem;
451                 A11: TMenuItem;
452                 S5: TMenuItem;
453                 Reload: TMenuItem;
454                 GoBack: TMenuItem;
455                 GoFoward: TMenuItem;
456     EditNGAction: TAction;
457                 ReloadAction: TAction;
458                 GoFowardAction: TAction;
459                 GoBackAction: TAction;
460                 SelectComboBoxSplitter: TImage;
461                 IndividualAbon1: TMenuItem;
462                 N41: TMenuItem;
463                 IndividualAbon2: TMenuItem;
464                 N42: TMenuItem;
465                 CancellIndividualAbon: TAction;
466                 AntiIndividualAbon: TMenuItem;
467                 N49: TMenuItem;
468                 N51: TMenuItem;
469                 N52: TMenuItem;
470                 N53: TMenuItem;
471                 SearchBoardName: TMenuItem;
472     TreeSelectLogDeleteSeparator: TMenuItem;
473                 TreeSelectSearchBoardName: TAction;
474                 CabinetFavoriteAction: TAction;
475                 N54: TMenuItem;
476                 A13: TMenuItem;
477                 FavoriteTreePopupMenu: TPopupMenu;
478                 FavoriteTreeViewRenameAction: TAction;
479                 FavoriteTreeRenamePopupMenu: TMenuItem;
480                 FavoriteTreeViewNewFolderAction: TAction;
481                 FavoriteTreeNewFolderPopupMenu: TMenuItem;
482                 N56: TMenuItem;
483                 FavoriteTreeViewDeleteAction: TAction;
484                 FavoriteTreeDeletePopupMenu: TMenuItem;
485                 FavoriteToolBar: TToolBar;
486                 ToolButton17: TToolButton;
487                 ToolButton19: TToolButton;
488                 FavoriteTreeViewBrowseFolderAction: TAction;
489                 FavoriteTreeBrowseFolderPopupMenu: TMenuItem;
490                 N57: TMenuItem;
491                 FavoriteTreeReloadPopupMenu: TMenuItem;
492                 N58: TMenuItem;
493                 FavoriteTreeURLCopyPopupMenu: TMenuItem;
494                 FavoriteTreeNameCopyPopupMenu: TMenuItem;
495                 FavoriteTreeLogDeletePopupMenu: TMenuItem;
496                 N59: TMenuItem;
497                 FavoriteTreeNameURLCopyPopupMenu: TMenuItem;
498                 FavoriteTreeViewReloadAction: TAction;
499                 FavoriteTreeViewURLCopyAction: TAction;
500                 FavoriteTreeViewNameCopyAction: TAction;
501                 FavoriteTreeViewNameURLCopyAction: TAction;
502                 FavoriteTreeViewLogDeleteAction: TAction;
503     ResRangeAction: TAction;
504                 ToolButton20: TToolButton;
505         ResRangeButton: TToolButton;
506                 N60: TMenuItem;
507                 ExportFavoriteFileAction1: TMenuItem;
508                 ExportFavoriteFile: TFileSaveAs;
509                 ToolButton21: TToolButton;
510                 CabinetBBSToolButton: TToolButton;
511                 ToolButton23: TToolButton;
512                 ToolButton24: TToolButton;
513                 N6: TMenuItem;
514                 N17: TMenuItem;
515                 FavoriteTreeViewBrowseBoardAction: TAction;
516                 FavoriteTreeViewBrowseThreadAction: TAction;
517                 UpBoardAction: TAction;
518     N18: TMenuItem;
519     N20: TMenuItem;
520     N24: TMenuItem;
521     N62: TMenuItem;
522     N61: TMenuItem;
523         N63: TMenuItem;
524     KoreCopy: TAction;
525     N64: TMenuItem;
526     dummy1: TMenuItem;
527     TreeSelectLogDeletePopupMenu: TMenuItem;
528     N65: TMenuItem;
529     BBSSelectPopupMenu: TPopupMenu;
530                 PlugInMenu: TMenuItem;
531         TmpToolBar: TToolBar;
532     TreeSelectNameCopy: TAction;
533     TreeSelectNamePupupMenu: TMenuItem;
534     BrowserPanel: TPanel;
535     SetFocusForBrowserAction: TAction;
536     SetFocusForThreadListAction: TAction;
537     SetFocusForCabinetAction: TAction;
538     FileRun1: TFileRun;
539     ThreadlistMaxAndFocusAction: TAction;
540     BrowserMaxAndFocusAction: TAction;
541         UpBoardButton: TToolButton;
542     SelectTimer: TTimer;
543     SelectThreadSave: TMenuItem;
544     SelectItemSaveForHTML: TAction;
545     FileSaveAs1: TFileSaveAs;
546     N55: TMenuItem;
547     N66: TMenuItem;
548     dat1: TMenuItem;
549     SelectItemSaveForDat: TAction;
550     LogFolderOpenAction: TAction;
551                 OpenLogFolder: TMenuItem;
552     Browser: TWebBrowser;
553     TabSave: TMenuItem;
554         TabOpen: TMenuItem;
555                 TabsSaveAction: TAction;
556     TabsOpenAction: TAction;
557     ResRangePopupMenu: TPopupMenu;
558     N1001: TMenuItem;
559         N501: TMenuItem;
560     N22: TMenuItem;
561     OnlyAHundredResAction: TAction;
562     OnlyNewResAction: TAction;
563     OnlyKokoResAction: TAction;
564     A14: TMenuItem;
565     BrowsBoradHeadAction: TAction;
566     BrowsBoradHeadAction1: TMenuItem;
567     ThreadRangeAction: TAction;
568     ThreadRangePopupMenu: TPopupMenu;
569     A15: TMenuItem;
570     L8: TMenuItem;
571     N67: TMenuItem;
572     N68: TMenuItem;
573     S6: TMenuItem;
574     N69: TMenuItem;
575     S7: TMenuItem;
576     ThreadRangeButton: TToolButton;
577         TabAutoSaveAction: TAction;
578     TabAutoLoadAction: TAction;
579     ListColumnPopupMenu: TPopupMenu;
580     JumpToNumOfResAction: TAction;
581     FavoriteTreeViewCollapseAction: TAction;
582                                 procedure FormCreate(Sender: TObject);
583                 procedure FormDestroy(Sender: TObject);
584                 procedure CabinetPanelHide(Sender: TObject);
585                 procedure ListViewData(Sender: TObject; Item: TListItem);
586                 procedure ListViewDataFind(Sender: TObject; Find: TItemFind;
587                         const FindString: String; const FindPosition: TPoint;
588                         FindData: Pointer; StartIndex: Integer; Direction: TSearchDirection;
589                         Wrap: Boolean; var Index: Integer);
590                 procedure ListViewDataHint(Sender: TObject; StartIndex,
591                         EndIndex: Integer);
592                 procedure ListViewDataStateChange(Sender: TObject; StartIndex,
593                         EndIndex: Integer; OldState, NewState: TItemStates);
594                 procedure BrowserStatusTextChange(Sender: TObject;
595                         const Text: WideString);
596                 procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
597                 procedure TreeViewChanging(Sender: TObject; Node: TTreeNode;
598                         var AllowChange: Boolean);
599                 procedure ListViewKeyDown(Sender: TObject; var Key: Word;
600                         Shift: TShiftState);
601                 procedure ListViewColumnClick(Sender: TObject; Column: TListColumn);
602                 procedure ListViewSort(Sender: TObject; Column: TListColumn);
603                 procedure MenuToolBarCustomDrawButton(Sender: TToolBar;
604                         Button: TToolButton; State: TCustomDrawState;
605                         var DefaultDraw: Boolean);
606                 procedure BrowserBeforeNavigate2(Sender: TObject;
607                         const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
608                         Headers: OleVariant; var Cancel: WordBool);
609                 procedure TreeViewCustomDraw(Sender: TCustomTreeView;
610                         const ARect: TRect; var DefaultDraw: Boolean);
611                 procedure TreeViewCustomDrawItem(Sender: TCustomTreeView;
612                         Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean);
613                 procedure TreeViewExpanded(Sender: TObject; Node: TTreeNode);
614                 procedure TreeViewDblClick(Sender: TObject);
615                 procedure ListViewCustomDraw(Sender: TCustomListView;
616                         const ARect: TRect; var DefaultDraw: Boolean);
617                 procedure ListViewMouseDown(Sender: TObject; Button: TMouseButton;
618                         Shift: TShiftState; X, Y: Integer);
619                 procedure TreeViewCollapsed(Sender: TObject; Node: TTreeNode);
620                 procedure MessageListViewResize(Sender: TObject);
621                 procedure ExitActionExecute(Sender: TObject);
622                 procedure AllSelectActionExecute(Sender: TObject);
623                 procedure StdToolBarVisibleActionExecute(Sender: TObject);
624                 procedure MsgBarVisibleActionExecute(Sender: TObject);
625                 procedure StatusBarVisibleActionExecute(Sender: TObject);
626                 procedure LargeIconActionExecute(Sender: TObject);
627                 procedure SmallIconActionExecute(Sender: TObject);
628                 procedure ListIconActionExecute(Sender: TObject);
629                 procedure DetailIconActionExecute(Sender: TObject);
630                 procedure SearchActionExecute(Sender: TObject);
631                 procedure OptionActionExecute(Sender: TObject);
632                 procedure GikoNaviWebPageActionExecute(Sender: TObject);
633                 procedure AboutActionExecute(Sender: TObject);
634                 procedure CabinetHistoryActionExecute(Sender: TObject);
635                 procedure       CabinetVisible( isVisible : Boolean );
636                 procedure CabinetVisibleActionExecute(Sender: TObject);
637                 procedure AllItemActionExecute(Sender: TObject);
638                 procedure LogItemActionExecute(Sender: TObject);
639                 procedure NewItemActionExecute(Sender: TObject);
640                 procedure SelectItemActionExecute(Sender: TObject);
641                 procedure ListNumberVisibleActionExecute(Sender: TObject);
642                 procedure UpFolderActionExecute(Sender: TObject);
643                 procedure IconStyleExecute(Sender: TObject);
644                 procedure RoundActionExecute(Sender: TObject);
645                 procedure StopActionExecute(Sender: TObject);
646                 procedure MsgBarCloseActionExecute(Sender: TObject);
647                 procedure BrowserMaxActionExecute(Sender: TObject);
648                 procedure ScrollTopActionExecute(Sender: TObject);
649                 procedure ScrollLastActionExecute(Sender: TObject);
650                 procedure ScrollNewActionExecute(Sender: TObject);
651                 procedure ScrollKokoActionExecute(Sender: TObject);
652                 procedure EditorActionExecute(Sender: TObject);
653                 procedure IEActionExecute(Sender: TObject);
654                 procedure ShowThreadActionExecute(Sender: TObject);
655                 procedure ShowBoardActionExecute(Sender: TObject);
656                 procedure URLCopyActionExecute(Sender: TObject);
657                 procedure ItemReloadActionExecute(Sender: TObject);
658                 procedure SelectListReloadActionExecute(Sender: TObject);
659                 procedure SelectThreadReloadActionExecute(Sender: TObject);
660                 procedure SelectListReloadActionUpdate(Sender: TObject);
661                 procedure AllItemActionUpdate(Sender: TObject);
662                 procedure LogItemActionUpdate(Sender: TObject);
663                 procedure NewItemActionUpdate(Sender: TObject);
664                 procedure SelectItemActionUpdate(Sender: TObject);
665                 procedure UpFolderActionUpdate(Sender: TObject);
666                 procedure FormResize(Sender: TObject);
667                 procedure ScrollTopActionUpdate(Sender: TObject);
668                 procedure ScrollLastActionUpdate(Sender: TObject);
669                 procedure ScrollNewActionUpdate(Sender: TObject);
670                 procedure ScrollKokoActionUpdate(Sender: TObject);
671                 procedure EditorActionUpdate(Sender: TObject);
672                 procedure IEActionUpdate(Sender: TObject);
673                 procedure ShowThreadActionUpdate(Sender: TObject);
674                 procedure ShowBoardActionUpdate(Sender: TObject);
675                 procedure SelectThreadReloadActionUpdate(Sender: TObject);
676                 procedure ItemReloadActionUpdate(Sender: TObject);
677                 procedure LogDeleteActionExecute(Sender: TObject);
678                 procedure KokomadeActionExecute(Sender: TObject);
679                 procedure ZenbuActionExecute(Sender: TObject);
680                 procedure KokoResActionExecute(Sender: TObject);
681                 procedure ListPopupMenuPopup(Sender: TObject);
682                 procedure SelectItemURLCopyActionExecute(Sender: TObject);
683                 procedure SelectItemURLCopyActionUpdate(Sender: TObject);
684                 procedure AllSelectActionUpdate(Sender: TObject);
685                 procedure LogDeleteActionUpdate(Sender: TObject);
686                 procedure BrowserTabCloseActionExecute(Sender: TObject);
687                 procedure NotSelectTabCloseActionExecute(Sender: TObject);
688                 procedure TreeSelectBoradReloadExecute(Sender: TObject);
689                 procedure TreeSelectThreadReloadExecute(Sender: TObject);
690                 procedure TreeSelectURLCopyExecute(Sender: TObject);
691                 procedure TreePopupMenuPopup(Sender: TObject);
692                 procedure ListToolBarVisibleActionExecute(Sender: TObject);
693                 procedure BrowserToolBarVisibleActionExecute(Sender: TObject);
694                 procedure BrowserNewWindow2(Sender: TObject; var ppDisp: IDispatch;
695                         var Cancel: WordBool);
696                 procedure ListSplitterMoved(Sender: TObject);
697                 procedure BrowserTabChange(Sender: TObject);
698                 procedure BrowserTabMouseDown(Sender: TObject; Button: TMouseButton;
699                         Shift: TShiftState; X, Y: Integer);
700                 procedure BrowserTabDragOver(Sender, Source: TObject; X, Y: Integer;
701                         State: TDragState; var Accept: Boolean);
702                 procedure BrowserTabDragDrop(Sender, Source: TObject; X, Y: Integer);
703                 procedure BrowserTabMouseMove(Sender: TObject; Shift: TShiftState; X,
704                         Y: Integer);
705                 procedure BrowserDocumentComplete(Sender: TObject;
706                         const pDisp: IDispatch; var URL: OleVariant);
707                 procedure SelectReservActionUpdate(Sender: TObject);
708                 procedure RoundNamePopupMenuPopup(Sender: TObject);
709                 procedure SelectNewRoundNameExecute(Sender: TObject);
710                 procedure SelectDeleteRoundExecute(Sender: TObject);
711                 procedure SelectReservActionExecute(Sender: TObject);
712                 procedure NewBoardActionExecute(Sender: TObject);
713                 procedure LoginActionExecute(Sender: TObject);
714                 procedure KeySettingActionExecute(Sender: TObject);
715                 procedure AllTabCloseActionExecute(Sender: TObject);
716                 procedure ArrangeActionExecute(Sender: TObject);
717                 procedure NameURLCopyActionExecute(Sender: TObject);
718                 procedure SelectItemNameURLCopyActionExecute(Sender: TObject);
719                 procedure URLCopyActionUpdate(Sender: TObject);
720                 procedure NameURLCopyActionUpdate(Sender: TObject);
721                 procedure BrowserTabCloseActionUpdate(Sender: TObject);
722                 procedure NotSelectTabCloseActionUpdate(Sender: TObject);
723                 procedure AllTabCloseActionUpdate(Sender: TObject);
724                 procedure SelectItemNameURLCopyActionUpdate(Sender: TObject);
725                 procedure ActiveLogDeleteActionExecute(Sender: TObject);
726                 procedure ActiveLogDeleteActionUpdate(Sender: TObject);
727                 procedure ListNameBarVisibleActionExecute(Sender: TObject);
728                 procedure BrowserNameBarVisibleActionExecute(Sender: TObject);
729                 procedure TreeSelectNameURLCopyExecute(Sender: TObject);
730                 procedure PaneInitActionExecute(Sender: TObject);
731                 procedure FormShow(Sender: TObject);
732                 procedure BrowserTabToolBarResize(Sender: TObject);
733                 procedure BrowserMinActionExecute(Sender: TObject);
734                 procedure SelectTextClearActionExecute(Sender: TObject);
735                 procedure NameTextClearActionExecute(Sender: TObject);
736                 procedure MailTextClearActionExecute(Sender: TObject);
737                 procedure LeftmostTabSelectActionExecute(Sender: TObject);
738                 procedure LeftTabSelectActionExecute(Sender: TObject);
739                 procedure RightTabSelectActionExecute(Sender: TObject);
740                 procedure RightmostTabSelectActionExecute(Sender: TObject);
741                 procedure LeftmostTabSelectActionUpdate(Sender: TObject);
742                 procedure LeftTabSelectActionUpdate(Sender: TObject);
743                 procedure RightTabSelectActionUpdate(Sender: TObject);
744                 procedure RightmostTabSelectActionUpdate(Sender: TObject);
745                 procedure FavoriteMenuClick(Sender: TObject);
746                 procedure FavoriteAddActionExecute(Sender: TObject);
747                 procedure FavoriteAddActionUpdate(Sender: TObject);
748                 procedure BoardFavoriteAddActionExecute(Sender: TObject);
749                 procedure BoardFavoriteAddActionUpdate(Sender: TObject);
750                 procedure ThreadFavoriteAddActionExecute(Sender: TObject);
751                 procedure ThreadFavoriteAddActionUpdate(Sender: TObject);
752                 procedure TreeSelectFavoriteAddActionExecute(Sender: TObject);
753                 procedure FavoriteArrangeActionExecute(Sender: TObject);
754                 procedure MainCoolBarResize(Sender: TObject);
755                 procedure MoveToActionExecute(Sender: TObject);
756                 procedure AddressToolBarResize(Sender: TObject);
757                 procedure AddressComboBoxKeyDown(Sender: TObject; var Key: Word;
758                         Shift: TShiftState);
759                 procedure AddressBarVisibleActionExecute(Sender: TObject);
760                 procedure BrowserEnter(Sender: TObject);
761                 procedure FormShortCut(var Msg: TWMKey; var Handled: Boolean);
762                 procedure BrowserTabVisibleActionExecute(Sender: TObject);
763                 procedure BrowserTabTopActionExecute(Sender: TObject);
764                 procedure BrowserTabBottomActionExecute(Sender: TObject);
765                 procedure BrowserTabTabStyleActionExecute(Sender: TObject);
766                 procedure BrowserTabButtonStyleActionExecute(Sender: TObject);
767                 procedure BrowserTabFlatStyleActionExecute(Sender: TObject);
768                 procedure PreviewTimerTimer(Sender: TObject);
769                 procedure MessageHideButtonClick(Sender: TObject);
770                 procedure MonazillaWebPageActionExecute(Sender: TObject);
771                 procedure GikoHelpActionExecute(Sender: TObject);
772                 procedure ToolButton18Click(Sender: TObject);
773                 procedure KotehanActionExecute(Sender: TObject);
774                 procedure LinkBarVisibleActionExecute(Sender: TObject);
775                 procedure BBS2chWebPageActionExecute(Sender: TObject);
776                 procedure GikoFolderOpenActionExecute(Sender: TObject);
777                 procedure MainCoolBarBandInfo(Sender: TObject;
778                         var BandInfo: PReBarBandInfoA);
779                 procedure MainCoolBarChevronClick(Sender: TObject;
780                         RebarChevron: PNMRebarChevron);
781                 procedure ListCoolBarBandInfo(Sender: TObject;
782                         var BandInfo: PReBarBandInfoA);
783                 procedure ListCoolBarChevronClick(Sender: TObject;
784                         RebarChevron: PNMRebarChevron);
785                 procedure BrowserCoolBarBandInfo(Sender: TObject;
786                         var BandInfo: PReBarBandInfoA);
787                 procedure BrowserCoolBarChevronClick(Sender: TObject;
788                         RebarChevron: PNMRebarChevron);
789                 procedure ListViewColumnInfo(Sender: TObject; var Column: PLVColumnA);
790                 procedure ThreadEditorActionExecute(Sender: TObject);
791                 procedure ThreadEditorActionUpdate(Sender: TObject);
792                 procedure ToolBarSettingActionExecute(Sender: TObject);
793                 procedure NameCopyActionExecute(Sender: TObject);
794                 procedure BoardIEActionExecute(Sender: TObject);
795                 procedure SelectItemNameCopyActionExecute(Sender: TObject);
796                 procedure SelectItemNameCopyActionUpdate(Sender: TObject);
797                 procedure BoardIEActionUpdate(Sender: TObject);
798                 procedure FormMouseWheel(Sender: TObject; Shift: TShiftState;
799                         WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
800                 procedure NameCopyActionUpdate(Sender: TObject);
801                 procedure SelectComboBoxChange(Sender: TObject);
802                 procedure SelectComboBoxKeyDown(Sender: TObject; var Key: Word;
803                         Shift: TShiftState);
804                 procedure SelectComboBoxExit(Sender: TObject);
805                 procedure SelectResActionExecute(Sender: TObject);
806                 procedure SelectResActionUpdate(Sender: TObject);
807                 procedure AllResActionExecute(Sender: TObject);
808                 procedure AllResActionUpdate(Sender: TObject);
809                 procedure ReloadClick(Sender: TObject);
810                 procedure GoBackClick(Sender: TObject);
811                 procedure GoFowardClick(Sender: TObject);
812                 procedure SelectComboBoxSplitterMouseMove(Sender: TObject;
813                         Shift: TShiftState; X, Y: Integer);
814                 procedure SelectComboBoxSplitterMouseDown(Sender: TObject;
815                         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
816                 procedure SelectComboBoxSplitterMouseUp(Sender: TObject;
817                         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
818                 procedure StatusBarResize(Sender: TObject);
819                 procedure IndividualAbon1Click(Sender: TObject);
820                 procedure IndividualAbon2Click(Sender: TObject);
821                 procedure N42Click(Sender: TObject);
822                 procedure SelectComboBoxEnter(Sender: TObject);
823                 procedure AntiIndividualAbonClick(Sender: TObject);
824                 procedure N51Click(Sender: TObject);
825                 procedure TreeSelectSearchBoardNameExecute(Sender: TObject);
826                 procedure CabinetFavoriteActionExecute(Sender: TObject);
827                 procedure FavoriteTreeViewDragDrop(Sender, Source: TObject; X,
828                         Y: Integer);
829                 procedure FavoriteTreeViewDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
830                 procedure FavoriteTreeViewEdited(Sender: TObject; Node: TTreeNode;
831                         var S: String);
832                 procedure FavoriteTreeViewKeyDown(Sender: TObject; var Key: Word;
833                         Shift: TShiftState);
834                 procedure FavoriteTreePopupMenuPopup(Sender: TObject);
835                 procedure FavoriteTreeViewDeleteActionExecute(Sender: TObject);
836                 procedure FavoriteTreeViewRenameActionExecute(Sender: TObject);
837                 procedure FavoriteTreeViewNewFolderActionExecute(Sender: TObject);
838                 procedure ToolButton19Click(Sender: TObject);
839                 procedure FavoriteTreeViewBrowseFolderActionExecute(Sender: TObject);
840                 procedure FavoriteTreeViewDblClick(Sender: TObject);
841                 procedure FavoriteTreeViewLogDeleteActionExecute(Sender: TObject);
842                 procedure FavoriteTreeViewReloadActionExecute(Sender: TObject);
843                 procedure FavoriteTreeViewURLCopyActionExecute(Sender: TObject);
844                 procedure FavoriteTreeViewNameCopyActionExecute(Sender: TObject);
845                 procedure FavoriteTreeViewNameURLCopyActionExecute(Sender: TObject);
846                 procedure LinkToolBarDragDrop(Sender, Source: TObject; X, Y: Integer);
847                 procedure BrowserTabMouseUp(Sender: TObject; Button: TMouseButton;
848                         Shift: TShiftState; X, Y: Integer);
849                 procedure LinkToolBarDragOver(Sender, Source: TObject; X, Y: Integer;
850                         State: TDragState; var Accept: Boolean);
851                 procedure ResRangeActionExecute(Sender: TObject);
852                 procedure FavoriteTreeViewEndDrag(Sender, Target: TObject; X,
853                         Y: Integer);
854                 procedure ListCoolBarContextPopup(Sender: TObject; MousePos: TPoint;
855                         var Handled: Boolean);
856                 procedure MainCoolBarContextPopup(Sender: TObject; MousePos: TPoint;
857                         var Handled: Boolean);
858                 procedure BrowserCoolBarContextPopup(Sender: TObject; MousePos: TPoint;
859                         var Handled: Boolean);
860                 procedure ExportFavoriteFileAccept(Sender: TObject);
861                 procedure ExportFavoriteFileBeforeExecute(Sender: TObject);
862                 procedure CabinetBBSActionExecute(Sender: TObject);
863                 procedure FavoriteTreeViewBrowseThreadActionExecute(Sender: TObject);
864                 procedure FavoriteTreeBrowseBoardPopupMenuClick(Sender: TObject);
865                 procedure UpBoardActionExecute(Sender: TObject);
866                 procedure UpBoardActionUpdate(Sender: TObject);
867     procedure BrowserTabContextPopup(Sender: TObject; MousePos: TPoint;
868       var Handled: Boolean);
869     procedure KoreCopyExecute(Sender: TObject);
870     procedure BrowserTabPopupMenuPopup(Sender: TObject);
871     procedure BrowserTabResize(Sender: TObject);
872         procedure TreeViewClick(Sender: TObject);
873     procedure TreeViewKeyDown(Sender: TObject; var Key: Word;
874       Shift: TShiftState);
875     procedure FavoriteTreeViewMouseDown(Sender: TObject;
876                         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
877     procedure MessagePanelResize(Sender: TObject);
878                 procedure OnResized;
879     procedure TreeSelectNameCopyExecute(Sender: TObject);
880     procedure FavoriteTreeViewMouseUp(Sender: TObject;
881       Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
882     procedure ResRangeActionUpdate(Sender: TObject);
883                 procedure SetFocusForBrowserActionExecute(Sender: TObject);
884                 procedure SetFocusForBrowserActionUpdate(Sender: TObject);
885     procedure SetFocusForThreadListActionExecute(Sender: TObject);
886     procedure SetFocusForCabinetActionExecute(Sender: TObject);
887         procedure BrowserMaxAndFocusActionExecute(Sender: TObject);
888     procedure BrowserMaxAndFocusActionUpdate(Sender: TObject);
889     procedure ThreadlistMaxAndFocusActionExecute(Sender: TObject);
890     procedure SetFocusForCabinetActionUpdate(Sender: TObject);
891     procedure ListViewSelectItem(Sender: TObject; Item: TListItem;
892       Selected: Boolean);
893     procedure SelectTimerTimer(Sender: TObject);
894     procedure SelectItemSaveForHTMLExecute(Sender: TObject);
895     procedure KidokuActionExecute(Sender: TObject);
896     procedure MidokuActionExecute(Sender: TObject);
897     procedure SelectItemSaveForDatExecute(Sender: TObject);
898     procedure LogFolderOpenActionExecute(Sender: TObject);
899     procedure LogFolderOpenActionUpdate(Sender: TObject);
900                 procedure TabsSaveActionExecute(Sender: TObject);
901                 procedure TabsOpenActionExecute(Sender: TObject);
902                 procedure TabsSaveToFileActionExecute(Sender: TObject);
903     procedure TabsOpenFromFileActionExecute(Sender: TObject);
904     procedure OnlyAHundredResActionExecute(Sender: TObject);
905     procedure OnlyKokoResActionExecute(Sender: TObject);
906     procedure OnlyNewResActionExecute(Sender: TObject);
907         procedure BrowsBoradHeadActionExecute(Sender: TObject);
908     procedure BrowsBoradHeadActionUpdate(Sender: TObject);
909     procedure EditNGActionExecute(Sender: TObject);
910     procedure ThreadRangeActionUpdate(Sender: TObject);
911     procedure ThreadRangeActionExecute(Sender: TObject);
912                 procedure TabAutoSaveActionExecute(Sender: TObject);
913     procedure TabAutoLoadActionExecute(Sender: TObject);
914                 procedure ListViewColumnRightClick(Sender: TObject;
915       Column: TListColumn; Point: TPoint);
916     procedure JumpToNumOfResActionExecute(Sender: TObject);
917     procedure JumpToNumOfResActionUpdate(Sender: TObject);
918     procedure FavoriteTreeViewCollapseActionExecute(Sender: TObject);
919         procedure ListViewCustomDrawItem(Sender: TCustomListView;
920       Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
921     procedure FormActivate(Sender: TObject);
922     procedure MainCoolBarChange(Sender: TObject);
923     procedure BrowserCoolBarChange(Sender: TObject);
924     procedure ListCoolBarChange(Sender: TObject);
925     procedure BrowserCoolBarResize(Sender: TObject);
926     procedure ListCoolBarResize(Sender: TObject);
927     procedure BrowserPanelResize(Sender: TObject);
928         private
929                 { Private \90é\8c¾ }
930         //RoundList : TRoundList;
931                 FSortIndex: Integer;
932                 FSortOrder: Boolean;
933
934                 FEnabledCloseButton: Boolean;
935 //              ThreadCreate: TThreadCreate;
936
937                 FClickNode: TTreeNode;
938                 FHttpState: Boolean;
939                 FHint: TResPopup;
940                 FPreviewBrowser: TWebBrowser;
941                 FPreviewURL: string;
942
943                 FBrowserSizeHeight: Integer;
944                 FBrowserSizeWidth: Integer;
945
946 //              FFavorite: TFavorite;
947                 FTabHintIndex: Integer;
948                 FListStyle: TViewStyle;                         //\83\8a\83X\83g\83A\83C\83R\83\93\83X\83^\83C\83\8b
949                 FItemNoVisible: Boolean;                        //\83\8a\83X\83g\94Ô\8d\86\95\\8e¦\83t\83\89\83O
950                 FViewType: TGikoViewType;                       //\83\8a\83X\83g\83A\83C\83e\83\80\95\\8e¦\83^\83C\83v
951                 FActiveList: TObject;
952                 FActiveContent: TBrowserRecord; //
953                 FActiveBBS : TBBS;
954                 FHistoryList: TList;                                    //\83q\83X\83g\83\8a\83\8a\83X\83g
955                 FTreeType: TGikoTreeType;
956                 FWorkCount: Integer;
957                 FNameCookie: string;
958                 FMailCookie: string;
959 //              FLastRoundTime: TDateTime;
960                 BrowserNullTab: TBrowserRecord;
961 //              DoubleClickOccurred: array [TMouseButton] of Boolean;
962                 FDownloadTitle: string;                         //\83_\83E\83\93\83\8d\81[\83h\92\86\82Ì\83^\83C\83g\83\8b\96¼
963                 FDownloadMax: Integer;                          //\83_\83E\83\93\83\8d\81[\83h\92\86\82Ì\8dÅ\91å\83T\83C\83Y
964                 FEvent: THTMLDocumentEventSink;//\83u\83\89\83E\83U\83h\83L\83\85\83\81\83\93\83g\83C\83x\83\93\83g
965
966           //    Fkeynum : Integer; //\83L\81[\83{\81[\83h\83\8c\83X\83|\83b\83v\83A\83b\83v\97p
967
968                 IsDraggingSelectComboBox : Boolean;
969                 DraggingSelectComboBoxPosition : TPoint;
970
971                 FSearchDialog: TSearchDialog;
972
973                 FDropSpaceNode: TTreeNode;
974
975                 FDragTime : Cardinal;                                                           ///< \83\8a\83\93\83N\82ÌD&D\97p
976                 FDragButton : TToolButton;                                      ///< \83\8a\83\93\83N\82ÌD&D\97p\82ÉDrag\82µ\82Ä\82éButton\95Û\91
977                 FDragWFirst : Boolean;                                                  ///< WebTab\82ÌD&D\97p
978
979                 FListViewBackGroundColor : TColor;      ///< ListView\82ÌBackGroundColor
980                 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¦
981                 FOddColor : TColor;                                                                     ///< \82»\82Ì\90F
982
983                 FSelectResWord  : string;                                               ///< \83\8c\83X\8di\8d\9e\83\8f\81[\83h
984                 FIsIgnoreResize : TResizeType;                  ///< \83\8a\83T\83C\83Y\83C\83x\83\93\83g\82ð\96³\8e\8b\82·\82é\82©\82Ç\82¤\82©
985                 FIsMinimize                     : TMinimizeType;                ///< \8dÅ\8f¬\89»\82µ\82Ä\82¢\82é\8dÅ\92\86\82©
986                 FOldFormWidth           : Integer;                                      ///< \92¼\91O\82Ì\83E\83B\83\93\83h\83E\82Ì\95\9d
987                 FToolBarSettingSender : TToolBarSettingSenderType;      ///< \83c\81[\83\8b\83o\81[\90Ý\92è\82ð\83N\83\8a\83b\83N\82µ\82½\83N\81[\83\8b\83o\81[
988                 FMouseDownPos           : TPoint;                                       ///< \83u\83\89\83E\83U\83^\83u\82Å\83}\83E\83X\82ð\89\9f\82µ\82½\82Æ\82«\82Ì\8dÀ\95W
989                 FBrowsers: TList;
990                 FResRangeMenuSelect     : Longint;                      ///< ResRangeButton \82Å\91I\91ð\82³\82ê\82Ä\82¢\82é\8d\80\96Ú (\83t\83H\81[\83}\83b\83g\82Í ResRange \8cÝ\8a·)
991                 FStartUp : Boolean;
992                 FIsHandledWheel : Boolean;                      ///< \8aù\82É\8eó\82¯\8eæ\82Á\82½ WM_MOUSEWHEEL \82©\82Ç\82¤\82©
993                 procedure SetBoardTreeNode( inBBS : TBBS );
994                 function SetCategoryListItem(ABBS2ch: TBBS): Integer;
995                 function SetBoardListItem(Category: TCategory): Integer;
996                 function SetThreadListItem(Board: TBoard): Integer;
997 //              function GetRoundName(index: integer): string;
998
999                 procedure DownloadEnd(Sender: TObject; Item: TDownloadItem);
1000                 procedure DownloadMsg(Sender: TObject; Item: TDownloadItem; Msg: string; Icon: TGikoMessageIcon);
1001                 procedure WorkBegin(Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer; Number: Integer; const AWorkTitle: string);
1002                 procedure WorkEnd(Sender: TObject; AWorkMode: TWorkMode; Number: Integer);
1003                 procedure Work(Sender: TObject; AWorkMode: TWorkMode; const AWorkCount: Integer; Number: Integer);
1004
1005
1006                 procedure ListClick;
1007                 procedure ListDoubleClick(Shift: TShiftState);
1008                 procedure BrowserMovement(const AName: string); overload;
1009                 procedure BrowserMovement(const AName: string; BrowserRecord: TBrowserRecord); overload;
1010                 procedure SelectListItem(List: TList);
1011 //              procedure SetProgressValue(Number: Integer; Value: Integer; Max: Integer = -1);
1012                 procedure DeleteTab(ThreadItem: TThreadItem); overload;
1013                 procedure DeleteTab(BrowserRecord: TBrowserRecord); overload;
1014                 function Hook(var Message: TMessage): Boolean;
1015                 procedure AddRoundNameMenu(MenuItem: TMenuItem);
1016                 procedure SetSelectItemRound(RoundFlag: Boolean; RoundName: string); overload;
1017                 procedure SetSelectItemRound(RoundFlag: Boolean; RoundName: string; ParentName: string); overload;
1018                 procedure SetSelectRoundName(Sender: TObject);
1019                 function GetCoolBand(CoolBar: TCoolBar; Control: TWinControl): TCoolBand;
1020
1021                 procedure SetMenuFont;
1022 //              procedure CreateFavMenu(Folder: TFavoriteFolder);
1023                 procedure CreateFavMenu(Node: TTreeNode; MenuItem: TMenuItem);
1024                 procedure FavoriteClick(Sender: TObject; ActiveTab: Boolean); overload;
1025                 procedure FavoriteClick(Sender: TObject); overload;
1026                 procedure FavoriteDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
1027                 procedure SelectTreeNode(Item: TObject; CallEvent: Boolean);
1028                 function OnDocumentContextMenu(Sender: TObject): WordBool;
1029 //              function GetThreadText(sBoard: string; sThread: string; StNum, ToNum: Integer; Title, First: Boolean): string;
1030                 procedure SetResPopupText(ThreadItem : TThreadItem; StNum, ToNum: Integer; Title, First: Boolean);
1031                 procedure ShowTextPopup;
1032                 //procedure ShowTextPopup(HintData: THintData);
1033 //              procedure SetStdToolBar;
1034 //              function GetAction(ActionName: string): TContainedAction;
1035                 procedure SetLinkBar;
1036                 function GetWidthAllToolButton(ToolBar: TToolBar): Integer;
1037                 procedure MenuBarChevronMenu;
1038                 procedure LinkBarChevronMenu;
1039                 procedure ToolBarChevronMenu(ToolBar: TToolBar);
1040                 procedure ModifySelectList;
1041                 procedure FavoriteBrowseFolder( node: TTreeNode );
1042                 procedure LinkToolButtonDragDrop(Sender, Source: TObject; X, Y: Integer);
1043                 procedure LinkToolButtonOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
1044                 procedure LinkToolButtonOnMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
1045                 procedure LinkToolButtonOnMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
1046                 procedure LinkToolButtonStartDrag(Sender: TObject; var DragObject: TDragObject);
1047                 function TreeNodeDataFind(Node: TTreeNode; FindPointer: Pointer): TTreeNode;
1048                 procedure FavoriteMoveTo( SenderNode, SourceNode: TTreeNode );
1049                 procedure FavoriteAddTo( SenderNode: TTreeNode; Source: TObject );
1050                 procedure FavoriteDragDrop( SenderNode: TTreeNode; Source: TObject );
1051                 //
1052                 procedure SetListViewBackGroundColor(value: TColor);
1053                 procedure BBSMenuItemOnClick( Sender : TObject );
1054                 //
1055                 procedure KonoresCopy(Number: Integer; ReplaceTag : Boolean);
1056                 /// CoolBar \82Ì\90Ý\92è\82ð\95Ï\90\94\82É\95Û\91
1057                 procedure       SaveCoolBarSettings;
1058                 procedure       SaveMainCoolBarSettings;
1059                 procedure       SaveBoardCoolBarSettings;
1060                 procedure       SaveBrowserCoolBarSettings;
1061                 /// CoolBar \82Ì\90Ý\92è\82ð\95Ï\90\94\82©\82ç\95\9c\8c³
1062                 procedure       LoadCoolBarSettings;
1063                 /// \8dÅ\8f¬\89»\82³\82ê\82é
1064                 procedure OnMinimize;
1065                 /// \8dÅ\8f¬\89»\82³\82ê\82½
1066                 procedure OnMinimized;
1067                 /// TreeView \82ª\83N\83\8a\83b\83N\82³\82ê\82½
1068                 procedure TreeClick( Node : TTreeNode );
1069                 /// TreeView \82ª\83_\83u\83\8b\83N\83\8a\83b\83N\82³\82ê\82½
1070                 procedure TreeDoubleClick( Node : TTreeNode );
1071                 /// \83M\83R\83i\83r\82Ì\83\81\83b\83Z\81[\83W\83\8b\81[\83v\82ð\89¡\8eæ\82è\82µ\82Ü\82·
1072                 procedure HandleAppMessage(var Msg: TMsg; var Handled: Boolean);
1073                 /// \83u\83\89\83E\83U\82Ì\83L\81[\83_\83E\83\93\83C\83x\83\93\83g
1074                 /// \83C\83x\83\93\83g\82ð\8eæ\82è\88µ\82Á\82½\8fê\8d\87\82Í True \82ð\95Ô\82·
1075 //              function BrowserKeydown(var Msg: TMsg; Key: Word; State:TShiftState) : Boolean;
1076                 /// \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
1077                 procedure SetBBSMenu;
1078                 function WebBrowserClick(Sender: TObject): WordBool;
1079                 function WebBrowserOnMouseDown(Sender: TObject): WordBool;
1080                 procedure SkinorCSSFilesCopy(path: string);
1081                 /// \83^\83u\8eæ\93¾
1082                 function GetTabURLs(AStringList: TStringList) : Boolean;
1083                 /// \83^\83u\95Û\91
1084                 function SaveTabURLs : Boolean;
1085                 /// \83^\83u\93Ç\82Ý\8fo\82µ
1086                 function LoadTabURLs : Boolean;
1087                 /// \83o\83\93\83h\95\9d\82ð\8dÄ\8cv\8eZ\81E\8dÄ\90Ý\92è\82·\82é
1088                 procedure ResetBandInfo( bar : TGikoCoolBar; band : TToolBar );
1089                 /// ListView \82Ì Column \82ð\90^\82Ì\83J\83\89\83\80\82É\95Ï\8a·
1090                 function        ActiveListTrueColumn( column : TListColumn ) : TListColumn;
1091                 /// ListColumnPopupMenu \83A\83C\83e\83\80\82Ì\83N\83\8a\83b\83N\83C\83x\83\93\83g
1092                 procedure       ListColumnPopupMenuOnClick( Sender : TObject );
1093                 // BrowserRecord\82É\82Â\82¢\82Ä\82¢\82éFBrowser\82ð\8aO\82·
1094                 procedure ReleaseBrowser( BRecord: TBrowserRecord);
1095                 //! \83}\83E\83X\83W\83F\83X\83`\83\83\81[\8aJ\8en
1096                 procedure OnGestureStart(Sender: TObject);
1097                 //! \83}\83E\83X\83W\83F\83X\83`\83\83\81[\92\86
1098                 procedure OnGestureMove(Sender: TObject);
1099                 //! \83}\83E\83X\83W\83F\83X\83`\83\83\81[\8fI\97¹
1100                 procedure OnGestureEnd(Sender: TObject);
1101         protected
1102                 procedure CreateParams(var Params: TCreateParams); override;
1103                 procedure WndProc(var Message: TMessage); override;
1104                 procedure WMSetCursor(var Message: TWMSetCursor); message WM_SETCURSOR;
1105                 procedure WMSettingChange(var Message: TWMWinIniChange); message WM_SETTINGCHANGE;
1106                 procedure WMCopyData(var Message: TWMCopyData); message WM_COPYDATA;
1107
1108         public
1109                 { Public \90é\8c¾ }
1110                 FControlThread: TThreadControl;
1111                 procedure MoveToURL(const inURL: string);
1112                 function InsertBrowserTab(
1113                         ThreadItem      : TThreadItem;
1114                         ActiveTab               : Boolean = True
1115                 ) : TBrowserRecord;
1116                 procedure ReloadBBS;
1117                 function GetHttpState: Boolean;
1118                 procedure SetEnabledCloseButton(Enabled: Boolean);
1119                 function GetTreeNode(Data: TObject): TTreeNode;
1120                 procedure AppFormDeactivate(Sender: TObject);
1121                 procedure ListViewAllSelect;
1122                 property ListStyle: TViewStyle read FListStyle write FListStyle;
1123                 property ItemNoVisible: Boolean read FItemNoVisible write FItemNoVisible;
1124                 property ViewType: TGikoViewType read FViewType write FViewType;
1125                 property NameCookie: string read FNameCookie write FNameCookie;
1126                 property MailCookie: string read FMailCookie write FMailCookie;
1127                 procedure SetContent(inThread: TBrowserRecord);
1128                 function GetActiveContent: TThreadItem;
1129                 function GetActiveList: TObject;
1130                 procedure SetListViewType(AViewType: TGikoViewType); overload;
1131                 procedure SetListViewType(AViewType: TGikoViewType; SelectText: string; KubetsuChk: Boolean); overload;
1132                 procedure DownloadContent(ThreadItem: TThreadItem; ForceDownload: Boolean = False);
1133                 procedure DownloadList(Board: TBoard; ForceDownload: Boolean = False);
1134                 procedure PlaySound(SoundEventName: string);
1135                 function AddHistory( FavItem: TFavoriteThreadItem ): Boolean;
1136                 procedure DeleteHistory( threadItem: TThreadItem );
1137                 procedure ClearHistory;
1138                 procedure       SaveHistory;
1139                 procedure       LoadHistory;
1140                 procedure ShowBBSTree( inBBS : TBBS );
1141                 procedure ShowBBSTreeOld( inBBS : TBBS );
1142                 procedure ShowHistoryTree;
1143                 procedure SetHistoryTreeNode;
1144                 procedure AddMessageList(ACaption: string; AObject: TObject; Icon: TGikoMessageIcon);
1145                 procedure SetBrowserTabState;
1146                 procedure SetToolBarPopup;
1147                 procedure ShowFavoriteAddDialog( Item : TObject );
1148                 procedure FavoritesURLReplace(oldURLs: TStringList; newURLs: TStringList);
1149                 procedure RoundListURLReplace(oldURLs: TStringList; newURLs: TStringList);
1150                 property ListViewBackGroundColor: TColor read FListViewBackGroundColor write SetListViewBackGroundColor;
1151                 property UseOddResOddColor : Boolean read FUseOddResOddColor write FUseOddResOddColor;
1152                 property OddColor : TColor read FOddColor write FOddColor;
1153                 function FindToolBarButton( bar : TToolBar; action : TAction ) : TToolButton;
1154                 procedure OnPlugInMenuItem( Sender : TObject );
1155                 procedure TabFileURLReplace(oldURLs: TStringList; newURLs: TStringList);
1156                 /// 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Å
1157                 procedure ActiveListColumnSave;
1158                 procedure SetActiveList(Obj: TObject);
1159                 property ActiveList: TObject read GetActiveList write SetActiveList;
1160         published
1161                 property EnabledCloseButton: Boolean read FEnabledCloseButton write SetEnabledCloseButton;
1162         end;
1163
1164         TFavoriteMenuItem = class(TMenuItem)
1165         private
1166                 FData : Pointer;
1167         public
1168                 property Data: Pointer read FData write FData;
1169         end;
1170
1171         TBBSMenuItem = class(TMenuItem)
1172         private
1173                 FData : Pointer;
1174         public
1175                 property Data: Pointer read FData write FData;
1176         end;
1177
1178         TLinkToolButton = class(TToolButton)
1179         private
1180                 FData : Pointer;
1181         public
1182                 property Data: Pointer read FData write FData;
1183         end;
1184
1185         TBrowserRecord = class( TObject )
1186         private
1187                 FBrowser        : TWebBrowser;
1188                 FEvent: THTMLDocumentEventSink; ///< \83u\83\89\83E\83U\83h\83L\83\85\83\81\83\93\83g\83C\83x\83\93\83g
1189                 FThread         : TThreadItem;
1190                 FLastSize       : Integer;
1191                 FRepaint        : Boolean;
1192                 FMovement       : string;                                                       ///< \83X\83N\83\8d\81[\83\8b\90æ\83A\83\93\83J\81[
1193         public
1194                 destructor      Destroy; override;
1195                 property        Browser : TWebBrowser   read FBrowser   write FBrowser;
1196                 property        Thread  : TThreadItem   read FThread    write FThread;
1197                 property        LastSize        : Integer               read FLastSize  write FLastSize;
1198                 property        Repaint         : Boolean               read FRepaint   write FRepaint;
1199                 property        Movement        : string                read FMovement  write FMovement;
1200         end;
1201
1202 var
1203         GikoForm: TGikoForm;
1204
1205 implementation
1206
1207 uses
1208         About, Option, Round, Splash, Sort, ListSelect,
1209         NewBoard, MojuUtils, Clipbrd, GikoBayesian;
1210
1211 const
1212         CAPTION_NAME: string = '\83M\83R\83i\83r';
1213         BLANK_HTML: string = 'about:blank';
1214         SELECTCOMBOBOX_NAME: string = ''; // '\83X\83\8c\83b\83h\8di\8d\9e\8c\9f\8dõ';
1215         SELECTCOMBOBOX_COLOR: TColor = clWindow;
1216         //D&D臒l
1217         DandD_THRESHOLD = 5;    //D&D\82Ìè\87\92l\81ipixcel)
1218         //\83c\83\8a\81[\81E\83\8a\83X\83g\83A\83C\83R\83\93
1219         ITEM_ICON_2CH1                                  = 0;            //2ch\83A\83C\83R\83\93
1220         ITEM_ICON_2CH2                                  = 1;            //2ch\83A\83C\83R\83\93
1221         ITEM_ICON_CATEGORY1                     = 2;            //\83J\83e\83S\83\8a\83A\83C\83R\83\93
1222         ITEM_ICON_CATEGORY2                     = 3;            //\83J\83e\83S\83\8a\83A\83C\83R\83\93
1223         ITEM_ICON_BOARD_NOSUBJECT       = 3;    //\93Ç\82Ý\8d\9e\82Ü\82ê\82Ä\82¢\82È\82¢\94Â\83A\83C\83R\83\93
1224         ITEM_ICON_BOARD1                                = 4;            //\94Â\83A\83C\83R\83\93
1225         ITEM_ICON_BOARD2                                = 5;            //\94Â\83A\83C\83R\83\93
1226         ITEM_ICON_THREADLOG1            = 6;            //\83X\83\8c\83A\83C\83R\83\93\81i\83\8d\83O\82 \82è\81j
1227         ITEM_ICON_THREADLOG2            = 7;            //\83X\83\8c\83A\83C\83R\83\93\81i\83\8d\83O\82 \82è\81j
1228         ITEM_ICON_THREAD1                               = 8;            //\83X\83\8c\83A\83C\83R\83\93\81i\83\8d\83O\82È\82µ\81j
1229         ITEM_ICON_THREAD2                               = 9;            //\83X\83\8c\83A\83C\83R\83\93\81i\83\8d\83O\82È\82µ\81j
1230         ITEM_ICON_THREADNEW1            = 10;           //\83X\83\8c\83A\83C\83R\83\93\81i\90V\92\85\81j
1231         ITEM_ICON_THREADNEW2            = 11;           //\83X\83\8c\83A\83C\83R\83\93\81i\90V\92\85\81j
1232         ITEM_ICON_SORT1                                 = 12;           //\83\\81[\83g\83A\83C\83R\83\93
1233         ITEM_ICON_SORT2                                 = 13;           //\83\\81[\83g\83A\83C\83R\83\93
1234         ITEM_ICON_BOARD_LOG                     = 17;           //\83X\83\8c\83\8d\83O\82 \82è\94Â\83A\83C\83R\83\93
1235         ITEM_ICON_BOARD_NEW                     = 18;           //\83X\83\8c\90V\92\85\94Â\83A\83C\83R\83\93
1236
1237         //\83c\81[\83\8b\83o\81[\83A\83C\83R\83\93
1238         TOOL_ICON_HEIGHT_MAX            = 16;           //\8d\82\82³\8dÅ\91å\83A\83C\83R\83\93
1239         TOOL_ICON_HEIGHT_MIN            = 17;           //\8d\82\82³\8dÅ\8f¬\83A\83C\83R\83\93
1240         TOOL_ICON_HEIGHT_NORMAL = 18;           //\8d\82\82³\95W\8f\80\83A\83C\83R\83\93
1241         TOOL_ICON_WIDTH_MAX             = 19;           //\95\9d\8dÅ\91å\83A\83C\83R\83\93
1242         TOOL_ICON_WIDTH_MIN             = 20;           //\95\9d\8dÅ\8f¬\83A\83C\83R\83\93
1243         TOOL_ICON_WIDTH_NORMAL  = 21;           //\95\9d\95W\8f\80\83A\83C\83R\83\93
1244
1245         TOOL_ICON_FAV_FOLDER            = 30;           //\82¨\8bC\82É\93ü\82è\83t\83H\83\8b\83_\83A\83C\83R\83\93
1246         TOOL_ICON_FAV_BOARD                     = 31;           //\82¨\8bC\82É\93ü\82è\94Â\83A\83C\83R\83\93
1247         TOOL_ICON_FAV_THREAD            = 32;           //\82¨\8bC\82É\93ü\82è\83X\83\8c\83A\83C\83R\83\93
1248
1249         HTML_FILE_NAME  = 'temp_preview.html';
1250
1251         WM_XBUTTONDOWN                                  = $020B;
1252         WM_XBUTTONUP                                            = $020C;
1253         WM_XBUTTONDBLCLK                                = $020D;
1254         XBUTTON1                                                                = $0001;
1255         XBUTTON2                                                                = $0002;
1256         USER_TREECLICK                                  = WM_USER + 2000;
1257         USER_RESIZED            = WM_USER + 2001;
1258         USER_MINIMIZED                                  = WM_USER + 2002;
1259         USER_SETLINKBAR                                 = WM_USER + 2003;
1260         USER_DOCUMENTCOMPLETE           = WM_USER + 2004;       ///< wParam : TWebBrowser
1261         SELECTTIME_INTERBAL                             = 110;
1262
1263         BROWSER_COUNT           = 5;    //\83u\83\89\83E\83U\82Ì\90\94
1264 {$R *.DFM}
1265
1266 procedure TGikoForm.CreateParams(var Params: TCreateParams);
1267 begin
1268         inherited;
1269         if FormStyle in [fsNormal, fsStayOnTop] then begin
1270                 if BorderStyle in [bsSingle, bsSizeable] then begin
1271                         Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
1272                         Params.WndParent := 0;
1273                 end;
1274         end;
1275 end;
1276
1277 procedure TGikoForm.FormCreate(Sender: TObject);
1278 const
1279         TVS_NOTOOLTIPS = $0080;
1280 var
1281         FileName: string;
1282         Style: DWORD;
1283         msg: string;
1284         i: Integer;
1285         wp: TWindowPlacement;
1286         s: string;
1287         newbrowser: TWebBrowser;
1288 begin
1289 {$IFDEF DEBUG}
1290         AllocConsole;
1291         Writeln('============================================================');
1292         Writeln(' \83M\83R\83i\83r\83f\83o\83b\83\83R\83\93\83\\81[\83\8b');
1293         Writeln('');
1294         Writeln(' \82±\82Ì\89æ\96Ê\82ð\95Â\82\82È\82¢\82Å\82­\82¾\82³\82¢\81B');
1295         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¢');
1296         Writeln('============================================================');
1297 {$ENDIF}
1298         FStartUp := true;
1299         //Application.OnDeactivate := AppFormDeactivate;
1300         Self.OnDeactivate := AppFormDeactivate;
1301         Application.HookMainWindow(Hook);
1302 //      Application.OnMessage := HandleAppMessage; //\82È\82ñ\82©\96³\82­\82Ä\82à\91å\8fä\95v\82É\82È\82Á\82½\81@by\81@\82à\82\82ã
1303         FTreeType := gttNone;
1304
1305         FSearchDialog := nil;
1306         BrowserNullTab := TBrowserRecord.Create;
1307         BrowserNullTab.Browser := Browser;
1308         BrowserNullTab.Browser.Navigate(BLANK_HTML);
1309         FBrowsers := TList.Create;
1310         for i := 0 to BROWSER_COUNT -1 do begin
1311                 FBrowsers.Add(TWebBrowser.Create(nil));
1312                 newBrowser := FBrowsers[FBrowsers.Count - 1];
1313                 TOleControl(newBrowser).Parent := BrowserPanel;
1314                 newBrowser.Align := alNone;
1315                 newBrowser.Left := 0;
1316                 newBrowser.Top  := 0;
1317                 newBrowser.StatusBar    := false;
1318                 newBrowser.MenuBar              := false;
1319                 newBrowser.AddressBar   := false;
1320                 newBrowser.OnDocumentComplete   := BrowserDocumentComplete;
1321                 newBrowser.OnBeforeNavigate2    := BrowserBeforeNavigate2;
1322                 newBrowser.OnEnter                              := BrowserEnter;
1323                 newBrowser.OnNewWindow2                 := BrowserNewWindow2;
1324                 newBrowser.OnStatusTextChange   := BrowserStatusTextChange;
1325                 newBrowser.Navigate(BLANK_HTML);
1326                 ShowWindow(newBrowser.Handle, SW_HIDE);
1327
1328         end;
1329         BrowserNullTab.Browser.BringToFront;
1330         ShowWindow(BrowserNullTab.Browser.Handle, SW_SHOW);
1331
1332         // \8bN\93®\8e\9e\82É\95Û\91\82³\82ê\82Ä\82µ\82Ü\82¤\91Î\8dô
1333         FIsIgnoreResize := rtResizing;
1334
1335         //\8eè\82Ì\83J\81[\83\\83\8b
1336         Screen.Cursors[5] := LoadCursor(HInstance, 'GIKOHAND');
1337
1338
1339         //\83A\83h\83\8c\83X\97\9a\97ð\93Ç\82Ý\8d\9e\82Ý
1340         AddressHistoryDM.ReadHistory(AddressComboBox.Items, GikoSys.Setting.AddressHistoryCount);
1341
1342         EnabledCloseButton := True;
1343
1344         //\83\8a\83X\83g\83X\83^\83C\83\8b
1345         ListView.ViewStyle := GikoSys.Setting.ListStyle;
1346
1347         //\83\81\83C\83\93\83N\81[\83\8b\83o\81[\88Ê\92u
1348 //      MainCoolBar.Top := 0;
1349 //      MainCoolBar.Left := 0;
1350
1351         //\83A\83j\83\81\83p\83l\83\8b\88Ê\92u
1352         AnimePanel.Top := 0;
1353         AnimePanel.Left := 0;
1354
1355         //\8ae\8eí\89Â\8e\8b\8fó\91Ô\82È\82Ç\90Ý\92è
1356
1357         //\83L\83\83\83r\83l\83b\83g
1358         CabinetPanel.Width := GikoSys.Setting.CabinetWidth;
1359
1360         //\83\81\83b\83Z\81[\83W\83o\81[
1361         MsgBarVisibleAction.Checked := GikoSys.Setting.MessageBarVisible;
1362         MsgBarVisibleActionExecute(nil);
1363         MessagePanel.Height := GikoSys.Setting.MessegeBarHeight;
1364
1365         //\83X\83e\81[\83^\83X\83o\81[
1366         StatusBarVisibleAction.Checked := GikoSys.Setting.StatusBarVisible;
1367         StatusBarVisibleActionExecute(nil);
1368
1369         //\83t\83H\83\93\83g\81E\90F\90Ý\92è
1370         TreeView.Items.BeginUpdate;
1371         FavoriteTreeView.Items.BeginUpdate;
1372         ListView.Items.BeginUpdate;
1373         try
1374                 TreeView.Font.Name := GikoSys.Setting.CabinetFontName;
1375                 TreeView.Font.Size := GikoSys.Setting.CabinetFontSize;
1376                 TreeView.Font.Color := GikoSys.Setting.CabinetFontColor;
1377                 TreeView.Color := GikoSys.Setting.CabinetBackColor;
1378                 {TreeView.Font.Style := [];
1379                 if GikoSys.Setting.CabinetFontBold then
1380                         TreeView.Font.Style := [fsBold];
1381                 if GikoSys.Setting.CabinetFontItalic then
1382                         TreeView.Font.Style := TreeView.Font.Style + [fsItalic];
1383                 }
1384                 //FavoriteTreeView.Font.Name := GikoSys.Setting.CabinetFontName;
1385                 //FavoriteTreeView.Font.Size := GikoSys.Setting.CabinetFontSize;
1386                 //FavoriteTreeView.Font.Color := GikoSys.Setting.CabinetFontColor;
1387                 FavoriteTreeView.Font.Assign(TreeView.Font);
1388                 FavoriteTreeView.Color := GikoSys.Setting.CabinetBackColor;
1389
1390                 ListView.Font.Name := GikoSys.Setting.ListFontName;
1391                 ListView.Font.Size := GikoSys.Setting.ListFontSize;
1392                 ListView.Font.Color := GikoSys.Setting.ListFontColor;
1393                 ListView.Font.Style := [];
1394                 if GikoSys.Setting.ListFontBold then
1395                         ListView.Font.Style := [fsbold];
1396                 if GikoSys.Setting.ListFontItalic then
1397                         ListView.Font.Style := ListView.Font.Style + [fsitalic];
1398
1399                 ListViewBackGroundColor := clWhite;                                                                                             // \83f\83t\83H\83\8b\83g\82É\90Ý\92è\82µ\82½\82Ì\82¿
1400                 ListViewBackGroundColor := GikoSys.Setting.ListBackColor;       // \83\86\81[\83U\92è\8b`\82É\95Ï\8dX
1401                 FUseOddResOddColor := GikoSys.Setting.UseOddColorOddResNum;
1402                 FOddColor := GikoSys.Setting.OddColor;
1403
1404         finally
1405                 TreeView.Items.EndUpdate;
1406                 FavoriteTreeView.Items.EndUpdate;
1407                 ListView.Items.EndUpdate;
1408         end;
1409         //ViewNoButton.Down := GikoSys.Setting.ListViewNo;
1410         ListNumberVisibleAction.Checked := GikoSys.Setting.ListViewNo;
1411
1412         //\83u\83\89\83E\83U\83^\83u\83t\83H\83\93\83g
1413         BrowserTab.Font.Name := GikoSys.Setting.BrowserTabFontName;
1414         BrowserTab.Font.Size := GikoSys.Setting.BrowserTabFontSize;
1415         BrowserTab.Font.Style := [];
1416         if GikoSys.Setting.BrowserTabFontBold then
1417                 BrowserTab.Font.Style := [fsBold];
1418         if GikoSys.Setting.BrowserTabFontItalic then
1419                 BrowserTab.Font.Style := GikoForm.BrowserTab.Font.Style + [fsItalic];
1420         FDragWFirst := false;
1421         SetContent(BrowserNullTab);                                                                                                     //\83u\83\89\83E\83U\82ð\8bó\94\92\95\\8e¦
1422 //      TreeView.TopItem.Expanded := True;                              //\83c\83\8a\81[\83g\83b\83v\8d\80\96Ú\82¾\82¯\82ð\8aJ\82­
1423 //      TreeView.Selected := TreeView.Items[0];         //\83c\83\8a\81[\82Ì\83g\83b\83v\8d\80\96Ú\82ð\91I\91ð\82·\82é
1424
1425
1426         //\8dÅ\91å\89»\81E\83E\83B\83\93\83h\83E\88Ê\92u\95\9c\8c³
1427         wp.length := sizeof(wp);
1428         wp.rcNormalPosition.Top := GikoSys.Setting.WindowTop;
1429         wp.rcNormalPosition.Left := GikoSys.Setting.WindowLeft;
1430         wp.rcNormalPosition.Bottom := GikoSys.Setting.WindowTop + GikoSys.Setting.WindowHeight;
1431         wp.rcNormalPosition.Right := GikoSys.Setting.WindowLeft + GikoSys.Setting.WindowWidth;
1432         wp.showCmd := SW_HIDE;
1433         SetWindowPlacement(Handle, @wp);
1434
1435 //      SetBounds(GikoSys.Setting.WindowLeft, GikoSys.Setting.WindowTop,
1436 //                                              GikoSys.Setting.WindowWidth, GikoSys.Setting.WindowHeight);
1437         if GikoSys.Setting.WindowMax then
1438                         WindowState := wsMaximized;
1439
1440         //\83M\83R\83A\83j\83\81
1441         try
1442                 FileName := GikoSys.GetAppDir + 'gikoNavi.avi';
1443                 if FileExists(FileName) then
1444                         Animate.FileName := FileName;
1445         except
1446         end;
1447
1448         //\83N\83b\83L\81[
1449         FNameCookie := '';
1450         FMailCookie := '';
1451
1452         //\83X\83\8c\91S\95\94\95\\8e¦\83{\83^\83\93\82ð\89\9f\82³\82ê\82½\8fó\91Ô\82É\82·\82é
1453         AllItemAction.Checked := True;
1454         AllResAction.Checked := True;
1455
1456         //TreeView\82Ì\8e×\96\82\8fL\82¢ToolTip\82ð\94ñ\95\\8e¦
1457         Style := GetWindowLong(TreeView.Handle, GWL_STYLE);
1458         Style := Style or TVS_NOTOOLTIPS;
1459         SetWindowLong(TreeView.Handle, GWL_STYLE, Style);
1460
1461         // \83c\83\8a\81[\82ð\83\81\83C\83\93\82¾\82¯\95\\8e¦\82É\82µ\82Ä\8dÅ\91å\89»
1462         TreeView.Align := alClient;
1463         FavoriteTreeView.Align := alClient;
1464         FavoriteTreeView.Visible := False;
1465
1466         //\83u\83\89\83E\83U\83T\83C\83Y\95Ï\8dX\82Ì\8f\89\8aú\89»
1467 //      FBrowserSizeFlag := False;
1468 //      FBrowserSizeHeight := ViewPanel.Height;
1469
1470         FBrowserSizeHeight := GikoSys.Setting.ListHeight;
1471         FBrowserSizeWidth := GikoSys.Setting.ListWidth;
1472
1473         // \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Æ)
1474         InitializeBoardPlugIns;
1475
1476         //\8f\84\89ñ\83f\81[\83^\93Ç\82Ý\8d\9e\82Ý
1477         RoundList := TRoundList.Create;
1478         RoundList.LoadRoundBoardFile;
1479
1480         // \83{\81[\83h\83t\83@\83C\83\8b\97ñ\8b\93(ReadFavorite \82æ\82è\90æ\82É\8ds\82¤\82±\82Æ)
1481         GikoSys.ListBoardFile;
1482
1483         RoundList.LoadRoundThreadFile;
1484
1485         if RoundList.OldFileRead or ( RoundList.Count[grtItem] > 0 ) then
1486                 GikoSys.ListBoardFile;
1487
1488         // \83\81\83j\83\85\81[\82É\92Ç\89Á
1489         SetBBSMenu;
1490
1491         // \83q\83X\83g\83\8a\83\8a\83X\83g(LoadHistory \82æ\82è\82à\90æ\82É\8ds\82¤\82±\82Æ)
1492         FHistoryList := TList.Create;
1493
1494         // \97\9a\97ð\93Ç\82Ý\8d\9e\82Ý
1495         LoadHistory;
1496
1497         //\82¨\8bC\82É\93ü\82è\93Ç\82Ý\8d\9e\82Ý
1498 //      FFavorite := TFavorite.Create(FavoriteTreeView);
1499         FavoriteDM.SetFavTreeView(FavoriteTreeView);
1500         FavoriteDM.ReadFavorite;
1501
1502         ArrangeAction.Checked := not (GikoSys.Setting.ListOrientation = gloVertical);
1503         ArrangeAction.Execute;
1504
1505         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
1506                 case GikoSys.Setting.ListWidthState of
1507                         glsMax: begin
1508                                 ViewPanel.Width := 1;
1509                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
1510                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
1511                         end;
1512                         glsMin: begin
1513                                 ViewPanel.Width := GikoSys.Setting.ListWidth;
1514                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
1515                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
1516                         end;
1517                         else begin
1518                                 ViewPanel.Width := GikoSys.Setting.ListWidth;
1519                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
1520                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
1521                         end;
1522                 end;
1523         end else begin
1524                 case GikoSys.Setting.ListHeightState of
1525                         glsMax: begin
1526                                 ViewPanel.Height := 1;
1527                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
1528                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
1529                         end;
1530                         glsMin: begin
1531                                 ViewPanel.Height := GikoSys.Setting.ListHeight;
1532                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
1533                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
1534                         end;
1535                         else begin
1536                                 ViewPanel.Height := GikoSys.Setting.ListHeight;
1537                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
1538                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
1539                         end;
1540                 end;
1541         end;
1542
1543         //\83v\83\8d\83O\83\8c\83X\83o\81[\82Ì\8f\89\8aú\89»
1544 //      ProgressBar.Visible := False;
1545         ProgressBar.Parent := StatusBar;
1546         ProgressBar.Top := 2;
1547         ProgressBar.Left := 0;
1548         ProgressBar.Width := StatusBar.Panels[0].Width;
1549         ProgressBar.Height := StatusBar.Height - 2;
1550         ProgressBar.Position := 0;
1551
1552         //\83_\83E\83\93\83\8d\81[\83h\83I\83u\83W\83F\83N\83g
1553         FControlThread := TThreadControl.Create(True);
1554         FControlThread.MaxThreadCount := 1;
1555         FControlThread.Resume;
1556         FControlThread.OnDownloadEnd := DownloadEnd;
1557         FControlThread.OnDownloadMsg := DownloadMsg;
1558         FControlThread.OnWork := Work;
1559         FControlThread.OnWorkBegin := WorkBegin;
1560         FControlThread.OnWorkEnd := WorkEnd;
1561 //      ProgressPanel.Width := FControlThread.MaxThreadCount * 12;
1562
1563         // \8di\8d\9e\8c\9f\8dõ\97\9a\97ð
1564         SelectComboBox.Items.Assign( GikoSys.Setting.SelectTextList );
1565
1566         //\83u\83\89\83E\83U\83^\83u\90Ý\92è
1567         SetBrowserTabState;
1568
1569         BrowserBoardNameLabel.Caption := '';
1570         BrowserNameLabel.Caption := '';
1571         FWorkCount := 0;
1572
1573         FTabHintIndex := -1;
1574
1575         //\83\8a\83\93\83N\83o\81[
1576         SetLinkBar;
1577
1578         //\83\81\83j\83\85\81[\83t\83H\83\93\83g
1579         SetMenuFont;
1580
1581         //\83c\81[\83\8b\83o\81[Wrapable
1582         ListToolBar.Wrapable := GikoSys.Setting.ListToolBarWrapable;
1583         BrowserToolBar.Wrapable := GikoSys.Setting.BrowserToolBarWrapable;
1584
1585         KeepDefaultToolButton(StdToolBar, TmpToolBar);
1586         KeepDefaultToolButton(ListToolBar, TmpToolBar);
1587         KeepDefaultToolButton(BrowserToolBar, TmpToolBar);
1588
1589         MakeDefaultINIFile();
1590         //\83c\81[\83\8b\83{\83^\83\93\93Ç\82Ý\8d\9e\82Ý
1591         ReadToolBarSetting(ActionList, StdToolBar);
1592         ReadToolBarSetting(ActionList, ListToolBar);
1593         try
1594                 for i := ListToolBar.ControlCount - 1 downto 0 do
1595                 begin
1596                         if ListToolBar.Controls[ i ].Action = SelectItemAction then
1597                         begin
1598                                 // \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·
1599                                 if (i + 1) < ListToolBar.ControlCount then
1600                                         if ListToolBar.Controls[ i + 1 ] is TToolButton then
1601                                                 if TToolButton( ListToolBar.Controls[ i + 1 ] ).Style = tbsSeparator then
1602                                                         ListToolBar.Controls[ i + 1 ].Visible := False;
1603
1604                                 // \83X\83\8c\83b\83h\8di\8d\9e\83{\83^\83\93\82ð\89B\82·
1605                                 ListToolBar.Controls[ i ].Visible := False;
1606                                 // \83X\83\8c\83b\83h\8di\8d\9e\83t\83B\81[\83\8b\83h\82ð\91}\93ü
1607                                 SelectComboBox.Parent := ListToolBar;
1608                                 SelectComboBox.Left := ListToolBar.Controls[ i ].Left;
1609                                 SelectComboBox.Width := GikoSys.Setting.SelectComboBoxWidth;
1610                                 // \83X\83\8c\83b\83h\8di\8d\9e\97p\93Æ\8e©\83Z\83p\83\8c\81[\83^\82ð\91}\93ü
1611                                 SelectComboBoxSplitter.Parent := ListToolBar;
1612                                 SelectComboBoxSplitter.Left := SelectComboBox.Left + SelectComboBox.Width;
1613
1614                                 break;
1615                         end;
1616                 end;
1617         except
1618         end;
1619         ReadToolBarSetting(ActionList, BrowserToolBar);
1620         SetToolBarPopup;
1621
1622         // \83\8c\83X\95\\8e¦\94Í\88Í
1623         FResRangeMenuSelect := GikoSys.ResRange;
1624         case GikoSys.ResRange of
1625         Ord( grrAll ):
1626                 begin
1627                         AllResAction.Execute;
1628                 end;
1629         Ord( grrSelect ):
1630                 begin
1631                         SelectComboBox.Text := SelectComboBox.Items[ 1 ];
1632                         SelectResAction.Checked := True;
1633                 end;
1634         else
1635 //              ResRangeAction.Execute;
1636                 case FResRangeMenuSelect of
1637                 Ord( grrKoko ): OnlyKokoResAction.Checked       := True;
1638                 Ord( grrNew ):  OnlyNewResAction.Checked        := True;
1639                 100:                                            OnlyAHundredResAction.Checked           := True;
1640                 end;
1641         end;
1642
1643         // \83X\83\8c\83b\83h\88ê\97\97\95\\8e¦\94Í\88Í
1644 //      ThreadRangeAction.Execute;
1645         case GikoSys.Setting.ThreadRange of
1646         gtrAll:
1647                 begin
1648                         AllItemAction.Checked := True;
1649                         ViewType := gvtAll;
1650                 end;
1651         gtrLog:
1652                 begin
1653                         LogItemAction.Checked := True;
1654                         ViewType := gvtLog;
1655                 end;
1656         gtrNew:
1657                 begin
1658                         NewItemAction.Checked := True;
1659                         ViewType := gvtNew;
1660                 end;
1661         end;
1662
1663         //\83A\83h\83\8c\83X\83o\81[
1664         AddressComboBox.TabStop := GikoSys.Setting.AddressBarTabStop;
1665
1666         //\83N\81[\83\8b\83o\81[\95\9c\8c³\82ÍFormShow\82É\88Ú\93®\82µ\82½
1667
1668         //\83{\81[\83h\83t\83@\83C\83\8b\82ª\96³\82¢\8fê\8d\87\82Í\83\81\83b\83Z\81[\83W\95\\8e¦
1669         if not FileExists(GikoSys.GetBoardFileName) then begin
1670                 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
1671                                  + '\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
1672                                  + '\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';
1673                 MsgBox(SplashWindow.Handle, msg, '\83M\83R\83i\83r', MB_OK or MB_ICONINFORMATION);
1674                 NewBoardAction.Execute;
1675         end;
1676
1677         //\83L\81[\90Ý\92è\93Ç\82Ý\8d\9e\82Ý
1678         GikoSys.LoadKeySetting(ActionList);
1679
1680         //\8dÅ\8fI\8f\84\89ñ\8e\9e\8aÔ
1681 //      FLastRoundTime := 0;
1682
1683         //ResHint
1684         FHint := TResPopup.Create(Self);
1685
1686         // \8dÅ\8cã\82É\91I\91ð\82³\82ê\82½\83L\83\83\83r\83l\83b\83g\82Ì\95\9c\8c³
1687         CabinetVisible( False );
1688         if GikoSys.Setting.CabinetVisible then begin
1689                 i := CabinetSelectPopupMenu.Items.Count - 1;
1690                 if GikoSys.Setting.CabinetIndex = i - 1 then
1691                         CabinetHistoryAction.Execute
1692                 else if GikoSys.Setting.CabinetIndex = i then
1693                         CabinetFavoriteAction.Execute
1694                 else begin
1695                         if GikoSys.Setting.CabinetIndex < Length( BBSs ) then
1696                                 ShowBBSTree( BBSs[ GikoSys.Setting.CabinetIndex ] );
1697                         // \8bN\93®\8e\9e\82É\95Û\91\82³\82ê\82Ä\82µ\82Ü\82¤\91Î\8dô 2
1698                         FIsIgnoreResize := rtResizing;
1699                         CabinetBBSAction.Execute;
1700                 end;
1701         end else begin
1702                 ShowBBSTreeOld( BBSs[ 0 ] );
1703                 PostMessage( Handle, USER_TREECLICK, 0, 0 );
1704         end;
1705
1706         // \8bN\93®\8e\9e\82É\95Û\91\82³\82ê\82Ä\82µ\82Ü\82¤\91Î\8dô 3
1707         FIsIgnoreResize := rtResizing;
1708
1709         //\83I\81[\83g\83\8d\83O\83C\83\93
1710         if GikoSys.Setting.AutoLogin then
1711                 LoginAction.Execute;
1712
1713         //\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
1714         for i := 1 to ParamCount do     begin
1715                 MoveToURL(ParamStr(i));
1716         end;
1717 //      SetStdToolBar;
1718 //      SetLinkBar;
1719
1720         s := GikoSys.FAbon.NGwordname;
1721         StatusBar.Panels[2].Text := s;
1722         StatusBar.Panels[2].Width := Max(StatusBar.Canvas.TextWidth(s), 100);
1723         StatusBarResize(Sender);
1724
1725         dummy1.Caption  := ItemReservPMenu.Caption;
1726         dummy1.Hint     := ItemReservPMenu.Hint;
1727
1728         //Samba24\82Ì\83t\83@\83C\83\8b\83`\83F\83b\83N
1729         GikoSys.SambaFileExists();
1730
1731         // \83X\83p\83\80\83t\83B\83\8b\83^\8aw\8fK\97\9a\97ð
1732         GikoSys.Bayesian.LoadFromFile( GikoSys.Setting.GetSpamFilterFileName );
1733
1734         // \83}\83E\83X\83W\83F\83X\83`\83\83\81[
1735         MouseGesture := TMouseGesture.Create;
1736         GikoSys.Setting.Gestures.LoadGesture(
1737                 GikoSys.Setting.GetGestureFileName, ActionList );
1738         MouseGesture.Margin := GikoSys.Setting.Gestures.Margin;
1739         MouseGesture.OnGestureStart := OnGestureStart;
1740         MouseGesture.OnGestureMove := OnGestureMove;
1741         MouseGesture.OnGestureEnd := OnGestureEnd;
1742         if GikoSys.Setting.GestureEnabled then
1743                 MouseGesture.SetHook( Handle );
1744
1745         //2ch\8c¾\8cê\93Ç\82Ý\8fo\82µ
1746                 if GikoSys.Setting.GengoSupport then begin
1747                         if GikoSys.Setting.Gengo = nil then
1748                                 GikoSys.Setting.Gengo := TStringList.Create;
1749                         if FileExists(GikoSys.GetConfigDir + 'language.ini') then
1750                                 GikoSys.Setting.Gengo.LoadFromFile(GikoSys.GetConfigDir + 'language.ini')
1751                         else
1752                                 GikoSys.Setting.GengoSupport := false;
1753                 end;
1754 end;
1755
1756 // CoolBar \82Ì\90Ý\92è\82ð\95Ï\90\94\82É\95Û\91
1757 procedure TGikoForm.SaveCoolBarSettings;
1758 begin
1759
1760         if IsIconic( Handle ) or (FIsIgnoreResize <> rtNone) then
1761                 Exit;
1762         SaveMainCoolBarSettings;
1763         SaveBoardCoolBarSettings;
1764         SaveBrowserCoolBarSettings;
1765
1766 end;
1767 procedure TGikoForm.SaveMainCoolBarSettings;
1768 var
1769         i : Integer;
1770         CoolSet : TCoolSet;
1771 begin
1772         //\83N\81[\83\8b\83o\81[\95Û\91¶(Main)
1773         for i := 0 to MAIN_COOLBAND_COUNT - 1 do begin
1774                 CoolSet.FCoolID := MainCoolBar.Bands[i].ID;
1775                 CoolSet.FCoolWidth := MainCoolBar.Bands[i].Width;
1776                 CoolSet.FCoolBreak := MainCoolBar.Bands[i].Break;
1777                 GikoSys.Setting.MainCoolSet[i] := CoolSet;
1778         end;
1779 end;
1780 procedure TGikoForm.SaveBoardCoolBarSettings;
1781 var
1782         i : Integer;
1783         CoolSet : TCoolSet;
1784 begin
1785         //\83N\81[\83\8b\83o\81[\95Û\91¶(Board)
1786         for i := 0 to LIST_COOLBAND_COUNT - 1 do begin
1787                 CoolSet.FCoolID := ListCoolBar.Bands[i].ID;
1788                 CoolSet.FCoolWidth := ListCoolBar.Bands[i].Width;
1789                 CoolSet.FCoolBreak := ListCoolBar.Bands[i].Break;
1790                 GikoSys.Setting.ListCoolSet[i] := CoolSet;
1791         end;
1792 end;
1793 procedure TGikoForm.SaveBrowserCoolBarSettings;
1794 var
1795         i : Integer;
1796         CoolSet : TCoolSet;
1797 begin
1798         //\83N\81[\83\8b\83o\81[\95Û\91¶(Browser)
1799         for i := 0 to BROWSER_COOLBAND_COUNT - 1 do begin
1800                 CoolSet.FCoolID := BrowserCoolBar.Bands[i].ID;
1801                 CoolSet.FCoolWidth := BrowserCoolBar.Bands[i].Width;
1802                 CoolSet.FCoolBreak := BrowserCoolBar.Bands[i].Break;
1803                 GikoSys.Setting.BrowserCoolSet[i] := CoolSet;
1804         end;
1805 end;
1806 // CoolBar \82Ì\90Ý\92è\82ð\95Ï\90\94\82©\82ç\95\9c\8c³
1807 procedure TGikoForm.LoadCoolBarSettings;
1808 var
1809         i                               : Integer;
1810         CoolSet : TCoolSet;
1811 begin
1812
1813         //\83N\81[\83\8b\83o\81[\95\9c\8c³(Main)
1814         MainCoolBar.Bands.BeginUpdate;
1815         try
1816 //              for i := 0 to MainCoolBar.Bands.Count - 1 do begin
1817                 for i := MAIN_COOLBAND_COUNT - 1 downto 0 do begin
1818                         CoolSet := GikoSys.Setting.MainCoolSet[i];
1819                         if (CoolSet.FCoolID = -1) or (CoolSet.FCoolWidth = -1) then begin
1820                                 FIsIgnoreResize := rtNone;
1821                                 SaveCoolBarSettings;
1822                                 Exit;
1823                         end;
1824                         MainCoolBar.Bands.FindItemID(CoolSet.FCoolID).Index := i;
1825                         MainCoolBar.Bands[i].Break := CoolSet.FCoolBreak;
1826                         MainCoolBar.Bands[i].Width := CoolSet.FCoolWidth;
1827                 end;
1828         finally
1829                 MainCoolBar.Bands.EndUpdate;
1830         end;
1831
1832         //\83N\81[\83\8b\83o\81[\95\9c\8c³(Board)
1833         ListCoolBar.Bands.BeginUpdate;
1834         try
1835 //              for i := 0 to ListCoolBar.Bands.Count - 1 do begin
1836                 for i := LIST_COOLBAND_COUNT - 1 downto 0 do begin
1837                         CoolSet := GikoSys.Setting.ListCoolSet[i];
1838                         if (CoolSet.FCoolID = -1) or (CoolSet.FCoolWidth = -1) then begin
1839                                 FIsIgnoreResize := rtNone;
1840                                 SaveCoolBarSettings;
1841                                 Exit;
1842                         end;
1843                         ListCoolBar.Bands.FindItemID(CoolSet.FCoolID).Index := i;
1844                         ListCoolBar.Bands[i].Break := CoolSet.FCoolBreak;
1845                         ListCoolBar.Bands[i].Width := CoolSet.FCoolWidth;
1846                 end;
1847         finally
1848                 ListCoolBar.Bands.EndUpdate;
1849         end;
1850
1851         //\83N\81[\83\8b\83o\81[\95\9c\8c³(Browser)
1852         BrowserCoolBar.Bands.BeginUpdate;
1853         try
1854 //              for i := 0 to BrowserCoolBar.Bands.Count - 1 do begin
1855                 for i := BROWSER_COOLBAND_COUNT - 1 downto 0 do begin
1856                         CoolSet := GikoSys.Setting.BrowserCoolSet[i];
1857                         if (CoolSet.FCoolID = -1) or (CoolSet.FCoolWidth = -1) then begin
1858                                 FIsIgnoreResize := rtNone;
1859                                 SaveCoolBarSettings;
1860                                 Exit;
1861                         end;
1862                         BrowserCoolBar.Bands.FindItemID(CoolSet.FCoolID).Index := i;
1863                         BrowserCoolBar.Bands[i].Break := CoolSet.FCoolBreak;
1864                         BrowserCoolBar.Bands[i].Width := CoolSet.FCoolWidth;
1865                 end;
1866         finally
1867                 BrowserCoolBar.Bands.EndUpdate;
1868         end;
1869
1870 end;
1871
1872 //
1873 //
1874 //
1875 procedure TGikoForm.FormShow(Sender: TObject);
1876 begin
1877         if FStartUp then begin
1878                 ShowWindow(Application.Handle, SW_HIDE);
1879
1880                 //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½
1881                 //\83c\81[\83\8b\83o\81[\95\\8e¦
1882                 StdToolBarVisibleAction.Checked := GikoSys.Setting.StdToolBarVisible;
1883                 StdToolBarVisibleActionExecute( nil );
1884                 AddressBarVisibleAction.Checked := GikoSys.Setting.AddressBarVisible;
1885                 AddressBarVisibleActionExecute( nil );
1886                 LinkBarVisibleAction.Checked := GikoSys.Setting.LinkBarVisible;
1887                 LinkBarVisibleActionExecute( nil );
1888                 ListToolBarVisibleAction.Checked := GikoSys.Setting.ListToolBarVisible;
1889                 ListToolBarVisibleActionExecute( nil );
1890                 ListNameBarVisibleAction.Checked := GikoSys.Setting.ListNameBarVisible;
1891                 ListNameBarVisibleActionExecute( nil );
1892                 BrowserToolBarVisibleAction.Checked := GikoSys.Setting.BrowserToolBarVisible;
1893                 BrowserToolBarVisibleActionExecute( nil );
1894                 BrowserNameBarVisibleAction.Checked := GikoSys.Setting.BrowserNameBarVisible;
1895                 BrowserNameBarVisibleActionExecute( nil );
1896
1897                 //\83u\83\89\83E\83U\83^\83u
1898                 BrowserTabVisibleAction.Checked := GikoSys.Setting.BrowserTabVisible;
1899                 BrowserTabVisibleActionExecute(nil);
1900
1901                 if GikoSys.Setting.BrowserTabPosition = gtpTop then begin
1902                         BrowserTabTopAction.Checked := True;
1903                         BrowserTabTopActionExecute(nil);
1904                 end else begin
1905                         BrowserTabBottomAction.Checked := True;
1906                         BrowserTabBottomActionExecute(nil);
1907                 end;
1908
1909                 if GikoSys.Setting.BrowserTabStyle = gtsTab then begin
1910                         BrowserTabTabStyleAction.Checked := True;
1911                         BrowserTabTabStyleActionExecute(nil);
1912                 end else if GikoSys.Setting.BrowserTabStyle = gtsButton then begin
1913                         BrowserTabButtonStyleAction.Checked := True;
1914                         BrowserTabButtonStyleActionExecute(nil);
1915                 end else begin
1916                         BrowserTabFlatStyleAction.Checked := True;
1917                         BrowserTabFlatStyleActionExecute(nil);
1918                 end;
1919
1920                 // ListView \82Ì\83w\83b\83_\83h\83\89\83b\83O
1921 //              ListView.FullDrag := True;
1922
1923                 // CoolBar \95\9c\8c³
1924                 LoadCoolBarSettings;
1925
1926                 FIsIgnoreResize := rtNone;
1927
1928                 //TabAutoLoad
1929                 //FormCrete\82©\82ç\88Ú\93®\81B
1930                 if GikoSys.Setting.TabAutoLoadSave then begin
1931                         TabAutoLoadAction.Execute;
1932                 end;
1933                                 //\82É\82¿\82á\82ñ\8cê\88Ä\93à\83T\83|\81[\83g\8b@\94\
1934                                 if GikoSys.Setting.GengoSupport then begin
1935                                 //\97\\92è\92n
1936                                 //Test\8cü\82¯
1937                                 end;
1938
1939                 FStartUp := false;
1940         end;
1941 end;
1942
1943 procedure TGikoForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
1944 begin
1945 //      if GikoForm.WindowState <> wsMinimized then
1946 //              SaveCoolBarSettings;
1947         if ( GikoSys.Setting.ShowDialogForEnd ) and
1948                         (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
1949                 CanClose := false;
1950                         Exit;
1951         end else begin
1952                 CanClose := True;
1953                 if GikoSys.Setting.TabAutoLoadSave then begin
1954                         TabAutoSaveAction.Execute;
1955                 end;
1956         end;
1957         //2ch\8c¾\8cȩ̂²ÙFree
1958                 if GikoSys.Setting.Gengo <> nil then begin
1959                                 GikoSys.Setting.Gengo.Free;
1960         end;
1961         //Application.HookMainWindow(Hook);
1962         Application.UnhookMainWindow(Hook);
1963         Application.Terminate;
1964 end;
1965
1966 procedure TGikoForm.FormDestroy(Sender: TObject);
1967 var
1968         i                               : Integer;
1969 //      CoolSet: TCoolSet;
1970         wp                      : TWindowPlacement;
1971         tmpBool : Boolean;
1972 begin
1973 //      Application.OnDeactivate := nil;
1974 //      Self.OnDeactivate := nil;
1975         // \83}\83E\83X\83W\83F\83X\83`\83\83\81[\8aJ\95ú
1976         try
1977                 MouseGesture.UnHook;
1978         except
1979         end;
1980         try
1981                 ActiveListColumnSave;
1982         except
1983         end;
1984         try
1985                 //\8dÅ\91å\89»\81E\83E\83B\83\93\83h\83E\88Ê\92u\95Û\91
1986                 wp.length := sizeof(wp);
1987                 GetWindowPlacement(Handle, @wp);
1988                 GikoSys.Setting.WindowTop := wp.rcNormalPosition.Top;
1989                 GikoSys.Setting.WindowLeft := wp.rcNormalPosition.Left;
1990                 GikoSys.Setting.WindowHeight := wp.rcNormalPosition.Bottom - wp.rcNormalPosition.Top;
1991                 GikoSys.Setting.WindowWidth := wp.rcNormalPosition.Right - wp.rcNormalPosition.Left;
1992                 GikoSys.Setting.WindowMax := WindowState = wsMaximized;
1993
1994                 GikoSys.Setting.ListStyle := ListView.ViewStyle;
1995                 GikoSys.Setting.CabinetVisible := CabinetVisibleAction.Checked;
1996                 GikoSys.Setting.CabinetWidth := CabinetPanel.Width;
1997                 GikoSys.Setting.ListHeight := FBrowserSizeHeight;
1998                 GikoSys.Setting.ListWidth := FBrowserSizeWidth;
1999                 if ArrangeAction.Checked then
2000                         GikoSys.Setting.ListOrientation := gloVertical
2001                 else
2002                         GikoSys.Setting.ListOrientation := gloHorizontal;
2003                 GikoSys.Setting.MessegeBarHeight := MessagePanel.Height;
2004         except
2005         end;
2006
2007         try
2008                 // \83\8c\83X\95\\8e¦\94Í\88Í
2009                 if not GikoSys.Setting.ResRangeHold then
2010                         GikoSys.Setting.ResRange := FResRangeMenuSelect;
2011         except
2012         end;
2013
2014         // \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è
2015         // \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¢
2016         {
2017                 // \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
2018         // CoolBar \95Û\91
2019         if GikoForm.WindowState <> wsMinimized then
2020                 SaveCoolBarSettings;
2021         }
2022         try
2023                 GikoSys.Setting.WriteWindowSettingFile;
2024                 GikoSys.Setting.WriteNameMailSettingFile;
2025         except
2026         end;
2027
2028         //\82¨\8bC\82É\93ü\82è\95Û\91
2029         try
2030                 //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é
2031                 FavoriteDM.WriteFavorite;
2032                 FavoriteDM.Clear;
2033         except
2034         end;
2035
2036         try
2037                 //\83^\83u\83N\83\8d\81[\83Y
2038                 tmpBool := GikoSys.Setting.ShowDialogForAllTabClose;
2039                 GikoSys.Setting.ShowDialogForAllTabClose := false;
2040                 AllTabCloseAction.Execute;
2041         GikoSys.Setting.ShowDialogForAllTabClose := tmpBool;
2042         except
2043         end;
2044         try
2045                 LockWindowUpdate(Self.Handle);
2046                 for i := FBrowsers.Count - 1 downto 0 do begin
2047                         TWebBrowser(FBrowsers[i]).Free;
2048                 end;
2049                 FBrowsers.Clear;
2050                 FBrowsers.Capacity := 0;
2051         finally
2052                 FBrowsers.Free;
2053         end;
2054         try
2055                 if BrowserNullTab <> nil then begin
2056                         BrowserNullTab.Browser := nil;  {*BrowserNullTab\82ÌBrowser\82Í\90Ý\8cv\8e\9e\82É\93\\82è\95t\82¯\82Ä\82é\93z
2057                                                                                          *\82È\82Ì\82Å\82±\82±\82ÅFree\82³\82ê\82é\82Æ\8d¢\82é\82Ì\82Å\82Í\82¸\82µ\82Ä\82µ\82Ü\82¤\81B
2058                                                                                          *}
2059                         BrowserNullTab.Free;
2060                 end;
2061         except
2062         end;
2063         LockWindowUpdate(0);
2064         try
2065                 TreeView.Items.BeginUpdate;
2066                 TreeView.Items.GetFirstNode.Free;
2067                 TreeView.Items.Clear;
2068                 TreeView.Items.EndUpdate;
2069         except
2070         end;
2071
2072         //\83A\83h\83\8c\83X\97\9a\97ð\95Û\91
2073         try
2074                 //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
2075                 AddressHistoryDM.WriteHistory(AddressComboBox.Items, GikoSys.Setting.AddressHistoryCount);
2076         except
2077         end;
2078
2079         //\83q\83X\83g\83\8a\83\8a\83X\83g\95Û\91
2080         try
2081                 SaveHistory;
2082         except
2083         end;
2084         try
2085                 try
2086                         ClearHistory;
2087                 except
2088                 end;
2089         finally
2090                 FHistoryList.Free;
2091         end;
2092
2093         //\8f\84\89ñ\83\8a\83X\83g\95Û\91¶&\94j\8aü
2094         try
2095                 RoundList.SaveRoundFile;
2096         except
2097         end;
2098         try
2099                 try
2100                         RoundList.Clear;
2101                 except
2102                 end;
2103         finally
2104                 RoundList.Free;
2105          end;
2106
2107         try
2108                 try
2109                         FControlThread.Terminate;
2110                         FControlThread.WaitFor;
2111                 except
2112                 end;
2113         finally
2114                 FControlThread.Free;
2115         end;
2116
2117         // TBBS \82Í\95Û\8e\9d\82µ\82Ä\82¢\82é TCategory, TBoard, TThreadItem \82·\82×\82Ä\82ð\8aJ\95ú\82·\82é
2118         // 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Å
2119         // BoardPluteIns \82Ì\8aJ\95ú\82æ\82è\90æ\82É\8ds\82¤\82±\82Æ
2120         try
2121                 for i := Length( BBSs ) - 1 downto 0 do begin
2122                         if BBSs[ i ] <> nil then
2123                                 BBSs[ i ].Free;
2124                         BBSs[ i ] := nil;
2125                 end;
2126         except
2127         end;
2128
2129         try
2130                 for i := Length( BoardPlugIns ) - 1 downto  0 do begin
2131                         if BoardPlugIns[ i ] <> nil then
2132                                 BoardPlugIns[ i ].Free;
2133                         BoardPlugIns[ i ] := nil;
2134                 end;
2135         except
2136         end;
2137
2138         try
2139                 if FEvent <> nil then
2140                         FEvent.Free;
2141
2142                 //Hint\94j\8aü
2143                 if FHint <> nil then begin
2144                         FHint.ReleaseHandle;
2145                         FHint.Free;
2146                         FHint := nil;
2147                 end;
2148                 //Preview\94j\8aü
2149                 if TPreviewBrowser <> nil then begin
2150                         FPreviewBrowser.Free;
2151                         FPreviewBrowser := nil;
2152                 end;
2153         except
2154         end;
2155
2156 end;
2157
2158 //\83L\83\83\83r\83l\83b\83g\81~\83{\83^\83\93\83N\83\8a\83b\83N
2159 procedure TGikoForm.CabinetPanelHide(Sender: TObject);
2160 begin
2161         CabinetVisibleAction.Execute;
2162 //      CabinetPanelVisible(false);
2163 end;
2164
2165 // \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
2166 procedure TGikoForm.SetBBSMenu;
2167 var
2168         i                       : Integer;
2169         item    : TBBSMenuItem;
2170 begin
2171
2172         // \83\81\83j\83\85\81[\82ð\8dí\8f\9c
2173         for i := CabinetSelectPopupMenu.Items.Count - 1 downto 0 do begin
2174                 try
2175                         if CabinetSelectPopupMenu.Items[ i ] is TBBSMenuItem then begin
2176                                 CabinetSelectPopupMenu.Items[ i ].Free;
2177                                 CabinetMenu.Items[ i ].Free;
2178                                 BBSSelectPopupMenu.Items[ i ].Free;
2179                         end;
2180                 except
2181                 end;
2182         end;
2183
2184         // \83\81\83j\83\85\81[\82ð\90Ý\92è
2185         for i := Length( BBSs ) - 1 downto 0 do begin
2186                 try
2187                         item                                    := TBBSMenuItem.Create( PopupMenu );
2188                         item.Caption    := BBSs[ i ].Title;
2189                         item.Data                       := BBSs[ i ];
2190                         item.OnClick    := BBSMenuItemOnClick;
2191                         CabinetSelectPopupMenu.Items.Insert( 0, item );
2192                         item                                    := TBBSMenuItem.Create( PopupMenu );
2193                         item.Caption    := BBSs[ i ].Title;
2194                         item.Data                       := BBSs[ i ];
2195                         item.OnClick    := BBSMenuItemOnClick;
2196                         CabinetMenu.Insert( 0, item );
2197                         item                                    := TBBSMenuItem.Create( PopupMenu );
2198                         item.Caption    := BBSs[ i ].Title;
2199                         item.Data                       := BBSs[ i ];
2200                         item.OnClick    := BBSMenuItemOnClick;
2201                         BBSSelectPopupMenu.Items.Insert( 0, Item );
2202                 except
2203                 end;
2204         end;
2205
2206 end;
2207
2208 procedure TGikoForm.ReloadBBS;
2209 var
2210         i                       : Integer;
2211         tmpBool: Boolean;
2212 begin
2213         //\83^\83u\83N\83\8d\81[\83Y
2214         tmpBool := GikoSys.Setting.ShowDialogForAllTabClose;
2215         GikoSys.Setting.ShowDialogForAllTabClose := false;
2216         AllTabCloseAction.Execute;
2217         GikoSys.Setting.ShowDialogForAllTabClose := tmpBool;
2218
2219         SetContent(BrowserNullTab);
2220         //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
2221         TreeView.Items.Clear;
2222
2223         //BBS\94j\8aü
2224         try
2225                 for i := Length( BBSs ) - 1 downto 0 do begin
2226                         if BBSs[ i ] <> nil then
2227                                 BBSs[ i ].Free;
2228                         BBSs[ i ] := nil;
2229                 end;
2230         except
2231         end;
2232
2233         ActiveList := nil;
2234
2235         FTreeType := gttNone;
2236
2237         GikoSys.ListBoardFile;          //\83{\81[\83h\83t\83@\83C\83\8b\93Ç\8d\9e
2238
2239         // BBS \83\81\83j\83\85\81[\82Ì\8dX\90V
2240         SetBBSMenu;
2241
2242         ShowBBSTree( BBSs[ 0 ] );
2243
2244         // \97\9a\97ð\93Ç\82Ý\8d\9e\82Ý
2245         SaveHistory;
2246         ClearHistory;
2247         LoadHistory;
2248
2249         //\82¨\8bC\82É\93ü\82è\93Ç\82Ý\8d\9e\82Ý
2250         FavoriteDM.WriteFavorite;
2251         FavoriteDM.Clear;
2252         FavoriteDM.ReadFavorite;
2253
2254         SetLinkBar;
2255
2256         //
2257         TabsOpenAction.Execute;
2258 end;
2259
2260 //\83{\81[\83h\83c\83\8a\81[\90Ý\92è
2261 procedure TGikoForm.SetBoardTreeNode(
2262         inBBS : TBBS
2263 );
2264 var
2265         i, j, k: integer;
2266         Root: TTreeNode;
2267         CategoryNode: TTreeNode;
2268         BoardNode: TTreeNode;
2269         Category: TCategory;
2270         Board: TBoard;
2271 begin
2272         // \94Â\83\8a\83X\83g\82Ì\90Ý\92è
2273         FActiveBBS := inBBS;
2274         TreeView.Items.BeginUpdate;
2275         TreeView.Items.Clear;
2276         try
2277                 if not inBBS.IsBoardFileRead then
2278                         GikoSys.ReadBoardFile( inBBS );
2279                 try
2280                         if SplashWindow <> nil then
2281                                 SplashWindow.ProgressBar.Max := inBBS.Count;
2282                 except
2283                 end;
2284
2285                 // \83L\83\83\83r\83l\83b\83g\95\\8e¦\91O\82É\8dÄ\83\\81[\83g
2286                 if ( GikoSys.Setting.BBSSortIndex <> 0 ) or ( GikoSys.Setting.BBSSortOrder <> true ) then begin
2287                         Sort.SortOrder := true;
2288                         Sort.SortIndex := 0;
2289                         Sort.SortNoFlag := true;
2290                         inBBS.Sort(CategorySortProc);
2291                 end;
2292
2293                 Root                                                            := TreeView.Items.Add( nil, inBBS.Title );
2294                 Root.ImageIndex                 := ITEM_ICON_2CH1;
2295                 Root.SelectedIndex      := ITEM_ICON_2CH2;
2296                 Root.Data                                               := inBBS;
2297                 for i := inBBS.Count - 1 downto 0 do begin
2298                         Category := TCategory(inBBS.Items[i]);
2299                         CategoryNode := TreeView.Items.AddChildFirst(Root, Category.Title);
2300                         CategoryNode.Data := Category;
2301                         CategoryNode.ImageIndex := ITEM_ICON_CATEGORY1;
2302                         CategoryNode.SelectedIndex := ITEM_ICON_CATEGORY2;
2303
2304                         // \83L\83\83\83r\83l\83b\83g\95\\8e¦\91O\82É\8dÄ\83\\81[\83g
2305                         if ( GikoSys.Setting.CategorySortIndex <> 0 ) or ( GikoSys.Setting.CategorySortOrder <> true ) then begin
2306                                 Sort.SortOrder := true;
2307                                 Sort.SortIndex := 0;
2308                                 Sort.SortNoFlag := true;
2309                                 Category.CustomSort(BoardSortProc);
2310                         end;
2311
2312                         for j := Category.Count - 1 downto 0 do begin
2313                                 Board := TBoard(Category.Items[j]);
2314                                 Board.BeginUpdate;
2315                                 BoardNode := TreeView.Items.AddChildFirst(CategoryNode, Board.Title);
2316                                 BoardNode.Data := Board;
2317                                 //if (Board.LastGetTime = 0) or (Board.LastGetTime = ZERO_DATE) then begin
2318                                 if not Board.IsLogFile then begin
2319                                         BoardNode.ImageIndex := ITEM_ICON_BOARD_NOSUBJECT;
2320                                         BoardNode.SelectedIndex := ITEM_ICON_BOARD_NOSUBJECT;
2321                                 end else begin
2322                                         BoardNode.ImageIndex := ITEM_ICON_BOARD1;
2323                                         BoardNode.SelectedIndex := ITEM_ICON_BOARD2;
2324                                         for k := 0 to Board.Count - 1 do begin
2325                                                 if Board.Items[ k ].IsLogFile then begin
2326                                                         BoardNode.ImageIndex := ITEM_ICON_BOARD_LOG;
2327                                                         BoardNode.SelectedIndex := ITEM_ICON_BOARD_LOG;
2328
2329                                                         Break;
2330                                                 end;
2331                                         end;
2332                                 end;
2333                                 Board.EndUpdate;
2334                         end;
2335
2336                         CategoryNode.Expanded := Category.NodeExpand;
2337
2338                         if SplashWindow <> nil then begin
2339                                 SplashWindow.ProgressBar.StepIt;
2340                                 Application.ProcessMessages;
2341                         end;
2342                 end;
2343         finally
2344                 TreeView.Items.EndUpdate;
2345         end;
2346 end;
2347
2348 function TGikoForm.SetCategoryListItem(ABBS2ch: TBBS): Integer;
2349 var
2350         TitleColumn     : TListColumn;
2351         ListColumn      : TListColumn;
2352         i, id, idx      : Integer;
2353 begin
2354         ListView.Items.BeginUpdate;
2355         try
2356                 Screen.Cursor := crHourGlass;
2357
2358                 ListView.Columns.Clear;
2359                 TitleColumn := ListView.Columns.Add;
2360                 TitleColumn.Caption := GikoBBSColumnCaption[ Ord( gbbscTitle ) ];
2361                 TitleColumn.Width := GikoSys.Setting.BBSColumnWidth[ Ord( gbbscTitle ) ];
2362                 idx := 0;
2363                 for i := 0 to GikoSys.Setting.BBSColumnOrder.Count - 1 do begin
2364                         if GikoSys.Setting.BBSColumnOrder[ i ] = gbbscTitle then begin
2365                                 TitleColumn.Tag := i;
2366                                 idx := i;
2367                         end else begin
2368                                 id := Ord( GikoSys.Setting.BBSColumnOrder[ i ] );
2369                                 if (Integer( Low( TGikoBBSColumnID ) ) <= id) and
2370                                         (id <= Integer( High( TGikoBBSColumnID ) )) then begin
2371                                         ListColumn := ListView.Columns.Add;
2372         //                                      ListColumn.Tag := id;
2373                                                 ListColumn.Tag := i;
2374                                         ListColumn.Caption := GikoBBSColumnCaption[ id ];
2375                                         ListColumn.Width := GikoSys.Setting.BBSColumnWidth[ id ];
2376                                 end;
2377                         end;
2378                 end;
2379                 TitleColumn.Index := idx;
2380
2381                 ListView.Items.Count := 0;
2382                 ListView.Items.Clear;
2383                 ListView.Items.Count := ABBS2ch.Count;
2384
2385 //              UpFolderAction.Enabled := False;
2386 //              AllItemAction.Enabled := False;
2387 //              LogItemAction.Enabled := False;
2388 //              NewItemAction.Enabled := False;
2389 //              SelectItemAction.Enabled := False;
2390 //              ListDownloadToolButton.Enabled := False;
2391 //              BoardReservToolButton.Enabled := False;
2392 //              ListThreadDownloadToolButton.Enabled := False;
2393
2394                 ListNameLabel.Caption := ABBS2ch.Title;
2395                 FolderImage.Picture := nil;
2396                 ItemIcon16.GetBitmap(1, FolderImage.Picture.Bitmap);
2397
2398                 FSortIndex := GikoSys.Setting.BBSSortIndex;
2399                 FSortOrder := GikoSys.Setting.BBSSortOrder;
2400                 for i := ListView.Columns.Count - 1 downto 0 do begin
2401                         idx := ListView.Column[ i ].Tag;
2402                         if FSortIndex = Ord( GikoSys.Setting.BBSColumnOrder[ idx ] ) then
2403                                 ListViewSort( nil, ListView.Column[ i ] );
2404                 end;
2405
2406                 Result := ABBS2ch.Count;
2407         finally
2408                 Screen.Cursor := crDefault;
2409                 ListView.Items.EndUpdate;
2410         end;
2411 end;
2412
2413 function TGikoForm.SetBoardListItem(Category: TCategory): Integer;
2414 var
2415         TitleColumn     : TListColumn;
2416         ListColumn      : TListColumn;
2417         i, id, idx      : Integer;
2418 begin
2419         ListView.Items.BeginUpdate;
2420         try
2421                 Screen.Cursor := crHourGlass;
2422
2423                 ListView.Columns.Clear;
2424                 TitleColumn := ListView.Columns.Add;
2425                 TitleColumn.Caption := GikoCategoryColumnCaption[ Ord( gccTitle ) ];
2426                 TitleColumn.Width := GikoSys.Setting.CategoryColumnWidth[ Ord( gccTitle ) ];
2427                 idx := 0;
2428                 for i := 0 to GikoSys.Setting.CategoryColumnOrder.Count - 1 do begin
2429                         if GikoSys.Setting.CategoryColumnOrder[ i ] = gccTitle then begin
2430                                 TitleColumn.Tag := i;
2431                                 idx := i;
2432                         end else begin
2433                                 id := Ord( GikoSys.Setting.CategoryColumnOrder[ i ] );
2434                                 if (Integer( Low( TGikoCategoryColumnID ) ) <= id) and
2435                                         (id <= Integer( High( TGikoCategoryColumnID ) )) then begin
2436                                         ListColumn := ListView.Columns.Add;
2437 //                                              ListColumn.Tag := id;
2438                                         ListColumn.Tag := i;
2439                                         ListColumn.Caption := GikoCategoryColumnCaption[ id ];
2440                                         ListColumn.Width := GikoSys.Setting.CategoryColumnWidth[ id ];
2441                                 end;
2442                         end;
2443                 end;
2444                 TitleColumn.Index := idx;
2445
2446                 ListView.Items.Count := 0;
2447                 ListView.Items.Clear;
2448                 ListView.Items.Count := Category.Count;
2449
2450 //              UpFolderAction.Enabled := True;
2451 //              AllItemAction.Enabled := False;
2452 //              LogItemAction.Enabled := False;
2453 //              NewItemAction.Enabled := False;
2454 //              SelectItemAction.Enabled := False;
2455 //              ListDownloadToolButton.Enabled := False;
2456 //              BoardReservToolButton.Enabled := False;
2457 //              ListThreadDownloadToolButton.Enabled := False;
2458
2459                 ListNameLabel.Caption := Category.Title;
2460                 FolderImage.Picture := nil;
2461                 ItemIcon16.GetBitmap(3, FolderImage.Picture.Bitmap);
2462
2463                 FSortIndex := GikoSys.Setting.CategorySortIndex;
2464                 FSortOrder := GikoSys.Setting.CategorySortOrder;
2465                 for i := ListView.Columns.Count - 1 downto 0 do begin
2466                         idx := ListView.Column[ i ].Tag;
2467                         if FSortIndex = Ord( GikoSys.Setting.CategoryColumnOrder[ idx ] ) then
2468                                 ListViewSort( nil, ListView.Column[ i ] );
2469                 end;
2470
2471                 Result := Category.Count;
2472         finally
2473                 Screen.Cursor := crDefault;
2474                 ListView.Items.EndUpdate;
2475         end;
2476 end;
2477
2478 function TGikoForm.SetThreadListItem(Board: TBoard): Integer;
2479 var
2480         TitleColumn     : TListColumn;
2481         ListColumn      : TListColumn;
2482         i, id, idx      : Integer;
2483 begin
2484         ListView.Items.BeginUpdate;
2485         try
2486                 Screen.Cursor := crHourGlass;
2487
2488 {*
2489                 // \83`\83\89\82Â\82«\96h\8e~\82Ì\82½\82ß\81A\95Ï\8dX\82³\82ê\82Ä\82¢\82é\8fê\8d\87\82Ì\82Ý
2490                 // \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Ó
2491                 if ListView.Columns.Count <> GikoSys.Setting.BoardColumnOrder.Count then
2492 *}
2493                 begin
2494                         ListView.Columns.Clear;
2495                         TitleColumn := ListView.Columns.Add;
2496                         TitleColumn.Caption := GikoBoardColumnCaption[ Ord( gbcTitle ) ];
2497                         TitleColumn.Width := GikoSys.Setting.BoardColumnWidth[ Ord( gbcTitle ) ];
2498                         idx := 0;
2499                         for i := 0 to GikoSys.Setting.BoardColumnOrder.Count - 1 do begin
2500                                 if GikoSys.Setting.BoardColumnOrder[ i ] = gbcTitle then begin
2501                                         TitleColumn.Tag := i;
2502                                         idx := i;
2503                                 end else begin
2504                                         id := Ord( GikoSys.Setting.BoardColumnOrder[ i ] );
2505                                         if (Integer( Low( TGikoBoardColumnID ) ) <= id) and
2506                                                 (id <= Integer( High( TGikoBoardColumnID ) )) then begin
2507                                                 ListColumn := ListView.Columns.Add;
2508                                                 ListColumn.Caption := GikoBoardColumnCaption[ id ];
2509         //                                      ListColumn.Tag := id;
2510                                                 ListColumn.Tag := i;
2511                                                 ListColumn.Width := GikoSys.Setting.BoardColumnWidth[ id ];
2512                                                 ListColumn.Alignment := GikoBoardColumnAlignment[ id ];
2513                                         end;
2514                                 end;
2515                         end;
2516                         TitleColumn.Index := idx;
2517                 end;
2518
2519                 ListView.Items.Count := 0;
2520                 ListView.Items.Clear;
2521
2522                 case GikoForm.ViewType of
2523                         gvtAll: ListView.Items.Count := Board.Count;
2524                         gvtLog: ListView.Items.Count := Board.GetLogThreadCount;
2525                         gvtNew: ListView.Items.Count := Board.GetNewThreadCount;
2526                         gvtUser: ListView.Items.Count := Board.GetUserThreadCount;
2527                 end;
2528
2529                 ListNameLabel.Caption := Board.Title;
2530                 FolderImage.Picture := nil;
2531                 ItemIcon16.GetBitmap(5, FolderImage.Picture.Bitmap);
2532
2533                 FSortIndex := GikoSys.Setting.BoardSortIndex;
2534                 FSortOrder := GikoSys.Setting.BoardSortOrder;
2535                 for i := ListView.Columns.Count - 1 downto 0 do begin
2536                         idx := ListView.Column[ i ].Tag;
2537                         if FSortIndex = Ord( GikoSys.Setting.BoardColumnOrder[ idx ] ) then
2538                                 ListViewSort( nil, ListView.Column[ i ] );
2539                 end;
2540
2541                 Result := Board.Count;
2542         finally
2543                 Screen.Cursor := crDefault;
2544                 ListView.Items.EndUpdate;
2545         end;
2546 end;
2547
2548 procedure TGikoForm.ListViewData(Sender: TObject; Item: TListItem);
2549 var
2550 //      FileName: string;
2551 //      DateTime: TDateTime;
2552         BoardCnt: Integer;
2553         BBS: TBBS;
2554         Category: TCategory;
2555         Board: TBoard;
2556         ThreadItem: TThreadItem;
2557         RepStr: string;
2558                 ActivListObj : TObject;
2559         i, idx : Integer;
2560 begin
2561         ActivListObj := ActiveList;
2562         if ActivListObj is TBBS then begin
2563                 //===== \83J\83e\83S\83\8a\83\8a\83X\83g =====
2564                 BBS := TBBS(ActivListObj);
2565
2566                 ListView.StateImages := nil;
2567
2568                 if BBS = nil then Exit;
2569                 if BBS.Count <= 0 then Exit;
2570                 if Item = nil then Exit;
2571                 if Item.Index >= BBS.Count then Exit;
2572                 if ListView.Items.Count = 0 then Exit;
2573
2574                 if not (BBS.Items[Item.index] is TCategory) then Exit;
2575                 Category := TCategory(BBS.Items[Item.index]);
2576
2577                 if Category = nil then Exit;
2578
2579                 if ListNumberVisibleAction.Checked then
2580                         Item.Caption := IntToStr(Category.No) + ': ' + Category.Title
2581                 else
2582                         Item.Caption := Category.Title;
2583
2584                 Item.ImageIndex := ITEM_ICON_CATEGORY1;
2585                 Item.Data := Category;
2586
2587         end else if ActivListObj is TCategory then begin
2588
2589                 //===== \94Â\83\8a\83X\83g =====
2590                 Category := TCategory(ActivListObj);
2591
2592                 ListView.StateImages := nil;
2593
2594                 if Category = nil then Exit;
2595                 if Category.Count <= 0 then Exit;
2596                 if Item = nil then Exit;
2597                 if Item.Index >= Category.Count then Exit;
2598                 if ListView.Items.Count = 0 then Exit;
2599
2600                 if not (Category.Items[Item.Index] is TBoard) then Exit;
2601                 Board := TBoard(Category.Items[Item.Index]);
2602
2603                 if Board = nil then Exit;
2604
2605                 if ListNumberVisibleAction.Checked then
2606                         Item.Caption := IntToStr(Board.No) + ': ' + Board.Title
2607                 else
2608                         Item.Caption := Board.Title;
2609
2610                 if Item.SubItems.Count <> ListView.Columns.Count then begin
2611                         Item.SubItems.Clear;
2612                         for i := GikoSys.Setting.CategoryColumnOrder.Count - 1 downto 1 do
2613                                 Item.SubItems.Add('');
2614                 end;
2615
2616                 Item.ImageIndex := ITEM_ICON_BOARD1;
2617                 idx := 0;
2618                 for i := 0 to ListView.Columns.Count - 1 do begin
2619                         if GikoSys.Setting.CategoryColumnOrder.Count <= i then
2620                                 Break;
2621 //                              case TGikoCategoryColumnID( ListView.Column[ i ].Tag ) of
2622                         case GikoSys.Setting.CategoryColumnOrder[ i ] of
2623                         gccTitle:
2624                                 // Item.Caption \82Í SubItems \82É\8aÜ\82Ü\82ê\96³\82¢\82Ì\82Å
2625                                 Dec( idx );
2626
2627                         gccRoundName:
2628                                 if Board.Round then
2629                                         Item.SubItems[ idx ] := Board.RoundName // '\97\\96ñ'
2630                                 else
2631                                         Item.SubItems[ idx ] := '';
2632
2633                         gccLastModified:
2634                                 if Board.RoundDate = ZERO_DATE then begin
2635                                         Item.SubItems[ idx ] := '';
2636                                 end else
2637                                         Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', Board.RoundDate);
2638                         end;
2639                         Inc( idx );
2640                 end;
2641
2642                 Item.Data := Board;
2643
2644         end else if ActivListObj is TBoard then begin
2645
2646                 //===== \83X\83\8c\83\8a\83X\83g =====
2647                 Board := TBoard(ActivListObj);
2648
2649                 if GikoSys.Setting.ListIconVisible then
2650                         ListView.StateImages := StateIconImageList
2651                 else
2652                         ListView.StateImages := nil;
2653
2654                 case GikoForm.ViewType of
2655                         gvtAll: BoardCnt := Board.Count;
2656                         gvtLog: BoardCnt := Board.GetLogThreadCount;
2657                         gvtNew: BoardCnt := Board.GetNewThreadCount;
2658                         gvtUser: BoardCnt := Board.GetUserThreadCount;
2659                         else
2660                                 BoardCnt := 0;
2661                 end;
2662
2663 //              if Board = nil then Exit;
2664                 if BoardCnt <= 0 then Exit;
2665                 if Item = nil then Exit;
2666                 if Item.Index > BoardCnt then Exit;
2667                 if ListView.Items.Count = 0 then Exit;
2668
2669 //              if not (Board.Items[Item.Index] is TThreadItem) then Exit;
2670
2671                 ThreadItem := nil;
2672                 case GikoForm.ViewType of
2673                         gvtAll: if Item.Index >= Board.Count then Exit else
2674                                                                 ThreadItem := TThreadItem(Board.Items[Item.Index]);
2675                         gvtLog:         ThreadItem := Board.GetLogThread(Item.Index);
2676                         gvtNew:         ThreadItem := Board.GetNewThread(Item.Index);
2677                         gvtUser:        ThreadItem := Board.GetUserThread(Item.Index);
2678                 end;
2679
2680                 if ThreadItem = nil then Exit;
2681
2682 //              if ListNumberVisibleAction.Checked then
2683 //                      RepStr := IntToStr(ThreadItem.No) + ': ' + ThreadItem.Title
2684 //              else
2685                 RepStr := ThreadItem.Title;
2686                 RepStr := CustomStringReplace(RepStr, '&lt;', '<' );
2687                 RepStr := CustomStringReplace(RepStr, '&gt;', '>' );
2688                 RepStr := CustomStringReplace(RepStr, '&quot;', '"' );
2689                 RepStr := CustomStringReplace(RepStr, '&amp;', '&' );
2690                 //RepStr := StringReplace(RepStr, '\81\97\81M', ',', [rfReplaceAll]);
2691
2692                 if Item.SubItems.Count <> ListView.Columns.Count then begin
2693                         Item.SubItems.Clear;
2694                         for i := GikoSys.Setting.BoardColumnOrder.Count - 1 downto 1 do
2695                                 Item.SubItems.Add('');
2696                 end;
2697
2698                 if ListNumberVisibleAction.Checked then
2699                         Item.Caption := IntToStr(ThreadItem.No) + ': ' + RepStr
2700                 else
2701                         Item.Caption := RepStr;
2702
2703                 case ThreadItem.AgeSage of
2704                         gasNone: Item.StateIndex := -1;
2705                         gasNew: Item.StateIndex := 0;
2706                         gasAge: Item.StateIndex := 1;
2707                         gasSage: Item.StateIndex := 2;
2708                 end;
2709
2710                 if ThreadItem.IsLogFile then begin
2711                         idx := 0;
2712                         for i := 0 to ListView.Columns.Count - 1 do begin
2713                         if GikoSys.Setting.BoardColumnOrder.Count <= i then
2714                                 Break;
2715 //                              case TGikoBoardColumnID( ListView.Column[ i ].Tag ) of
2716                                 case GikoSys.Setting.BoardColumnOrder[ i ] of
2717                                 gbcTitle:
2718                                         // Item.Caption \82Í SubItems \82É\8aÜ\82Ü\82ê\96³\82¢\82Ì\82Å
2719                                         Dec( idx );
2720
2721                                 gbcAllCount:
2722                                         Item.SubItems[ idx ] := IntToStr(ThreadItem.AllResCount);
2723
2724                                 gbcLocalCount:
2725                                         Item.SubItems[ idx ] := IntToStr(ThreadItem.Count);
2726
2727                                 gbcNonAcqCount:
2728                                         Item.SubItems[ idx ] := IntToStr(ThreadItem.AllResCount - ThreadItem.Count);
2729
2730                                 gbcNewCount:
2731                                         if ThreadItem.NewResCount = 0 then
2732                                                 Item.SubItems[ idx ] := ''
2733                                         else
2734                                                 Item.SubItems[ idx ] := IntToStr(ThreadItem.NewResCount);
2735
2736                                 gbcUnReadCount:
2737                                         Item.SubItems[ idx ] := '';
2738
2739                                 gbcRoundName:
2740                                         if ThreadItem.Round then
2741                                                 Item.SubItems[ idx ] := ThreadItem.RoundName
2742                                         else
2743                                                 Item.SubItems[ idx ] := '';
2744
2745                                 gbcRoundDate://gbcLastModified:
2746                                         if (ThreadItem.RoundDate = ZERO_DATE)  then begin
2747                                                 Item.SubItems[ idx ] := '';
2748                                         end else
2749                                                 Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', ThreadItem.RoundDate);
2750
2751                                 gbcCreated:
2752                                         if ThreadItem.CreateDate = ZERO_DATE then begin
2753                                                 Item.SubItems[ idx ] := '';
2754                                         end else
2755                                                 Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', ThreadItem.CreateDate);
2756
2757                                 gbcLastModified:
2758                                         if (ThreadItem.LastModified = ZERO_DATE)  then begin
2759                                                 Item.SubItems[ idx ] := '';
2760                                         end else
2761                                                 Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', ThreadItem.LastModified);
2762
2763
2764                                 end;
2765                                 Inc( idx );
2766                         end;
2767                         if ThreadItem.NewArrival then
2768                                 Item.ImageIndex := ITEM_ICON_THREADNEW1
2769                         else
2770                                 Item.ImageIndex := ITEM_ICON_THREADLOG1;
2771
2772
2773                 end else begin
2774                         idx := 0;
2775                         for i := 0 to GikoSys.Setting.BoardColumnOrder.Count - 1 do begin
2776 //                              case TGikoBoardColumnID( ListView.Column[ i ].Tag ) of
2777                                 case GikoSys.Setting.BoardColumnOrder[ i ] of
2778                                 gbcTitle:
2779                                         // Item.Caption \82Í SubItems \82É\8aÜ\82Ü\82ê\96³\82¢\82Ì\82Å
2780                                         Dec( idx );
2781
2782                                 gbcAllCount:
2783                                         Item.SubItems[ idx ] := IntToStr(ThreadItem.AllResCount);
2784
2785                                 gbcRoundDate://gbcLastModified:
2786                                         Item.SubItems[ idx ] := '';
2787
2788                                 gbcCreated:
2789                                         if ThreadItem.CreateDate = ZERO_DATE then begin
2790                                                 Item.SubItems[ idx ] := '';
2791                                         end else
2792                                                 Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', ThreadItem.CreateDate);
2793
2794                                 gbcLastModified:
2795                                         Item.SubItems[ idx ] := '';
2796
2797                                 else
2798                                         Item.SubItems[ idx ] := '';
2799                                 end;
2800                                 Inc( idx );
2801                         end;
2802                         if ThreadItem.NewArrival then
2803                                 Item.ImageIndex := ITEM_ICON_THREADNEW1
2804                         else
2805                                 Item.ImageIndex := ITEM_ICON_THREAD1;
2806                 end;
2807                 Item.Data := ThreadItem;
2808
2809         end;
2810 end;
2811
2812 procedure TGikoForm.ListViewDataFind(Sender: TObject; Find: TItemFind;
2813         const FindString: String; const FindPosition: TPoint; FindData: Pointer;
2814         StartIndex: Integer; Direction: TSearchDirection; Wrap: Boolean;
2815         var Index: Integer);
2816 begin
2817
2818 //
2819 end;
2820
2821 procedure TGikoForm.ListViewDataHint(Sender: TObject; StartIndex,
2822         EndIndex: Integer);
2823 begin
2824 //
2825 end;
2826
2827 procedure TGikoForm.ListViewDataStateChange(Sender: TObject; StartIndex,
2828         EndIndex: Integer; OldState, NewState: TItemStates);
2829 begin
2830 //
2831 end;
2832
2833 procedure TGikoForm.BrowserStatusTextChange(Sender: TObject; const Text: WideString);
2834 var
2835         p: TPoint;
2836         s: string;
2837         tmp2: string;
2838         URL: string;
2839         ATitle: Boolean;
2840
2841         threadItem      : TThreadItem;
2842         board                           : TBoard;
2843         Protocol, Host, Path, Document, Port, Bookmark: string;
2844
2845         wkInt: Integer;
2846         wkIntSt: Integer;
2847         wkIntTo: Integer;
2848         ActiveFileName: string;
2849         e: IHTMLElement;
2850         Ext: string;
2851 //      buf, buf2: string;
2852         PathRec: TPathRec;
2853 begin
2854         if not( TObject(Sender) is TWebBrowser )then
2855                 Exit;
2856         try
2857                 try
2858                         if (TWebBrowser(Sender) <> nil) and (not TWebBrowser(Sender).Busy) and (Assigned(TWebBrowser(Sender).Document)) then begin
2859                                 if LowerCase(OleVariant(IHTMLDocument2(TWebBrowser(Sender).Document)).charset) <> 'shift_jis' then begin
2860                                         OleVariant(IHTMLDocument2(TWebBrowser(Sender).Document)).charset := 'shift_jis';
2861                                 end;
2862                         end;
2863                 except
2864                 end;
2865         finally
2866         end;
2867         if PreviewTimer.Enabled then
2868                 PreviewTimer.Enabled := False;
2869         Application.CancelHint;
2870         try
2871                 if GetActiveContent <> nil then
2872                         ActiveFileName := ChangeFileExt(ExtractFileName(GetActiveContent.FileName), '')
2873                 else
2874                         ActiveFileName := '';
2875         except
2876                 FActiveContent := nil;
2877                 Exit;
2878         end;
2879
2880         StatusBar.Panels[1].Text := Text;
2881
2882         if FHint <> nil then begin
2883                 FHint.ReleaseHandle;
2884                 FHint.ClearAllRes;
2885         end;
2886         if FPreviewBrowser <> nil then
2887                 ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
2888
2889         if not GikoSys.Setting.UnActivePopup then
2890                 if not GikoForm.Active then
2891                         Exit;
2892
2893 //file:///C:/Borland/Projects/gikoNavi/test/read.cgi/qa/990576336/10
2894 //file:///C:/Borland/Projects/gikoNavi/test/read.cgi/qa/990576336/10-15
2895
2896         s := '';
2897         Ext := AnsiLowerCase(ExtractFileExt(Text));
2898         if (Pos('http://', Text) = 1) and (GikoSys.Setting.PreviewVisible) and
2899                         ((Ext = '.jpg') or (Ext = '.jpeg') or (Ext = '.gif') or (Ext = '.png')) then begin
2900                 if FPreviewBrowser = nil then begin
2901                         FPreviewBrowser := TPreviewBrowser.Create(Self);
2902                         ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
2903                         TOleControl(FPreviewBrowser).Parent := nil;
2904                 end;
2905                 FPreviewBrowser.Navigate(BLANK_HTML);//\91O\89ñ\82Ì\83v\83\8c\83r\83\85\81[\89æ\91\9c\8fÁ\8b\8e\97p
2906                 FPreviewURL := Text;
2907                 PreviewTimer.Interval := GikoSys.Setting.PreviewWait;
2908                 PreviewTimer.Enabled := True;
2909         end else if (Pos('about:blank', Text) = 1) or (Pos('http://', Text) = 1) or (Pos('mailto:', Text) = 1) then begin
2910                 if Pos('mailto:', Text) = 1 then begin
2911                         s := StringReplace(Text, 'mailto:', '', [rfIgnoreCase]);
2912                         //\83M\83R\83i\83r\83X\83\8c \83p\81[\83g3\82Ì466\8e\81\82É\8a´\8eÓ
2913                         GetCursorPos(p);
2914                         p.x := p.x - TWebBrowser(Sender).ClientOrigin.x;
2915                         p.y := p.y - TWebBrowser(Sender).ClientOrigin.y;
2916                         e := IHTMLDocument2(TWebBrowser(Sender).Document).elementFromPoint(p.x, p.y);
2917                         if (Assigned(e)) then begin
2918                                 tmp2 := ZenToHan(e.Get_outerText);
2919                                 if (GikoSys.IsNumeric(tmp2)) then begin
2920                                         //\82\93\82Í\83\8c\83X\94Ô\8d\86\82Á\82Û\82¢\82Á\82·\81B
2921                                         wkIntSt := StrToInt(tmp2);
2922                                         wkIntTo := StrToInt(tmp2);
2923                                                 //s := GetThreadText(wkBBS, wkKey, wkIntSt, wkIntTo, False, False);
2924                                         FHint.PopupType := gptThread;
2925                                         SetResPopupText(GetActiveContent, wkIntSt, wkIntTo, False, False);
2926                                 end else begin
2927                                         FHint.PopupType := gptRaw;
2928                                         FHint.Caption := s;
2929                                 end;
2930                         end;
2931                 end else begin
2932                         threadItem := GetActiveContent;
2933                         if Pos('about:blank..', Text) = 1 then begin
2934                                 wkInt := LastDelimiter( '/', threadItem.URL );
2935                                 if Pos( '?', Copy( threadItem.URL, wkInt, MaxInt ) ) = 0 then begin
2936                                         // Thread.URL \82Í PATH_INFO \93n\82µ
2937                                         URL := Copy( threadItem.URL, 1,  LastDelimiter( '/', threadItem.URL ) );
2938                                         wkInt := LastDelimiter( '/', Text );
2939                                         if Pos( '?', Copy( Text, wkInt, MaxInt ) ) = 0 then
2940                                                 // Text \82à PATH_INFO \93n\82µ
2941                                                 URL := URL + Copy( Text, LastDelimiter( '/', Text ) + 1, MaxInt )
2942                                         else
2943                                                 // Text \82Í QUERY_STRING \93n\82µ
2944                                                 URL := URL + Copy( Text, LastDelimiter( '?', Text ) + 1, MaxInt );
2945                                 end else begin
2946                                         // Thread.URL \82Í QUERY_STRING \93n\82µ
2947                                         URL := Copy( threadItem.URL, 1,  LastDelimiter( '?', threadItem.URL ) );
2948                                         wkInt := LastDelimiter( '/', Text );
2949                                         if Pos( '?', Copy( Text, wkInt, MaxInt ) ) = 0 then begin
2950                                                 // Text \82Í PATH_INFO \93n\82µ
2951                                                 // URL \82É\94Â\82Æ\83L\81[\82ª\91«\82ç\82È\82¢\82Ì\82Å Text \82©\82ç\92¸\91Õ\82·\82é
2952                                                 wkInt := LastDelimiter( '/', Copy( Text, 1, wkInt - 1 ) );
2953                                                 wkInt := LastDelimiter( '/', Copy( Text, 1, wkInt - 1 ) );
2954                                                 URL := Copy( URL, 1, Length( URL ) - 1 ) + Copy( Text, wkInt, MaxInt );
2955                                         end else begin
2956                                                 // Text \82à QUERY_STRING \93n\82µ
2957                                                 URL := URL + Copy( Text, LastDelimiter( '?', Text ) + 1, MaxInt )
2958                                         end;
2959                                 end;
2960                         end else begin
2961                                 URL := Text;
2962                         end;
2963
2964                         PathRec := Gikosys.Parse2chURL2(URL);
2965                         if (PathRec.FNoParam) then begin
2966                                 PathRec.FSt := 1;
2967                                 PathRec.FTo := 1;
2968                         end else begin
2969                                 Gikosys.GetPopupResNumber(URL,PathRec.FSt,PathRec.FTo);
2970                         end;
2971                         GikoSys.ParseURI( URL, Protocol, Host, Path, Document, Port, Bookmark );
2972
2973                         if PathRec.FDone or (not GikoSys.Is2chHost( Host )) then begin
2974
2975                                 URL := GikoSys.GetBrowsableThreadURL( URL );
2976                                 wkIntSt := PathRec.FSt;
2977                                 wkIntTo := PathRec.FTo;
2978
2979                                 if (wkIntSt = 0) and (wkIntTo = 0) then begin
2980                                         wkIntSt := 1;
2981                                         wkIntTo := 1;
2982                                 end else if (wkIntSt = 0) and (wkIntTo > 0) then begin
2983                                         wkIntSt := wkIntTo;
2984                                 end else if (wkIntSt > 0) and (wkIntTo = 0) then begin
2985                                         wkIntTo := wkIntSt;
2986                                 end else if wkIntSt > wkIntTo then begin
2987                                         wkInt := wkIntTo;
2988                                         wkIntTo := wkIntSt;
2989                                         wkIntSt := wkInt;
2990                                 end;
2991                                 //if wkIntSt = 0 then
2992                                 //      wkIntSt := 1;
2993                                 //if wkINtTo = 0 then
2994                                 //      wkIntTo := 1;
2995                                 //if PathRec.FFirst then
2996                                 //      wkIntSt := 1;
2997                                 //if PathRec.FStBegin then //http://\81`\81`\81`\81`/-50\82Æ\82¢\82¤\82Æ\82«
2998                                 //      wkIntSt := 1;          //
2999                                 //if PathRec.FToEnd then   //http://\81`\81`\81`\81`/50-\82Æ\82¢\82¤\82Æ\82«
3000                                 //      wkIntTo := 9999;       // \82Ç\82¿\82ç\82Ì\8fê\8d\87\82à\81AGetPopupResNumber\82Å\82¤\82Ü\82­\94Ô\8d\86\82ð\92²\90®\82·\82é\82Ì\82Å\82Ó\82æ\82¤\81B
3001
3002                                 //ATitle := ActiveFileName <> PathRec.FKey;
3003                                 if (FActiveContent <> nil) and (FActiveContent.Thread.URL = URL) then
3004                                         ATitle := false
3005                                 else
3006                                         ATitle := true;
3007
3008                                 threadItem := BBSsFindThreadFromURL( URL );
3009
3010                                 if (threadItem = nil) and GikoSys.Is2chHost( Host ) then begin
3011                                         board := BBSs[ 0 ].FindBBSID( PathRec.FBBS );
3012                                         if board <> nil then begin
3013                                                 if not board.IsThreadDatRead then
3014                                                         GikoSys.ReadSubjectFile( board );
3015                                                 threadItem := board.FindThreadFromFileName( PathRec.FKey + '.dat' );
3016                                         end;
3017                                 end;
3018
3019                                 if threadItem <> nil then begin
3020                                         //HintData := GetThreadText(PathRec.FBBS, PathRec.FKey, wkIntSt, wkIntTo, ATitle, PathRec.FFirst);
3021                                         FHint.PopupType := gptThread;
3022                                         SetResPopupText( threadItem, wkIntSt, wkIntTo, ATitle, PathRec.FFirst );
3023                                 end;
3024                         end;
3025                 end;
3026
3027                 //if s <> '' then
3028                 //      ShowTextPopup(s);
3029                 if FHint.PopupType = gptRaw then begin
3030                         if FHint.Caption <> '' then
3031                                 ShowTextPopup;
3032                 end else begin
3033                         if (FHint.ResCount <> 0) or (FHint.Title <> '') then
3034                                 ShowTextPopup;
3035                 end;
3036         end;
3037 end;
3038
3039 procedure TGikoForm.SetEnabledCloseButton(Enabled: Boolean);
3040 var
3041         SysMenu: HMenu;
3042         //SysMenuApp: HMenu;
3043 begin
3044         FEnabledCloseButton := Enabled;
3045         SysMenu := GetSystemMenu(Handle, False);
3046         //SysMenuApp := GetSystemMenu(Application.Handle, False);
3047
3048         if Enabled then begin
3049                 EnableMenuItem(SysMenu, SC_CLOSE, MF_BYCOMMAND or MF_ENABLED);
3050                 //EnableMenuItem(SysMenuApp, SC_CLOSE, MF_BYCOMMAND or MF_ENABLED);
3051         end else begin
3052                 EnableMenuItem(SysMenu, SC_CLOSE, MF_BYCOMMAND or MF_GRAYED);
3053                 //EnableMenuItem(SysMenuApp, SC_CLOSE, MF_BYCOMMAND or MF_GRAYED);
3054         end;
3055
3056         DrawMenuBar(Handle);
3057         //DrawMenuBar(Application.Handle);
3058 end;
3059
3060 procedure TGikoForm.TreeViewChanging(Sender: TObject; Node: TTreeNode;
3061         var AllowChange: Boolean);
3062 begin
3063 //\83\\81[\83g\8f\87\82ð\95Û\91\82·\82é\82æ\82¤\82É\82µ\82½\82Ì\82Å\8dí\8f\9c
3064 //      if FTreeType = gtt2ch then
3065 //              FSortIndex := -1;
3066 end;
3067
3068 procedure TGikoForm.ListViewKeyDown(Sender: TObject; var Key: Word;
3069         Shift: TShiftState);
3070 var
3071         pos     : TPoint;
3072 begin
3073         if GetActiveList is TBoard then begin
3074                 case Key of
3075                 VK_BACK:;       //      UpFolderButtonClick(Sender);
3076                 VK_SPACE:                       ListDoubleClick(Shift);
3077                 VK_RETURN:              ListClick;
3078                 VK_APPS:
3079                         begin
3080                                 if ListView.Selected <> nil then begin
3081                                         pos.X := ListView.Column[ 0 ].Width;
3082                                         pos.Y := ListView.Selected.Top;
3083                                 end else begin
3084                                         pos.X := ListView.Left;
3085                                         pos.Y := ListView.Top;
3086                                 end;
3087                                 Windows.ClientToScreen( ListView.Handle, pos );
3088                                 ListPopupMenu.Popup( pos.X, pos.Y );
3089                         end;
3090                 end;
3091         end else begin // TBBS, TCategory
3092                 case Key of
3093                 VK_BACK:;       //      UpFolderButtonClick(Sender);
3094                 VK_SPACE:                       ListClick;
3095                 VK_RETURN:              ListDoubleClick(Shift);
3096                 VK_APPS:
3097                         begin
3098                                 if ListView.Selected <> nil then begin
3099                                         pos.X := ListView.Column[ 0 ].Width;
3100                                         pos.Y := ListView.Selected.Top;
3101                                 end else begin
3102                                         pos.X := ListView.Left;
3103                                         pos.Y := ListView.Top;
3104                                 end;
3105                                 Windows.ClientToScreen( ListView.Handle, pos );
3106                                 ListPopupMenu.Popup( pos.X, pos.Y );
3107                         end;
3108                 end;
3109         end;
3110 end;
3111
3112 function TGikoForm.GetHttpState: Boolean;
3113 begin
3114         Result := FHttpState;
3115 end;
3116
3117 {!
3118 \brief          ListView \82Ì Column \82ð\90^\82Ì\83J\83\89\83\80\82É\95Ï\8a·
3119
3120 Delphi 6 Personal \82Å\82Ì ListView \82Å\82Í ListViewColumnClick \83C\83x\83\93\83g\82Å
3121 \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
3122 }
3123 function        TGikoForm.ActiveListTrueColumn( column : TListColumn ) : TListColumn;
3124 {*
3125 var
3126         i, idx          : Integer;
3127         orderList       : TList;
3128 *}
3129 begin
3130
3131         // \90³\82µ\82­\95Ï\8a·\82·\82é\95û\96@\82ª\95ª\82©\82ç\82È\82¢\82Ì\82Å\95Û\97¯
3132         Result := column;
3133         Exit;
3134 {*
3135         Result := column;
3136
3137         if TObject( FActiveList ) is TBBS then
3138                 orderList := GikoSys.Setting.BBSColumnOrder
3139         else if TObject( FActiveList ) is TCategory then
3140                 orderList := GikoSys.Setting.CategoryColumnOrder
3141         else if TObject( FActiveList ) is TBoard then
3142                 orderList := GikoSys.Setting.BoardColumnOrder
3143         else
3144                 Exit;
3145
3146         idx := column.Tag;
3147
3148         for i := 0 to ListView.Columns.Count - 1 do begin
3149                 if Integer( orderList[ ListView.Column[ i ].Tag ] ) = 0 then begin
3150                         if idx = 0 then
3151                                 Result := ListView.Column[ i ]
3152                         else if idx <= i then
3153                                 Result := ListView.Column[ idx - 1 ];
3154                         Exit;
3155                 end;
3156         end;
3157 *}
3158
3159 end;
3160
3161 procedure TGikoForm.ListViewColumnClick(Sender: TObject;
3162         Column: TListColumn);
3163 var
3164         id, idx                 : Integer;
3165         orderList               : TList;
3166 begin
3167         idx := ActiveListTrueColumn( Column ).Tag;
3168
3169         if TObject( FActiveList ) is TBBS then
3170                 orderList := GikoSys.Setting.BBSColumnOrder
3171         else if TObject( FActiveList ) is TCategory then
3172                 orderList := GikoSys.Setting.CategoryColumnOrder
3173         else if TObject( FActiveList ) is TBoard then
3174                 orderList := GikoSys.Setting.BoardColumnOrder
3175         else
3176                 Exit;
3177
3178         id := Integer( orderList[ idx ] );
3179
3180         if FSortIndex = id then
3181                 FSortOrder := not FSortOrder
3182         else begin
3183                 FSortOrder := id = 0;
3184         end;
3185
3186         ListViewSort(Sender, Column);
3187 end;
3188
3189 procedure TGikoForm.ListViewSort(Sender: TObject; Column: TListColumn);
3190 var
3191         i, id, idx      : Integer;
3192         orderList               : TList;
3193         wkBBS: TBBS;
3194         wkCategory: TCategory;
3195         wkBoard: TBoard;
3196 begin
3197         idx := ActiveListTrueColumn( Column ).Tag;
3198
3199         for i := 0 to ListView.Columns.Count - 1 do begin
3200                 ListView.Column[i].ImageIndex := -1;
3201         end;
3202
3203         if FSortOrder then
3204                 ListView.Column[ idx ].ImageIndex := ITEM_ICON_SORT1
3205         else
3206                 ListView.Column[ idx ].ImageIndex := ITEM_ICON_SORT2;
3207
3208         Sort.SortNoFlag := ListNumberVisibleAction.Checked;
3209
3210         //if TObject(TreeView.Selected.Data) is TBBS then begin
3211         if TObject( FActiveList ) is TBBS then begin
3212                 //wkBBS := TBBS(TreeView.Selected.Data);
3213                 wkBBS := TBBS( FActiveList );
3214                 orderList := GikoSys.Setting.BBSColumnOrder;
3215                 id := Integer( orderList[ idx ] );
3216                 Sort.SortOrder := FSortOrder;
3217                 Sort.SortIndex := id;
3218                 GikoSys.Setting.BBSSortIndex := id;
3219                 GikoSys.Setting.BBSSortOrder := FSortOrder;
3220                 wkBBS.Sort(CategorySortProc);
3221         //end else if TObject(TreeView.Selected.Data) is TCategory then begin
3222         end else if TObject( FActiveList ) is TCategory then begin
3223                 //wkCategory := TCategory(TreeView.Selected.Data);
3224                 wkCategory := TCategory( FActiveList );
3225                 orderList := GikoSys.Setting.CategoryColumnOrder;
3226                 id := Integer( orderList[ idx ] );
3227                 Sort.SortOrder := FSortOrder;
3228                 Sort.SortIndex := id;
3229                 GikoSys.Setting.CategorySortIndex := id;
3230                 GikoSys.Setting.CategorySortOrder := FSortOrder;
3231                 wkCategory.CustomSort(BoardSortProc);
3232         //end else if TObject(TreeView.Selected.Data) is TBoard then begin
3233         end else if TObject( FActiveList ) is TBoard then begin
3234                 //wkBoard := TBoard(TreeView.Selected.Data);
3235                 wkBoard := TBoard( FActiveList );
3236                 orderList := GikoSys.Setting.BoardColumnOrder;
3237                 id := Integer( orderList[ idx ] );
3238                 Sort.SortOrder := FSortOrder;
3239                 Sort.SortIndex := id;
3240                 GikoSys.Setting.BoardSortIndex := id;
3241                 GikoSys.Setting.BoardSortOrder := FSortOrder;
3242                 wkBoard.CustomSort(ThreadItemSortProc);
3243         end else begin
3244                 id := 0;
3245         end;
3246
3247         ListView.Refresh;
3248         FSortIndex := id;
3249 end;
3250
3251 procedure TGikoForm.MenuToolBarCustomDrawButton(Sender: TToolBar;
3252         Button: TToolButton; State: TCustomDrawState; var DefaultDraw: Boolean);
3253 var
3254         ARect: TRect;
3255 begin
3256         DefaultDraw := True;
3257         Exit;
3258         DefaultDraw := False;
3259         if (cdsSelected in State) or (cdsHot in State) then begin
3260                 Sender.Canvas.Brush.Color := clHighlight;
3261                 Sender.Canvas.Font.Color := clHighlightText;
3262         end else begin
3263                 Sender.Canvas.Brush.Color := clBtnFace;
3264                 Sender.Canvas.Font.Color := clBtnText;
3265         end;
3266         ARect := Rect(Button.Left, Button.Top, Button.Left + Button.Width, Button.Top + Button.Height);
3267         Sender.Canvas.FillRect(ARect);
3268         DrawText(Sender.Canvas.Handle, PChar(Button.Caption), -1, ARect, DT_SINGLELINE or DT_VCENTER or DT_CENTER);
3269 end;
3270
3271 function TGikoForm.GetTreeNode(Data: TObject): TTreeNode;
3272 var
3273         Nodes: TTreeNodes;
3274         i: integer;
3275 begin
3276         Nodes := TreeView.Items;
3277
3278         for i := 0 to Nodes.Count - 1 do begin
3279                 if Nodes.Item[i].Data = Data then begin
3280                         Result := Nodes.Item[i];
3281                         Exit;
3282                 end;
3283         end;
3284         Result := nil;
3285 end;
3286
3287 procedure TGikoForm.BrowserBeforeNavigate2(Sender: TObject;
3288         const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
3289         Headers: OleVariant; var Cancel: WordBool);
3290 var
3291         sNo: string;
3292         p: TPoint;
3293 const
3294         kMenuName: string = 'menu:';
3295 begin
3296
3297         if Pos(kMenuName, URL) <> 0 then begin
3298                 sNo := Copy( URL, Pos( kMenuName, URL ) + Length( kMenuName ), Length( URL ) );
3299                 
3300                 if not GikoSys.IsNumeric(sNo) then Exit;
3301
3302                 Cancel := True;
3303                 GetCursorpos(p);
3304                 KokoPopupMenu.Tag := StrToInt(sNo);
3305                 KokoPopupMenu.Popup(p.x, p.y);
3306         end else if Pos('mailto', LowerCase(URL)) <> 0 then begin
3307                 Cancel := not GikoSys.Setting.OpenMailer;
3308         end;
3309
3310 end;
3311
3312 procedure TGikoForm.AppFormDeactivate(Sender: TObject);
3313 begin
3314     Application.ProcessMessages;
3315         if Application.Terminated then
3316                 Exit;
3317         if PreviewTimer.Enabled then
3318                 PreviewTimer.Enabled := False;
3319         //\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
3320         if FHint <> nil then begin
3321                 FHint.ReleaseHandle;
3322                 FHint.ClearAllRes;
3323 //              FHint.Free;
3324 //              FHint := nil;
3325         end;
3326         if FPreviewBrowser <> nil then
3327                 ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
3328
3329 end;
3330
3331 procedure TGikoForm.TreeViewCustomDraw(Sender: TCustomTreeView;
3332         const ARect: TRect; var DefaultDraw: Boolean);
3333 var
3334         NodeRect: TRect;
3335         i, j: Integer;
3336         IsBoardNode: Boolean;
3337         Cnt: Integer;
3338         CntText: string;
3339         TextWidth: Integer;
3340         TextRect: TRect;
3341         Board: TBoard;
3342         Category: TCategory;
3343         Bitmap: TBitmap;
3344         NodeWidth: Integer;
3345 begin
3346         DefaultDraw := True;
3347
3348         if FTreeType = gttHistory then Exit;
3349
3350         TreeView.Canvas.Font.Color := clBlue;
3351         IsBoardNode := False;
3352         for i := 0 to TreeView.Items.Count - 1 do begin
3353                 Cnt := 0;
3354                 if not TreeView.Items[i].IsVisible then
3355                         continue;
3356
3357                 if TObject(TreeView.Items[i].Data) is TCategory then begin
3358                         if TreeView.Items[i].Expanded then
3359                                 continue;
3360
3361                         IsBoardNode := False;
3362                         Category := TCategory(TreeView.Items[i].Data);
3363                         for j := 0 to Category.Count - 1 do begin
3364                                 Board := Category.Items[j];
3365                                 if Board <> nil then begin
3366                                         if Board.UnRead > 0 then begin
3367                                                 Cnt := 1;
3368                                                 Break;
3369                                         end;
3370                                 end;
3371                         end;
3372                         if Cnt <> 1 then
3373                                 continue;
3374                 end else if TObject(TreeView.Items[i].Data) is TBoard then begin
3375                         IsBoardNode := True;
3376                         Board := TBoard(TreeView.Items[i].Data);
3377                         Cnt := Board.UnRead;
3378                         if Cnt <= 0 then
3379                                 continue;
3380                 end else
3381                         continue;
3382
3383                 Bitmap := TBitmap.Create;
3384                 try
3385                         Bitmap.Canvas.Font.Assign(TreeView.Canvas.Font);
3386                         Bitmap.Canvas.Font.Style := [fsBold];
3387                         NodeWidth := Bitmap.Canvas.TextWidth(TreeView.Items[i].Text);
3388                 finally
3389                         Bitmap.Free;
3390                 end;
3391
3392                 NodeRect := TreeView.Items[i].DisplayRect(True);
3393
3394                 if IsBoardNode then
3395                         CntText := '(' + IntToStr(Cnt) + ')'
3396                 else if Cnt = 1 then
3397                         CntText := '(+)';
3398
3399
3400                 TextWidth := TreeView.Canvas.TextWidth(CntText);
3401
3402                 TextRect := Rect(NodeRect.Left + NodeWidth + 8,
3403                                                                                  NodeRect.Top,
3404                                                                                  NodeRect.Left + NodeWidth + TextWidth + 8,
3405                                                                                  NodeRect.Bottom);
3406                 DrawText(TreeView.Canvas.Handle,
3407                                                  PChar(CntText),
3408                                                  -1,
3409                                                  TextRect,
3410                                                  DT_SINGLELINE or DT_VCENTER);
3411         end;
3412         TreeViewCustomDrawItem(nil, nil, [], DefaultDraw);
3413 end;
3414
3415 procedure TGikoForm.TreeViewCustomDrawItem(Sender: TCustomTreeView;
3416         Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean);
3417 var
3418         Board: TBoard;
3419         Category: TCategory;
3420         i: Integer;
3421 begin
3422         DefaultDraw := True;
3423
3424         if FTreeType = gttHistory then Exit;
3425
3426         TreeView.Canvas.Font.Style := [];
3427         if Node <> nil then begin
3428                 if TObject(Node.Data) is TCategory then begin
3429                         Category := TCategory(Node.Data);
3430                         for i := 0 to Category.Count - 1 do begin
3431                                 Board := Category.Items[i];
3432                                 if Board <> nil then begin
3433                                         if Board.UnRead > 0 then begin
3434                                                 TreeView.Canvas.Font.Style := [fsBold];
3435                                                 Break;
3436                                         end;
3437                                 end;
3438                         end;
3439                 end else if TObject(Node.Data) is TBoard then begin
3440                         Board := TBoard(Node.Data);
3441                         if Board.UnRead > 0 then
3442                                 TreeView.Canvas.Font.Style := [fsBold];
3443                 end;
3444         end;
3445 end;
3446
3447 procedure TGikoForm.TreeViewExpanded(Sender: TObject; Node: TTreeNode);
3448 begin
3449         TreeView.Invalidate;
3450
3451         if TObject(Node.Data) is TBBS then begin
3452                 TBBS(Node.Data).NodeExpand := True;
3453         end else if TObject(Node.Data) is TCategory then begin
3454                 TCategory(Node.Data).NodeExpand := True;
3455         end else if TObject(Node.Data) is TBoard then begin
3456                 TBoard(Node.Data).NodeExpand := True;
3457         end;
3458 end;
3459
3460 {procedure TGikoForm.CabinetPanelVisible(PanelVisible: Boolean);
3461 begin
3462         TreeSplitter.Visible := PanelVisible;
3463         CabinetPanel.Visible := PanelVisible;
3464         CabinetToolButton.Down := PanelVisible;
3465 end;}
3466
3467 procedure TGikoForm.ListViewAllSelect;
3468 begin
3469         ListView.SetFocus;
3470         ListView.SelectAll;
3471 end;
3472
3473 procedure TGikoForm.TreeViewDblClick(Sender: TObject);
3474 var
3475         APoint: TPoint;
3476         HitTest: THitTests;
3477 begin
3478         GetCursorPos(APoint);
3479         APoint := TreeView.ScreenToClient(APoint);
3480         HitTest := TreeView.GetHitTestInfoAt(APoint.x, APoint.y);
3481         if not (htOnLabel in HitTest) then Exit;
3482
3483         TreeDoubleClick( TreeView.Selected );
3484 end;
3485
3486 procedure TGikoForm.DownloadMsg(Sender: TObject; Item: TDownloadItem; Msg: string; Icon: TGikoMessageIcon);
3487 begin
3488         AddMessageList(Msg, nil, Icon);
3489 end;
3490
3491 procedure TGikoForm.DownloadEnd(Sender: TObject; Item: TDownloadItem);
3492 var
3493         ATitle: string;
3494         s: string;
3495         boardPlugIn : TBoardPlugIn;
3496         i: Integer;
3497         browserRec      : TBrowserRecord;
3498 begin
3499         try
3500                 if Item.DownType = gdtBoard then
3501                         ATitle := Item.Board.Title
3502                 else
3503                         ATitle := Item.ThreadItem.Title;
3504                 if ATitle = '' then
3505                         ATitle := '\81i\96¼\8fÌ\95s\96¾\81j';
3506
3507                 if Item.State in [gdsComplete, gdsDiffComplete] then begin
3508                         //\90³\8fí\8fI\97¹
3509                         if Item.DownType = gdtBoard then begin
3510                                 //\94Â
3511                                 Item.SaveListFile;
3512                                 AddMessageList(ATitle + ' [\83X\83\8c\88ê\97\97\8eæ\93¾\8a®\97¹]', nil, gmiOK);
3513                                 if GetActiveList = Item.Board then begin
3514                                         FActiveList := nil;
3515                                         SetActiveList(Item.Board);
3516                                 end;
3517                                 Item.Board.Modified := True;
3518                                 Item.Board.IsThreadDatRead := True;
3519                                 PlaySound('New');
3520                         end else if Item.DownType = gdtThread then begin
3521                                 //\83X\83\8c
3522                                 Item.SaveItemFile;
3523                                 Item.ThreadItem.NewArrival := True;
3524                                 if (Item.ThreadItem.IsBoardPlugInAvailable) and (Item.ThreadItem.Title = '') then begin
3525                                         boardPlugIn             := Item.ThreadItem.BoardPlugIn;
3526                                         Item.ThreadItem.Title := GikoSys.DivideStrLine(boardPlugIn.GetDat( DWORD( Item.ThreadItem ), 1 )).FTitle;
3527                                         ATitle := Item.ThreadItem.Title;
3528                                 end else if ATitle = '\81i\96¼\8fÌ\95s\96¾\81j' then begin
3529                                         ATitle := GikoSys.DivideStrLine(GikoSys.ReadThreadFile(Item.ThreadItem.GetThreadFileName, 1)).FTitle;
3530                                 end;
3531                                 for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
3532                                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread = Item.ThreadItem then begin
3533                                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
3534                                                 break;
3535                                         end;
3536                                 end;
3537                                 if GikoSys.Setting.BrowserTabVisible then begin
3538                                         if GetActiveContent = Item.ThreadItem then
3539                                                 browserRec := InsertBrowserTab(Item.ThreadItem)
3540                                         else if (ListView.Selected <> nil ) and ( TObject(ListView.Selected.Data) is TThreadItem ) and ( Item.ThreadItem = TThreadItem(ListView.Selected.Data)) then
3541                                                 browserRec := InsertBrowserTab(Item.ThreadItem, True)
3542                                         else
3543                                                 browserRec := InsertBrowserTab(Item.ThreadItem, False);
3544                                         if browserRec.Thread = BrowserNullTab.Thread then begin
3545                                                 browserRec.Movement := BrowserNullTab.Movement;
3546                                                 BrowserNullTab.Movement := '';
3547                                         end;
3548                                 end else begin
3549                                         if (GetActiveContent = Item.ThreadItem) or (FActiveContent = nil) or(FActiveContent.Browser = BrowserNullTab.Browser) then
3550                         InsertBrowserTab(Item.ThreadItem);
3551                                 end;
3552                 Application.ProcessMessages;
3553                                 if Item.State = gdsComplete then begin
3554                                         PlaySound('New');
3555                                         AddMessageList(ATitle + ' [\83X\83\8c\8eæ\93¾\8a®\97¹]', nil, gmiOK);
3556                                 end else begin
3557                                         PlaySound('NewDiff');
3558                                         AddMessageList(ATitle + ' [\83X\83\8c\8d·\95ª\8eæ\93¾\8a®\97¹]', nil, gmiOK);
3559                                 end;
3560
3561                                 //\8f\84\89ñ\82 \82è\82Ì\8fê\8d\87\81\95\82P\82O\82O\82O\92´\82Í\8f\84\89ñ\8dí\8f\9c
3562                                 if (Item.ThreadItem.Round) and (Item.ThreadItem.Count > 1000) then begin
3563                                         Item.ThreadItem.Round := False;
3564                                         Item.ThreadItem.RoundName := '';
3565                                         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);
3566                                 end;
3567
3568                                 TreeView.Refresh;
3569                         end;
3570                         ListView.Refresh;
3571                 end else if Item.State = gdsNotModify then begin
3572                         //\95Ï\8dX\83i\83V
3573 {                       if (Item.DownType = gdtThread) and (AddHistory(Item.ThreadItem)) then begin
3574                                 //SetContent(Item.ThreadItem);
3575                                 InsertBrowserTab(Item.ThreadItem);
3576                         end;}
3577                         AddMessageList(ATitle + ' [\96¢\8dX\90V]', nil, gmiSAD);
3578                         PlaySound('NoChange');
3579                         Screen.Cursor := crDefault;
3580                 end else if Item.State = gdsAbort then begin
3581                         //\92\86\92f
3582                         AddMessageList(ATitle + ' [\92\86\92f]', nil, gmiSAD);
3583                 end else if Item.State = gdsError then begin
3584                         //\83G\83\89\81[
3585                         s := Item.ErrText;
3586                         if s <> '' then
3587                                 s := ':' + s;
3588                         AddMessageList(ATitle + ' [\83G\83\89\81[(' + IntToStr(Item.ResponseCode) + s + ')]', nil, gmiNG);
3589 //                      if Item.ResponseCode = 302 then
3590 //                              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);
3591                         PlaySound('Error');
3592                 end;
3593         finally
3594                 Item.Free;
3595                 Dec(FWorkCount);
3596                 if FWorkCount < 0 then FWorkCount := 0;
3597                 if FWorkCount = 0 then begin
3598                         try
3599                                 Animate.Active := False;
3600                         finally
3601                                 Screen.Cursor := crDefault;
3602                         end;
3603                 end;
3604
3605         end;
3606 end;
3607
3608 procedure TGikoForm.WorkBegin(Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer; Number: Integer; const AWorkTitle: string);
3609 begin
3610 //      SetProgressValue(Number, 0, AWorkCountMax);
3611 //      ProgressBar.Visible := True;
3612         ProgressBar.Position := 0;
3613         ProgressBar.Max := AWorkCountMax;
3614         FDownloadTitle := AWorkTitle;
3615         StatusBar.Panels[1].Text := FDownloadTitle + ' - \83_\83E\83\93\83\8d\81[\83h\82ð\8aJ\8en\82µ\82Ü\82·';
3616         FDownloadMax := AWorkCountMax;
3617 end;
3618
3619 procedure TGikoForm.WorkEnd(Sender: TObject; AWorkMode: TWorkMode; Number: Integer);
3620 begin
3621         ProgressBar.Position := 0;
3622         if FDownloadMax <> 0 then
3623                 StatusBar.Panels[1].Text := FDownloadTitle + ' - \83_\83E\83\93\83\8d\81[\83h\82ª\8a®\97¹\82µ\82Ü\82µ\82½';
3624 end;
3625
3626 procedure TGikoForm.Work(Sender: TObject; AWorkMode: TWorkMode; const AWorkCount: Integer; Number: Integer);
3627 begin
3628         ProgressBar.Position := AWorkCount;
3629 //      SetProgressValue(Number, AWorkCount);
3630         StatusBar.Panels[1].Text := FDownloadTitle + ' - \83_\83E\83\93\83\8d\81[\83h\92\86 (' + IntToStr(AWorkCount) + '/' + IntToStr(FDownloadMax) + ')';
3631 end;
3632
3633 {
3634 procedure TGikoForm.SetProgressValue(Number: Integer; Value: Integer; Max: Integer = -1);
3635 var
3636         Component: TComponent;
3637 begin
3638         Component := FindComponent('ProgressBar' + IntToStr(Number + 1));
3639         if Component <> nil then begin
3640                 if not (Component is TProgressBar) then Exit;
3641                 if Max <> -1 then
3642                         TProgressBar(Component).Max := Max;
3643                 TProgressBar(Component).Position := Value;
3644         end;
3645 end;
3646 }
3647
3648 procedure TGikoForm.AddMessageList(ACaption: string; AObject: TObject; Icon: TGikoMessageIcon);
3649 var
3650         ListItem: TListItem;
3651 begin
3652         MessageListView.Items.BeginUpdate;
3653         try
3654                 ListItem := MessageListView.Items.Add;
3655                 ListItem.Caption := ACaption;
3656                 ListItem.Data := AObject;
3657                 ListItem.MakeVisible(False);
3658                 case Icon of
3659                         gmiOK:   ListItem.ImageIndex := 0;
3660                         gmiSAD: ListItem.ImageIndex := 1;
3661                         gmiNG:   ListItem.ImageIndex := 2;
3662                         gmiWhat: ListItem.ImageIndex := 3;
3663                 end;
3664         finally
3665                 MessageListView.Items.EndUpdate;
3666         end;
3667 end;
3668
3669 {procedure TGikoForm.BrowserTabChange(Sender: TObject);
3670 var
3671         index: Integer;
3672         ThreadItem: TThreadItem;
3673 begin
3674         ThreadItem := GetActiveContent;
3675         if ThreadItem <> nil then begin
3676                 SetContent(ThreadItem);
3677         end;
3678 end;}
3679
3680 function TGikoForm.InsertBrowserTab(
3681         ThreadItem      : TThreadItem;
3682         ActiveTab               : Boolean = True
3683 ) : TBrowserRecord;
3684 var
3685         i, j, idx               : Integer;
3686         favItem                 : TFavoriteThreadItem;
3687         newBrowser      : TBrowserRecord;
3688 begin
3689
3690         Result := nil;
3691         if Threaditem = nil then Exit;
3692
3693         if ThreadItem.IsLogFile then begin
3694                 //\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é
3695                 //\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é
3696                 if (FActiveContent <> nil) and (FActiveContent.FBrowser <> nil) and
3697                         (FActiveContent.FBrowser <> BrowserNullTab.Browser)then begin
3698                         j := FBrowsers.IndexOf(FActiveContent.FBrowser);
3699                         if j = BROWSER_COUNT - 1 then
3700                                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
3701                 end;
3702                 favItem := TFavoriteThreadItem.Create(ThreadItem.URL, ThreadItem.Title );
3703                 if not AddHistory( favItem ) then
3704                         favItem.Free;
3705
3706                 for i := 0 to BrowserTab.Tabs.Count - 1 do begin
3707                         if TObject(BrowserTab.Tabs.Objects[i]) is TBrowserRecord then begin
3708                                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread = ThreadItem then begin
3709                                         Result := TBrowserRecord( BrowserTab.Tabs.Objects[i] );
3710                                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).FBrowser = nil then begin
3711                                                 for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
3712                                                         if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FBrowser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
3713                                                                 ReleaseBrowser(TBrowserRecord(BrowserTab.Tabs.Objects[j]));
3714                                                                 break;
3715                                                         end;
3716                                                 end;
3717                                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).FBrowser := TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
3718                                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
3719                                                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
3720                                         end;
3721                                         if ActiveTab then begin
3722                                                 BrowserTab.TabIndex := i;
3723                                                         BrowserTab.OnChange(nil);
3724                                                 BrowserTab.Repaint;
3725                                         end;
3726                                         Exit;
3727                                 end;
3728                         end;
3729                 end;
3730                 idx := BrowserTab.TabIndex;
3731                 if GikoSys.Setting.BrowserTabAppend = gtaFirst then begin
3732                         newBrowser := TBrowserRecord.Create;
3733                         for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
3734                                 if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FBrowser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
3735                                         ReleaseBrowser(TBrowserRecord(BrowserTab.Tabs.Objects[j]));
3736                                         break;
3737                                 end;
3738                         end;
3739                         newBrowser.Browser := TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
3740                         FBrowsers.Move(BROWSER_COUNT - 1, 0);
3741                         //newBrowser.Browser.Navigate(BLANK_HTML);
3742                         newBrowser.thread := ThreadItem;
3743                         newBrowser.Repaint := true;
3744 //                      newBrowser.OnlyHundred := GikoSys.OnlyAHundredRes;
3745
3746                         BrowserTab.Tabs.InsertObject(0, GikoSys.GetShortName(ThreadItem.Title, 20), newBrowser);
3747                         if (not GikoSys.Setting.BrowserTabVisible) and (BrowserTab.Tabs.Count > 1) then begin
3748                                 DeleteTab( TBrowserRecord( BrowserTab.Tabs.Objects[ 1 ] ) );
3749                         end;// else begin
3750                         //end;
3751                         BrowserTab.Repaint;
3752                         if ActiveTab then begin
3753                                 BrowserTab.TabIndex := 0;
3754                         end;
3755
3756                 end else begin
3757                         newBrowser := TBrowserRecord.Create;
3758                         for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
3759                                 if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FBrowser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
3760                                         ReleaseBrowser(TBrowserRecord(BrowserTab.Tabs.Objects[j]));
3761                                         break;
3762                                 end;
3763                         end;
3764                         newBrowser.Browser := TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
3765                         FBrowsers.Move(BROWSER_COUNT - 1, 0);
3766                         //newBrowser.Browser.Navigate(BLANK_HTML);
3767                         newBrowser.thread := ThreadItem;
3768 //                      newBrowser.OnlyHundred := GikoSys.OnlyAHundredRes;
3769                         newBrowser.Repaint := true;
3770
3771                         i := BrowserTab.Tabs.AddObject(GikoSys.GetShortName(ThreadItem.Title, 20), newBrowser);
3772                         if (not GikoSys.Setting.BrowserTabVisible) and (BrowserTab.Tabs.Count > 1) then begin
3773                                 DeleteTab( TBrowserRecord( BrowserTab.Tabs.Objects[ 0 ] ) );
3774                         end;
3775                         //end;
3776                         BrowserTab.Repaint;
3777                         if ActiveTab then begin
3778                                 if (not GikoSys.Setting.BrowserTabVisible) and (BrowserTab.Tabs.Count > 0) then
3779                                         BrowserTab.TabIndex := 0
3780                                 else
3781                                         BrowserTab.TabIndex := i;
3782                         end;
3783                 end;
3784                 Result := newBrowser;
3785                 if(ActiveTab) or (idx = -1) then begin
3786                         BrowserTab.OnChange(nil);
3787                 end;
3788         end else begin
3789                 if BrowserNullTab = nil then begin
3790                         BrowserNullTab := TBrowserRecord.Create;
3791                         BrowserNullTab.Browser := Browser;
3792                 end;
3793                 BrowserNullTab.thread := ThreadItem;
3794                 Result := BrowserNullTab;
3795                 BrowserTab.TabIndex := -1;
3796                 SetContent(BrowserNullTab);
3797         end;
3798
3799         if GikoSys.Setting.URLDisplay then
3800                 AddressComboBox.Text := ThreadItem.URL;
3801
3802 end;
3803
3804 procedure TGikoForm.SetContent(inThread : TBrowserRecord);
3805 var
3806         BBSID: string;
3807         FileName: string;
3808         sTitle: string;
3809 //      HtmlName: string;
3810         doc:  Variant;
3811         s: string;
3812 //      OldCursor: TCursor;
3813         i: Integer;
3814         idx: Integer;
3815         ThreadItem: TThreadItem;
3816         Thread: TBrowserRecord;
3817         ThreadTitle, ThreadPTitle: string;
3818         ThreadScrollTop: Integer;
3819         ThreadIsLog, ThreadUnRead, ThreadNewArraical: boolean;
3820 begin
3821 //      AddMessageList('SetContent', nil, gmiWhat);
3822         Thread := inThread;
3823         idx := BrowserTab.TabIndex;
3824         if (FActiveContent <> nil) and
3825                 (FActiveContent.Thread <> Thread.Thread) and
3826                 (Assigned(FActiveContent.Browser.Document)) then begin
3827                 try
3828                 try
3829                         Sleep(1);
3830                         //Application.ProcessMessages;
3831                         FActiveContent.Thread.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document).Body).ScrollTop;
3832                         //if FActiveContent.Browser <> BrowserNullTab.Browser then
3833                         //      TOleControl(FActiveContent.Browser).Visible := false;
3834                 except
3835                         on E: Exception do
3836                                 MsgBox(Handle, E.Message, 'SetContent[<-ScrollTop]', 0);
3837                 end;
3838                 finally
3839                 end;
3840         end;
3841         if not (Assigned(Thread)) or (Thread.Thread = nil) then begin
3842                 Thread.Browser.Navigate(BLANK_HTML);
3843                 BrowserBoardNameLabel.Caption := '';
3844                 ItemBoardImage.Picture := nil;
3845                 BrowserNameLabel.Caption := '';
3846                 ItemImage.Picture := nil;
3847                 BrowserNullTab.Thread := nil;
3848                 //TOleControl(BrowserNullTab.Browser).Visible := true;
3849                 ShowWindow(BrowserNullTab.Browser.Handle, SW_SHOW);
3850                 FActiveContent := nil;
3851                 Exit;
3852         end     else if Thread.Browser = nil then begin
3853                 if FActiveContent.Browser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then
3854                         FBrowsers.Move(BROWSER_COUNT - 1, 0);
3855                 for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
3856                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).FBrowser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
3857                                 ReleaseBrowser(TBrowserRecord(BrowserTab.Tabs.Objects[i]));
3858                                 break;
3859                         end;
3860                 end;
3861                 Thread.Browser := TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
3862                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
3863         end;
3864
3865         //MoveWindow(Thread.FBrowser.Handle, 0, 0, BrowserPanel.Width, BrowserPanel.Height, false);
3866         
3867         ThreadTitle := Thread.Thread.Title;
3868         ThreadPTitle := Thread.Thread.ParentBoard.Title;
3869         ThreadScrollTop := Thread.Thread.ScrollTop;
3870         ThreadIsLog := Thread.Thread.IsLogFile;
3871         ThreadItem := Thread.Thread;
3872         ThreadNewArraical :=  Thread.Thread.NewArrival;
3873         ThreadUnRead := Thread.Thread.UnRead;
3874         BBSID := ThreadItem.ParentBoard.BBSID;
3875         FileName := ThreadItem.FileName;
3876
3877         if GetCapture = ListView.Handle then
3878                 ReleaseCapture;
3879
3880         Screen.Cursor := crHourGlass;
3881
3882
3883         try
3884                 {
3885                 if ThreadItem.UnRead then begin
3886                         ThreadItem.ParentBoard.UnRead := ThreadItem.ParentBoard.UnRead - 1;
3887                         if ThreadItem.ParentBoard.UnRead < 0 then ThreadItem.ParentBoard.UnRead := 0;
3888                         TreeView.Refresh;
3889                 end;
3890                 }
3891
3892                 if(FActiveContent <> nil) and (FActiveContent <> Thread) then begin
3893                         if (FActiveContent.Browser <> BrowserNullTab.Browser) then
3894                                 ShowWindow(FActiveContent.Browser.Handle, SW_HIDE);
3895                 end;
3896                 ShowWindow(Thread.FBrowser.Handle, SW_SHOW);
3897                 if (not Assigned(Thread.Browser.Document)) then begin
3898                         Thread.Browser.Navigate('about:blank');
3899                 end;
3900                 FActiveContent := Thread;
3901                 while (Thread.Browser.ReadyState <> READYSTATE_COMPLETE) and
3902                                 (Thread.Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin
3903                         Application.ProcessMessages;
3904                         if idx <> BrowserTab.TabIndex then begin
3905                                 Exit;
3906                         end;
3907                 end;
3908                 if not ThreadIsLog then begin
3909                         Self.Caption := CAPTION_NAME ;
3910                         try
3911                                 s := '<HTML><BODY><CENTER>\82±\82Ì\83X\83\8c\83b\83h\82Í\8eæ\93¾\82µ\82Ä\82¢\82Ü\82¹\82ñ</CENTER></BODY></HTML>';
3912                                 doc := Idispatch( olevariant(Thread.Browser.ControlInterface).Document) as IHTMLDocument2;
3913                                 doc.open;
3914                                 doc.charset := 'Shift_JIS';
3915                                 doc.Write(s);
3916                                 doc.Close;
3917                         finally
3918                         end;
3919                 end else begin
3920                         Self.Caption := CAPTION_NAME + ' - [' + ThreadTitle + ']';
3921                         //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«
3922                         //\90V\8bK\82ÉThread\82ð\8aJ\82¢\82½\82Æ\82«\82É\90^\82É\82È\82Á\82Ä\82¢\82é\81B
3923                         if Thread.Repaint then begin
3924                                 //Thread.LastSize := ThreadItem.Size;
3925                                 Thread.Repaint := false;
3926
3927                                 Thread.Browser.OnStatusTextChange := nil;
3928                                 doc := Idispatch( olevariant(Thread.Browser.ControlInterface).Document) as IHTMLDocument2;
3929                                 GikoSys.CreateHTML2(doc, ThreadItem, sTitle);
3930                                 Thread.Browser.OnStatusTextChange := BrowserStatusTextChange;
3931                                 PostMessage( Handle, USER_DOCUMENTCOMPLETE, Integer( Thread.Browser ), 0 );
3932                                 if ThreadItem = nil then begin
3933                                         FActiveContent := nil;
3934                                         BrowserTab.Repaint;
3935                                         Exit;
3936                                 end;
3937                         end;
3938                         ListView.Refresh;
3939                 end;
3940                 if (Assigned(Thread)) and (Assigned(Thread.Thread)) and (Thread <> nil) and (ThreadItem <>nil) then begin
3941                         //FActiveContent := Thread;
3942
3943                         BrowserBoardNameLabel.Caption := ThreadPTitle;
3944                         ItemIcon16.GetBitmap(4, ItemBoardImage.Picture.Bitmap);
3945                         BrowserNameLabel.Caption := ThreadTitle;
3946                         ItemImage.Picture := nil;
3947                         if ThreadIsLog then
3948                                 if ThreadNewArraical then
3949                                         ItemImageList.GetBitmap(2, ItemImage.Picture.Bitmap)
3950                                 else
3951                                         ItemImageList.GetBitmap(0, ItemImage.Picture.Bitmap)
3952                         else
3953                                 ItemImageList.GetBitmap(1, ItemImage.Picture.Bitmap);
3954
3955                         ItemImage.Left := BrowserBoardNameLabel.Left + BrowserBoardNameLabel.Width + 8;
3956                         BrowserNameLabel.Left := ItemImage.Left + 20;
3957                 end else begin
3958                         FActiveContent := nil;
3959                 end;
3960         finally
3961                 Screen.Cursor := crDefault;
3962         end;
3963 end;
3964
3965 function TGikoForm.GetActiveContent: TThreadItem;
3966 begin
3967         try
3968                 if( Assigned(FActiveContent) ) and (Assigned(FActiveContent.Thread))
3969                         and (FActiveContent <> nil) and (FActiveContent.Thread <> nil) then
3970                         Result := FActiveContent.Thread
3971                 else begin
3972             FActiveContent := nil;
3973                         Result := nil;
3974                 end;
3975         except
3976                 FActiveContent := nil;
3977                 Result := nil;
3978         end;
3979 end;
3980
3981 procedure TGikoForm.SetActiveList(Obj: TObject);
3982 var
3983         idx     : Integer;
3984 begin
3985 //      if FActiveList <> Obj then begin
3986                 FActiveList := Obj;
3987
3988                 if ListView.Selected <> nil then
3989                         idx := ListView.Selected.Index
3990                 else
3991                         idx := -1;
3992                 ListView.Items.Count := 0;
3993                 ListView.Items.Clear;
3994                 ListView.Selected := nil;
3995 //      ListView.Columns.Clear;
3996                 if (FActiveContent <> nil) and (FActiveContent.Thread <> nil)
3997                         and (FActiveContent.Thread.IsLogFile) then
3998                         Self.Caption := CAPTION_NAME + ' - [' + FActiveContent.Thread.Title + ']'
3999                 else
4000                         Self.Caption := CAPTION_NAME;
4001                 //Application.Title := CAPTION_NAME;
4002
4003 //              ActiveListColumnSave;
4004
4005                 if Obj is TBBS then begin
4006                         SetCategoryListItem(TBBS(Obj));
4007                 end else if Obj is TCategory then begin
4008                         SetBoardListItem(TCategory(Obj));
4009                 end else if Obj is TBoard then begin
4010                         SetThreadListItem(TBoard(Obj));
4011                 end;
4012
4013                 if idx >= 0 then begin
4014                         ListView.ItemIndex := idx;
4015                         ListView.ItemFocused := ListView.Items.Item[ idx ];
4016                 end;
4017 //      end;
4018 end;
4019
4020
4021 //\81\9a\81\9a\83q\83\8d\83\86\83L\83\81\83\82
4022 //\82»\82Ì\82¤\82¿interface\82ð\8eg\82¤
4023 function TGikoForm.GetActiveList: TObject;
4024 begin
4025         Result := FActiveList;
4026 end;
4027
4028 procedure TGikoForm.SetListViewType(AViewType: TGikoViewType);
4029 begin
4030         SetListViewType(AViewType, '', False);
4031 end;
4032
4033 procedure TGikoForm.SetListViewType(AViewType: TGikoViewType; SelectText: string; KubetsuChk: Boolean);
4034 var
4035         Board: TBoard;
4036         i: Integer;
4037 begin
4038         if ActiveList is TBoard then begin
4039                 for i := Length( BBSs ) - 1 downto 0 do begin
4040                         BBSs[i].SelectText := SelectText;
4041                         BBSs[i].KubetsuChk := KubetsuChk;
4042                 end;
4043                 Board := TBoard(ActiveList);
4044                 ViewType := AViewType;
4045                 SetActiveList(Board);
4046                 SetThreadListItem(Board);
4047         end;
4048 end;
4049
4050 procedure TGikoForm.ListViewCustomDraw(Sender: TCustomListView;
4051         const ARect: TRect; var DefaultDraw: Boolean);
4052 var
4053         s: string;
4054         p: TPoint;
4055 //      Board: TBoard;
4056 begin
4057         if ListView.Items.Count = 0 then begin
4058                 DefaultDraw := true;
4059
4060                 ListView.Canvas.Brush.Color := ListView.Color;
4061                 ListView.Canvas.FillRect(ARect);
4062
4063                 case ViewType of
4064                         gvtAll: begin
4065                                 ListView.Canvas.Font.Color := clWindowText;
4066                                 s := '\82±\82Ì\83r\83\85\81[\82É\82Í\83A\83C\83e\83\80\82ª\82 \82è\82Ü\82¹\82ñ\81B';
4067                         end;
4068                         gvtLog: begin
4069                                 ListView.Canvas.Font.Color := clBlue;
4070                                 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';
4071                         end;
4072                         gvtNew: begin
4073                                 ListView.Canvas.Font.Color := clGreen;
4074                                 s := '\82±\82Ì\83r\83\85\81[\82É\82Í\90V\92\85\83A\83C\83e\83\80\82ª\82 \82è\82Ü\82¹\82ñ\81B';
4075                         end;
4076                         gvtUser: begin
4077                                 ListView.Canvas.Font.Color := clNavy;
4078                                 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';
4079                                 if GetActiveList is TBoard then
4080                                         s := Format(s, [TBoard(GetActiveList).ParentCategory.ParenTBBS.SelectText]);
4081 //                                      SelectText]);
4082                         end;
4083                         else begin
4084                                 s := '';
4085                         end;
4086                 end;
4087
4088                 p := Point((ListView.ClientWidth div 2) - (ListView.Canvas.TextWidth(s) div 2),
4089                                                          (ListView.ClientHeight div 2) - (ListView.Canvas.TextHeight(s) div 2));
4090                 ListView.Canvas.TextOut(p.X, p.Y, s);
4091         end else begin
4092                 DefaultDraw := True;
4093         end;
4094 end;
4095
4096 procedure TGikoForm.DownloadList(Board: TBoard; ForceDownload: Boolean = False);
4097 var
4098         Item: TDownloadItem;
4099 begin
4100         if not Board.IsThreadDatRead then
4101                 GikoSys.ReadSubjectFile(Board);
4102         Item := TDownloadItem.Create;
4103         try
4104                 Item.Board := Board;
4105                 Item.DownType := gdtBoard;
4106                 Item.ForceDownload := ForceDownload;
4107 //              AbortToolButton.Enabled := True;
4108 //              Animate.Active := True;
4109 //              FDownload.Add(Item);
4110                 FControlThread.AddItem(Item);
4111 //              Animate.Active := False;
4112 //              AbortToolButton.Enabled := False;
4113                 if FWorkCount = 0 then begin
4114                         try
4115                                 Animate.Active := True;
4116                         except
4117                         end;
4118                         Screen.Cursor := crAppStart;
4119                 end;
4120                 Inc(FWorkCount);
4121         finally
4122                 //Item.Free;
4123         end;
4124 end;
4125
4126 procedure TGikoForm.DownloadContent(ThreadItem: TThreadItem; ForceDownload: Boolean = False);
4127 var
4128         Item: TDownloadItem;
4129 begin
4130         Item := TDownloadItem.Create;
4131         try
4132                 Item.ThreadItem := ThreadItem;
4133                 Item.DownType := gdtThread;
4134                 Item.ForceDownload := ForceDownload;
4135 //              AbortToolButton.Enabled := True;
4136 //              Animate.Active := True;
4137 //              FDownload.Add(Item);
4138                 FControlThread.AddItem(Item);
4139 //              Animate.Active := False;
4140 //              AbortToolButton.Enabled := False;
4141                 if FWorkCount = 0 then begin
4142                         try
4143                                 Animate.Active := True;
4144                         except
4145                         end;
4146                         Screen.Cursor := crAppStart;
4147                 end;
4148                 Inc(FWorkCount);
4149         finally
4150 //              Item.Free;
4151         end;
4152 end;
4153
4154 procedure TGikoForm.PlaySound(SoundEventName: string);
4155 var
4156         FileName: string;
4157 begin
4158         FileName := GikoSys.Setting.FindSoundFileName(SoundEventName);
4159         if FileExists(FileName) then begin
4160                 if not sndPlaySound(PChar(FileName), SND_ASYNC or SND_NOSTOP) then begin
4161                         sndPlaySound(nil, SND_SYNC);
4162                         Application.ProcessMessages;
4163                         Sleep(10);
4164                         sndPlaySound(PChar(FileName), SND_ASYNC);
4165                 end;
4166         end;
4167 end;
4168
4169 function TGikoForm.AddHistory( favItem : TFavoriteThreadItem ): Boolean;
4170 var
4171         i: Integer;
4172         Item: TFavoriteThreadItem;
4173         Node: TTreeNode;
4174 begin
4175 //      Result := False;
4176 //      if (GetActiveContent = ThreadItem) and
4177 //                      (ThreadItem.Count <= ThreadItem.Kokomade) then
4178 //              Exit;
4179 //      if GetActiveContent = ThreadItem then
4180 //              Exit;
4181
4182         Result := True;
4183         if FTreeType = gttHistory then
4184         TreeView.Selected := nil;
4185
4186         for i := 0 to FHistoryList.Count - 1 do begin
4187                 if TObject(FHistoryList[i]) is TFavoriteThreadItem then begin
4188                         Item := TFavoriteThreadItem(FHistoryList[i]);
4189                         if Item.URL = favItem.URL then begin
4190 //                              SetContent(ThreadItem);
4191                                 FHistoryList.Move(i, 0);
4192                                 if FTreeType = gttHistory then
4193                                         if TreeView.Items.GetFirstNode <> TreeView.Items[ i ] then
4194                                                 TreeView.Items[ i ].MoveTo( TreeView.Items.GetFirstNode, naInsert );
4195                                                                 Result := false;
4196                                 Exit;
4197                         end;
4198                 end;
4199         end;
4200
4201         if FHistoryList.Count > 0 then
4202                 FHistoryList.Insert( 0, favItem )
4203         else
4204                 FHistoryList.Add( favItem );
4205 //      SetContent(ThreadItem);
4206         while GikoSys.Setting.AddressHistoryCount < FHistoryList.Count do begin
4207                 i := FHistoryList.Count - 1;
4208                 TObject( FHistoryList.Items[ i ] ).Free;
4209                 FHistoryList.Delete( i );
4210         end;
4211
4212         if FTreeType = gttHistory then begin
4213                 Node := TreeView.Items.Add( nil, favItem.Title );
4214                 Node.MoveTo( TreeView.Items.GetFirstNode, naInsert );
4215                 {
4216                 if favItem.NewArrival then begin
4217                         Node.ImageIndex := ITEM_ICON_THREADNEW1;
4218                         Node.SelectedIndex := ITEM_ICON_THREADNEW2;
4219                 end else begin
4220                         Node.ImageIndex := ITEM_ICON_THREADLOG1;
4221                         Node.SelectedIndex := ITEM_ICON_THREADLOG2;
4222                 end;
4223                 }
4224                 // \95\89\89×\82ð\82©\82¯\82½\82­\82È\82¢\82Ì\82Å NewArrival \82Ì\83`\83F\83b\83N\82ð\8ds\82í\82È\82¢
4225                 // \81¦favItem.Item \83v\83\8d\83p\83e\83B\82Í dat \82Ì\93Ç\82Ý\8d\9e\82Ý\82ð\95K\97v\82Æ\82·\82é
4226                 Node.ImageIndex := ITEM_ICON_THREADLOG1;
4227                 Node.SelectedIndex := ITEM_ICON_THREADLOG2;
4228                 Node.Data := favItem;
4229                 while GikoSys.Setting.AddressHistoryCount < TreeView.Items.Count do begin
4230                         i := TreeView.Items.Count - 1;
4231                         TreeView.Items.Item[ i ].Delete;
4232                 end;
4233         end;
4234 end;
4235
4236 procedure TGikoForm.DeleteHistory( threadItem: TThreadItem );
4237 var
4238         i: Integer;
4239 begin
4240         for i := 0 to FHistoryList.Count - 1 do begin
4241                 if threadItem.URL = TFavoriteThreadItem( FHistoryList.Items[i] ).URL then begin
4242                         TFavoriteThreadItem( FHistoryList.Items[ i ] ).Free;
4243                         FHistoryList.Delete(i);
4244             FHistoryList.Capacity := FHistoryList.Count;
4245                         Break;
4246                 end;
4247         end;
4248 end;
4249
4250 procedure TGikoForm.ClearHistory;
4251 var
4252         i : Integer;
4253 begin
4254         //FHistoryList.Clear;
4255
4256         try
4257                 for i := FHistoryList.Count - 1 downto 0 do begin
4258                         if TObject(FHistoryList[ i ]) is TFavoriteThreadItem then
4259                 TFavoriteThreadItem(FHistoryList[ i ]).Free
4260             else if TObject(FHistoryList[ i ]) is TFavoriteBoardItem then
4261                 TFavoriteBoardItem(FHistoryList[ i ]).Free;
4262
4263                         //FHistoryList.Delete(i);
4264         end;
4265         except
4266         end;
4267
4268         FHistoryList.Clear;
4269     FHistoryList.Capacity := FHistoryList.Count;
4270
4271 end;
4272
4273 procedure TGikoForm.SaveHistory;
4274 var
4275         i, bound        : Integer;
4276         saveList        : TstringList;
4277 begin
4278
4279         saveList := TStringList.Create;
4280         try
4281                 FHistoryList.Pack;
4282         FHistoryList.Capacity := FHistoryList.Count;
4283                 saveList.Add('<?xml version="1.0" encoding="Shift_JIS" standalone="yes"?>');
4284                 saveList.Add('<address>');
4285                 bound := FHistoryList.Count - 1;
4286                 for i := bound downto 0 do begin
4287                         // title \82Í\8d¡\82Ì\82Æ\82±\82ë\8eg\82Á\82Ä\82¢\82È\82¢
4288                         saveList.Add(
4289                                 '<history url="' + HtmlEncode( TFavoriteThreadItem( FHistoryList[ i ] ).URL ) + '"' +
4290                                 ' title="' + HtmlEncode( TFavoriteThreadItem( FHistoryList[ i ] ).Title ) + '"/>');
4291                 end;
4292                 saveList.Add('</address>');
4293                 saveList.SaveToFile( GikoSys.GetConfigDir + 'History.xml' );
4294         finally
4295                 saveList.Free;
4296         end;
4297
4298 end;
4299
4300 procedure TGikoForm.LoadHistory;
4301 var
4302         i, bound                : Integer;
4303         fileName                : string;
4304         XMLDoc                  : IXMLDocument;
4305         XMLNode                 : IXMLNode;
4306         HistoryNode     : IXMLNode;
4307         s                                               : string;
4308         favItem                 : TFavoriteThreadItem;
4309 begin
4310
4311         fileName := GikoSys.GetConfigDir + 'History.xml';
4312
4313         if FileExists( fileName ) then begin
4314                 try
4315             XMLDoc := IXMLDocument.Create;
4316                         //XMLDoc := LoadXMLDocument(FileName);
4317             LoadXMLDocument(FileName, XMLDoc);
4318                         try
4319                                 XMLNode := XMLDoc.DocumentElement;
4320
4321                                 if XMLNode.NodeName = 'address' then begin
4322                                         bound := XMLNode.ChildNodes.Count - 1;
4323                                         for i := 0 to bound do begin
4324                                                 HistoryNode := XMLNode.ChildNodes[i];
4325                                                 if HistoryNode.NodeName = 'history' then begin
4326                                                         //if FReadCount >= sl.Count then begin
4327                                                                 s := Trim(HistoryNode.Attributes['url']);
4328                                                                 if s <> '' then begin
4329                                                                         favItem := TFavoriteThreadItem.Create(
4330                                                                                 s, HistoryNode.Attributes[ 'title' ] );
4331                                                                         if not AddHistory( favItem ) then
4332                                         favItem.Free;
4333                                                                 end;
4334                                                         //end;
4335                                                 end;
4336                                         end;
4337                                 end;
4338                         finally
4339                                 XMLDoc.Free;
4340                         end;
4341                 except
4342                 end;
4343         end;
4344
4345 end;
4346
4347 procedure TGikoForm.ShowBBSTreeOld(
4348         inBBS : TBBS
4349 );
4350 var
4351         i, b            : Integer;
4352         item            : TMenuItem;
4353 begin
4354         try
4355                 FavoriteTreeView.Visible := False;
4356                 FavoriteToolBar.Hide;
4357                 TreeView.Visible := True;
4358
4359                 b := CabinetSelectPopupMenu.Items.Count - 1;
4360                 for i := 0 to b do begin
4361                         item := CabinetSelectPopupMenu.Items[ i ];
4362                         if item is TBBSMenuItem then begin
4363                                 if TBBSMenuItem( item ).Data = inBBS then begin
4364                                         item.Checked := True;
4365                                         // CabinetMenu ?? CabinetSelectPopupMenu ??????????????
4366                                         CabinetMenu.Items[ i ].Checked := True;
4367                                         GikoSys.Setting.CabinetIndex := i;
4368                                         Continue;
4369                                 end;
4370                         end;
4371                         item.Checked := False;
4372                         // CabinetMenu ?? CabinetSelectPopupMenu ??????????????
4373                         CabinetMenu.Items[ i ].Checked := False;
4374                 end;
4375                 CabinetSelectToolButton.Caption := inBBS.Title;
4376
4377                 CabinetHistoryAction.Checked := False;
4378                 CabinetFavoriteAction.Checked := False;
4379
4380                 if (FTreeType <> gtt2ch) or (FActiveBBS <> inBBS) then begin
4381                         FTreeType := gtt2ch;
4382                         HistoryToolBar.Hide;
4383                         SetBoardTreeNode( inBBS );
4384                         TreeView.Items.GetFirstNode.Expanded := True;                           //?c???[?g?b?v???????J??
4385                         //?c???[??g?b?v?????I????
4386                         if GetActiveList = nil then
4387                                 TreeView.Selected := TreeView.Items[0]
4388                         else begin
4389                                 for i := 0 to TreeView.Items.Count - 1 do begin
4390                                         if TreeView.Items[i].Data = GetActiveList then begin
4391                                                 TreeView.Selected := TreeView.Items[i];
4392                                                 Exit;
4393                                         end;
4394                                 end;
4395                                 TreeView.Selected := TreeView.Items[0]
4396                         end;
4397                 end;
4398         except
4399         end;
4400
4401 end;
4402
4403 procedure TGikoForm.ShowBBSTree(
4404         inBBS : TBBS
4405 );
4406 var
4407         i, b            : Integer;
4408         item            : TMenuItem;
4409 begin
4410
4411         try
4412                 FavoriteTreeView.Visible := False;
4413                 FavoriteToolBar.Hide;
4414                 TreeView.Visible := True;
4415
4416                 b := CabinetSelectPopupMenu.Items.Count - 1;
4417                 for i := 0 to b do begin
4418                         item := CabinetSelectPopupMenu.Items[ i ];
4419                         if item is TBBSMenuItem then begin
4420                                 if TBBSMenuItem( item ).Data = inBBS then begin
4421                                         item.Checked := True;
4422                                         // CabinetMenu \82Í CabinetSelectPopupMenu \82Æ\93¯\82\82Æ\8c\88\82ß\82¤\82¿\82µ\82¿\82á\82¤
4423                                         CabinetMenu.Items[ i ].Checked := True;
4424                                         GikoSys.Setting.CabinetIndex := i;
4425                                         Continue;
4426                                 end;
4427                         end;
4428                         item.Checked := False;
4429                         // CabinetMenu \82Í CabinetSelectPopupMenu \82Æ\93¯\82\82Æ\8c\88\82ß\82¤\82¿\82µ\82¿\82á\82¤
4430                         CabinetMenu.Items[ i ].Checked := False;
4431                 end;
4432                 CabinetSelectToolButton.Caption := inBBS.Title;
4433
4434                 CabinetHistoryAction.Checked := False;
4435                 CabinetFavoriteAction.Checked := False;
4436
4437                 if (FTreeType <> gtt2ch) or (FActiveBBS <> inBBS) then begin
4438                         FTreeType := gtt2ch;
4439                         HistoryToolBar.Hide;
4440                         SetBoardTreeNode( inBBS );
4441                         TreeView.Items.GetFirstNode.Expanded := True;                           //\83c\83\8a\81[\83g\83b\83v\8d\80\96Ú\82¾\82¯\82ð\8aJ\82­
4442                         //\83c\83\8a\81[\82Ì\83g\83b\83v\8d\80\96Ú\82ð\91I\91ð\82·\82é
4443                         if GetActiveList = nil then begin
4444                                 try
4445                                         TreeClick( TreeView.Items[0] );
4446                                 except
4447                                 end;
4448                         end else begin
4449                                 for i := 0 to TreeView.Items.Count - 1 do begin
4450                                         if TreeView.Items[i].Data = GetActiveList then begin
4451                                                 TreeClick( TreeView.Items[i] );
4452                                                 Exit;
4453                                         end;
4454                                 end;
4455                                 TreeClick( TreeView.Items[0] );
4456                         end;
4457                 end;
4458         except
4459         end;
4460
4461 end;
4462
4463 procedure TGikoForm.ShowHistoryTree;
4464 var
4465         i, b : Integer;
4466         item : TMenuItem;
4467 begin
4468         if CabinetPanel.Visible then begin
4469                 if FTreeType = gttHistory then begin
4470                         CabinetVisible( False );
4471                         CabinetHistoryAction.Checked := False;
4472                 end else begin
4473                         CabinetHistoryAction.Checked := True;
4474                 end;
4475         end else begin
4476                 CabinetVisible( True );
4477                 CabinetHistoryAction.Checked := True;
4478         end;
4479
4480         // BBS...BBS, History, Favorite
4481         GikoSys.Setting.CabinetIndex := CabinetSelectPopupMenu.Items.Count - 2;
4482
4483         FavoriteTreeView.Visible := False;
4484         TreeView.Visible := True;
4485
4486         CabinetBBSAction.Checked := False;
4487         CabinetFavoriteAction.Checked := False;
4488
4489         if FTreeType <> gttHistory then begin
4490                 b := CabinetSelectPopupMenu.Items.Count - 1;
4491                 for i := 0 to b do begin
4492                         item := CabinetSelectPopupMenu.Items[ i ];
4493                         if item is TBBSMenuItem then begin
4494                                 item.Checked := False;
4495                                 // CabinetMenu \82Í CabinetSelectPopupMenu \82Æ\93¯\82\82Æ\8c\88\82ß\82¤\82¿\82µ\82¿\82á\82¤
4496                                 CabinetMenu.Items[ i ].Checked := False;
4497                         end;
4498                 end;
4499
4500                 FTreeType := gttHistory;
4501                 HistoryToolBar.Show;
4502                 FavoriteToolBar.Hide;
4503                 SetHistoryTreeNode;
4504                 CabinetSelectToolButton.Caption := '\97\9a\97ð\83\8a\83X\83g';
4505         end;
4506 end;
4507
4508 procedure TGikoForm.SetHistoryTreeNode;
4509 var
4510         i: Integer;
4511         Node: TTreeNode;
4512         Item: TFavoriteThreadItem;
4513 begin
4514         TreeView.Items.BeginUpdate;
4515         try
4516                 TreeView.Items.Clear;
4517                 for i := 0 to FHistoryList.Count - 1 do begin
4518                         Item := TFavoriteThreadItem(FHistoryList[i]);
4519                         Node := TreeView.Items.Add(nil, Item.Title);
4520                         {
4521                         if Item.Item.NewArrival then begin
4522                                 Node.ImageIndex := ITEM_ICON_THREADNEW1;
4523                                 Node.SelectedIndex := ITEM_ICON_THREADNEW2;
4524                         end else begin
4525                                 Node.ImageIndex := ITEM_ICON_THREADLOG1;
4526                                 Node.SelectedIndex := ITEM_ICON_THREADLOG2;
4527                         end;
4528                         }
4529                         // \95\89\89×\82ð\82©\82¯\82½\82­\82È\82¢\82Ì\82Å NewArrival \82Ì\83`\83F\83b\83N\82ð\8ds\82í\82È\82¢
4530                         // \81¦Item.Item \83v\83\8d\83p\83e\83B\82Í dat \82Ì\93Ç\82Ý\8d\9e\82Ý\82ð\95K\97v\82Æ\82·\82é
4531                         Node.ImageIndex := ITEM_ICON_THREADLOG1;
4532                         Node.SelectedIndex := ITEM_ICON_THREADLOG2;
4533                         Node.Data := Item;
4534                 end;
4535         finally
4536                 TreeView.Items.EndUpdate;
4537         end;
4538 end;
4539
4540 procedure TGikoForm.SelectTreeNode(Item: TObject; CallEvent: Boolean);
4541 var
4542         ChangeEvent: TTVChangedEvent;
4543         ChangingEvent: TTVChangingEvent;
4544         i: Integer;
4545         bbs : TBBS;
4546 begin
4547         if Item is TCategory then
4548                 bbs := TCategory( Item ).ParenTBBS
4549         else if Item is TBoard then
4550                 bbs := TBoard( Item ).ParentCategory.ParenTBBS
4551         else
4552                 bbs := nil;
4553
4554         if (FTreeType = gtt2ch) and (FActiveBBS = bbs) then begin
4555                 if Item <> FActiveList then begin
4556                         ChangeEvent := nil;
4557                         ChangingEvent := nil;
4558
4559                         if not CallEvent then begin
4560                                 ChangeEvent := TreeView.OnChange;
4561                                 ChangingEvent := TreeView.OnChanging;
4562                         end;
4563                         try
4564                                 if not CallEvent then begin
4565                                         TreeView.OnChange := nil;
4566                                         TreeView.OnChanging := nil;
4567                                 end;
4568                                 //Application.ProcessMessages;
4569                                 for i := 0 to TreeView.Items.Count - 1 do begin
4570                                         if TreeView.Items[i].Data = Item then begin
4571                                                 TreeView.Items[i].Selected := True;
4572                                                 if CallEvent then
4573                                                         TreeClick(TreeView.Items[i]);
4574                                                 Break;
4575                                         end;
4576                                 end;
4577                                 //Application.ProcessMessages;
4578                         finally
4579                                 if not CallEvent then begin
4580                                         TreeView.OnChange := ChangeEvent;
4581                                         TreeView.OnChanging := ChangingEvent;
4582                                 end;
4583                         end;
4584                 end;
4585         end else begin
4586                 if Item <> FActiveList then begin
4587                         ActiveListColumnSave;
4588
4589                         if (Item is TBBS) or (Item is TCategory) then begin
4590                                 ListView.Columns.Clear;
4591                                 SetActiveList( Item );
4592                         end else if Item is TBoard then begin
4593                                 if not TBoard( Item ).IsThreadDatRead then begin
4594                                         Screen.Cursor := crHourGlass;
4595                                         try
4596                                                 if not TBoard( Item ).IsThreadDatRead then
4597                                                         GikoSys.ReadSubjectFile(TBoard( Item ));
4598                                         finally
4599                                                 Screen.Cursor := crDefault;
4600                                         end;
4601                                 end;
4602                                 SetActiveList( Item );
4603                         end;
4604                 end;
4605         end;
4606
4607         if Item is TBoard then begin // not TCategory
4608                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
4609                         if GikoSys.Setting.ListWidthState = glsMax then begin
4610                                 BrowserMinAction.Execute;
4611                                 if GikoForm.Visible then
4612                                         ListView.SetFocus;
4613                         end;
4614                 end else begin
4615                         if GikoSys.Setting.ListHeightState = glsMax then begin
4616                                 BrowserMinAction.Execute;
4617                                 if GikoForm.Visible then
4618                                         ListView.SetFocus;
4619                         end;
4620                 end;
4621         end;
4622 end;
4623
4624 procedure TGikoForm.ListViewMouseDown(Sender: TObject;
4625         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
4626 var
4627         listItem                : TListItem;
4628         threadItem      : TThreadItem;
4629         pos                                     : TPoint;
4630 //      t: Cardinal;
4631 begin
4632         case Button of
4633         mbMiddle:
4634                 begin
4635                         if not (GetActiveList is TBoard) then Exit;
4636                         listItem := ListView.GetItemAt( X, Y );
4637                         if listItem = nil then Exit;
4638                         if not (TObject(listItem.Data) is TThreadItem) then Exit;
4639
4640                         threadItem := TThreadItem(ListItem.Data);
4641                         InsertBrowserTab(threadItem, False);
4642                         if threadItem.IsLogFile then
4643                                 ListView.UpdateItems(listItem.Index, listItem.Index);
4644                 end;
4645         mbLeft:
4646                 begin
4647             //\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Å
4648                         if (ssDouble in Shift) then
4649                                 ListDoubleClick(Shift)
4650                         else
4651                                 ListClick;
4652                 end;
4653         mbRight:
4654                 begin
4655                         pos.X := X;
4656                         pos.Y := Y;
4657                         Windows.ClientToScreen( ListView.Handle, pos );
4658                         ListPopupMenu.Popup( pos.X, pos.Y );
4659                 end;
4660         end;
4661 {       if ssDouble in Shift then begin
4662                 DoubleClickOccurred[Button] := True;
4663         end else begin
4664                 DoubleClickOccurred[Button] := False;
4665                 t := GetTickCount+GetDoubleClickTime;
4666                 while GetTickCount < t do begin
4667                         Application.ProcessMessages;
4668                         if DoubleClickOccurred[Button] then
4669                                 Exit;
4670                 end;
4671         end;
4672
4673         if ssDouble in Shift then begin
4674                 case Button of
4675                         mbLeft: ListDoubleClick;
4676 //                      mbMiddle: ;
4677 //                      mbRight:        ;
4678                 end;
4679         end else begin
4680                 case Button of
4681                         mbLeft: ListClick;
4682 //                      mbMiddle: ;
4683 //                      mbRight:        ;
4684                 end;
4685         end;}
4686 end;
4687
4688 procedure TGikoForm.ListClick;
4689 var
4690         ListItem: TListItem;
4691         ThreadItem: TThreadItem;
4692 begin
4693         if ListView.SelCount <> 1 then Exit;
4694         ListItem := ListView.Selected;
4695         if ListItem = nil then Exit;
4696         if not (TObject(ListItem.Data) is TThreadItem) then Exit;
4697
4698         ThreadItem := TThreadItem(ListItem.Data);
4699         if ThreadItem.IsLogFile then begin
4700 //              if AddHistory(ThreadItem) then
4701 //              SetContent(ThreadItem);
4702                 InsertBrowserTab(ThreadItem);
4703                 ListView.UpdateItems(ListItem.Index, ListItem.Index);
4704         end else begin
4705 //              SetContent(ThreadItem);
4706                 InsertBrowserTab(ThreadItem);
4707         end;
4708
4709         if GikoSys.Setting.BrowserAutoMaximize = gbmClick then begin
4710                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
4711                         if GikoSys.Setting.ListWidthState = glsMin then begin
4712                                 BrowserMaxAndFocusAction.Execute;
4713                         end;
4714                 end else begin
4715                         if GikoSys.Setting.ListHeightState = glsMin then begin
4716                                 BrowserMaxAndFocusAction.Execute;
4717                         end;
4718                 end;
4719         end;
4720 end;
4721
4722 procedure TGikoForm.ListDoubleClick(Shift: TShiftState);
4723 var
4724         ThreadItem: TThreadItem;
4725         shiftDown: Boolean;
4726 begin
4727         shiftDown := (ssShift in Shift);
4728
4729         if ListView.Selected = nil then Exit;
4730
4731         if TObject(ListView.Selected.Data) is TCategory then begin
4732                 SelectTreeNode(ListView.Selected.Data, True);
4733 //              TreeView.Selected.Expanded := True;
4734 //              TreeView.Selected.Item[ListView.Selected.Index].Selected := True;
4735                 //TreeViewChange(nil, TreeView.Selected);
4736         end else if TObject(ListView.Selected.Data) is TBoard then begin
4737                 SelectTreeNode(ListView.Selected.Data, True);
4738 //              TreeView.Selected.Expanded := True;
4739 //              TreeView.Selected.Item[ListView.Selected.Index].Selected := True;
4740                 //TreeViewChange(nil, TreeView.Selected);
4741         end else if TObject(ListView.Selected.Data) is TThreadItem then begin
4742                 //if TObject(ListView.Selected.Data) is TThreadItem then begin
4743                         Application.ProcessMessages;
4744                         ThreadItem := TThreadItem(ListView.Selected.Data);
4745                         DownloadContent(ThreadItem, shiftDown);
4746                 //end;
4747                 
4748                 if GikoSys.Setting.BrowserAutoMaximize = gbmDoubleClick then begin
4749                         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
4750                                 if GikoSys.Setting.ListWidthState = glsMin then begin
4751 //                                      BrowserMaxAndFocusAction.Execute;
4752                                         BrowserMaxAction.Execute;
4753                                         SetFocusForBrowserAction.Execute;
4754                                 end;
4755                         end else begin
4756                                 if GikoSys.Setting.ListHeightState = glsMin then begin
4757 //                                      BrowserMaxAndFocusAction.Execute;
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 //      OleVariant(Browser.Document).parentWindow.location.hash := AName;
4773
4774         while (BrowserRecord.Browser.ReadyState <> READYSTATE_COMPLETE) and
4775                                 (BrowserRecord.Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin
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 //      OleVariant(Browser.Document).parentWindow.location.hash := AName;
4805         {
4806         while (Browser.ReadyState <> READYSTATE_COMPLETE) and
4807                                 (Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin
4808                 Application.ProcessMessages;
4809         end;
4810         }
4811         // Access Violation \82ª\8bN\82«\82é\8e\96\82ª\82 \82é\82Ì\82Å\8d¡\8cã\97v\83`\83F\83b\83N
4812         if(BrowserTab.Tabs.Count > 0) and (BrowserTab.TabIndex >= 0) then begin
4813                 activeBrower := FActiveContent.Browser;
4814                 try
4815                         top := 0;
4816                         nm := AName;
4817                         item := OleVariant( activeBrower.Document as IHTMLDocument2).anchors.item(nm);
4818             item.focus();
4819                         repeat
4820                                 top := top + item.offsetTop;
4821                                 item := item.offsetParent;
4822                         until AnsiCompareText(item.tagName, 'body' ) = 0;
4823
4824                         OleVariant(activeBrower.Document as IHTMLDocument2).body.scrollTop := top;
4825                 except
4826                 end;
4827         end;
4828 end;
4829
4830 procedure TGikoForm.TreeViewCollapsed(Sender: TObject; Node: TTreeNode);
4831 begin
4832         if TObject(Node.Data) is TBBS then begin
4833                 TBBS(Node.Data).NodeExpand := False;
4834         end else if TObject(Node.Data) is TCategory then begin
4835                 TCategory(Node.Data).NodeExpand := False;
4836         end else if TObject(Node.Data) is TBoard then begin
4837                 TBoard(Node.Data).NodeExpand := False;
4838         end;
4839 end;
4840
4841 procedure TGikoForm.MessageListViewResize(Sender: TObject);
4842 begin
4843 //      MessageListView.Column[0].Width := MessageListView.ClientWidth - 16;
4844 end;
4845
4846 procedure TGikoForm.SelectListItem(List: TList);
4847 var
4848 //      TmpTreeNode: TTreeNode;
4849         TmpListItem: TListItem;
4850 begin
4851         List.Clear;
4852         TmpListItem := ListView.Selected;
4853         while TmpListItem <> nil do begin
4854                 List.Add(TmpListItem.Data);
4855                 TmpListItem := ListView.GetNextItem(TmpListItem, sdAll, [isSelected]);
4856         end;
4857     
4858 end;
4859
4860 procedure TGikoForm.ExitActionExecute(Sender: TObject);
4861 begin
4862         Close;
4863 end;
4864
4865 procedure TGikoForm.AllSelectActionExecute(Sender: TObject);
4866 begin
4867         ListViewAllSelect;
4868 end;
4869
4870 procedure TGikoForm.StdToolBarVisibleActionExecute(Sender: TObject);
4871 var
4872         CoolBand: TCoolBand;
4873 begin
4874         CoolBand := GetCoolBand(MainCoolBar, StdToolBar);
4875         if CoolBand = nil then
4876                 Exit;
4877         GikoSys.Setting.StdToolBarVisible := StdToolBarVisibleAction.Checked;
4878         CoolBand.Visible := GikoSys.Setting.StdToolBarVisible;
4879 //      StdToolBar.Visible := StdToolBarVisibleAction.Checked;
4880 //      AnimePanel.Visible := StdToolBar.Visible or ListToolBar.Visible;
4881
4882         //StdToolBarVisibleAction.Checked := GikoSys.Setting.StdToolBarVisible;
4883         StdToolBarVisiblePMenu.Checked := GikoSys.Setting.StdToolBarVisible;
4884 end;
4885
4886 procedure TGikoForm.AddressBarVisibleActionExecute(Sender: TObject);
4887 var
4888         CoolBand: TCoolBand;
4889 begin
4890         CoolBand := GetCoolBand(MainCoolBar, AddressToolBar);
4891         if CoolBand = nil then
4892                 Exit;
4893         GikoSys.Setting.AddressBarVisible := AddressBarVisibleAction.Checked;
4894         CoolBand.Visible := GikoSys.Setting.AddressBarVisible;
4895         //AddressBarVisibleAction.Checked := GikoSys.Setting.AddressBarVisible;
4896         AddressToolBarVisiblePMenu.Checked := GikoSys.Setting.AddressBarVisible;
4897 end;
4898
4899 procedure TGikoForm.LinkBarVisibleActionExecute(Sender: TObject);
4900 var
4901         CoolBand: TCoolBand;
4902 begin
4903         CoolBand := GetCoolBand(MainCoolBar, LinkToolBar);
4904         if CoolBand = nil then
4905                 Exit;
4906         GikoSys.Setting.LinkBarVisible := LinkBarVisibleAction.Checked;
4907         CoolBand.Visible := GikoSys.Setting.LinkBarVisible;
4908                                 //LinkBarVisibleAction.Checked := GikoSys.Setting.LinkBarVisible;
4909                                 LinkToolBarVisiblePMenu.Checked := GikoSys.Setting.LinkBarVisible;
4910 end;
4911
4912 procedure TGikoForm.ListToolBarVisibleActionExecute(Sender: TObject);
4913 var
4914         CoolBand: TCoolBand;
4915 begin
4916         CoolBand := GetCoolBand(ListCoolBar, ListToolBar);
4917         if CoolBand = nil then
4918                 Exit;
4919         CoolBand.Visible := ListToolBarVisibleAction.Checked;
4920 //      ListToolBar.Visible := ListToolBarVisibleAction.Checked;
4921 //      AnimePanel.Visible := StdToolBar.Visible or ListToolBar.Visible;
4922         GikoSys.Setting.ListToolBarVisible := ListToolBarVisibleAction.Checked;
4923 end;
4924
4925 procedure TGikoForm.ListNameBarVisibleActionExecute(Sender: TObject);
4926 var
4927         CoolBand: TCoolBand;
4928 begin
4929         CoolBand := GetCoolBand(ListCoolBar, ListNameToolBar);
4930         if CoolBand = nil then
4931                 Exit;
4932         CoolBand.Visible := ListNameBarVisibleAction.Checked;
4933         GikoSys.Setting.ListNameBarVisible := ListNameBarVisibleAction.Checked;
4934 end;
4935
4936 procedure TGikoForm.BrowserToolBarVisibleActionExecute(Sender: TObject);
4937 var
4938         CoolBand: TCoolBand;
4939 begin
4940         CoolBand := GetCoolBand(BrowserCoolBar, BrowserToolBar);
4941         if CoolBand = nil then
4942                 Exit;
4943         CoolBand.Visible := BrowserToolBarVisibleAction.Checked;
4944 //      BrowserToolBar.Visible := BrowserToolBarVisibleAction.Checked;
4945         GikoSys.Setting.BrowserToolBarVisible := BrowserToolBarVisibleAction.Checked;
4946 end;
4947
4948 procedure TGikoForm.BrowserNameBarVisibleActionExecute(Sender: TObject);
4949 var
4950         CoolBand: TCoolBand;
4951 begin
4952         CoolBand := GetCoolBand(BrowserCoolBar, BrowserNameToolBar);
4953         if CoolBand = nil then
4954                 Exit;
4955         CoolBand.Visible := BrowserNameBarVisibleAction.Checked;
4956         GikoSys.Setting.BrowserNameBarVisible := BrowserNameBarVisibleAction.Checked;
4957 end;
4958
4959 procedure TGikoForm.MsgBarVisibleActionExecute(Sender: TObject);
4960 begin
4961         MessageSplitter.Visible := MsgBarVisibleAction.Checked;
4962         MessagePanel.Top := MessageSplitter.Top + MessageSplitter.Height;
4963         MessageSplitter.Top := MessagePanel.Top + 1;
4964         MessagePanel.Visible := MsgBarVisibleAction.Checked;
4965         GikoSys.Setting.MessageBarVisible := MsgBarVisibleAction.Checked;
4966 end;
4967
4968 procedure TGikoForm.StatusBarVisibleActionExecute(Sender: TObject);
4969 begin
4970         StatusBar.Visible := StatusBarVisibleAction.Checked;
4971         GikoSys.Setting.StatusBarVisible := StatusBarVisibleAction.Checked;
4972 end;
4973
4974 procedure TGikoForm.IconStyleExecute(Sender: TObject);
4975 begin
4976         case ListView.ViewStyle of
4977                 vsIcon: SmallIconAction.Execute;
4978                 vsSmallIcon: ListIconAction.Execute;
4979                 vsList: DetailIconAction.Execute;
4980                 vsReport: LargeIconAction.Execute;
4981         end;
4982 end;
4983
4984 procedure TGikoForm.LargeIconActionExecute(Sender: TObject);
4985 begin
4986         ListView.ViewStyle := vsIcon;
4987         LargeIconAction.Checked := True;
4988 end;
4989
4990 procedure TGikoForm.SmallIconActionExecute(Sender: TObject);
4991 begin
4992         ListView.ViewStyle := vsSmallIcon;
4993         SmallIconAction.Checked := True;
4994 end;
4995
4996 procedure TGikoForm.ListIconActionExecute(Sender: TObject);
4997 begin
4998         ListView.ViewStyle := vsList;
4999         ListIconAction.Checked := True;
5000 end;
5001
5002 procedure TGikoForm.DetailIconActionExecute(Sender: TObject);
5003 begin
5004         ListView.ViewStyle := vsReport;
5005         DetailIconAction.Checked := True;
5006 end;
5007
5008 procedure TGikoForm.SearchActionExecute(Sender: TObject);
5009 var
5010         chk: TObject;
5011 begin
5012
5013         if FSearchDialog = nil then begin
5014                 if (GikoForm.GetActiveList is TCategory) or (GikoForm.GetActiveList is TBoard) then
5015                         chk := GikoForm.GetActiveList
5016                 else
5017                         chk := nil;
5018
5019                 FSearchDialog := TSearchDialog.Create(Self, chk);
5020                 FSearchDialog.SearchComboBox.Items.Assign( GikoSys.Setting.SelectTextList );
5021         end;
5022
5023         try
5024                 FSearchDialog.Show;
5025         except
5026         end;
5027         
5028 end;
5029
5030 procedure TGikoForm.OptionActionExecute(Sender: TObject);
5031 var
5032         Dlg: TOptionDialog;
5033 begin
5034         Dlg := TOptionDialog.Create(Self);
5035         try
5036                 Dlg.ShowModal;
5037         finally
5038                 Dlg.Release;
5039         end;
5040 end;
5041
5042 procedure TGikoForm.GikoNaviWebPageActionExecute(Sender: TObject);
5043 const
5044         URL_GIKONAVI: string = 'http://gikonavi.sourceforge.jp/';
5045 begin
5046         GikoSys.OpenBrowser(URL_GIKONAVI, gbtAuto);
5047 end;
5048
5049 procedure TGikoForm.MonazillaWebPageActionExecute(Sender: TObject);
5050 const
5051         URL_MONAZILLA: string = 'http://www.monazilla.org/';
5052 begin
5053         GikoSys.OpenBrowser(URL_MONAZILLA, gbtAuto);
5054 end;
5055
5056 procedure TGikoForm.BBS2chWebPageActionExecute(Sender: TObject);
5057 const
5058         URL_2ch: string = 'http://www.2ch.net/';
5059 begin
5060         GikoSys.OpenBrowser(URL_2ch, gbtAuto);
5061 end;
5062
5063 procedure TGikoForm.GikoFolderOpenActionExecute(Sender: TObject);
5064 begin
5065 //      GikoSys.OpenBrowser(GikoSys.GetAppDir, gbtIE);
5066         GikoSys.CreateProcess('explorer.exe', '/e,"' + GikoSys.GetAppDir + '"');
5067 end;
5068
5069 procedure TGikoForm.AboutActionExecute(Sender: TObject);
5070 var
5071         Dlg: TAboutDialog;
5072 begin
5073         Dlg := TAboutDialog.Create(Self);
5074         try
5075                 Dlg.ShowModal;
5076         finally
5077                 Dlg.Release;
5078         end;
5079 end;
5080
5081 procedure TGikoForm.CabinetHistoryActionExecute(Sender: TObject);
5082 begin
5083         ShowHistoryTree;
5084 end;
5085
5086 procedure       TGikoForm.CabinetVisible( isVisible : Boolean );
5087 begin
5088         TreeSplitter.Visible := isVisible;
5089         CabinetPanel.Visible := isVisible;
5090         CabinetVisibleAction.Checked := isVisible;
5091 end;
5092
5093 procedure TGikoForm.CabinetVisibleActionExecute(Sender: TObject);
5094 begin
5095         case FTreeType of
5096         gttHistory:             CabinetHistoryAction.Execute;
5097         gttFavorite:    CabinetFavoriteAction.Execute;
5098         else
5099                 CabinetBBSAction.Execute;
5100         end;
5101 end;
5102
5103 procedure TGikoForm.AllItemActionExecute(Sender: TObject);
5104 begin
5105         try
5106                 if ViewType <> gvtAll then
5107                         SetListViewType(gvtAll);
5108                 GikoSys.Setting.ThreadRange := gtrAll;
5109                 AllItemAction.Checked           := True;
5110                 // SelectComboBox \82Ì\97\9a\97ð\82ð\8dX\90V\82µ\82Ä\82¨\82­
5111                 ModifySelectList;
5112                 // SelectComboBox \82Ì\92l\82ð\83N\83\8a\83A
5113                 if SelectComboBox.Parent <> nil then begin
5114                         SelectComboBox.Text := SELECTCOMBOBOX_NAME;
5115                         SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
5116                         ListView.SetFocus;
5117                 end;
5118         except
5119         end;
5120 end;
5121
5122 procedure TGikoForm.LogItemActionExecute(Sender: TObject);
5123 begin
5124         try
5125                 if ViewType <> gvtLog then
5126                         SetListViewType(gvtLog);
5127                 GikoSys.Setting.ThreadRange     := gtrLog;
5128                 LogItemAction.Checked := True;
5129                 // SelectComboBox \82Ì\97\9a\97ð\82ð\8dX\90V\82µ\82Ä\82¨\82­
5130                 ModifySelectList;
5131                 // SelectComboBox \82Ì\92l\82ð\83N\83\8a\83A
5132                 if SelectComboBox.Parent <> nil then begin
5133                         SelectComboBox.Text := SELECTCOMBOBOX_NAME;
5134                         SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
5135                         ListView.SetFocus;
5136                 end;
5137         except
5138         end;
5139 end;
5140
5141 procedure TGikoForm.NewItemActionExecute(Sender: TObject);
5142 begin
5143         try
5144
5145                 if ViewType <> gvtNew then
5146                         SetListViewType(gvtNew);
5147                 GikoSys.Setting.ThreadRange     := gtrNew;
5148                 NewItemAction.Checked := True;
5149                 // SelectComboBox \82Ì\97\9a\97ð\82ð\8dX\90V\82µ\82Ä\82¨\82­
5150                 ModifySelectList;
5151                 // SelectComboBox \82Ì\92l\82ð\83N\83\8a\83A
5152                 if SelectComboBox.Parent <> nil then begin
5153                         SelectComboBox.Text := SELECTCOMBOBOX_NAME;
5154                         SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
5155                         ListView.SetFocus;
5156                 end;
5157         except
5158         end;
5159 end;
5160
5161 procedure TGikoForm.SelectItemActionExecute(Sender: TObject);
5162 var
5163         idx: Integer;
5164         Dlg: TListSelectDialog;
5165 begin
5166         try
5167                 if SelectComboBox.Parent <> nil then begin
5168                         if SelectComboBox.Left + SelectComboBox.Width < ListToolBar.Width then begin
5169                                 // SelectComboBox \82ª\82 \82é\8fê\8d\87\82Í\83t\83H\81[\83J\83X\82ð\88Ú\82·
5170                                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
5171                                         if GikoSys.Setting.ListWidthState = glsMax then
5172                                                 BrowserMinAction.Execute;
5173                                 end else begin
5174                                         if GikoSys.Setting.ListHeightState = glsMax then
5175                                                 BrowserMinAction.Execute;
5176                                 end;
5177                                 SelectComboBox.SetFocus;
5178                                 exit;
5179                         end;
5180                 end;
5181         except
5182         end;
5183
5184         if SelectComboBox.Text = SELECTCOMBOBOX_NAME then begin
5185                 SelectComboBox.Text := '';
5186                 SelectComboBox.Color := clWindow;
5187         end;
5188
5189         AllItemAction.Checked := False;
5190         LogItemAction.Checked := False;
5191         NewItemAction.Checked := False;
5192         //SelectItemAction.Checked := True;
5193         ModifySelectList;
5194         Dlg := TListSelectDialog.Create(Self);
5195         try
5196                 Dlg.SelectComboBox.Items.Assign(GikoSys.Setting.SelectTextList);
5197                 Dlg.SelectComboBox.Text := SelectComboBox.Text;
5198                 Dlg.ShowModal;
5199                 if Dlg.ModalResult = mrCancel then begin
5200                         if Length( SelectComboBox.Text ) = 0 then begin
5201                                 AllItemAction.Checked := True;
5202                                 SelectComboBox.Text := SELECTCOMBOBOX_NAME;
5203                                 SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
5204                         end;
5205
5206                         if GetActiveList is TBoard then
5207                                 SetListViewType(gvtUser, TBoard(GetActiveList).ParentCategory.ParenTBBS.SelectText , Dlg.KubetsuCheckBox.Checked);
5208                 end else begin
5209                         idx := GikoSys.Setting.SelectTextList.IndexOf(Dlg.SelectComboBox.Text);
5210                         if idx <> -1 then
5211                                 GikoSys.Setting.SelectTextList.Delete(idx);
5212                         GikoSys.Setting.SelectTextList.Insert(0, Dlg.SelectComboBox.Text);
5213                         while Dlg.SelectComboBox.Items.Count > 100 do begin
5214                                 Dlg.SelectComboBox.Items.Delete(Dlg.SelectComboBox.Items.Count - 1);
5215                         end;
5216
5217                         if Length( Dlg.SelectComboBox.Text ) = 0 then begin
5218                                 SelectComboBox.Text := SELECTCOMBOBOX_NAME;
5219                                 SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
5220                         end else begin
5221                                 SelectComboBox.Text := Dlg.SelectComboBox.Text;
5222                                 SelectComboBox.Color := clWindow;
5223                         end;
5224                         SetListViewType(gvtUser, Dlg.SelectComboBox.Text, Dlg.KubetsuCheckBox.Checked);
5225                 end;
5226         finally
5227                 Dlg.Release;
5228         end;
5229 end;
5230
5231 procedure TGikoForm.ListNumberVisibleActionExecute(Sender: TObject);
5232 begin
5233         GikoSys.Setting.ListViewNo := ListNumberVisibleAction.Checked;
5234         ListView.Refresh;
5235 end;
5236
5237 procedure TGikoForm.UpFolderActionExecute(Sender: TObject);
5238 begin
5239         if GetActiveList is TBoard then begin
5240 //              if FTreeType = gtt2ch then
5241                         SelectTreeNode(TBoard(GetActiveList).ParentCategory, True);
5242                 //SetActiveList(TBoard(GetActiveList).ParentCategory);
5243         end else if GetActiveList is TCategory then begin
5244 //              if FTreeType = gtt2ch then
5245                         SelectTreeNode(TCategory(GetActiveList).ParenTBBS, True);
5246                 //SetActiveList(TCategory(GetActiveList).ParenTBBS);
5247         end;
5248 //      if TreeView.Selected = nil then Exit;
5249 //      if TreeView.Selected.Level = 0 then Exit;
5250 //      TreeView.Selected.Parent.Selected := True;
5251 end;
5252
5253 procedure TGikoForm.RoundActionExecute(Sender: TObject);
5254 var
5255         Dlg: TRoundDialog;
5256 begin
5257         Dlg := TRoundDialog.Create(Self);
5258         try
5259                 Dlg.ShowModal;
5260         finally
5261                 Dlg.Release;
5262         end;
5263 end;
5264
5265 procedure TGikoForm.StopActionExecute(Sender: TObject);
5266 begin
5267         FControlThread.DownloadAbort;
5268         if FWorkCount <> 0 then FWorkCount := 0;
5269         try
5270                 Animate.Active := False;
5271         except
5272         end;
5273         Screen.Cursor := crDefault;
5274 end;
5275
5276 procedure TGikoForm.MsgBarCloseActionExecute(Sender: TObject);
5277 begin
5278 //      MessagePanel.Visible := False;
5279 //      MessageSplitter.Visible := False;
5280 //      MsgBarVisibleAction.Checked := False;
5281         MsgBarVisibleAction.Execute;
5282 end;
5283
5284 procedure TGikoForm.BrowserMaxActionExecute(Sender: TObject);
5285 begin
5286         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
5287                 case GikoSys.Setting.ListWidthState of
5288                         glsMax: begin
5289                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
5290                                 if FActiveContent <> nil then
5291                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5292                                 ViewPanel.Width := FBrowserSizeWidth;
5293                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
5294                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
5295                                 GikoSys.Setting.ListWidthState := glsNormal;
5296                                 if FActiveContent <> nil then
5297                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5298                         end;
5299                         glsMin, glsNormal: begin
5300                                 //\8dÅ\91å\95\\8e¦\82É\82·\82é
5301                                 if FActiveContent <> nil then
5302                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5303                                 if GikoSys.Setting.ListWidthState = glsNormal then
5304                                         FBrowserSizeWidth := ViewPanel.Width;
5305                                 if FActiveContent <> nil then
5306                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5307                                 ViewPanel.Width := 1;
5308                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
5309                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
5310                                 GikoSys.Setting.ListWidthState := glsMax;
5311                         end;
5312                 end;
5313         end else begin
5314                 case GikoSys.Setting.ListHeightState of
5315                         glsMax: begin
5316                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
5317                                 if FActiveContent <> nil then
5318                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5319                                 ViewPanel.Height := FBrowserSizeHeight;
5320                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
5321                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
5322                                 GikoSys.Setting.ListHeightState := glsNormal;
5323                                 if FActiveContent <> nil then
5324                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5325                         end;
5326                         glsMin, glsNormal: begin
5327                                 //\8dÅ\91å\95\\8e¦\82É\82·\82é
5328                                 if FActiveContent <> nil then
5329                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5330                                 if GikoSys.Setting.ListHeightState = glsNormal then
5331                                         FBrowserSizeHeight := ViewPanel.Height;
5332                                 if FActiveContent <> nil then
5333                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5334                                 ViewPanel.Height := 1;
5335                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
5336                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
5337                                 GikoSys.Setting.ListHeightState := glsMax;
5338                         end;
5339                 end;
5340         end;
5341 //      Mouse.CursorPos := BrowserSizeButton.ClientToScreen(Point(
5342 //                                                                                              System.Round(BrowserToolBar.ButtonWidth div 2),
5343 //                                                                                              System.Round(BrowserToolBar.ButtonHeight div 2)));
5344         //BrowserTab.OnChange(nil);
5345 end;
5346
5347 procedure TGikoForm.BrowserMinActionExecute(Sender: TObject);
5348 begin
5349
5350         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
5351                 case GikoSys.Setting.ListWidthState of
5352                         glsMax, glsNormal: begin
5353                                 //\8dÅ\8f¬\95\\8e¦\82É\82·\82é
5354                                 if FActiveContent <> nil then
5355                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5356                                 if GikoSys.Setting.ListWidthState = glsNormal then
5357                                         FBrowserSizeWidth := ViewPanel.Width;
5358                                 if FActiveContent <> nil then
5359                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5360                                 ViewPanel.Width := ThreadMainPanel.Width - 80;
5361                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
5362                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
5363                                 GikoSys.Setting.ListWidthState := glsMin;
5364                         end;
5365                         glsMin: begin
5366                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
5367                                 if FActiveContent <> nil then
5368                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5369                                 ViewPanel.Width := FBrowserSizeWidth;
5370                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
5371                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
5372                                 GikoSys.Setting.ListWidthState := glsNormal;
5373                                 if FActiveContent <> nil then
5374                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5375                         end;
5376                 end;
5377         end else begin
5378                 case GikoSys.Setting.ListHeightState of
5379                         glsMax, glsNormal: begin
5380                                 //\8dÅ\8f¬\95\\8e¦\82É\82·\82é
5381                                 if FActiveContent <> nil then
5382                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5383                                 if GikoSys.Setting.ListHeightState = glsNormal then
5384                                         FBrowserSizeHeight := ViewPanel.Height;
5385                                 ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
5386                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
5387                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
5388                                 GikoSys.Setting.ListHeightState := glsMin;
5389                                 if FActiveContent <> nil then
5390                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5391                         end;
5392                         glsMin: begin
5393                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
5394                                 if FActiveContent <> nil then
5395                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 0, 0);  //\95`\89æ\92â\8e~
5396                                 ViewPanel.Height := FBrowserSizeHeight;
5397                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
5398                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
5399                                 GikoSys.Setting.ListHeightState := glsNormal;
5400                                 if FActiveContent <> nil then
5401                                         SendMessage(FActiveContent.FBrowser.Handle, WM_SETREDRAW, 1, 0);  //\95`\89æ
5402                         end;
5403                 end;
5404         end;
5405 end;
5406
5407 procedure TGikoForm.ScrollTopActionExecute(Sender: TObject);
5408 begin
5409         BrowserMovement('top');
5410 end;
5411
5412 procedure TGikoForm.ScrollLastActionExecute(Sender: TObject);
5413 begin
5414         BrowserMovement('bottom');
5415 end;
5416
5417 procedure TGikoForm.ScrollNewActionExecute(Sender: TObject);
5418 begin
5419         BrowserMovement('new');
5420 end;
5421
5422 procedure TGikoForm.ScrollKokoActionExecute(Sender: TObject);
5423 begin
5424         BrowserMovement('koko');
5425 end;
5426
5427 procedure TGikoForm.EditorActionExecute(Sender: TObject);
5428 var
5429         Editor: TEditorForm;
5430         Item: TThreadItem;
5431 begin
5432         Item := GetActiveContent;
5433         if Item = nil then Exit;
5434         Editor := TEditorForm.Create(Application.MainForm);
5435         Editor.SetThreadItem(Item);
5436     GikoSys.LoadEditorKeySetting(Editor.ActionList);
5437         Editor.Show;
5438         Editor.BodyEdit.SetFocus;
5439 end;
5440
5441 procedure TGikoForm.IEActionExecute(Sender: TObject);
5442 begin
5443         ShowThreadAction.Execute;
5444 end;
5445
5446 procedure TGikoForm.ShowThreadActionExecute(Sender: TObject);
5447 var
5448         ThreadItem: TThreadItem;
5449 begin
5450         ThreadItem := GetActiveContent;
5451         if ThreadItem = nil then Exit;
5452         GikoSys.OpenBrowser(ThreadItem.URL, gbtAuto);
5453 end;
5454
5455 procedure TGikoForm.ShowBoardActionExecute(Sender: TObject);
5456 var
5457         ThreadItem: TThreadItem;
5458 begin
5459         ThreadItem := GetActiveContent;
5460         if ThreadItem = nil then Exit;
5461         GikoSys.OpenBrowser(ThreadItem.ParentBoard.URL, gbtAuto);
5462 end;
5463
5464 //(Thread)URL\82ð\83R\83s\81[
5465 procedure TGikoForm.URLCopyActionExecute(Sender: TObject);
5466 var
5467         s: string;
5468 begin
5469         s := '';
5470         if TObject(GetActiveContent) is TBoard then
5471                 s := s + TBoard(GetActiveContent).URL + #13#10
5472         else if TObject(GetActiveContent) is TThreadItem then
5473                 s := s + TThreadItem(GetActiveContent).URL + #13#10;
5474         if s <> '' then
5475                 Clipboard.AsText := s;
5476 end;
5477
5478 //(Thread)\83X\83\8c\83b\83h\96¼\82ð\83R\83s\81[
5479 procedure TGikoForm.NameCopyActionExecute(Sender: TObject);
5480 var
5481         s: string;
5482 begin
5483         s := '';
5484         if TObject(GetActiveContent) is TBoard then
5485                 s := s + TBoard(GetActiveContent).Title + #13#10
5486         else if TObject(GetActiveContent) is TThreadItem then
5487                 s := s + TThreadItem(GetActiveContent).Title + #13#10;
5488         if s <> '' then
5489                 Clipboard.AsText := s;
5490 end;
5491
5492 //(Thread)\83X\83\8c\83b\83h\96¼\82ÆURL\82ð\83R\83s\81[
5493 procedure TGikoForm.NameURLCopyActionExecute(Sender: TObject);
5494 var
5495         s: string;
5496 begin
5497         s := '';
5498         if TObject(GetActiveContent) is TBoard then
5499                 s := s + TBoard(GetActiveContent).Title + #13#10 + TBoard(GetActiveContent).URL + #13#10
5500         else if TObject(GetActiveContent) is TThreadItem then
5501                 s := s + TThreadItem(GetActiveContent).Title + #13#10 + TThreadItem(GetActiveContent).URL + #13#10;
5502         if s <> '' then
5503                 Clipboard.AsText := s;
5504 end;
5505
5506 procedure TGikoForm.ItemReloadActionExecute(Sender: TObject);
5507 var
5508         ThreadItem: TThreadItem;
5509         shiftDown: Boolean;
5510 begin
5511         ThreadItem := GetActiveContent;
5512         shiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
5513         if ThreadItem <> nil then
5514                 DownloadContent(ThreadItem, shiftDown);
5515 end;
5516
5517 procedure TGikoForm.SelectListReloadActionExecute(Sender: TObject);
5518 var
5519         i: Integer;
5520         List: TList;
5521         msg: string;
5522         shiftDown: Boolean;
5523 begin
5524         shiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
5525         if GetActiveList is TCategory then begin
5526                 List := TList.Create;
5527                 try
5528                         SelectListItem(List);
5529                         if List.Count > 5 then begin
5530                                 msg := '5\8cÂ\88È\8fã\82Í\8ew\92è\82Å\82«\82Ü\82¹\82ñ' + #13#10
5531                                                  + '\82Q\82¿\82á\82ñ\82Ë\82é\95\89\89×\8cy\8c¸\82É\82²\8b¦\97Í\82­\82¾\82³\82¢';
5532                                 MsgBox(Handle, msg, '\8cx\8d\90', MB_ICONEXCLAMATION);
5533                                 Exit;
5534                         end;
5535                         for i := 0 to List.Count - 1 do begin
5536                                 if TObject(List[i]) is TBoard then
5537                                         DownloadList(TBoard(List[i]), shiftDown);
5538                         end;
5539                 finally
5540                         List.Free;
5541                 end;
5542         end else if GetActiveList is TBoard then begin
5543                 DownloadList(TBoard(GetActiveList), shiftDown);
5544         end;
5545 end;
5546
5547 procedure TGikoForm.SelectThreadReloadActionExecute(Sender: TObject);
5548 var
5549         List: TList;
5550         i: Integer;
5551         msg: string;
5552         shiftDown: Boolean;
5553 begin
5554         shiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
5555         List := TList.Create;
5556         try
5557                 SelectListItem(List);
5558                 if List.Count > 10 then begin
5559                         msg := '10\8cÂ\88È\8fã\82Í\8ew\92è\82Å\82«\82Ü\82¹\82ñ' + #13#10
5560                                          + '\82Q\82¿\82á\82ñ\82Ë\82é\95\89\89×\8cy\8c¸\82É\82²\8b¦\97Í\82­\82¾\82³\82¢';
5561                         MsgBox(Handle, msg, '\8cx\8d\90', MB_ICONEXCLAMATION);
5562                         Exit;
5563                 end;
5564                 for i := 0 to List.Count - 1 do begin
5565                         if TObject(List[i]) is TThreadItem then
5566                                 DownloadContent(TThreadItem(List[i]), shiftDown);
5567                 end;
5568         finally
5569                 List.Free;
5570         end;
5571 end;
5572
5573 procedure TGikoForm.SelectListReloadActionUpdate(Sender: TObject);
5574 begin
5575         if (GetActiveList is TCategory) and (ListView.SelCount > 0) then
5576                 SelectListReloadAction.Enabled := True
5577         else if GetActiveList is TBoard then
5578                 SelectListReloadAction.Enabled := True
5579         else
5580                 SelectListReloadAction.Enabled := False;
5581 end;
5582
5583 procedure TGikoForm.SelectThreadReloadActionUpdate(Sender: TObject);
5584 begin
5585         if (GetActiveList is TBoard) and (ListView.SelCount > 0) then
5586                 SelectThreadReloadAction.Enabled := True
5587         else
5588                 SelectThreadReloadAction.Enabled := False;
5589 end;
5590
5591 procedure TGikoForm.AllItemActionUpdate(Sender: TObject);
5592 begin
5593         AllItemAction.Enabled := (GetActiveList is TBoard);
5594 end;
5595
5596 procedure TGikoForm.LogItemActionUpdate(Sender: TObject);
5597 begin
5598         LogItemAction.Enabled := (GetActiveList is TBoard);
5599 end;
5600
5601 procedure TGikoForm.NewItemActionUpdate(Sender: TObject);
5602 begin
5603         NewItemAction.Enabled := (GetActiveList is TBoard);
5604 end;
5605
5606 procedure TGikoForm.SelectItemActionUpdate(Sender: TObject);
5607 begin
5608         SelectItemAction.Enabled := (GetActiveList is TBoard);
5609 end;
5610
5611 procedure TGikoForm.UpFolderActionUpdate(Sender: TObject);
5612 begin
5613         UpFolderAction.Enabled := not (GetActiveList is TBBS);
5614 end;
5615
5616 procedure TGikoForm.ThreadEditorActionUpdate(Sender: TObject);
5617 begin
5618         ThreadEditorAction.Enabled := (GetActiveList is TBoard);
5619 end;
5620
5621 procedure TGikoForm.FormResize(Sender: TObject);
5622 begin
5623
5624         MessageListView.Column[0].Width := MessageListView.ClientWidth - 32;
5625         MainCoolBar.Width := TopPanel.Width - TopRightPanel.Width;
5626
5627         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
5628                 if GikoSys.Setting.ListWidthState = glsMin then begin
5629                         // \8dÅ\8f¬\95\\8e¦\82É\82·\82é
5630                         ViewPanel.Width := ThreadMainPanel.Width - 80;
5631                 end;
5632         end else begin
5633                 if GikoSys.Setting.ListHeightState = glsMin then begin
5634                         // \8dÅ\8f¬\95\\8e¦\82É\82·\82é
5635                         ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
5636                 end;
5637         end;
5638
5639 //      FIsIgnoreResize := rtResizing;
5640 //      PostMessage( Handle, USER_RESIZED, 0, 0 );
5641
5642
5643 end;
5644
5645 procedure TGikoForm.ScrollTopActionUpdate(Sender: TObject);
5646 begin
5647         ScrollTopAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
5648 end;
5649
5650 procedure TGikoForm.ScrollLastActionUpdate(Sender: TObject);
5651 begin
5652         ScrollLastAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
5653 end;
5654
5655 procedure TGikoForm.ScrollNewActionUpdate(Sender: TObject);
5656 begin
5657         ScrollNewAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
5658 end;
5659
5660 procedure TGikoForm.ScrollKokoActionUpdate(Sender: TObject);
5661 begin
5662         ScrollKokoAction.Enabled := (GetActiveContent <> nil)
5663                                                                                                         and (GetActiveContent.IsLogFile)
5664                                                                                                         and (GetActiveContent.Kokomade <> -1);
5665
5666 end;
5667
5668 procedure TGikoForm.EditorActionUpdate(Sender: TObject);
5669 begin
5670         EditorAction.Enabled := GetActiveContent <> nil;
5671 end;
5672
5673 procedure TGikoForm.IEActionUpdate(Sender: TObject);
5674 begin
5675         IEAction.Enabled := GetActiveContent <> nil;
5676 end;
5677
5678 procedure TGikoForm.ShowThreadActionUpdate(Sender: TObject);
5679 begin
5680         ShowThreadAction.Enabled := GetActiveContent <> nil;
5681 end;
5682
5683 procedure TGikoForm.ShowBoardActionUpdate(Sender: TObject);
5684 begin
5685         ShowBoardAction.Enabled := GetActiveContent <> nil;
5686 end;
5687
5688 procedure TGikoForm.ItemReloadActionUpdate(Sender: TObject);
5689 begin
5690         ItemReloadAction.Enabled := GetActiveContent <> nil;
5691 end;
5692
5693 procedure TGikoForm.URLCopyActionUpdate(Sender: TObject);
5694 begin
5695         URLCopyAction.Enabled := GetActiveContent <> nil;
5696 end;
5697
5698 procedure TGikoForm.NameCopyActionUpdate(Sender: TObject);
5699 begin
5700         NameCopyAction.Enabled := GetActiveContent <> nil;
5701 end;
5702
5703 procedure TGikoForm.NameURLCopyActionUpdate(Sender: TObject);
5704 begin
5705         NameURLCopyAction.Enabled := GetActiveContent <> nil;
5706 end;
5707
5708 procedure TGikoForm.BrowserTabCloseActionUpdate(Sender: TObject);
5709 begin
5710         BrowserTabCloseAction.Enabled := (BrowserTab.Tabs.Count > 0);
5711 end;
5712
5713 procedure TGikoForm.NotSelectTabCloseActionUpdate(Sender: TObject);
5714 begin
5715         NotSelectTabCloseAction.Enabled := (BrowserTab.Tabs.Count > 1);
5716 end;
5717
5718 procedure TGikoForm.AllTabCloseActionUpdate(Sender: TObject);
5719 begin
5720         AllTabCloseAction.Enabled := (BrowserTab.Tabs.Count > 0);
5721 end;
5722
5723 procedure TGikoForm.ActiveLogDeleteActionUpdate(Sender: TObject);
5724 begin
5725         ActiveLogDeleteAction.Enabled := GetActiveContent <> nil;
5726 end;
5727
5728 procedure TGikoForm.LogDeleteActionExecute(Sender: TObject);
5729 const
5730         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';
5731         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';
5732         DEL_TITLE = '\8dí\8f\9c\8am\94F';
5733 var
5734         ThreadItem: TThreadItem;
5735         TmpListItem: TListItem;
5736         List: TList;
5737         i: Integer;
5738 begin
5739         List := TList.Create;
5740         try
5741                 TmpListItem := ListView.Selected;
5742                 while TmpListItem <> nil do begin
5743                         if TObject(TmpListItem.Data) is TThreadItem then begin
5744                                 ThreadItem := TThreadItem(TmpListItem.Data);
5745                                 if ThreadItem.IsLogFile then
5746                                         List.Add(ThreadItem);
5747                         end;
5748                         TmpListItem := ListView.GetNextItem(TmpListItem, sdAll, [isSelected]);
5749                 end;
5750
5751                 if GikoSys.Setting.DeleteMsg and (List.Count > 0) then begin
5752                         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then begin
5753                                 if List.Count = 1 then begin
5754                                         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
5755                                                 Exit;
5756                                 end else begin
5757                                         if MsgBox(Handle, StringReplace( DEL_SAME_MSG, '^0', IntToStr( List.Count ), [rfReplaceAll] ), DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> IDYES then
5758                                                 Exit;
5759                                 end;
5760                         end;
5761                 end;
5762
5763                 for i := 0 to List.Count - 1 do begin
5764                         ThreadItem := TThreadItem(List[i]);
5765                         DeleteHistory(ThreadItem);
5766                         DeleteTab(ThreadItem);
5767                         ThreadItem.DeleteLogFile;
5768                         
5769                         TreeView.Refresh;       // UnRead \82Ì\95\\8e¦\82ð\8dX\90V
5770                 end;
5771                 ListView.Refresh;
5772         finally
5773                 List.Free;
5774         end;
5775 end;
5776 procedure TGikoForm.DeleteTab(BrowserRecord: TBrowserRecord);
5777 var
5778         i, j, idx: Integer;
5779         doc: Variant;
5780 begin
5781         idx := BrowserTab.TabIndex;
5782         FTabHintIndex := -1;
5783         for i := 0 to BrowserTab.Tabs.Count - 1 do begin
5784                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]) = BrowserRecord then begin
5785                         BrowserTab.Tabs.BeginUpdate;
5786                         try
5787                                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser <> nil then begin
5788                                         doc := TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser.Document;
5789                                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread.ScrollTop := doc.Body.ScrollTop;
5790                                 end;
5791                         except
5792                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread.ScrollTop := 0;
5793                         end;
5794                         if( FActiveContent = TBrowserRecord(BrowserTab.Tabs.Objects[i]) ) then
5795                                 FActiveContent := nil;
5796                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser <> nil then begin
5797                                 j := FBrowsers.IndexOf(TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser);
5798                                 if j <> -1 then
5799                                         FBrowsers.Move(j, BROWSER_COUNT - 1);
5800                         end;
5801                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
5802                         BrowserTab.Tabs.Delete(i);
5803                         if idx > i then begin
5804                                 BrowserTab.TabIndex := idx - 1;
5805                         end else begin
5806                                 if BrowserTab.Tabs.Count -1 >= idx then
5807                                         BrowserTab.TabIndex := idx
5808                                 else
5809                                         BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1;
5810                         end;
5811                         if BrowserTab.Tabs.Count = 0 then begin
5812                                 BrowserNullTab.Thread := nil;
5813                         end;
5814                         if(BrowserTab.TabIndex <> -1) and
5815                                 ( TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Browser = nil) then begin
5816                                 for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
5817                                         if(TBrowserRecord(BrowserTab.Tabs.Objects[j]).Browser
5818                                                  = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) )then
5819                                         begin
5820                                                 ReleaseBrowser(TBrowserRecord(BrowserTab.Tabs.Objects[j]));
5821                                                 break;
5822                                         end;
5823                                 end;
5824                                 TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Browser
5825                                          :=  TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
5826                                 TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Repaint := true;
5827                                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
5828                         end;
5829                         BrowserTab.Tabs.EndUpdate;
5830                         if( FActiveContent = nil) then
5831                                 BrowserTab.OnChange(nil);
5832                         Exit;
5833                 end;
5834         end;
5835 end;
5836 procedure TGikoForm.DeleteTab(ThreadItem: TThreadItem);
5837 var
5838         i, j, idx: Integer;
5839         doc: Variant;
5840 begin
5841         idx := BrowserTab.TabIndex;
5842         FTabHintIndex := -1;
5843         for i := 0 to BrowserTab.Tabs.Count - 1 do begin
5844                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread = ThreadItem then begin
5845                         BrowserTab.Tabs.BeginUpdate;
5846                         try
5847                                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser <> nil then begin
5848                                         doc := TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser.Document;
5849                                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread.ScrollTop := doc.Body.ScrollTop;
5850
5851                                 end;
5852                         except
5853                                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread.ScrollTop := 0;
5854                         end;
5855                         if(FActiveContent = TBrowserRecord(BrowserTab.Tabs.Objects[i])) then
5856                                 FActiveContent := nil;
5857                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser <> nil then begin
5858                                 j := FBrowsers.IndexOf(TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser);
5859                                 if j <> -1 then
5860                                         FBrowsers.Move(j, BROWSER_COUNT - 1);
5861                         end;
5862                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
5863                         BrowserTab.Tabs.Delete(i);
5864                         if idx > i then begin
5865                                 BrowserTab.TabIndex := idx - 1;
5866                         end else begin
5867                                 if BrowserTab.Tabs.Count -1 >= idx then
5868                                         BrowserTab.TabIndex := idx
5869                                 else
5870                                         BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1;
5871                         end;
5872                         if(BrowserTab.TabIndex <> -1) and
5873                                 ( TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Browser = nil) then begin
5874                                 for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
5875                                         if(TBrowserRecord(BrowserTab.Tabs.Objects[j]).Browser
5876                                                  = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) )then
5877                                         begin
5878                                                 ReleaseBrowser(TBrowserRecord(BrowserTab.Tabs.Objects[j]));
5879                                                 break;
5880                                         end;
5881                                 end;
5882                                 TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Browser
5883                                          :=  TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
5884                                 TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Repaint := true;
5885                                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
5886                         end;
5887
5888                         BrowserTab.Tabs.EndUpdate;
5889                         if( FActiveContent = nil) then
5890                                 BrowserTab.OnChange(nil);
5891                         Exit;
5892                 end;
5893         end;
5894 end;
5895 procedure TGikoForm.KokomadeActionExecute(Sender: TObject);
5896 var
5897         No: Integer;
5898         ThreadItem: TThreadItem;
5899 begin
5900         No := KokoPopupMenu.Tag;
5901         if No = 0 then Exit;
5902         ThreadItem := GetActiveContent;
5903         if ThreadItem = nil then Exit;
5904         ThreadItem.Kokomade := No;
5905         FActiveContent.Thread.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
5906         FActiveContent.FRepaint := true;
5907         InsertBrowserTab(FActiveContent.Thread, true);
5908         Application.ProcessMessages;
5909 end;
5910
5911 procedure TGikoForm.ZenbuActionExecute(Sender: TObject);
5912 var
5913         ThreadItem: TThreadItem;
5914 begin
5915         ThreadItem := GetActiveContent;
5916         if ThreadItem = nil then Exit;
5917         ThreadItem.Kokomade := -1;
5918         FActiveContent.Thread.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
5919         FActiveContent.FRepaint := true;
5920         InsertBrowserTab(FActiveContent.Thread, true);
5921         Application.ProcessMessages;
5922 end;
5923
5924 function TGikoForm.Hook(var Message: TMessage): Boolean;
5925 begin
5926         Result := False;
5927         case Message.Msg of
5928         CM_APPKEYDOWN:
5929                 Result := True;
5930         end;
5931 end;
5932
5933 procedure TGikoForm.KokoResActionExecute(Sender: TObject);
5934 var
5935         Editor: TEditorForm;
5936         Item: TThreadItem;
5937         Number: Integer;
5938 begin
5939         Number := KokoPopupMenu.Tag;
5940         if Number = 0 then Exit;
5941         Item := GetActiveContent;
5942         if Item = nil then Exit;
5943
5944         Editor := TEditorForm.Create(Self);
5945         Editor.SetThreadItem(Item);
5946     GikoSys.LoadEditorKeySetting(Editor.ActionList);
5947         Editor.BodyEdit.Text := '>>' + IntToStr(Number) + #13#10;
5948         Editor.Show;
5949         Editor.BodyEdit.SetFocus;
5950 end;
5951
5952 procedure TGikoForm.ListPopupMenuPopup(Sender: TObject);
5953 begin
5954         ItemRoundPMenu.Visible := (GetActiveList is TBoard);
5955         ItemReservPMenu.Visible := (GetActiveList is TBoard);
5956         LPMSep01.Visible := (GetActiveList is TBoard);
5957         ListRoundPMenu.Visible := (GetActiveList is TCategory);// or (GetActiveList is TBoard);
5958         ListReservPMenu.Visible := (GetActiveList is TCategory);// or (GetActiveList is TBoard);
5959         LPMSep02.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5960         KidokuPMenu.Visible := (GetActiveList is TBoard);
5961         MidokuPMenu.Visible := (GetActiveList is TBoard);
5962         UrlCopyPMenu.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5963         NameUrlCopyPMenu.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5964         AllSelectPMenu.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5965         LPMSep05.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5966         DeletePMenu.Visible := (GetActiveList is TBoard);
5967         LPMSep06.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
5968         BoardFavoriteAddMenu.Visible := (GetActiveList is TCategory);
5969         ThreadFavoriteAddMenu.Visible := (GetActiveList is TBoard);
5970
5971         AddRoundNameMenu(ItemReservPMenu);
5972         AddRoundNameMenu(ListReservPMenu);
5973 end;
5974
5975 procedure TGikoForm.BoardIEActionExecute(Sender: TObject);
5976 var
5977         URL: string;
5978 begin
5979         if GetActiveList is TBoard then begin
5980                 URL := TBoard(GetActiveList).URL;
5981                 GikoSys.OpenBrowser(URL, gbtAuto);
5982         end;
5983 end;
5984
5985 procedure TGikoForm.SelectItemURLCopyActionExecute(Sender: TObject);
5986 var
5987         List: TList;
5988         i: Integer;
5989         s: string;
5990 begin
5991         s := '';
5992         List := TList.Create;
5993         try
5994                 SelectListItem(List);
5995                 for i := 0 to List.Count - 1 do begin
5996                         if TObject(List[i]) is TBoard then
5997                                 s := s + TBoard(List[i]).URL + #13#10
5998                         else if TObject(List[i]) is TThreadItem then
5999                                 s := s + TThreadItem(List[i]).URL + #13#10;
6000                 end;
6001                 if s <> '' then
6002                         Clipboard.AsText := s;
6003         finally
6004                 List.Free;
6005         end;
6006 end;
6007
6008 procedure TGikoForm.SelectItemNameCopyActionExecute(Sender: TObject);
6009 var
6010         List: TList;
6011         i: Integer;
6012         s: string;
6013 begin
6014         s := '';
6015         List := TList.Create;
6016         try
6017                 SelectListItem(List);
6018                 for i := 0 to List.Count - 1 do begin
6019                         if TObject(List[i]) is TBoard then
6020                                 s := s + TBoard(List[i]).Title + #13#10
6021                         else if TObject(List[i]) is TThreadItem then
6022                                 s := s + TThreadItem(List[i]).Title + #13#10;
6023                 end;
6024                 if s <> '' then
6025                         Clipboard.AsText := s;
6026         finally
6027                 List.Free;
6028         end;
6029 end;
6030
6031 procedure TGikoForm.SelectItemNameURLCopyActionExecute(Sender: TObject);
6032 var
6033         List: TList;
6034         i: Integer;
6035         s: string;
6036 begin
6037         s := '';
6038         List := TList.Create;
6039         try
6040                 SelectListItem(List);
6041                 for i := 0 to List.Count - 1 do begin
6042                         if TObject(List[i]) is TBoard then
6043                                 s := s + TBoard(List[i]).Title + #13#10 + TBoard(List[i]).URL + #13#10
6044                         else if TObject(List[i]) is TThreadItem then
6045                                 s := s + TThreadItem(List[i]).Title + #13#10 + TThreadItem(List[i]).URL + #13#10;
6046                 end;
6047                 if s <> '' then
6048                         Clipboard.AsText := s;
6049         finally
6050                 List.Free;
6051         end;
6052 end;
6053
6054 procedure TGikoForm.BoardIEActionUpdate(Sender: TObject);
6055 begin
6056         if GetActiveList is TBoard then
6057                 BoardIEAction.Enabled := True
6058         else
6059                 BoardIEAction.Enabled := False;
6060 end;
6061
6062 procedure TGikoForm.SelectItemURLCopyActionUpdate(Sender: TObject);
6063 begin
6064         if ((GetActiveList is TBoard) or (GetActiveList is TCategory))and (ListView.SelCount > 0) then
6065                 SelectItemURLCopyAction.Enabled := True
6066         else
6067                 SelectItemURLCopyAction.Enabled := False;
6068 end;
6069
6070 procedure TGikoForm.SelectItemNameCopyActionUpdate(Sender: TObject);
6071 begin
6072         if ((GetActiveList is TBoard) or (GetActiveList is TCategory))and (ListView.SelCount > 0) then
6073                 SelectItemNameCopyAction.Enabled := True
6074         else
6075                 SelectItemNameCopyAction.Enabled := False;
6076 end;
6077
6078 procedure TGikoForm.SelectItemNameURLCopyActionUpdate(Sender: TObject);
6079 begin
6080         if ((GetActiveList is TBoard) or (GetActiveList is TCategory))and (ListView.SelCount > 0) then
6081                 SelectItemNameURLCopyAction.Enabled := True
6082         else
6083                 SelectItemNameURLCopyAction.Enabled := False;
6084 end;
6085
6086 procedure TGikoForm.AllSelectActionUpdate(Sender: TObject);
6087 begin
6088         if ListView.SelCount > 0 then
6089                 AllSelectAction.Enabled := True
6090         else
6091                 AllSelectAction.Enabled := False;
6092 end;
6093
6094 procedure TGikoForm.LogDeleteActionUpdate(Sender: TObject);
6095 begin
6096         if (GetActiveList is TBoard) and (ListView.SelCount > 0) then
6097                 LogDeleteAction.Enabled := True
6098         else
6099                 LogDeleteAction.Enabled := False;
6100 end;
6101
6102 procedure TGikoForm.BrowserTabCloseActionExecute(Sender: TObject);
6103 var
6104         idx: Integer;
6105 //      ThreadItem: TThreadItem;
6106 begin
6107         idx := BrowserTab.TabIndex;
6108         if idx <> -1 then begin
6109                 if BrowserTab.Tabs.Objects[idx] <> nil then begin
6110                         //ThreadItem := TThreadItem(BrowserTab.Tabs.Objects[idx]);
6111                         DeleteTab(TBrowserRecord(BrowserTab.Tabs.Objects[idx]));
6112                 end;
6113         end;
6114 end;
6115
6116 procedure TGikoForm.NotSelectTabCloseActionExecute(Sender: TObject);
6117 var
6118         i: Integer;
6119         idx: Integer;
6120 begin
6121         idx := BrowserTab.TabIndex;
6122         if idx = -1 then Exit;
6123         BrowserTab.Tabs.BeginUpdate;
6124         for i := BrowserTab.Tabs.Count - 1 downto BrowserTab.TabIndex + 1 do begin
6125                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
6126                 BrowserTab.Tabs.Delete(i);
6127         end;
6128         if idx > 0 then begin
6129                 for i := BrowserTab.TabIndex - 1 downto 0 do begin
6130                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
6131                         BrowserTab.Tabs.Delete(i);
6132                 end;
6133         end;
6134         BrowserTab.Tabs.EndUpdate;
6135 end;
6136
6137 procedure TGikoForm.AllTabCloseActionExecute(Sender: TObject);
6138 var
6139         i: Integer;
6140 begin
6141         if GikoSys.Setting.ShowDialogForAllTabClose then
6142                 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
6143                         Exit;
6144
6145         FActiveContent := nil;
6146         BrowserNullTab.Thread := nil;
6147         BrowserTab.OnChange := nil;
6148         BrowserTab.Tabs.BeginUpdate;
6149         for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
6150                 TBrowserRecord(BrowserTab.Tabs.Objects[i]).Free;
6151         end;
6152         BrowserTab.Tabs.Clear;
6153         BrowserTab.Tabs.EndUpdate;
6154         BrowserTab.OnChange := BrowserTabChange;
6155         SetContent(BrowserNullTab);
6156         Self.Caption := CAPTION_NAME ;
6157 end;
6158
6159 procedure TGikoForm.TreeSelectBoradReloadExecute(Sender: TObject);
6160 var
6161         Board: TBoard;
6162         TmpTreeNode: TTreeNode;
6163 begin
6164         TmpTreeNode := FClickNode;
6165         TreeView.Selected := FClickNode;
6166         Board := nil;
6167
6168         if TObject(TmpTreeNode.Data) is TBoard then
6169                 Board := TBoard(TmpTreeNode.Data)
6170         else if TObject(TmpTreeNode.Data) is TFavoriteBoardItem then
6171                 Board := TFavoriteBoardItem(TmpTreeNode.Data).Item;
6172
6173         if Board <> nil then
6174                 DownloadList(Board);
6175 end;
6176
6177 procedure TGikoForm.TreeSelectThreadReloadExecute(Sender: TObject);
6178 var
6179         ThreadItem: TThreadItem;
6180         TmpTreeNode: TTreeNode;
6181 begin
6182         TmpTreeNode := FClickNode;
6183         TreeView.Selected := FClickNode;
6184         ThreadItem := nil;
6185
6186         if TObject(TmpTreeNode.Data) is TThreadItem then
6187                 ThreadItem := TThreadItem(TmpTreeNode.Data)
6188         else if TObject(TmpTreeNode.Data) is TFavoriteThreadItem then
6189                 ThreadItem := TFavoriteThreadItem(TmpTreeNode.Data).Item;
6190
6191         if ThreadItem <> nil then
6192                 DownloadContent(ThreadItem);
6193 end;
6194
6195 procedure TGikoForm.TreeSelectURLCopyExecute(Sender: TObject);
6196 var
6197         TmpTreeNode: TTreeNode;
6198         s: string;
6199 begin
6200         TmpTreeNode := FClickNode;
6201         TreeView.Selected := FClickNode;
6202         if TObject(TmpTreeNode.Data) is TBoard then begin
6203                 s := TBoard(TmpTreeNode.Data).URL + #13#10;
6204         end else if TObject(TmpTreeNode.Data) is TFavoriteBoardItem then begin
6205                 s := TFavoriteBoardItem(TmpTreeNode.Data).URL + #13#10;
6206         end else if (TObject(TmpTreeNode.Data) is TThreadItem) then begin
6207                 s := TThreadItem(TmpTreeNode.Data).URL + #13#10;
6208         end else if TObject(TmpTreeNode.Data) is TFavoriteThreadItem then begin
6209                 s := TFavoriteThreadItem(TmpTreeNode.Data).URL + #13#10;
6210         end;
6211         Clipboard.AsText := s;
6212 end;
6213
6214 procedure TGikoForm.TreeSelectNameURLCopyExecute(Sender: TObject);
6215 var
6216         TmpTreeNode: TTreeNode;
6217         s: string;
6218 begin
6219         TmpTreeNode := FClickNode;
6220         TreeView.Selected := FClickNode;
6221         if TObject(TmpTreeNode.Data) is TBoard then begin
6222                 s := TBoard(TmpTreeNode.Data).Title + #13#10 + TBoard(TmpTreeNode.Data).URL + #13#10;
6223         end else if TObject(TmpTreeNode.Data) is TFavoriteBoardItem then begin
6224                 s := TFavoriteBoardItem(TmpTreeNode.Data).Item.Title + #13#10 + TFavoriteBoardItem(TmpTreeNode.Data).URL + #13#10;
6225         end else if (TObject(TmpTreeNode.Data) is TThreadItem) then begin
6226                 s := TThreadItem(TmpTreeNode.Data).Title + #13#10 + TThreadItem(TmpTreeNode.Data).URL + #13#10;
6227         end else if TObject(TmpTreeNode.Data) is TFavoriteThreadItem then begin
6228                 s := TFavoriteThreadItem(TmpTreeNode.Data).Item.Title + #13#10 + TFavoriteThreadItem(TmpTreeNode.Data).URL + #13#10;
6229         end;
6230         Clipboard.AsText := s;
6231 end;
6232
6233 procedure TGikoForm.TreePopupMenuPopup(Sender: TObject);
6234 begin
6235         FClickNode := TreeView.Selected;
6236         if FClickNode = nil then begin
6237                 TreeSelectThreadPupupMenu.Visible := False;
6238                 TreeSelectBoardPupupMenu.Visible := False;
6239                 TPMSep01.Visible := False;
6240                 TreeSelectURLPupupMenu.Visible := False;
6241                 TreeSelectNamePupupMenu.Visible := False;
6242                 TreeSelectNameURLPupupMenu.Visible := False;
6243                 TreeSelectFavoriteAddPupupMenu.Visible := False;
6244                 TreeSelectLogDeleteSeparator.Visible := False;
6245                 TreeSelectLogDeletePopupMenu.Visible := False;
6246         end else if TObject(FClickNode.Data) is TBoard then begin
6247                 TreeSelectThreadPupupMenu.Visible := False;
6248                 TreeSelectBoardPupupMenu.Visible := True;
6249                 TPMSep01.Visible := True;
6250                 TreeSelectURLPupupMenu.Visible := True;
6251                 TreeSelectNamePupupMenu.Visible := True;
6252                 TreeSelectNameURLPupupMenu.Visible := True;
6253                 TreeSelectFavoriteAddPupupMenu.Visible := True;
6254                 TreeSelectLogDeleteSeparator.Visible := False;
6255                 TreeSelectLogDeletePopupMenu.Visible := False;
6256         end else if TObject(FClickNode.Data) is TFavoriteBoardItem then begin
6257                 TreeSelectThreadPupupMenu.Visible := False;
6258                 TreeSelectBoardPupupMenu.Visible := True;
6259                 TPMSep01.Visible := True;
6260                 TreeSelectURLPupupMenu.Visible := True;
6261                 TreeSelectNamePupupMenu.Visible := True;
6262                 TreeSelectNameURLPupupMenu.Visible := True;
6263                 TreeSelectFavoriteAddPupupMenu.Visible := True;
6264                 TreeSelectLogDeleteSeparator.Visible := False;
6265                 TreeSelectLogDeletePopupMenu.Visible := False;
6266         end else if (TObject(FClickNode.Data) is TThreadItem) then begin
6267                 TreeSelectThreadPupupMenu.Visible := True;
6268                 TreeSelectBoardPupupMenu.Visible := False;
6269                 TPMSep01.Visible := True;
6270                 TreeSelectURLPupupMenu.Visible := True;
6271                 TreeSelectNamePupupMenu.Visible := True;
6272                 TreeSelectNameURLPupupMenu.Visible := True;
6273                 TreeSelectFavoriteAddPupupMenu.Visible := True;
6274                 TreeSelectLogDeleteSeparator.Visible := True;
6275                 TreeSelectLogDeletePopupMenu.Visible := True;
6276         end else if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
6277                 TreeSelectThreadPupupMenu.Visible := True;
6278                 TreeSelectBoardPupupMenu.Visible := False;
6279                 TPMSep01.Visible := True;
6280                 TreeSelectURLPupupMenu.Visible := True;
6281                 TreeSelectNamePupupMenu.Visible := True;
6282                 TreeSelectNameURLPupupMenu.Visible := True;
6283                 TreeSelectFavoriteAddPupupMenu.Visible := True;
6284                 TreeSelectLogDeleteSeparator.Visible := True;
6285                 TreeSelectLogDeletePopupMenu.Visible := True;
6286         end else if (TObject(FClickNode.Data) is TCategory) then begin
6287                 TreeSelectThreadPupupMenu.Visible := False;
6288                 TreeSelectBoardPupupMenu.Visible := False;
6289                 TPMSep01.Visible := False;
6290                 TreeSelectURLPupupMenu.Visible := False;
6291                 TreeSelectNamePupupMenu.Visible := True;
6292                 TreeSelectNameURLPupupMenu.Visible := False;
6293                 TreeSelectFavoriteAddPupupMenu.Visible := False;
6294                 TreeSelectLogDeleteSeparator.Visible := False;
6295                 TreeSelectLogDeletePopupMenu.Visible := False;
6296         end else if FClickNode.IsFirstNode then begin
6297                 TreeSelectThreadPupupMenu.Visible := False;
6298                 TreeSelectBoardPupupMenu.Visible := False;
6299                 TPMSep01.Visible := False;
6300                 TreeSelectURLPupupMenu.Visible := False;
6301                 TreeSelectNamePupupMenu.Visible := True;
6302                 TreeSelectNameURLPupupMenu.Visible := False;
6303                 TreeSelectFavoriteAddPupupMenu.Visible := False;
6304                 TreeSelectLogDeleteSeparator.Visible := False;
6305                 TreeSelectLogDeletePopupMenu.Visible := False;
6306         end else begin
6307                 TreeSelectThreadPupupMenu.Visible := False;
6308                 TreeSelectBoardPupupMenu.Visible := False;
6309                 TPMSep01.Visible := False;
6310                 TreeSelectURLPupupMenu.Visible := False;
6311                 TreeSelectNamePupupMenu.Visible := False;
6312                 TreeSelectNameURLPupupMenu.Visible := False;
6313                 TreeSelectFavoriteAddPupupMenu.Visible := False;
6314                 TreeSelectLogDeleteSeparator.Visible := False;
6315                 TreeSelectLogDeletePopupMenu.Visible := False;
6316         end;
6317 end;
6318
6319 procedure TGikoForm.BrowserNewWindow2(Sender: TObject;
6320         var ppDisp: IDispatch; var Cancel: WordBool);
6321 var
6322         Text: string;
6323         Html: string;
6324         URL: string;
6325         idx: Integer;
6326         wkIntSt: Integer;
6327         wkIntTo: Integer;
6328 begin
6329
6330         Cancel := True;
6331         if (IHTMLDocument2(TWebBrowser(Sender).Document).activeElement <> nil) then begin
6332                 Text := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerText;
6333                 Html := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerHTML;
6334                 if(AnsiPos('>>', Text) = 1) or (AnsiPos('>', Text) = 1)
6335                         or (AnsiPos('\81\84\81\84', Text) = 1) or (AnsiPos('\81\84', Text) = 1) then begin
6336                         if GikoSys.Setting.ResAnchorJamp then begin
6337                                 Text := ZenToHan(Text);
6338
6339                                 if(AnsiPos('>>', Text) = 1) then begin
6340                                         Text := Copy(Text, 3, Length(Text) - 2);
6341                                 end else begin
6342                                         Text := Copy(Text, 2, Length(Text) - 1);
6343                                 end;
6344                                 if AnsiPos('-', Text) <> 0 then begin
6345                                         wkIntSt := StrToIntDef(Copy(Text, 1, AnsiPos('-', Text) - 1), 0);
6346                                         Text := Copy(Text, AnsiPos('-', Text) + 1, Length(Text));
6347                                         wkIntTo := StrToIntDef(Text, 0);
6348                                         if wkIntTo < wkIntSt then
6349                                                 wkIntSt := wkIntTo;
6350                                 end else
6351                                         wkIntSt := StrToIntDef(Text, 0);
6352
6353                                 if wkIntSt <> 0 then
6354                                         BrowserMovement(IntToStr(wkIntSt));
6355                         end;
6356                 end else begin
6357                         URL := GikoSys.GetHRefText(Html);
6358                         URL := GikoSys.HTMLDecode(URL);
6359                         if( AnsiPos('http://', URL) = 1) or (AnsiPos('https://', URL) = 1) or
6360                                 ( AnsiPos('ftp://', URL) = 1) then begin
6361                                 //\83A\83h\83\8c\83X\83o\81[\82Ì\97\9a\97ð
6362                                 if GikoSys.Setting.LinkAddAddressBar then begin
6363                                         idx := AddressComboBox.Items.IndexOf(URL);
6364                                         if idx = -1 then begin
6365                                                 AddressComboBox.Items.Insert(0, URL);
6366                                                 if AddressComboBox.Items.Count > GikoSys.Setting.AddressHistoryCount then
6367                                                         AddressComboBox.Items.Delete(AddressComboBox.Items.Count - 1);
6368                                         end else begin
6369                                                 AddressComboBox.Items.Delete(idx);
6370                                                 AddressComboBox.Items.Insert(0, URL);
6371                                         end;
6372                                 end;
6373                                 MoveToURL( URL );
6374                         end;
6375                 end;
6376         end;
6377
6378 {       ShiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
6379         CtrlDown := GetAsyncKeyState(VK_CONTROL) = Smallint($8001);
6380
6381         if ShiftDown then
6382                 Memo1.Lines.Add('ShiftDown');
6383         if CtrlDown then
6384                 Memo1.Lines.Add('CtrlDown');
6385
6386         if      (IHTMLDocument2(TWebBrowser(Sender).Document).activeElement <> nil) then        begin
6387                 Text := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerText;
6388                 Url := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerHTML;
6389
6390
6391
6392                 URL := GetHRefText(URL);
6393
6394                 ParseURI(URL, Protocol, Host, path, Document, Port, Bookmark);
6395
6396                 b := Parse2chURL(path, document, bbs, num);
6397                 memo1.Lines.Add('bbs: ' + bbs);
6398                 memo1.Lines.Add('key: ' + num);
6399                 if b then
6400                         Memo1.Lines.Add('Parse2chURL: True')
6401                 else
6402                         Memo1.Lines.Add('Parse2chURL: False');
6403
6404 //      AppPath := 'C:\Borland\Projects\Test\TestBrowser\TestBrowser.exe';
6405
6406         end;}
6407 end;
6408
6409 procedure TGikoForm.ListSplitterMoved(Sender: TObject);
6410 begin
6411         if Mouse.Capture <> 0 then
6412                 Exit;
6413         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
6414                 if (ViewPanel.Width > 1) and (ViewPanel.Width <= (ThreadMainPanel.Width - 80)) then
6415                         FBrowserSizeWidth := ViewPanel.Width;
6416         end else begin
6417                 if (ViewPanel.Height > 1) and (ViewPanel.Height <= (ThreadMainPanel.Height - BrowserCoolBar.Height)) then
6418                         FBrowserSizeHeight := ViewPanel.Height;
6419         end;
6420         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
6421                 if ViewPanel.Width < 2 then begin
6422                         ViewPanel.Width := 1;
6423                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
6424                         BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
6425                         GikoSys.Setting.ListWidthState := glsMax;
6426                 end else if ViewPanel.Width > (ThreadMainPanel.Width - 80) then begin
6427                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
6428                         BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
6429                         GikoSys.Setting.ListWidthState := glsMin;
6430                 end else begin
6431                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
6432                         BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
6433                         GikoSys.Setting.ListWidthState := glsNormal;
6434                 end;
6435         end else begin
6436                 if ViewPanel.Height < 2 then begin
6437                         ViewPanel.Height := 1;
6438                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
6439                         BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
6440                         GikoSys.Setting.ListHeightState := glsMax;
6441                 end else if ViewPanel.Height > (ThreadMainPanel.Height - BrowserCoolBar.Height - 7) then begin
6442                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
6443                         BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
6444                         GikoSys.Setting.ListHeightState := glsMin;
6445                 end else begin
6446                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
6447                         BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
6448                         GikoSys.Setting.ListHeightState := glsNormal;
6449                 end;
6450         end;
6451 {       if (Mouse.Capture = 0) and (ViewPanel.Height > 1) and (not ArrangeAction.Checked) then
6452                 FBrowserSizeHeight := ViewPanel.Height
6453         else if (Mouse.Capture = 0) and (ViewPanel.Width > 1) and (ArrangeAction.Checked) then
6454                 FBrowserSizeWidth := ViewPanel.Width;}
6455 end;
6456
6457 procedure TGikoForm.BrowserTabChange(Sender: TObject);
6458 var
6459         i, j: Integer;
6460         idx: Integer;
6461 begin
6462
6463 //      if NewTab = -1 then
6464 //      ThreadItem := nil;
6465         if not BrowserTab.Dragging then begin
6466                 FTabHintIndex := -1;
6467                 BrowserTab.Hint := '';
6468                 idx := BrowserTab.TabIndex;
6469                 if idx = -1 then begin
6470                         BrowserNullTab.Thread := nil;
6471                         SetContent(BrowserNullTab);
6472
6473                 end else if(BrowserTab.Tabs.Objects[idx] <> nil) and (BrowserTab.Tabs.Objects[idx] is TBrowserRecord) then begin
6474                         if TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Browser <> nil then begin
6475                                 j := FBrowsers.IndexOf(TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Browser);
6476                                 if j <> -1 then
6477                                         FBrowsers.Move(j ,0);
6478                         end else begin
6479                                 if( FActiveContent <> nil ) and (FActiveContent.Browser <> nil) and
6480                                         (FActiveContent.Browser <> BrowserNullTab.Browser) and
6481                                         (FActiveContent.Browser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1])) then
6482                                         FBrowsers.Move(BROWSER_COUNT - 1, 0);
6483
6484                                 for i := 0 to BrowserTab.Tabs.Count - 1 do begin
6485                                         if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
6486                                                 ReleaseBrowser(TBrowserRecord(BrowserTab.Tabs.Objects[i]));
6487                                                 break;
6488                                         end;
6489                                 end;
6490                                 TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Browser := TWebBrowser(FBrowsers[BROWSER_COUNT - 1]);
6491                                 TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Repaint := true;
6492                                 FBrowsers.Move(BROWSER_COUNT - 1, 0);
6493                         end;
6494                         MoveWindow(TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Browser.Handle, 0, 0, BrowserPanel.Width, BrowserPanel.Height, false);
6495                         TOleControl(TBrowserRecord(BrowserTab.Tabs.Objects[idx]).Browser).BringToFront;
6496 //                      GikoSys.OnlyAHundredRes := TBrowserRecord(BrowserTab.Tabs.Objects[idx]).OnlyHundred;
6497 //                      OnlyAHundredRes.Checked := TBrowserRecord(BrowserTab.Tabs.Objects[idx]).OnlyHundred;
6498                         SetContent(TBrowserRecord(BrowserTab.Tabs.Objects[idx]));
6499
6500                         if (GikoSys.Setting.URLDisplay) and (GetActiveContent <> nil) then
6501                                 AddressComboBox.Text := GetActiveContent.URL;
6502
6503                         if ((TreeView.Visible) and (TreeView.Focused)) or ((FavoriteTreeView.Visible) and (FavoriteTreeView.Focused)) or
6504                                 (ListView.Focused) or (SelectComboBox.Focused) or (AddressComboBox.Focused)
6505                         then
6506                         else
6507                 SetFocusForBrowserAction.Execute;       
6508
6509                 end;
6510
6511         end;
6512
6513 end;
6514
6515
6516 procedure TGikoForm.BrowserTabMouseDown(Sender: TObject;
6517         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
6518 var
6519         p: TPoint;
6520         p2: TPoint;
6521         idx: Integer;
6522 begin
6523         if Button = mbMiddle then begin
6524                 // \83}\83E\83X\92\86\83{\83^\83\93
6525                 GetCursorPos(p);
6526                 p2 := p;
6527                 p := BrowserTab.ScreenToClient(p);
6528                 idx := BrowserTab.IndexOfTabAt(p.X, p.Y);
6529                 if idx <> -1 then
6530                         DeleteTab(TBrowserRecord(BrowserTab.Tabs.Objects[idx]));
6531         //end else if Button = mbRight then begin
6532         //PopupMenu\82ÅBrowserTabPoupMenu\82ð\8ew\92è\82µ\82Ä\82¢\82é\82Ì\82Å\82±\82±\82Å\82í\82´\82í\82´\8cÄ\82Ñ\8fo\82·\82Æ\82Q\8fd\82É\82È\82é
6533         //OnContextPopup\82Å\82à\82µ\82àActive\82ÈTab\88È\8aO\82Å\8cÄ\82Ñ\8fo\82³\82ê\82½\82çTab\82ð\90Ø\82è\91Ö\82¦\82é\82æ\82¤\82É\82µ\82½\81B
6534 {               // \83}\83E\83X\89E\83{\83^\83\93
6535                 GetCursorPos(p);
6536                 p2 := p;
6537 //              GetCursorPos(p2);
6538                 p := BrowserTab.ScreenToClient(p);
6539 //              idx := BrowserTab.ItemAtPos(p);
6540                 idx := BrowserTab.IndexOfTabAt(p.X, p.Y);
6541                 if idx <> -1 then begin
6542                         OldIndex := BrowserTab.TabIndex;
6543                         BrowserTab.TabIndex := idx;
6544                         if OldIndex <> idx then
6545                                 BrowserTab.OnChange(nil);
6546                         BrowserTabPopupMenu.Tag := idx;
6547                         BrowserTabPopupMenu.Popup(p2.X, p2.Y);
6548                 end;
6549 }
6550         end else if BUtton = mbLeft then begin
6551                 FDragWFirst := true;
6552                 FMouseDownPos.X := X;
6553                 FMouseDownPos.Y := Y;
6554         end;
6555
6556 end;
6557
6558 procedure TGikoForm.SetBrowserTabState;
6559 var
6560 //      i: Integer;
6561         CoolBand: TCoolBand;
6562 begin
6563         BrowserBottomPanel.AutoSize := False;
6564         if GikoSys.Setting.BrowserTabVisible then begin
6565                 if GikoSys.Setting.BrowserTabStyle = gtsTab then begin
6566                         BrowserTab.Style := tsTabs;
6567                         if GikoSys.Setting.BrowserTabPosition = gtpTop then
6568                                 BrowserTab.TabPosition := tpTop
6569                         else
6570                                 BrowserTab.TabPosition := tpBottom;
6571                 end else if GikoSys.Setting.BrowserTabStyle = gtsButton then begin
6572                         BrowserTab.TabPosition := tpTop;
6573                         BrowserTab.Style := tsButtons;
6574                 end else begin
6575                         BrowserTab.TabPosition := tpTop;
6576                         BrowserTab.Style := tsFlatButtons
6577                 end;
6578
6579                 if GikoSys.Setting.BrowserTabPosition = gtpTop then begin
6580                         BrowserTab.Parent := BrowserTabToolBar;
6581                         BrowserBottomPanel.Hide;
6582                         CoolBand := GetCoolBand(BrowserCoolBar, BrowserTabToolBar);
6583                         if CoolBand <> nil then
6584                                 CoolBand.Visible := True;
6585 //                      BrowserTab.Parent := BrowserTopPanel;
6586 //                      BrowserTab.Parent := BrowserCoolBar;
6587 //                      BrowserTab.Top := 26;
6588 //                      BrowserTopPanel.Height := 44;
6589
6590                 end else begin
6591                         BrowserTab.Parent := BrowserBottomPanel;
6592                         BrowserTab.Top := 0;
6593                         BrowserTab.Left := 0;
6594                         BrowserBottomPanel.Show;
6595                         CoolBand := GetCoolBand(BrowserCoolBar, BrowserTabToolBar);
6596                         if CoolBand <> nil then
6597                                 CoolBand.Visible := False;
6598 //                      BrowserTopPanel.Height := 26;
6599                 end;
6600                 BrowserTab.Show;
6601         end else begin
6602                 CoolBand := GetCoolBand(BrowserCoolBar, BrowserTabToolBar);
6603                 if CoolBand <> nil then
6604                         CoolBand.Visible := False;
6605                 BrowserBottomPanel.Visible := False;
6606 //              BrowserTab.Visible := False;
6607 //              BrowserTopPanel.Height := 26;
6608                 AllTabCloseAction.Execute;
6609         end;
6610 end;
6611
6612 procedure TGikoForm.BrowserTabDragOver(Sender, Source: TObject; X,
6613         Y: Integer; State: TDragState; var Accept: Boolean);
6614 var
6615         idx: Integer;
6616 begin
6617         idx := BrowserTab.IndexOfTabAt(X, Y);
6618         Accept := (Source = BrowserTab) and (BrowserTab.TabIndex <> idx);
6619 end;
6620
6621 procedure TGikoForm.BrowserTabDragDrop(Sender, Source: TObject; X,
6622         Y: Integer);
6623 var
6624         idx: Integer;
6625 begin
6626         idx := BrowserTab.IndexOfTabAt(X, Y);
6627         if idx <> -1 then
6628                 BrowserTab.Tabs.Move(BrowserTab.TabIndex, idx);
6629 end;
6630
6631 procedure TGikoForm.BrowserTabMouseMove(Sender: TObject;
6632         Shift: TShiftState; X, Y: Integer);
6633 var
6634         TabIdx: Integer;
6635         ThreadItem: TThreadItem;
6636 begin
6637
6638         TabIdx := BrowserTab.IndexOfTabAt(x, y);
6639
6640         if ( ssLeft in Shift ) and ( BrowserTab.Style = tsTabs ) then begin
6641                 if FDragWFirst = false then begin
6642                         FDragWFirst := true;
6643                 end else begin
6644                         BrowserTab.EndDrag(false);
6645                         BrowserTab.BeginDrag(false, DandD_THRESHOLD);
6646                         FDragWFirst := false;
6647                 end;
6648         end else begin
6649                 BrowserTab.EndDrag(false);
6650                 FDragWFirst := false;
6651         end;
6652         
6653         if (FTabHintIndex <> TabIdx) and (TabIdx <> -1) then begin
6654                 Application.CancelHint;
6655                 ThreadItem := TBrowserRecord(BrowserTab.Tabs.Objects[TabIdx]).Thread;
6656                 if ThreadItem.Title <> BrowserTab.Tabs[TabIdx] then begin
6657                         BrowserTab.Hint := ThreadItem.Title;
6658                         Application.ShowHint := True;
6659                 end else begin
6660                         BrowserTab.Hint := '';
6661                         Application.ShowHint := True;
6662                 end;
6663                 FTabHintIndex := TabIdx;
6664         end;
6665
6666 end;
6667
6668 procedure TGikoForm.BrowserDocumentComplete(Sender: TObject;
6669         const pDisp: IDispatch; var URL: OleVariant);
6670 var
6671         FDispHtmlDocument: DispHTMLDocument;
6672         BrowserRecord :TBrowserRecord;
6673         i :Integer;
6674         doc                                     : Variant;
6675         threadItem      : TThreadItem;
6676 begin
6677 //      AddMessageList('DocumentComplete', nil, gmiWhat);
6678         if TObject(Sender) is TWebBrowser then begin
6679                 BrowserRecord := nil;
6680                 if TWebBrowser(Sender) <> Browser then begin
6681                         for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
6682                                 if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser = TWebBrowser(Sender) then begin
6683                                                 BrowserRecord := TBrowserRecord(BrowserTab.Tabs.Objects[i]);
6684                                                 break;
6685                                 end;
6686                         end;
6687                         if BrowserRecord <> nil then begin
6688                                 if BrowserRecord.FEvent <> nil then
6689                                         BrowserRecord.FEvent.Free;
6690                                 FDispHtmlDocument := Idispatch(OleVariant(BrowserRecord.Browser.ControlInterface).Document) as DispHTMLDocument;
6691                                 BrowserRecord.FEvent := THTMLDocumentEventSink.Create(Self, FDispHtmlDocument, HTMLDocumentEvents2);
6692                                 BrowserRecord.FEvent.OnContextMenu := OnDocumentContextMenu;
6693                                 BrowserRecord.FEvent.OnClick := WebBrowserClick;  //\92Ç\89Á\82µ\82½OnClick\83C\83x\83\93\83g
6694                                 BrowserRecord.FEvent.OnMouseDown := WebBrowserOnMouseDown;
6695                         end;
6696                 end else begin
6697                         if GetActiveContent <> nil then begin
6698                                 FDispHtmlDocument := Idispatch(OleVariant(Browser.ControlInterface).Document) as DispHTMLDocument;
6699                                 if FEvent <> nil then
6700                                         FEvent.Free;
6701                                 FEvent := THTMLDocumentEventSink.Create(Self, FDispHtmlDocument, HTMLDocumentEvents2);
6702                                 FEvent.OnContextMenu := OnDocumentContextMenu;
6703                                 FEvent.OnClick := WebBrowserClick;  //\92Ç\89Á\82µ\82½OnClick\83C\83x\83\93\83g
6704                                 FEvent.OnMouseDown := WebBrowserOnMouseDown;;
6705                         end;
6706                 end;
6707
6708                 if (BrowserRecord <> nil) and
6709                          Assigned( BrowserRecord.Thread ) then begin
6710                         threadItem := BrowserRecord.Thread;
6711
6712                         if (BrowserRecord <> nil) and (Length( BrowserRecord.Movement ) > 0) then begin
6713                                 if threadItem.UnRead then begin
6714                                         threadItem.UnRead := False;
6715                                         threadItem.ParentBoard.UnRead := ThreadItem.ParentBoard.UnRead - 1;
6716                                         if threadItem.ParentBoard.UnRead < 0 then threadItem.ParentBoard.UnRead := 0;
6717                                         TreeView.Refresh;
6718                                         ListView.Refresh;
6719                                 end;
6720                                 BrowserMovement( BrowserRecord.Movement, BrowserRecord );
6721                                 BrowserRecord.Movement := '';
6722                         end else if threadItem.UnRead then begin
6723                                 threadItem.UnRead := False;
6724                                 threadItem.ParentBoard.UnRead := ThreadItem.ParentBoard.UnRead - 1;
6725                                 if threadItem.ParentBoard.UnRead < 0 then threadItem.ParentBoard.UnRead := 0;
6726                                 TreeView.Refresh;
6727                                 BrowserMovement( 'new', BrowserRecord );
6728                                 ListView.Refresh;
6729                         end else if threadItem.ScrollTop <> 0 then begin
6730                                 try
6731                                         doc := Idispatch( OleVariant( BrowserRecord.Browser.ControlInterface ).Document ) as IHTMLDocument2;
6732                                         doc.Body.ScrollTop := threadItem.ScrollTop;
6733                                 except
6734                                         on E: Exception do
6735                                                 MsgBox(Handle, E.Message, 'SetContent[ScrollTop<-]', 0);
6736                                 end;
6737                         end;
6738                 end;
6739         end;
6740 end;
6741
6742 procedure TGikoForm.SelectReservActionUpdate(Sender: TObject);
6743 var
6744         i: Integer;
6745         List: TList;
6746 begin
6747         if (GetActiveList is TBoard) and (ListView.SelCount > 0) then begin
6748                 List := TList.Create;
6749                 try
6750                         SelectListItem(List);
6751                         for i := 0 to List.Count - 1 do begin
6752                                 if TObject(List[i]) is TThreadItem then begin
6753                                         if TThreadItem(List[i]).IsLogFile then begin
6754                                                 SelectReservAction.Enabled := True;
6755                                                 Exit;
6756                                         end;
6757                                 end;
6758                         end;
6759                         SelectReservAction.Enabled := False;
6760                 finally
6761                         List.Free;
6762                 end;
6763         end else if (GetActiveList is TCategory) and (ListView.SelCount > 0) then
6764                 SelectReservAction.Enabled := True
6765         else
6766                 SelectReservAction.Enabled := False;
6767 end;
6768
6769 procedure TGikoForm.RoundNamePopupMenuPopup(Sender: TObject);
6770 begin
6771         AddRoundNameMenu(RoundNamePopupMenu.Items);
6772 end;
6773
6774 procedure TGikoForm.AddRoundNameMenu(MenuItem: TMenuItem);
6775 var
6776         i: Integer;
6777         Item: TMenuItem;
6778 begin
6779         MenuItem.Clear;
6780         Item := TMenuItem.Create(Self);
6781         Item.Caption := '\90V\82µ\82¢\96¼\91O\82Å\8f\84\89ñ\97\\96ñ(&N)...';
6782         Item.OnClick := SelectNewRoundNameExecute;
6783         MenuItem.Add(Item);
6784         Item := TMenuItem.Create(Self);
6785         Item.Caption := '\8f\84\89ñ\83\8a\83X\83g\82©\82ç\8dí\8f\9c(&D)';
6786         Item.OnClick := SelectDeleteRoundExecute;
6787         MenuItem.Add(Item);
6788         Item := TMenuItem.Create(Self);
6789         Item.Caption := '-';
6790         MenuItem.Add(Item);
6791         for i := 0 to RoundList.RoundNameList.Count - 1 do begin
6792                 Item := TMenuItem.Create(Self);
6793                 Item.Caption := RoundList.RoundNameList[i];
6794                 Item.OnClick := SetSelectRoundName;
6795                 MenuItem.Add(Item);
6796         end;
6797 end;
6798
6799 procedure TGikoForm.SelectNewRoundNameExecute(Sender: TObject);
6800 var
6801         s: string;
6802         Dlg: TRoundNameDialog;
6803
6804 begin
6805         Dlg := TRoundNameDialog.Create(Self);
6806         try
6807                 Dlg.ShowModal;
6808                 if Dlg.ModalResult <> mrCancel then begin
6809                         s := Trim(Dlg.RoundNameEdit.Text);
6810                         RoundList.RoundNameList.Add(s);
6811                         SetSelectItemRound(True, s, TMenuItem(Sender).Parent.Name);
6812             ListView.Refresh;
6813                 end;
6814         finally
6815                 Dlg.Free;
6816         end;
6817 end;
6818 procedure TGikoForm.SetSelectItemRound(RoundFlag: Boolean; RoundName: string; ParentName: string);
6819 var
6820     threadItem : TThreadItem;
6821 begin
6822     if ParentName <> 'dummy1' then begin
6823         SetSelectItemRound(RoundFlag, RoundName);
6824     end else begin
6825         threadItem := GetActiveContent;
6826                 if threadItem <> nil then begin
6827                 threadItem.RoundName := RoundName;
6828             threadItem.Round := RoundFlag;
6829         end;
6830     end;
6831 end;
6832
6833 procedure TGikoForm.SetSelectItemRound(RoundFlag: Boolean; RoundName: string);
6834 var
6835         i: Integer;
6836         List: TList;
6837 begin
6838         List := TList.Create;
6839         try
6840                 SelectListItem(List);
6841                 for i := 0 to List.Count - 1 do begin
6842                         if TObject(List[i]) is TBoard then begin
6843                                 TBoard(List[i]).RoundName := RoundName;
6844                                 TBoard(List[i]).Round := RoundFlag;
6845                         end else if TObject(List[i]) is TThreadItem then begin
6846                                 if TThreadItem(List[i]).IsLogFile then begin
6847                                         TThreadItem(List[i]).RoundName := RoundName;
6848                                         TThreadItem(List[i]).Round := RoundFlag;
6849                                 end;
6850                         end;
6851                 end;
6852         finally
6853                 List.Free;
6854         end;
6855 end;
6856
6857 procedure TGikoForm.SelectDeleteRoundExecute(Sender: TObject);
6858 begin
6859         SetSelectItemRound(False, '', TMenuItem(Sender).Parent.Name);
6860         ListView.Refresh;
6861 end;
6862
6863 procedure TGikoForm.SelectReservActionExecute(Sender: TObject);
6864 begin
6865         // \82±\82Ì\83R\83\81\83\93\83g\8dí\8f\9c\82µ\82Ä\82Í\91Ê\96Ú
6866 end;
6867
6868 procedure TGikoForm.SetSelectRoundName(Sender: TObject);
6869 var
6870         MenuItem: TMenuItem;
6871 begin
6872         if Sender is TMenuItem then begin
6873                 MenuItem := TMenuItem(Sender);
6874                 SetSelectItemRound(True, StripHotKey(MenuItem.Caption), TMenuItem(Sender).Parent.Name);
6875                 ListView.Refresh;
6876         end;
6877 end;
6878
6879 procedure TGikoForm.NewBoardActionExecute(Sender: TObject);
6880 var
6881         Dlg: TNewBoardDialog;
6882         Msg: string;
6883         i: Integer;
6884 begin
6885         for i := 0 to Screen.CustomFormCount - 1 do begin
6886                 if TObject(Screen.CustomForms[i]) is TEditorForm then begin
6887                         Msg := '\83\8c\83X\83G\83f\83B\83^\82ð\91S\82Ä\95Â\82\82Ä\82­\82¾\82³\82¢';
6888                         MsgBox(Handle, Msg, '\83G\83\89\81[', MB_OK or MB_ICONSTOP);
6889                         Exit;
6890                 end;
6891         end;
6892         Dlg := TNewBoardDialog.Create(Self);
6893         try
6894                 Dlg.ShowModal;
6895         finally
6896                 Dlg.Release;
6897         end;
6898 end;
6899
6900 procedure TGikoForm.LoginActionExecute(Sender: TObject);
6901 var
6902         TmpCursor: TCursor;
6903         msg : String;
6904 begin
6905         if GikoSys.Dolib.Connected then begin
6906                 //\83\8d\83O\83A\83E\83g
6907                 GikoSys.Dolib.Disconnect;
6908                 LoginAction.Checked := False;
6909                 if GikoSys.Setting.GengoSupport then begin
6910                         AddMessageList(GikoSys.Setting.Gengo.Names[1], nil, gmiOK);
6911                 end else begin
6912                         AddMessageList('\83\8d\83O\83A\83E\83g\82µ\82Ü\82µ\82½', nil, gmiOK);
6913                 end;
6914                 LoginAction.Caption := '\83\8d\83O\83C\83\93(&L)';
6915         end else begin
6916                 TmpCursor := Screen.Cursor;
6917                 Screen.Cursor := crHourGlass;
6918                 try
6919             //\92Ê\8fí\83\8d\83O\83C\83\93
6920             if not GikoSys.Setting.ForcedLogin then begin
6921                                 GikoSys.Dolib.ClientUA := 'gikoNavi/1.00';
6922                                 GikoSys.Dolib.UserName := GikoSys.Setting.UserID;
6923                                 GikoSys.Dolib.Password := GikoSys.Setting.Password;
6924                                 if GikoSys.Setting.ReadProxy then begin
6925                                         GikoSys.Dolib.ProxyAddress := GikoSys.Setting.ReadProxyAddress;
6926                                         GikoSys.Dolib.ProxyPort := GikoSys.Setting.ReadProxyPort;
6927                                 end else begin
6928                                         GikoSys.Dolib.ProxyAddress := '';
6929                                         GikoSys.Dolib.ProxyPort := 0;
6930                                 end;
6931                                 if GikoSys.Dolib.Connect then begin
6932                                         LoginAction.Checked := True;
6933                                 if GikoSys.Setting.GengoSupport then begin
6934                                         AddMessageList(GikoSys.Setting.Gengo.Names[2] + GikoSys.Setting.UserID, nil, gmiOK);
6935                                 end else begin
6936                                         AddMessageList('\83\8d\83O\83C\83\93\82µ\82Ü\82µ\82½ - ' + GikoSys.Setting.UserID, nil, gmiOK);
6937                                 end;
6938                                 LoginAction.Caption := '\83\8d\83O\83A\83E\83g(&L)';
6939                                 LoginToolButton.Style := tbsCheck;
6940                                 end else begin
6941                 //                      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);
6942                                         AddMessageList(GikoSys.Dolib.ErrorMsg, nil, gmiNG);
6943                                         PlaySound('Error');
6944                                         LoginAction.Checked := False;
6945                                         LoginToolButton.Down := False;
6946                                         LoginToolButton.Style := tbsButton;
6947                                 end;
6948                 end else begin
6949                                 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
6950                                                 + '\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
6951                         + '\82±\82Ì\83\82\81[\83h\82Å\83\8d\83O\83C\83\93\82ð\8e\8e\82Ý\82Ü\82·\82©\81H' + #13#10;
6952                 if MsgBox(Handle, msg, '\8cx\8d\90', MB_YESNO or MB_ICONEXCLAMATION) = IDYES   then begin
6953                     GikoSys.Dolib.ClientUA := 'gikoNavi/1.00';
6954                     GikoSys.Dolib.UserName := GikoSys.Setting.UserID;
6955                     GikoSys.Dolib.Password := GikoSys.Setting.Password;
6956                     if GikoSys.Setting.ReadProxy then begin
6957                         GikoSys.Dolib.ProxyAddress := GikoSys.Setting.ReadProxyAddress;
6958                         GikoSys.Dolib.ProxyPort := GikoSys.Setting.ReadProxyPort;
6959                     end else begin
6960                         GikoSys.Dolib.ProxyAddress := '';
6961                         GikoSys.Dolib.ProxyPort := 0;
6962                     end;
6963                     //SSL\8fá\8aQ\97p\8b­\90§\83\8d\83O\83C\83\93
6964                     GikoSys.Dolib.ForcedConnect;
6965                     if GikoSys.Dolib.Connect then begin
6966                         LoginAction.Checked := True;
6967                         AddMessageList('\8b­\90§\83\8d\83O\83C\83\93\82µ\82Ü\82µ\82½ - ' + GikoSys.Setting.UserID, nil, gmiOK);
6968                         LoginAction.Caption := '\83\8d\83O\83A\83E\83g(&L)';
6969                         LoginToolButton.Style := tbsCheck;
6970                     end else begin
6971             //                  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);
6972                         AddMessageList(GikoSys.Dolib.ErrorMsg, nil, gmiNG);
6973                         PlaySound('Error');
6974                                                 LoginAction.Checked := False;
6975                         LoginToolButton.Down := False;
6976                         LoginToolButton.Style := tbsButton;
6977                     end;
6978                 end else begin
6979                         LoginAction.Checked := False;
6980                     LoginToolButton.Down := False;
6981                     LoginToolButton.Style := tbsButton;
6982                 end;
6983             end;
6984                 finally
6985                         Screen.Cursor := TmpCursor;
6986                 end;
6987         end;
6988 end;
6989
6990 procedure TGikoForm.KeySettingActionExecute(Sender: TObject);
6991 var
6992         Dlg: TKeySettingForm;
6993 begin
6994         Dlg := TKeySettingForm.Create(Self);
6995         try
6996                 if Dlg.ShowModal = mrOk then begin
6997                         GikoSys.SaveKeySetting(ActionList);
6998                         GikoSys.Setting.Gestures.SaveGesture( GikoSys.Setting.GetGestureFileName );
6999                 end;
7000                 GikoSys.SaveEditorKeySetting(Dlg.EditorForm.ActionList);
7001         finally
7002                 Dlg.Release;
7003                 MouseGesture.UnHook;
7004                 MouseGesture.OnGestureStart := OnGestureStart;
7005                 MouseGesture.OnGestureMove := OnGestureMove;
7006                 MouseGesture.OnGestureEnd := OnGestureEnd;
7007                 if GikoSys.Setting.GestureEnabled then
7008                         MouseGesture.SetHook( Handle );
7009         end;
7010 end;
7011
7012 procedure TGikoForm.ArrangeActionExecute(Sender: TObject);
7013 begin
7014         if ArrangeAction.Checked then begin
7015                 //\8fc
7016                 ViewPanel.Align := alNone;
7017                 ListSplitter.Align := alNone;
7018                 ThreadPanel.Align := alNone;
7019
7020                 ViewPanel.Width := FBrowserSizeWidth;
7021                 ViewPanel.Align := alLeft;
7022
7023                 ListSplitter.Width := 5;
7024                 ListSplitter.Align := alLeft;
7025
7026                 ViewPanel.Left := -10;
7027
7028                 ThreadPanel.Align := alClient;
7029
7030                 GikoSys.Setting.ListOrientation := gloHorizontal;
7031                 case GikoSys.Setting.ListWidthState of
7032                         glsMax: begin
7033                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
7034                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
7035                                 ViewPanel.Width := 1;
7036                         end;
7037                         glsNormal: begin
7038                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
7039                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
7040                         end;
7041                         glsMin: begin
7042                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
7043                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
7044                                 ViewPanel.Width := ThreadMainPanel.Width - 80;
7045                         end;
7046                 end;
7047         end else begin
7048                 //\89¡
7049                 ViewPanel.Align := alNone;
7050                 ListSplitter.Align := alNone;
7051                 ThreadPanel.Align := alNone;
7052
7053                 ViewPanel.Height := FBrowserSizeHeight;
7054                 ViewPanel.Align := alTop;
7055
7056                 ListSplitter.Height := 5;
7057                 ListSplitter.Align := alTop;
7058
7059                 ViewPanel.Top := -10;
7060
7061                 ThreadPanel.Align := alClient;
7062                 GikoSys.Setting.ListOrientation := gloVertical;
7063                 case GikoSys.Setting.ListHeightState of
7064                         glsMax: begin
7065                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
7066                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
7067                                 ViewPanel.Height := 1;
7068                         end;
7069                         glsNormal: begin
7070                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
7071                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
7072                         end;
7073                         glsMin: begin
7074                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
7075                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
7076                                 ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
7077                         end;
7078                 end;
7079         end;
7080
7081 end;
7082
7083 procedure TGikoForm.PaneInitActionExecute(Sender: TObject);
7084 begin
7085         CabinetPanel.Width := 150;
7086         MessagePanel.Height := 40;
7087
7088         FBrowserSizeWidth := 200;
7089         FBrowserSizeHeight := 200;
7090         if ArrangeAction.Checked then begin
7091                 ViewPanel.Width := FBrowserSizeWidth;
7092         end else begin
7093                 ViewPanel.Height := FBrowserSizeHeight;
7094         end;
7095         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
7096                 if GikoSys.Setting.ListHeightState = glsMax then begin
7097                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
7098                         GikoSys.Setting.ListHeightState := glsNormal;
7099                 end;
7100         end else begin
7101                 if GikoSys.Setting.ListWidthState = glsMax then begin
7102                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
7103                         GikoSys.Setting.ListWidthState := glsNormal;
7104                 end;
7105         end;
7106 end;
7107
7108 procedure TGikoForm.ActiveLogDeleteActionExecute(Sender: TObject);
7109 const
7110         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';
7111         DEL_TITLE = '\8dí\8f\9c\8am\94F';
7112 var
7113         idx: Integer;
7114         ThreadItem: TThreadItem;
7115 begin
7116         idx := BrowserTab.TabIndex;
7117         if idx <> -1 then begin
7118                 if BrowserTab.Tabs.Objects[idx] <> nil then begin
7119                         ThreadItem := TBrowserRecord(BrowserTab.Tabs.Objects[idx]).FThread;
7120                         if GikoSys.Setting.DeleteMsg then
7121                                 if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
7122                                         if MsgBox(Handle, StringReplace( DEL_MSG, '^0', ThreadItem.Title, [rfReplaceAll] ) , DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
7123                                                 Exit;
7124                         DeleteTab(TBrowserRecord(BrowserTab.Tabs.Objects[idx]));
7125                         ThreadItem.DeleteLogFile;
7126                         if ThreadItem.ParentBoard = FActiveList then
7127                                 ListView.Refresh;
7128                 end;
7129         end;
7130 end;
7131
7132 function TGikoForm.GetCoolBand(CoolBar: TCoolBar; Control: TWinControl): TCoolBand;
7133 var
7134         i: Integer;
7135 begin
7136         Result := nil;
7137         if CoolBar = nil then
7138                 Exit;
7139         for i := 0 to CoolBar.Bands.Count - 1 do begin
7140                 if CoolBar.Bands[i].Control = Control then begin
7141                         Result := CoolBar.Bands[i];
7142                         Exit;
7143                 end;
7144         end;
7145 end;
7146
7147 procedure TGikoForm.BrowserTabToolBarResize(Sender: TObject);
7148 begin
7149         if BrowserTab.Parent = BrowserTabToolBar then
7150                 BrowserTab.Width := BrowserTabToolBar.Width;
7151 end;
7152
7153 procedure TGikoForm.SelectTextClearActionExecute(Sender: TObject);
7154 const
7155         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';
7156         DEL_TITLE = '\8dí\8f\9c\8am\94F';
7157 begin
7158         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
7159                 if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
7160                         Exit;
7161         GikoSys.Setting.SelectTextList.Clear;
7162         SelectComboBox.Items.Clear;
7163         SelectComboBox.Text := '';
7164         SetListViewType( gvtAll );
7165 end;
7166
7167 procedure TGikoForm.NameTextClearActionExecute(Sender: TObject);
7168 var
7169         i: Integer;
7170 const
7171         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';
7172         DEL_TITLE = '\8dí\8f\9c\8am\94F';
7173 begin
7174         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
7175                 if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
7176                         Exit;
7177         GikoSys.Setting.NameList.Clear;
7178         for i := 0 to Screen.CustomFormCount - 1 do begin
7179                 if TObject(Screen.CustomForms[i]) is TEditorForm then
7180                         TEditorForm(Screen.CustomForms[i]).NameComboBox.Items.Clear;
7181         end;
7182 end;
7183
7184 procedure TGikoForm.MailTextClearActionExecute(Sender: TObject);
7185 var
7186         i: Integer;
7187 const
7188         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';
7189         DEL_TITLE = '\8dí\8f\9c\8am\94F';
7190 begin
7191         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
7192                 if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
7193                         Exit;
7194         GikoSys.Setting.MailList.Clear;
7195         for i := 0 to Screen.CustomFormCount - 1 do begin
7196                 if TObject(Screen.CustomForms[i]) is TEditorForm then
7197                         TEditorForm(Screen.CustomForms[i]).MailComboBox.Items.Clear;
7198         end;
7199 end;
7200
7201 procedure TGikoForm.LeftmostTabSelectActionExecute(Sender: TObject);
7202 begin
7203         if BrowserTab.Tabs.Count > 0 then begin
7204                 BrowserTab.TabIndex := 0;
7205                 BrowserTab.OnChange(nil);
7206         end;
7207 end;
7208
7209 procedure TGikoForm.LeftTabSelectActionExecute(Sender: TObject);
7210 begin
7211         if BrowserTab.Tabs.Count > 0 then begin
7212                 if BrowserTab.TabIndex = -1 then begin
7213                         BrowserTab.TabIndex := 0;
7214                         BrowserTab.OnChange(nil);
7215                 end else if BrowserTab.TabIndex > 0 then begin
7216                         BrowserTab.TabIndex := BrowserTab.TabIndex - 1;
7217                         BrowserTab.OnChange(nil);
7218                 end;
7219         end;
7220 end;
7221
7222 procedure TGikoForm.RightTabSelectActionExecute(Sender: TObject);
7223 begin
7224         if BrowserTab.Tabs.Count > 0 then begin
7225                 if BrowserTab.TabIndex = -1 then begin
7226                         BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1;
7227                         BrowserTab.OnChange(nil);
7228                 end else if BrowserTab.TabIndex < (BrowserTab.Tabs.Count - 1) then begin
7229                         BrowserTab.TabIndex := BrowserTab.TabIndex + 1;
7230                         BrowserTab.OnChange(nil);
7231                 end;
7232         end;
7233 end;
7234
7235 procedure TGikoForm.RightmostTabSelectActionExecute(Sender: TObject);
7236 begin
7237         if BrowserTab.Tabs.Count > 0 then begin
7238                 BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1;
7239                 BrowserTab.OnChange(nil);
7240         end;
7241 end;
7242
7243 procedure TGikoForm.LeftmostTabSelectActionUpdate(Sender: TObject);
7244 begin
7245         LeftmostTabSelectAction.Enabled := (BrowserTab.TabIndex <> 0) and (BrowserTab.Tabs.Count > 0);
7246 end;
7247
7248 procedure TGikoForm.LeftTabSelectActionUpdate(Sender: TObject);
7249 begin
7250         LeftTabSelectAction.Enabled := (BrowserTab.TabIndex <> 0) and (BrowserTab.Tabs.Count > 0);
7251 end;
7252
7253 procedure TGikoForm.RightTabSelectActionUpdate(Sender: TObject);
7254 begin
7255         RightTabSelectAction.Enabled := (BrowserTab.TabIndex <> BrowserTab.Tabs.Count - 1) and (BrowserTab.Tabs.Count > 0);
7256 end;
7257
7258 procedure TGikoForm.RightmostTabSelectActionUpdate(Sender: TObject);
7259 begin
7260         RightmostTabSelectAction.Enabled := (BrowserTab.TabIndex <> BrowserTab.Tabs.Count - 1) and (BrowserTab.Tabs.Count > 0);
7261 end;
7262
7263 procedure TGikoForm.WMSettingChange(var Message: TWMWinIniChange);
7264 begin
7265         SetMenuFont;
7266 end;
7267
7268 procedure TGikoForm.SetMenuFont;
7269 begin
7270 //      GikoSys.MenuFont(MenuToolBar.Font);
7271 //      MenuToolBar.Buttons[0].AutoSize := False;
7272 //      MenuToolBar.Buttons[0].AutoSize := True;
7273 //      MenuToolBar.Font.Color := clMenuText;
7274         GikoSys.MenuFont(MainCoolBar.Font);
7275         MenuToolBar.Buttons[0].AutoSize := False;
7276         MenuToolBar.Buttons[0].AutoSize := True;
7277         MainCoolBar.AutoSize := False;
7278         MainCoolBar.AutoSize := True;
7279
7280         GikoSys.MenuFont(ListCoolBar.Font);
7281         GikoSys.MenuFont(BrowserCoolBar.Font);
7282 //      MenuToolBar.Font.Color := clMenuText;
7283 end;
7284
7285 procedure TGikoForm.FavoriteMenuClick(Sender: TObject);
7286 var
7287         NewMenu: TMenuItem;
7288 begin
7289         FavoriteMenu.Clear;
7290
7291         //\82¨\8bC\82É\93ü\82è\82Ì\92Ç\89Á
7292         NewMenu := TMenuItem.Create(MainMenu);
7293         NewMenu.Action := FavoriteAddAction;
7294         FavoriteMenu.Add(NewMenu);
7295         //\82¨\8bC\82É\93ü\82è\82Ì\90®\97\9d
7296         NewMenu := TMenuItem.Create(FavoriteMenu);
7297         NewMenu.Action := FavoriteArrangeAction;
7298         FavoriteMenu.Add(NewMenu);
7299         //\83Z\83p\83\8c\81[\83^
7300         NewMenu := TMenuItem.Create(FavoriteMenu);
7301         NewMenu.Caption := '-';
7302         FavoriteMenu.Add(NewMenu);
7303
7304         CreateFavMenu(FavoriteDM.TreeView.Items.GetFirstNode, FavoriteMenu);
7305 end;
7306
7307 procedure TGikoForm.CreateFavMenu(Node: TTreeNode; MenuItem: TMenuItem);
7308 var
7309         i: Integer;
7310         NewMenu: TMenuItem;
7311 begin
7312         for i := 0 to Node.Count - 1 do begin
7313                 NewMenu := TFavoriteMenuItem.Create(Self);
7314                 NewMenu.AutoHotkeys := maAutomatic;
7315                 NewMenu.Caption := CustomStringReplace(Node.Item[i].Text, '&', '&&');
7316                 TFavoriteMenuItem(NewMenu).Data := Node.Item[i].Data;
7317                 MenuItem.Add(NewMenu);
7318
7319                 if TObject(Node.Item[i].Data) is TFavoriteFolder then begin
7320                         NewMenu.ImageIndex := TOOL_ICON_FAV_FOLDER;
7321                         CreateFavMenu(Node.Item[i], NewMenu);
7322                 end else if TObject(Node.Item[i].Data) is TFavoriteBoardItem then begin
7323                         NewMenu.ImageIndex := TOOL_ICON_FAV_BOARD;
7324                         NewMenu.OnClick := FavoriteClick;
7325                 end else if TObject(Node.Item[i].Data) is TFavoriteThreadItem then begin
7326                         NewMenu.ImageIndex := TOOL_ICON_FAV_THREAD;
7327                         NewMenu.OnClick := FavoriteClick;
7328                 end;
7329         end;
7330 end;
7331
7332 procedure TGikoForm.ShowFavoriteAddDialog( Item : TObject );
7333 var
7334         Dlg                     : TFavoriteAddDialog;
7335         ItemURL : string;
7336         Data            : Pointer;
7337         Node            : TTreeNode;
7338 begin
7339
7340         if Item is TFavoriteBoardItem then
7341                 Item := TFavoriteBoardItem( Item ).Item
7342         else if Item is TFavoriteThreadItem then
7343                 Item := TFavoriteThreadItem( Item ).Item;
7344
7345         Node := FavoriteTreeView.Items.GetFirstNode;
7346         if Item is TBoard then begin
7347                 ItemURL := TBoard( Item ).URL;
7348                 while Node <> nil do begin
7349                         Data := Node.Data;
7350                         if TObject( Data ) is TFavoriteBoardItem then begin
7351                                 if ItemURL = TFavoriteBoardItem( Data ).URL then begin
7352                                         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
7353                                                 Exit;
7354                                         Break;
7355                                 end;
7356                         end;
7357                         Node := Node.GetNext;
7358                 end;
7359                 Dlg := TFavoriteAddDialog.Create(Self);
7360                 try
7361                         Dlg.SetBoard( TBoard( Item ) );
7362                         Dlg.ShowModal;
7363                 finally
7364                         Dlg.Release;
7365                 end;
7366         end else if Item is TThreadItem then begin
7367                 ItemURL := TThreadItem( Item ).URL;
7368                 while Node <> nil do begin
7369                         Data := Node.Data;
7370                         if TObject( Data ) is TFavoriteThreadItem then begin
7371                                 if ItemURL = TFavoriteThreadItem( Data ).URL then begin
7372                                         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
7373                                                 Exit;
7374                                         Break;
7375                                 end;
7376                         end;
7377                         Node := Node.GetNext;
7378                 end;
7379                 Dlg := TFavoriteAddDialog.Create(Self);
7380                 try
7381                         Dlg.SetThreadItem( TThreadItem( Item ) );
7382                         Dlg.ShowModal;
7383                 finally
7384                         Dlg.Release;
7385                 end;
7386         end;
7387
7388         SetLinkBar;
7389 end;
7390
7391 procedure TGikoForm.FavoriteAddActionExecute(Sender: TObject);
7392 begin
7393         ShowFavoriteAddDialog(GetActiveContent);
7394 end;
7395
7396 procedure TGikoForm.FavoriteClick(Sender: TObject);
7397 begin
7398
7399         FavoriteClick( Sender, True );
7400
7401 end;
7402
7403 procedure TGikoForm.FavoriteClick(Sender: TObject; ActiveTab: Boolean);
7404 var
7405         Board: TBoard;
7406         ThreadItem: TThreadItem;
7407         FavBoard: TFavoriteBoardItem;
7408         FavThread: TFavoriteThreadItem;
7409         Item: TObject;
7410 begin
7411 //      Item := nil;
7412         if Sender is TFavoriteMenuItem then
7413                 Item := TFavoriteMenuItem(Sender).Data
7414         else if Sender is TLinkToolButton then
7415                 Item := TLinkToolButton(Sender).Data
7416         else if Sender is TTreeNode then
7417                 Item := TTreeNode( Sender ).Data
7418         else
7419                 Exit;
7420
7421         if TObject(Item) is TFavoriteBoardItem then begin
7422                 FavBoard := TFavoriteBoardItem(Item);
7423                 Board := FavBoard.Item;
7424                 if Board <> nil then begin
7425                         if (FTreeType = gtt2ch) and (FActiveBBS <> Board.ParentCategory.ParenTBBS) then
7426                                 ShowBBSTree( Board.ParentCategory.ParenTBBS );
7427                         SelectTreeNode(Board, True);
7428                 end;
7429         end else if TObject(Item) is TFavoriteThreadItem then begin
7430                 FavThread := TFavoriteThreadItem(Item);
7431                 ThreadItem := FavThread.Item;
7432                 if ThreadItem = nil then
7433                         Exit;
7434
7435                 InsertBrowserTab(ThreadItem, ActiveTab);
7436
7437                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
7438                         if GikoSys.Setting.ListWidthState = glsMin then begin
7439                                 BrowserMaxAndFocusAction.Execute;
7440                         end;
7441                 end else begin
7442                         if GikoSys.Setting.ListHeightState = glsMin then begin
7443                                 BrowserMaxAndFocusAction.Execute;
7444                         end;
7445                 end;
7446         end;
7447 end;
7448
7449 procedure TGikoForm.FavoriteAddActionUpdate(Sender: TObject);
7450 begin
7451         FavoriteAddAction.Enabled := (GetActiveContent <> nil);
7452 end;
7453
7454 procedure TGikoForm.BoardFavoriteAddActionExecute(Sender: TObject);
7455 begin
7456         if TObject(ListView.Selected.Data) is TBoard then
7457                 ShowFavoriteAddDialog(TObject(ListView.Selected.Data));
7458 end;
7459
7460 procedure TGikoForm.BoardFavoriteAddActionUpdate(Sender: TObject);
7461 begin
7462         BoardFavoriteAddAction.Enabled := (GetActiveList is TCategory) and (ListView.SelCount > 0);
7463 end;
7464
7465 procedure TGikoForm.ThreadFavoriteAddActionExecute(Sender: TObject);
7466 begin
7467         if TObject(ListView.Selected.Data) is TThreadItem then
7468                 ShowFavoriteAddDialog(TObject(ListView.Selected.Data));
7469 end;
7470
7471 procedure TGikoForm.ThreadFavoriteAddActionUpdate(Sender: TObject);
7472 begin
7473         ThreadFavoriteAddAction.Enabled := (GetActiveList is TBoard) and (ListView.SelCount > 0);
7474 end;
7475
7476 procedure TGikoForm.TreeSelectFavoriteAddActionExecute(Sender: TObject);
7477 begin
7478         ShowFavoriteAddDialog(TObject(FClickNode.Data));
7479 end;
7480
7481 procedure TGikoForm.FavoriteArrangeActionExecute(Sender: TObject);
7482 var
7483         Dlg: TFavoriteArrangeDialog;
7484 begin
7485         Dlg := TFavoriteArrangeDialog.Create(Self);
7486         try
7487                 Dlg.ShowModal;
7488         finally
7489                 Dlg.Release;
7490         end;
7491         PostMessage( Handle, USER_SETLINKBAR, 0, 0 );
7492 end;
7493
7494 procedure TGikoForm.BBSMenuItemOnClick(
7495         Sender  : TObject
7496 );
7497 begin
7498
7499         if Sender is TBBSMenuItem then
7500                 ShowBBSTree( TBBSMenuItem( Sender ).Data );
7501
7502 end;
7503
7504 procedure TGikoForm.MainCoolBarResize(Sender: TObject);
7505 begin
7506         TopPanel.Height := Max(MainCoolBar.Height, AnimePanel.Height);
7507         if not FStartUp then begin
7508 //              SaveCoolBarSettings;
7509                 SaveMainCoolBarSettings;
7510         end;
7511
7512 end;
7513
7514 procedure TGikoForm.MoveToActionExecute(Sender: TObject);
7515 var
7516         URL: string;
7517         idx: Integer;
7518 begin
7519         URL := Trim(AddressComboBox.Text);
7520         MoveToURL(URL);
7521
7522         idx := AddressComboBox.Items.IndexOf(URL);
7523         if idx = -1 then begin
7524                 AddressComboBox.Items.Insert(0, URL);
7525                 if AddressComboBox.Items.Count > GikoSys.Setting.AddressHistoryCount then
7526                         AddressComboBox.Items.Delete(AddressComboBox.Items.Count - 1);
7527         end else begin
7528                 AddressComboBox.Items.Delete(idx);
7529                 AddressComboBox.Items.Insert(0, URL);
7530         end;
7531 end;
7532
7533 procedure TGikoForm.MoveToURL(const inURL: string);
7534 var
7535         protocol, host, path, document, port, bookmark : string;
7536         URL, protocol2, host2, path2, document2, port2, bookmark2 : string;
7537         tmp1, tmp2: string;
7538         BBSID, BBSKey: string;
7539         tmpBoard, Board: TBoard;
7540         ThreadItem: TThreadItem;
7541         i, bi                                   : Integer;
7542         boardURL                        : string;
7543         tmpThread                       : TThreadItem;
7544 //      category                        : TCategory;
7545 //      categoryNode    : TTreeNode;
7546 //      boardNode                       : TTreeNode;
7547         shiftDown                       : Boolean;
7548         ctrlDown                        : Boolean;
7549         stRes, edRes    : Int64;
7550         browserRec              : TBrowserRecord;
7551 begin
7552
7553         GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
7554         GikoSys.Parse2chURL( inURL, path, document, BBSID, BBSKey );
7555
7556
7557         shiftDown       := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
7558         ctrlDown        := GetAsyncKeyState(VK_CONTROL) = Smallint($8001);
7559         if shiftDown then begin
7560                 GikoSys.OpenBrowser(inURL, gbtUserApp);
7561                 Exit;
7562         end else if ctrlDown then begin
7563                 GikoSys.OpenBrowser(inURL, gbtIE);
7564                 Exit;
7565         end;
7566
7567         //===== \83v\83\89\83O\83C\83\93
7568         try
7569                 //\8dì\8bÆ\92\86//
7570                 bi := High( BoardPlugIns );
7571                 for i := Low( BoardPlugIns ) to bi do begin
7572                         if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
7573                                 case BoardPlugIns[ i ].AcceptURL( inURL ) of
7574                                 atThread:
7575                                         begin
7576                                                 tmpThread               := TThreadItem.Create( BoardPlugIns[ i ], inURL );
7577                                                 boardURL                := tmpThread.BoardPlugIn.GetBoardURL( DWORD( tmpThread ) );
7578                                                 Board                           := BBSsFindBoardFromURL( boardURL );
7579                                                 if Board = nil then begin
7580                             //break;
7581                                                         // \81¦\8dì\82Á\82Ä\82à\92Ç\89Á\82·\82é\82Æ\82±\82ë\82ª\96³\82¢\82Ì\82Å\8c\83\82µ\82­\95Û\97¯
7582                                                         //GikoSys.OpenBrowser(inURL, gbtUserApp);
7583                                                         //Exit;
7584                                                         {
7585                                                         Board := GikoSys.GetUnknownBoard( tmpThread.BoardPlugIn, boardURL );
7586                                                         if (FTreeType = gtt2ch) and (FActiveBBS = BBSs[ 1 ]) then
7587                                                                 ShowBBSTree( BBSs[ 1 ] );
7588                                                         }
7589                                                 end else begin
7590                                                         if not Board.IsThreadDatRead then begin
7591                                                                 GikoSys.ReadSubjectFile( Board );
7592                                                                 Exit;
7593                                                         end;
7594                                                         ThreadItem := Board.FindThreadFromFileName( tmpThread.FileName );
7595                                                         if ThreadItem = nil then begin
7596                                                                 ThreadItem := tmpThread;
7597                                                                 Board.Insert( 0, ThreadItem );
7598                                                                 if ActiveList is TBoard then begin
7599                                                                         if TBoard(ActiveList) = Board then
7600                                                                                 ListView.Items.Count := ListView.Items.Count + 1;
7601                                                                 end;
7602                                                                 GikoSys.GetPopupResNumber( inURL, stRes, edRes );
7603                                                                 browserRec := InsertBrowserTab( ThreadItem );
7604                                                                 if (browserRec <> nil) and (stRes > 0) then
7605                                                                         browserRec.Movement := IntToStr( stRes );
7606                                                                 DownloadContent( ThreadItem );
7607                                                                 Exit;
7608                                                         end else begin
7609                                                                 tmpThread.Free;
7610                                                                 GikoSys.GetPopupResNumber( inURL, stRes, edRes );
7611                                                                 browserRec := InsertBrowserTab( ThreadItem );
7612                                                                 if ThreadItem.IsLogFile then begin
7613                                                                         if (browserRec <> nil) and (stRes > 0) then
7614                                                                                 BrowserMovement( IntToStr( stRes ), browserRec );
7615                                                                 end else begin
7616                                                                         if (browserRec <> nil) and (stRes > 0) then
7617                                                                                 browserRec.Movement := IntToStr( stRes );
7618                                                                         DownloadContent( ThreadItem );
7619                                                                 end;
7620                                                                 Exit;
7621                                                         end;
7622                                                 end;
7623                                         end;
7624
7625                                 atBoard:
7626                                         begin
7627                                                 tmpBoard := TBoard.Create(BoardPlugIns[ i ], inURL);
7628                                                 Board := BBSsFindBoardFromURL( tmpBoard.URL );
7629                                                 tmpBoard.Free;
7630                                                 if Board <> nil then begin
7631                                                         if FActiveBBS <> Board.ParentCategory.ParenTBBS then
7632                                                                 ShowBBSTree( Board.ParentCategory.ParenTBBS );
7633                                                         SelectTreeNode( Board, True );
7634                                                         Exit;
7635                                                 end;
7636                                         end;
7637                                 end;
7638                         end;
7639                 end;
7640         except
7641                 // 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¢
7642         end;
7643
7644
7645         if (Length( Trim(BBSKey) ) > 0) and (Length( Trim(BBSID) ) > 0) then begin
7646                 boardURL := GikoSys.Get2chThreadURL2BoardURL( inURL );
7647                 Board := BBSsFindBoardFromURL( boardURL );
7648                 if Board = nil then
7649                         Board := BBSsFindBoardFromBBSID( BBSID );
7650
7651                 if Board = nil then begin
7652                         // \81¦\8dì\82Á\82Ä\82à\92Ç\89Á\82·\82é\82Æ\82±\82ë\82ª\96³\82¢\82Ì\82Å\8c\83\82µ\82­\95Û\97¯
7653                         //\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)
7654                         Board := BBSs[ 0 ].FindBBSID( Copy(BBSID, 1 , Length(BBSID) - 1) );
7655                 end;
7656                 if Board = nil then begin
7657                          // \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­
7658                          GikoSys.OpenBrowser(inURL, gbtUserApp);
7659                          Exit;
7660                 end else begin
7661                         // \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é
7662                         URL :=  Board.URL;
7663                         GikoSys.ParseURI(URL , protocol2, host2, path2, document2, port2, bookmark2 );
7664                         tmp1 := Copy(host, AnsiPos('.', host) + 1, Length(host));
7665                         tmp2 := Copy(host2, AnsiPos('.', host2) + 1, Length(host2));
7666                         if ( not GikoSys.Is2chHost(tmp1)) and (tmp1 <> tmp2) then begin
7667                                 GikoSys.OpenBrowser(inURL, gbtUserApp);
7668                                 Exit;
7669                         end;
7670                 end;
7671
7672                 if not Board.IsThreadDatRead then
7673                         GikoSys.ReadSubjectFile(Board);
7674                 URL := GikoSys.Get2chBrowsableThreadURL( inURL );
7675                 ThreadItem := Board.FindThreadFromURL( URL );
7676                 //\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)
7677                 if ThreadItem = nil then begin
7678                         ThreadItem := Board.FindThreadFromFileName( BBSKey + '.dat' );
7679                 end;
7680
7681                 if ThreadItem = nil then begin
7682                         //shift -> \90Ý\92è\83u\83\89\83E\83U\81i\96³\82¯\82ê\82ÎIE\81j
7683                         //ctrl  -> IE
7684                         {shiftDown      := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
7685                         ctrlDown        := GetAsyncKeyState(VK_CONTROL) = Smallint($8001);
7686                         if shiftDown then
7687                                 GikoSys.OpenBrowser(URL1, gbtUserApp)
7688                         else if ctrlDown then
7689                                 GikoSys.OpenBrowser(URL1, gbtIE)
7690                         else begin
7691                         }
7692                         ThreadItem := TThreadItem.Create( nil, URL );
7693                         ThreadItem.FileName := ChangeFileExt(BBSKey, '.dat');
7694                         if AnsiPos(Host, Board.URL) = 0 then
7695                                 ThreadItem.DownloadHost := Host
7696                         else
7697                                 ThreadItem.DownloadHost := '';
7698                         Board.Insert(0, ThreadItem);
7699                         if ActiveList is TBoard then begin
7700                                 if TBoard(ActiveList) = Board then
7701                                         ListView.Items.Count := ListView.Items.Count + 1;
7702                         end;
7703                         GikoSys.GetPopupResNumber( inURL, stRes, edRes );
7704                         browserRec := InsertBrowserTab(ThreadItem);
7705                         if (browserRec <> nil) and (stRes > 0) then
7706                                 browserRec.Movement := IntToStr( stRes );
7707                         DownloadContent(ThreadItem);
7708                         {end;}
7709                 end else begin
7710                         if ThreadItem.IsLogFile then begin
7711                                 GikoSys.GetPopupResNumber( inURL, stRes, edRes );
7712                                 browserRec := InsertBrowserTab(ThreadItem);
7713                                 if (browserRec <> nil) and (stRes > 0) then
7714                                         browserRec.Movement := IntToStr( stRes );
7715                         end else begin
7716                                 if AnsiPos(Host, Board.URL) = 0 then
7717                                         ThreadItem.DownloadHost := Host
7718                                 else
7719                                         ThreadItem.DownloadHost := '';
7720                                 GikoSys.GetPopupResNumber( inURL, stRes, edRes );
7721                                 browserRec := InsertBrowserTab(ThreadItem);
7722                                 if (browserRec <> nil) and (stRes > 0) then
7723                                         browserRec.Movement := IntToStr( stRes );
7724                                 DownloadContent(ThreadItem);
7725                         end;
7726                 end;
7727         end else begin
7728                 Board := BBSsFindBoardFromURL( inURL );
7729     if Board = nil then begin
7730                         GikoSys.OpenBrowser(inURL, gbtAuto);
7731     end else begin
7732           if FActiveBBS <> Board.ParentCategory.ParenTBBS then
7733         ShowBBSTree( Board.ParentCategory.ParenTBBS );
7734       SelectTreeNode( Board, True );
7735     end;
7736         end;
7737 end;
7738
7739 procedure TGikoForm.AddressToolBarResize(Sender: TObject);
7740 begin
7741         AddressComboBox.Width := AddressToolBar.Width - MoveToToolButton.Width - 10;
7742         //CoolBarResized( Sender, MainCoolBar );
7743 end;
7744
7745 procedure TGikoForm.AddressComboBoxKeyDown(Sender: TObject; var Key: Word;
7746         Shift: TShiftState);
7747 begin
7748         if Key = VK_RETURN then
7749                 MoveToAction.Execute;
7750 end;
7751
7752 procedure TGikoForm.BrowserEnter(Sender: TObject);
7753 begin
7754         Browser.DoObjectVerb(OLEIVERB_UIACTIVATE);
7755 end;
7756
7757 procedure TGikoForm.WMCopyData(var Message: TWMCopyData);
7758 var
7759         CDS:PCopyDataStruct;
7760         PC:PChar;
7761         sURL: string;
7762 begin
7763         CDS := Message.CopyDataStruct;
7764         GetMem(PC, CDS^.cbData);
7765         try
7766                 lstrcpy(PC,CDS^.lpData);
7767                 SetString(sURL, PC,lstrlen(PC));
7768                 MoveToURL(sURL);
7769         finally
7770                 FreeMem(PC);
7771         end;
7772         Message.Result := 1;
7773 end;
7774
7775 procedure TGikoForm.WndProc(var Message: TMessage);
7776 var
7777         senderBrowser   : TWebBrowser;
7778         url                                             : OleVariant;
7779 begin
7780         try
7781                 case Message.Msg of
7782                 CM_DIALOGCHAR:
7783                         if not (ssAlt in KeyDataToShiftState(TWMChar(Message).KeyData)) then
7784                                 Exit;
7785                 WM_SYSCOMMAND:
7786                         if Message.WParam = SC_MINIMIZE then
7787                                 OnMinimize;
7788                 USER_TREECLICK:
7789                         TreeClick( TreeView.Selected );
7790                 USER_RESIZED:
7791                         OnResized;
7792                 USER_MINIMIZED:
7793                         OnMinimized;
7794                 USER_SETLINKBAR:
7795                         SetLinkBar;
7796                 USER_DOCUMENTCOMPLETE:
7797                         if (Message.WParam <> 0) and
7798                                  (TObject(Message.WParam) is TWebBrowser) then begin
7799                                 senderBrowser := TWebBrowser( Message.WParam );
7800                                 BrowserDocumentComplete( senderBrowser, senderBrowser.Parent, url );
7801                         end;
7802                 end;
7803
7804                 inherited;
7805         except
7806         end;
7807 end;
7808
7809 procedure TGikoForm.FormShortCut(var Msg: TWMKey; var Handled: Boolean);
7810 var
7811         hComboEdit: THandle;
7812 //      KeyData: Integer;
7813 begin
7814         Handled := False;
7815         if AddressComboBox.Focused or SelectComboBox.Focused then begin
7816                 if Msg.CharCode in [VK_BACK] then begin
7817                         hComboEdit := GetFocus;
7818                         if hComboEdit <> 0 then
7819                                 SendMessage(hComboEdit, WM_CHAR, Msg.CharCode, Msg.KeyData);
7820 //                              SendMessage(hComboEdit, WM_CHAR, Msg.CharCode, $000E0001);
7821                         Handled := True;
7822                 end;
7823                 if Msg.CharCode in [VK_INSERT, VK_DELETE, VK_HOME, VK_END, VK_PRIOR, VK_NEXT] then begin
7824                         hComboEdit := GetFocus;
7825                         if hComboEdit <> 0 then
7826                                 SendMessage(hComboEdit, WM_KEYDOWN, Msg.CharCode, Msg.KeyData);
7827                         Handled := True;
7828                 end;
7829 {       end else begin
7830                 //\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ð
7831                 KeyData := Msg.KeyData;
7832                 if (KeyData and $20000000) = 0 then begin
7833                         if Msg.CharCode in [Ord('F'), Ord('V'), Ord('B'), Ord('R'),
7834                                                                                                         Ord('A'), Ord('T'), Ord('H')] then begin
7835                                 if not ActionList.IsShortCut(Msg) then begin
7836                                         Handled := True;
7837                                 end;
7838                         end;
7839                 end;}
7840         end;
7841 end;
7842
7843 procedure TGikoForm.BrowserTabVisibleActionExecute(Sender: TObject);
7844 begin
7845         GikoSys.Setting.BrowserTabVisible := BrowserTabVisibleAction.Checked;
7846         SetBrowserTabState;
7847 end;
7848
7849 procedure TGikoForm.BrowserTabTopActionExecute(Sender: TObject);
7850 begin
7851         BrowserTabBottomAction.Checked := False;
7852         BrowserTabTopAction.Checked := True;
7853         GikoSys.Setting.BrowserTabPosition := gtpTop;
7854         SetBrowserTabState;
7855 end;
7856
7857 procedure TGikoForm.BrowserTabBottomActionExecute(Sender: TObject);
7858 begin
7859         BrowserTabTopAction.Checked := False;
7860         BrowserTabBottomAction.Checked := True;
7861         GikoSys.Setting.BrowserTabPosition := gtpBottom;
7862         SetBrowserTabState;
7863 end;
7864
7865 procedure TGikoForm.BrowserTabTabStyleActionExecute(Sender: TObject);
7866 begin
7867         BrowserTabButtonStyleAction.Checked := False;
7868         BrowserTabFlatStyleAction.Checked := False;
7869         BrowserTabTabStyleAction.Checked := True;
7870         GikoSys.Setting.BrowserTabStyle := gtsTab;
7871         SetBrowserTabState;
7872 end;
7873
7874 procedure TGikoForm.BrowserTabButtonStyleActionExecute(Sender: TObject);
7875 begin
7876         BrowserTabTabStyleAction.Checked := False;
7877         BrowserTabFlatStyleAction.Checked := False;
7878         BrowserTabButtonStyleAction.Checked := True;
7879         GikoSys.Setting.BrowserTabStyle := gtsButton;
7880         SetBrowserTabState;
7881 end;
7882
7883 procedure TGikoForm.BrowserTabFlatStyleActionExecute(Sender: TObject);
7884 begin
7885         BrowserTabFlatStyleAction.Checked := True;
7886         BrowserTabTabStyleAction.Checked := False;
7887         BrowserTabButtonStyleAction.Checked := False;
7888         GikoSys.Setting.BrowserTabStyle := gtsFlat;
7889         SetBrowserTabState;
7890 end;
7891
7892 procedure TGikoForm.PreviewTimerTimer(Sender: TObject);
7893 var
7894         p: TPoint;
7895         ARect: TRect;
7896         sl: TStringList;
7897         html: string;
7898         HtmlFileName: string;
7899
7900         NavURL: OleVariant;
7901         Flags: OleVariant;
7902         TargetFrameName: OleVariant;
7903         PostData: OleVariant;
7904         Headers: OleVariant;
7905         WindowHeight: Integer;
7906         WindowWidth: Integer;
7907
7908 //      Style: Longint;
7909         Referer: string;
7910         Protocol, Host, Path, Document, Port, Bookmark: string;
7911 begin
7912         PreviewTimer.Enabled := False;
7913
7914         GetCursorpos(p);
7915
7916         case GikoSys.Setting.PreviewSize of
7917                 gpsXSmall: begin
7918                         WindowWidth := 128;
7919                         WindowHeight := 96;
7920                 end;
7921                 gpsSmall: begin
7922                         WindowWidth := 256;
7923                         WindowHeight := 192;
7924                 end;
7925                 gpsLarge: begin
7926                         WindowWidth := 512;
7927                         WindowHeight := 384;
7928                 end;
7929                 gpsXLarge: begin
7930                         WindowWidth := 640;
7931                         WindowHeight := 480;
7932                 end;
7933                 else begin      //gpsMedium
7934                         WindowWidth := 384;
7935                         WindowHeight := 288;
7936                 end;
7937         end;
7938
7939         ARect := Rect(0, 0, WindowWidth, WindowHeight);
7940
7941         case GikoSys.Setting.PopupPosition of
7942                 gppRightTop:            OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - (ARect.Bottom - ARect.Top) -     15);
7943                 gppRight:                       OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
7944                 gppRightBottom: OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y + 15);
7945                 gppTop:                                 OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - (ARect.Bottom - ARect.Top) -  15);
7946                 gppCenter:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - ((ARect.Bottom - ARect.Top) div 2));
7947                 gppBottom:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y + 15);
7948                 gppLeftTop:                     OffsetRect(ARect, p.x + 15, p.y - (ARect.Bottom - ARect.Top) -  15);
7949                 gppLeft:                                OffsetRect(ARect, p.x + 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
7950                 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Ó
7951         end;
7952
7953         html := '<html><head>'#13#10
7954                                 + '<SCRIPT>'#13#10
7955                                 + 'function init() {'#13#10
7956                                 + '     if ((document.body.clientHeight >= Image1.height) && (document.body.clientWidth >= Image1.width)) {'#13#10
7957                                 + '     } else {'#13#10
7958                                 + '             var dh, ih;'#13#10
7959                                 + '             dh = document.body.clientWidth / document.body.clientHeight;'#13#10
7960                                 + '             ih = Image1.width / Image1.height;'#13#10
7961                                 + '             if (document.body.clientWidth < document.body.clientHeight) {'#13#10
7962                                 + '                     if (ih > dh)'#13#10
7963                                 + '                             Image1.width = document.body.clientWidth;'#13#10
7964                                 + '                     else'#13#10
7965                                 + '                             Image1.height = document.body.clientHeight;'#13#10
7966                                 + '             } else {'#13#10
7967                                 + '                     if (ih < dh)'#13#10
7968                                 + '                             Image1.height = document.body.clientHeight;'#13#10
7969                                 + '                     else'#13#10
7970                                 + '                             Image1.width = document.body.clientWidth;'#13#10
7971                                 + '             }'#13#10
7972                                 + '     }'#13#10
7973                                 + '     Message.style.display = "none";'#13#10
7974                                 + '}'#13#10
7975                                 + '</SCRIPT>'#13#10
7976                                 + '</head>'#13#10
7977                                 + '<body topmargin="0" leftmargin="0" style="border-width: 1px; overflow:hidden; border-style: solid;" onLoad="init()">'#13#10
7978                                 + '<div align="center" id="Message">\83v\83\8c\83r\83\85\81[\8dì\90¬\92\86</div>'#13#10
7979                                 + '<div align="center"><img name="Image1" border="0" src="%ImageURL%"></div>'#13#10
7980                                 + '</body></html>';
7981         sl := TStringList.Create;
7982         try
7983                 try
7984                         HtmlFileName := GikoSys.GetAppDir + HTML_FILE_NAME;
7985                         sl.Text := AnsiReplaceStr(html, '%ImageURL%', FPreviewURL);
7986                         sl.SaveToFile(HtmlFileName);
7987                 finally
7988                         sl.Free;
7989                 end;
7990         except
7991         end;
7992
7993         NavURL := HtmlFileName;
7994         Flags := 0;
7995         TargetFrameName := '';
7996         PostData := '';
7997
7998         GikoSys.ParseURI(FPreviewURL, Protocol, Host, Path, Document, Port, Bookmark);
7999         Referer := Protocol + '://' + Host;
8000         if Port <> '' then
8001                 Referer := Referer + ':' + Port;
8002         Referer := Referer + Path;
8003         Headers := 'Referer: ' + Referer;
8004         FPreviewBrowser.Navigate(NavURL, Flags, TargetFrameName, PostData, Headers);
8005         if ARect.Top + WindowHeight > Screen.DesktopHeight then
8006                 ARect.Top := Screen.DesktopHeight - WindowHeight;
8007         if ARect.Left + WindowWidth > Screen.DesktopWidth then
8008                 ARect.Left := Screen.DesktopWidth - WindowWidth;
8009         if ARect.Left < Screen.DesktopLeft then ARect.Left := Screen.DesktopLeft;
8010         if ARect.Bottom < Screen.DesktopTop then ARect.Bottom := Screen.DesktopTop;
8011
8012         SetWindowPos(FPreviewBrowser.Handle, HWND_TOPMOST, ARect.Left, ARect.Top, WindowWidth, WindowHeight, SWP_NOACTIVATE or SWP_HIDEWINDOW);
8013         ShowWindow(FPreviewBrowser.Handle, SW_SHOWNOACTIVATE);
8014
8015 //      Style := GetWindowLong(FPreviewBrowser.Handle, GWL_EXSTYLE);
8016 //      SetWindowLong(FPreviewBrowser.Handle, GWL_EXSTYLE, Style xor WS_EX_APPWINDOW);
8017
8018 end;
8019
8020 procedure TGikoForm.WMSetCursor(var Message: TWMSetCursor);
8021 begin
8022         if PreviewTimer.Enabled then
8023                 PreviewTimer.Enabled := False;
8024         if (FHint <> nil) and (IsWindowVisible(FHint.Handle)) then begin
8025                 FHint.ReleaseHandle;
8026                 FHint.ClearAllRes;
8027         end;
8028         if (FPreviewBrowser <> nil) and (IsWindowVisible(FPreviewBrowser.Handle)) then
8029                 ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
8030         Message.Result := 1;
8031         inherited;
8032 end;
8033
8034 procedure TGikoForm.MessageHideButtonClick(Sender: TObject);
8035 begin
8036         MsgBarCloseAction.Execute;
8037 end;
8038
8039 function TGikoForm.OnDocumentContextMenu(Sender: TObject): WordBool;
8040 var
8041         Doc: IHtmlDocument2;
8042         Range: IHTMLTxtRange;
8043         s: string;
8044         Num: Integer;
8045         ThreadItem: TThreadItem;
8046 begin
8047         Result := False;
8048         Doc := FactiveContent.FBrowser.Document as IHtmlDocument2;
8049         if Assigned(Doc) then begin
8050                 Range := Doc.selection.createRange as IHTMLTxtRange;
8051                 s := CustomStringReplace(Range.text, '\81@', ' ');//\91S\8ap\8bó\94\92\82ð\94¼\8ap\8bó\94\92\82É
8052                 s := ZenToHan(Trim(s));
8053                 if GikoSys.IsNumeric(s) then begin
8054
8055                         ThreadItem := GetActiveContent;
8056                         if ThreadItem <> nil then begin
8057                                 Num := StrToInt(s);
8058                                 FHint.PopupType := gptThread;
8059                                 SetResPopupText(ThreadItem, Num, Num, False, False);
8060                                 if FHint.ResCount <> 0 then
8061                                         ShowTextPopup;
8062                                 Result := False;
8063                         end else
8064                                 Result := True;
8065                 end else begin
8066                         Result := True;
8067                 end;
8068         end;
8069 end;
8070
8071 procedure TGikoForm.SetResPopupText(threadItem: TThreadItem; StNum, ToNum: Integer; Title, First: Boolean);
8072 var
8073         i: Integer;
8074         tmp: string;
8075         FileName: string;
8076         Line: Integer;
8077
8078         wkInt: Integer;
8079
8080         Res: TResRec;
8081         Header: string;
8082         Body: string;
8083     boardPlugIn : TBoardPlugIn;
8084 begin
8085         try
8086                 if StNum > ToNum then begin
8087                         wkInt := StNum;
8088                         StNum := ToNum;
8089                         ToNum := wkInt;
8090                 end;
8091
8092                 //\8dÅ\91å10\83\8c\83X\82Ü\82Å\95\\8e¦
8093                 if StNum + MAX_POPUP_RES < ToNum then
8094                         ToNum := StNum + MAX_POPUP_RES;
8095
8096                 //\83^\83C\83g\83\8b\95\\8e¦
8097                 if Title then
8098                                 if ThreadItem <> nil then
8099                                         FHint.Title := ThreadItem.Title;
8100
8101         if ThreadItem <> nil then begin
8102             if ThreadItem.IsBoardPlugInAvailable then begin
8103                 //===== \83v\83\89\83O\83C\83\93\82É\82æ\82é\95\\8e¦
8104                 boardPlugIn             := ThreadItem.BoardPlugIn;
8105
8106                 // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
8107                 // \95\8e\9a\83R\81[\83h\82Í\83v\83\89\83O\83C\83\93\82É\94C\82¹\82é
8108                 for i := StNum to ToNum do begin
8109                     Line := i;
8110                                         //\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½
8111                                         tmp := boardPlugIn.GetDat( DWORD( threadItem ), i );
8112                     if (tmp <> '') And ( not GikoSys.FAbon.CheckAbonPopupRes(tmp) And( not GikoSys.FAbon.CheckIndividualAbonList(line))) then begin
8113                         Res := GikoSys.DivideStrLine(tmp);
8114                         if (GikoSys.Setting.ShowMail = false) or (Length(res.FMailTo) = 0) then
8115                                 Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' \93\8a\8de\93ú\81F ' + Res.FDateTime
8116                         else
8117                                 Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' [' + res.FMailTo + '] \93\8a\8de\93ú\81F ' + Res.FDateTime;
8118
8119
8120                         Body := CustomStringReplace(Res.FBody, '<br> ', #10,true);
8121                         Body := CustomStringReplace(Body, '<br>', #10,true);
8122                         Body := CustomStringReplace(Body, '</a>', '',true);
8123                         Body := GikoSys.DeleteLink(Body);
8124                         Body := CustomStringReplace(Body, '&lt;', '<');
8125                         Body := CustomStringReplace(Body, '&gt;', '>');
8126                         Body := CustomStringReplace(Body, '&quot;', '"');
8127                         Body := CustomStringReplace(Body, '&amp;', '&');
8128                         Body := CustomStringReplace(Body, '&nbsp;', ' ');
8129
8130                         FHint.Add(Header, Body);
8131                         //FHint.Title := '';
8132                     end;
8133                 end;
8134             end else begin
8135                 for i := StNum to ToNum do begin
8136                     Line := i;
8137                     FileName := ThreadItem.FilePath;
8138                     tmp := GikoSys.ReadThreadFile(FileName, Line);
8139                     if (tmp <> '') And ( not GikoSys.FAbon.CheckAbonPopupRes(tmp) And( not GikoSys.FAbon.CheckIndividualAbonList(line))) then begin
8140                         Res := GikoSys.DivideStrLine(tmp);
8141                         if (GikoSys.Setting.ShowMail = false) or (Length(res.FMailTo) = 0) then 
8142                                 Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' \93\8a\8de\93ú\81F ' + Res.FDateTime
8143                         else
8144                                 Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' [' + res.FMailTo + '] \93\8a\8de\93ú\81F ' + Res.FDateTime; 
8145
8146                         Body := CustomStringReplace(Res.FBody, '<br> ', #10,true);
8147                         Body := CustomStringReplace(Body, '<br>', #10,true);
8148                         Body := CustomStringReplace(Body, '</a>', '',true);
8149                         Body := GikoSys.DeleteLink(Body);
8150                         Body := CustomStringReplace(Body, '&lt;', '<');
8151                         Body := CustomStringReplace(Body, '&gt;', '>');
8152                         Body := CustomStringReplace(Body, '&quot;', '"');
8153                         Body := CustomStringReplace(Body, '&amp;', '&');
8154                          Body := CustomStringReplace(Body, '&nbsp;', ' ');
8155                         FHint.Add(Header, Body);
8156                         //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
8157                     end;
8158                 end;
8159             end;
8160         end;
8161     finally
8162     end;
8163 end;
8164
8165 procedure TGikoForm.ShowTextPopup;
8166 var
8167         p: TPoint;
8168         ARect: TRect;
8169 begin
8170 //      if Trim(s) = '' then
8171 //              Exit;
8172         try
8173                 FHint.Font.Name := GikoSys.Setting.HintFontName;
8174                 FHint.Font.Size := GikoSys.Setting.HintFontSize;
8175                 FHint.Font.Color := GikoSys.Setting.HintFontColor;
8176                 FHint.Color := GikoSys.Setting.HintBackColor;
8177                 FHint.HeaderBold := GikoSys.Setting.ResPopupHeaderBold;
8178                 GetCursorpos(p);
8179                 if FHint.PopupType = gptRaw then
8180                         ARect := FHint.CalcHintRect(Screen.Width, FHint.Caption, nil)
8181                 else
8182                         ARect := FHint.CalcHintRect(Screen.Width, '', nil);
8183                 case GikoSys.Setting.PopupPosition of
8184                         gppRightTop:            OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - (ARect.Bottom - ARect.Top) -     15);
8185                         gppRight:                       OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
8186                         gppRightBottom: OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y + 15);
8187                         gppTop:                                 OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - (ARect.Bottom - ARect.Top) -  15);
8188                         gppCenter:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - ((ARect.Bottom - ARect.Top) div 2));
8189                         gppBottom:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y + 15);
8190                         gppLeftTop:                     OffsetRect(ARect, p.x + 15, p.y - (ARect.Bottom - ARect.Top) -  15);
8191                         gppLeft:                                OffsetRect(ARect, p.x + 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
8192                         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Ó
8193                 end;
8194                 //FHint.ActivateHint(ARect, s);
8195                 if FHint.PopupType = gptRaw then
8196                         FHint.ActivateHint(ARect, FHint.Caption)
8197                 else
8198                         FHint.ActivateHint(ARect, '');
8199         except
8200                 FHint.ReleaseHandle;
8201                 FHint.ClearAllRes;
8202         end;
8203 end;
8204
8205 procedure TGikoForm.GikoHelpActionExecute(Sender: TObject);
8206 var
8207         FileName: string;
8208 begin
8209         FileName := GikoSys.GetAppDir + 'batahlp.chm';
8210         if not FileExists(FileName) then begin
8211                 MsgBox(
8212                         Handle,
8213                         '\83w\83\8b\83v\82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\82Å\82µ\82½' + #13#10 +
8214                         '\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 +
8215                         '\83w\83\8b\83v\82Í\83M\83R\83i\83r\82Ì\83T\83C\83g\82É\92u\82¢\82Ä\82 \82è\82Ü\82·',
8216                         '\83G\83\89\81[',
8217                         MB_ICONSTOP);
8218                 Exit;
8219         end;
8220         ShellExecute(Handle, 'open', PChar(FileName), '', PChar(GikoSys.GetAppDir), SW_SHOW);
8221 end;
8222
8223 procedure TGikoForm.ToolButton18Click(Sender: TObject);
8224 const
8225         DEL_MSG = '\97\9a\97ð\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
8226         DEL_TITLE = '\8dí\8f\9c\8am\94F';
8227 begin
8228         if FTreeType = gttHistory then begin
8229                 if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
8230                         if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
8231                                 Exit;
8232                 ClearHistory;
8233                 FHistoryList.Clear;
8234                 TreeView.Items.Clear;
8235         end;
8236 end;
8237
8238 procedure TGikoForm.KotehanActionExecute(Sender: TObject);
8239 var
8240         Dlg: TKotehanDialog;
8241 begin
8242         Dlg := TKotehanDialog.Create(Self);
8243         try
8244                 Dlg.ShowModal;
8245         finally
8246                 Dlg.Release;
8247         end;
8248 end;
8249
8250 procedure TGikoForm.SetLinkBar;
8251 var
8252         i: Integer;
8253         j: Integer;
8254         ToolButton: TLinkToolButton;
8255         MenuItem: TMenuItem;
8256         oldIgnoreResize : TResizeType;
8257 begin
8258         oldIgnoreResize := FIsIgnoreResize;
8259         FIsIgnoreResize := rtResizing;
8260         MainCoolBar.Bands.BeginUpdate;
8261         try
8262                 LinkBarPopupMenu.Items.Clear;
8263                 for i := LinkToolBar.ButtonCount - 1 downto 0 do
8264                         //LinkToolBar.RemoveControl(LinkToolBar.Buttons[i]);
8265             LinkToolBar.Buttons[i].Free;
8266                 for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
8267                         if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
8268                                 for j := 0 to FavoriteTreeView.Items[i].Count - 1 do begin
8269                                         ToolButton := TLinkToolButton.Create(LinkToolBar);
8270 //                    ToolButton.Parent := LinkToolBar;
8271                                         if TObject(FavoriteTreeView.Items[i].Item[j].Data) is TFavoriteFolder then begin
8272                                                 MenuItem := TMenuItem.Create(Self);
8273                                                 CreateFavMenu(FavoriteTreeView.Items[i].Item[j], MenuItem);
8274                                                 LinkBarPopupMenu.Items.Add(MenuItem);
8275                                                 ToolButton.MenuItem := MenuItem;
8276                                                 ToolButton.ImageIndex := TOOL_ICON_FAV_FOLDER;
8277                                         end else if TObject(FavoriteTreeView.Items[i].Item[j].Data) is TFavoriteBoardItem then begin
8278                                                 ToolButton.ImageIndex := TOOL_ICON_FAV_BOARD;
8279                                                 ToolButton.OnClick := FavoriteClick;
8280                                         end else if TObject(FavoriteTreeView.Items[i].Item[j].Data) is TFavoriteThreadItem then begin
8281                                                 ToolButton.ImageIndex := TOOL_ICON_FAV_THREAD;
8282                                                 ToolButton.OnClick := FavoriteClick;
8283                                         end;
8284                                         ToolButton.Caption := FavoriteTreeView.Items[i].Item[j].Text;
8285                                         ToolButton.Left := 10000;
8286                                         ToolButton.Data := FavoriteTreeView.Items[i].Item[j].Data;
8287                                         ToolButton.AutoSize := True;
8288                                         ToolButton.OnDragDrop := LinkToolButtonDragDrop;
8289                                         ToolButton.OnDragOver := FavoriteDragOver;
8290                                         ToolButton.OnMouseDown := LinkToolButtonOnMouseDown;
8291                                         ToolButton.OnMouseMove := LinkToolButtonOnMouseMove;
8292                                         ToolButton.OnMouseUp := LinkToolButtonOnMouseUp;
8293                                         ToolButton.OnStartDrag := LinkToolButtonStartDrag;
8294                                         //ToolButton.DragMode := dmAutomatic;
8295                                         ToolButton.DragMode := dmManual;
8296                                         ToolButton.PopupMenu := FavoriteTreePopupMenu;
8297
8298                                         LinkToolBar.InsertControl(ToolButton);
8299                                 end;
8300                                 break;
8301                         end;
8302                 end;
8303 {               if LinkToolBar.ButtonCount = 0 then begin
8304                         ToolButton := TLinkToolButton.Create(LinkToolBar);
8305                         ToolButton.Style := tbsButton;
8306                         ToolButton.ImageIndex := -1;
8307                         ToolButton.Caption := '';
8308                         LinkToolBar.InsertControl(ToolButton);
8309                 end;}
8310         finally
8311                 MainCoolBar.Bands.EndUpdate;
8312                 LoadCoolBarSettings;
8313                 FIsIgnoreResize := oldIgnoreResize;
8314         end;
8315 end;
8316
8317 procedure TGikoForm.FavoriteDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
8318 var
8319         Node: TTreeNode;
8320         bound: TRect;
8321         height: Integer;
8322         Change: Boolean;
8323 begin
8324
8325         if Sender = FavoriteTreeView then begin
8326                 Node := FavoriteTreeView.GetNodeAt(X, Y);
8327
8328                 if Node = nil then
8329                         Exit;
8330
8331                 bound := Node.DisplayRect( False );
8332                 height := bound.Bottom - bound.Top;
8333                 if (bound.Top + height / 2) <= Y then
8334                         Node := FavoriteTreeView.GetNodeAt(X, Y + height);
8335
8336                 if Node = nil then
8337                         Exit;
8338
8339                 if Node.IsFirstNode then
8340                         Exit;
8341
8342                 Change := True;
8343
8344                 if FDropSpaceNode <> nil then
8345                         if FDropSpaceNode.AbsoluteIndex = Node.AbsoluteIndex then
8346                                 Change := False;
8347
8348                 if Change then begin
8349                         if FDropSpaceNode <> nil then
8350                                 FDropSpaceNode.Free;
8351
8352                         FDropSpaceNode := FavoriteDM.TreeView.Items.AddChildObjectFirst(Node.Parent, '', nil );
8353                         FDropSpaceNode.MoveTo( Node, naInsert );
8354                         FDropSpaceNode.ImageIndex := -1;
8355                         FDropSpaceNode.SelectedIndex := -1;
8356                 end;
8357         end;
8358
8359         if Source = FavoriteTreeView then begin
8360                 if FavoriteTreeView.Selected = FavoriteTreeView.Items.GetFirstNode then begin
8361                         Accept := False;
8362                         Exit;
8363                 end;
8364                 Accept := True;
8365         end else if Source = BrowserTab then
8366                 Accept := True
8367         else if Source = ListView then
8368                 Accept := True
8369         else if Source is TLinkToolButton then
8370                 Accept := True
8371         else if Source = TreeView then
8372                 Accept := True
8373         else
8374                 Accept := False;
8375 end;
8376
8377 procedure TGikoForm.FavoriteTreeViewDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
8378 begin
8379
8380         FavoriteDragOver( Sender, Source, X, Y, State, Accept );
8381
8382 end;
8383 procedure TGikoForm.LinkToolButtonStartDrag(Sender: TObject; var DragObject: TDragObject);
8384 begin
8385          //     FDragging := true;
8386 end;
8387
8388 procedure TGikoForm.LinkToolButtonDragDrop(Sender, Source: TObject; X, Y: Integer);
8389 var
8390         SenderNode: TTreeNode;
8391         LinkToolButton: TLinkToolButton;
8392 begin
8393
8394         LinkToolButton := TLinkToolButton( Sender );
8395         SenderNode := TreeNodeDataFind( FavoriteTreeView.Items.GetFirstNode, LinkToolButton.Data );
8396
8397         FavoriteDragDrop( SenderNode, Source );
8398
8399 end;
8400
8401 procedure TGikoForm.LinkToolButtonOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
8402 var
8403         favButton                       : TLinkToolButton;
8404         favThreadItem   : TFavoriteThreadItem;
8405 begin
8406
8407         case Button of
8408         mbMiddle:
8409                 begin
8410                         if Sender is TLinkToolButton then begin
8411                                 favButton := TLinkToolButton( Sender );
8412                                 if TObject( favButton.Data ) is TFavoriteThreadItem then begin
8413                                         favThreadItem := TFavoriteThreadItem( favButton.Data );
8414                                         if favThreadItem.Item <> nil then
8415                                                 InsertBrowserTab( favThreadItem.Item, False );
8416                                 end;
8417                         end;
8418                 end;
8419         end;
8420
8421 end;
8422
8423 procedure TGikoForm.LinkToolButtonOnMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
8424 var
8425         Now : Cardinal;
8426 begin
8427         TToolButton( Sender ).DragMode := dmManual;
8428         if ssLeft in Shift then begin
8429 //              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)
8430                 if FDragTime = 0 then begin
8431                         FDragTime := GetTickCount();
8432                 end else begin
8433                         Now := GetTickCount();
8434                         if (Now - FDragTime) > 500 then begin
8435                                 if FDragButton <> TToolButton( Sender ) then begin
8436                                         try
8437                                                 FDragButton := TToolButton( Sender );
8438                                                 TToolButton(Sender).BeginDrag(false ,5);
8439                                                 FDragTime := 0;
8440                                         except
8441                                                 {$IF Defined(debug)}
8442                                                 ShowMessage('Error');
8443                                                 {$IFEND}
8444                                         end;
8445                                 end;
8446                         end;
8447                 end;
8448         end else begin
8449                 FDragTime := 0;
8450         end;
8451 end;
8452
8453 procedure TGikoForm.LinkToolButtonOnMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
8454 begin
8455         FDragTime := 0;
8456 end;
8457
8458 function TGikoForm.GetWidthAllToolButton(ToolBar: TToolBar): Integer;
8459 var
8460         i: Integer;
8461 begin
8462         Result := 0;
8463         for i := 0 to ToolBar.ButtonCount - 1 do
8464                 if ToolBar.Buttons[i].Visible then
8465                         Result := Result + ToolBar.Buttons[i].Width;
8466 end;
8467
8468 procedure TGikoForm.MainCoolBarBandInfo(Sender: TObject; var BandInfo: PReBarBandInfoA);
8469 var
8470         Control : TWinControl;
8471         i, idx  : Integer;
8472 begin
8473         Control := FindControl(BandInfo^.hwndChild);
8474         if Control = nil then
8475                 Exit;
8476         idx := 0;
8477         for i := MainCoolBar.Bands.Count - 1 downto 0 do begin
8478                 if MainCoolBar.Bands[ i ].Control.Handle = Control.Handle then begin
8479                         idx := MainCoolBar.Bands[ i ].ID;
8480                         Break;
8481                 end;
8482         end;
8483         Canvas.Font.Handle := GetStockObject( DEFAULT_GUI_FONT );
8484         if (Control = MenuToolBar) or (Control = StdToolBar) then begin
8485                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE or RBBIM_STYLE or RBBIM_IDEALSIZE;
8486                 BandInfo^.fStyle                        := BandInfo.fStyle or RBBS_USECHEVRON;
8487                 BandInfo^.cxMinChild    := 0;
8488                 BandInfo^.cx                                    := GikoSys.Setting.MainCoolSet[ idx ].FCoolWidth;
8489                 BandInfo^.cxIdeal                       := GetWidthAllToolButton(TToolBar(Control));
8490         end else if Control = LinkToolBar then begin
8491                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE or RBBIM_STYLE or RBBIM_IDEALSIZE;
8492                 BandInfo^.fStyle                        := BandInfo.fStyle or RBBS_USECHEVRON;
8493                 BandInfo^.cxMinChild    := 0;
8494                 BandInfo^.cx                                    := GikoSys.Setting.MainCoolSet[ idx ].FCoolWidth + Canvas.TextWidth( '\83\8a\83\93\83N' );
8495                 BandInfo^.cxIdeal                       := GetWidthAllToolButton(TToolBar(Control));
8496         end else begin // AddressToolBar
8497                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE;
8498                 BandInfo^.cxMinChild    := 0;
8499                 BandInfo^.cx                                    := GikoSys.Setting.MainCoolSet[ idx ].FCoolWidth + Canvas.TextWidth( '\83A\83h\83\8c\83X' );
8500         end;
8501 end;
8502
8503 procedure TGikoForm.MainCoolBarChevronClick(Sender: TObject; RebarChevron: PNMRebarChevron);
8504 var
8505         i : Integer;
8506         Idx: Integer;
8507         p: TPoint;
8508 begin
8509         ChevronPopupMenu.Items.Clear;
8510         Idx := 0;
8511         for i := 0 to MainCoolBar.Bands.Count - 1 do begin
8512                 if MainCoolBar.Bands[ i ].Visible then begin
8513                         if Idx = Int64(RebarChevron^.uBand) then begin
8514                                 Idx := i;
8515                                 break;
8516                         end;
8517                         Inc( Idx );
8518                 end;
8519         end;
8520         if (Idx >= 0) and (MainCoolBar.Bands.Count > Idx) then begin
8521                 if MainCoolBar.Bands[Idx].Control = MenuToolbar then begin
8522                         MenuBarChevronMenu;
8523                 end else if MainCoolBar.Bands[Idx].Control = StdToolbar then begin
8524                         ToolBarChevronMenu(StdToolBar);
8525                 end else if MainCoolBar.Bands[Idx].Control = LinkToolbar then begin
8526                         LinkBarChevronMenu;
8527                 end else
8528                         Exit;
8529                 p := MainCoolBar.ClientToScreen(Point(RebarChevron^.rc.left, RebarChevron^.rc.bottom));
8530                 ChevronPopupMenu.Popup(p.x, p.y);
8531         end;
8532 end;
8533
8534 procedure TGikoForm.MenuBarChevronMenu;
8535         procedure SetSubMenu(MenuItem: TMenuItem; PopupItem: TMenuItem);
8536         var
8537                 i: Integer;
8538                 Item: TMenuItem;
8539         begin
8540                 MenuItem.Click;
8541                 for i := 0 to MenuItem.Count - 1 do begin
8542 //                      Item := nil;
8543                         if MenuItem[i] is TFavoriteMenuItem then begin
8544                                 Item := TFavoriteMenuItem.Create(Self);
8545                                 TFavoriteMenuItem(Item).Data := TFavoriteMenuItem(MenuItem[i]).Data;
8546                         end else
8547                                 Item := TMenuItem.Create(Self);
8548                         Item.Caption := MenuItem[i].Caption;
8549                         Item.Action := MenuItem[i].Action;
8550                         Item.ImageIndex := MenuItem[i].ImageIndex;
8551                         Item.OnClick := MenuItem[i].OnClick;
8552                         PopupItem.Add(Item);
8553                         if MenuItem[i].Count > 0 then
8554                                 SetSubMenu(MenuItem[i], Item);
8555                 end;
8556         end;
8557 var
8558         i: Integer;
8559         w: Integer;
8560         bw: Integer;
8561         Item: TMenuItem;
8562 begin
8563         ChevronPopupMenu.Items.Clear;
8564         ChevronPopupMenu.Images := MainMenu.Images;
8565         bw := GetWidthAllToolButton(MenuToolBar);
8566         if MenuToolBar.Width < bw then begin
8567                 w := 0;
8568                 for i := 0 to MenuToolBar.ButtonCount - 1 do begin
8569                         w := w + MenuToolBar.Buttons[i].Width;
8570                         if MenuToolBar.Width <= w then begin
8571                                 Item := TMenuItem.Create(Self);
8572                                 Item.Caption := MenuToolBar.Buttons[i].MenuItem.Caption;
8573                                 //Item.Action := MenuToolBar.Buttons[i].MenuItem.Action;
8574                                 ChevronPopupMenu.Items.Add(Item);
8575                                 SetSubMenu(MenuToolbar.Buttons[i].MenuItem, Item);
8576                         end;
8577                 end;
8578         end;
8579 end;
8580
8581 procedure TGikoForm.ToolBarChevronMenu(ToolBar: TToolBar);
8582         procedure SetSubMenu(PopupMenu: TPopupMenu; PopupItem: TMenuItem);
8583         var
8584                 i: Integer;
8585                 Item: TMenuItem;
8586         begin
8587                 if Assigned(PopupMenu.OnPopup) then
8588                         PopupMenu.OnPopup(nil);
8589                 for i := 0 to PopupMenu.Items.Count - 1 do begin
8590 //                      Item := nil;
8591                         if PopupMenu.Items[i] is TFavoriteMenuItem then begin
8592                                 Item := TFavoriteMenuItem.Create(Self);
8593                                 TFavoriteMenuItem(Item).Data := TFavoriteMenuItem(PopupMenu.Items[i]).Data;
8594                         end else
8595                         Item := TMenuItem.Create(Self);
8596                         Item.Caption := PopupMenu.Items[i].Caption;
8597                         Item.Action := PopupMenu.Items[i].Action;
8598                         Item.ImageIndex := PopupMenu.Items[i].ImageIndex;
8599                         Item.OnClick := PopupMenu.Items[i].OnClick;
8600                         PopupItem.Add(Item);
8601                 end;
8602         end;
8603 var
8604         i: Integer;
8605         w: Integer;
8606         bw: Integer;
8607         Item: TMenuItem;
8608 begin
8609         ChevronPopupMenu.Items.Clear;
8610         ChevronPopupMenu.Images := ToolBar.HotImages;
8611         bw := GetWidthAllToolButton(ToolBar);
8612         if ToolBar.Width < bw then begin
8613                 w := 0;
8614                 for i := 0 to ToolBar.ButtonCount - 1 do begin
8615                         w := w + ToolBar.Buttons[i].Width;
8616                         if ToolBar.Width <= w then begin
8617                                 Case ToolBar.Buttons[i].Tag of
8618                                 0:
8619                                         begin
8620                                                 Item := TMenuItem.Create(Self);
8621                                                 if ToolBar.Buttons[i].Style = tbsSeparator then
8622                                                         Item.Caption := '-'
8623                                                 else begin
8624                                                         Item.Caption := ToolBar.Buttons[i].Caption;
8625                                                         Item.Action := ToolBar.Buttons[i].Action;
8626                                                         //Item.Visible := True;
8627                                                 end;
8628                                                 ChevronPopupMenu.Items.Add(Item);
8629                                                 if ToolBar.Buttons[i].DropdownMenu <> nil then begin
8630                                                         Item.Action := nil;
8631                                                         Item.OnClick := nil;
8632                                                         SetSubMenu(ToolBar.Buttons[i].DropdownMenu, Item);
8633                                                 end;
8634                                         end;
8635                                 else
8636                                         // \8f«\97\88\82Ì\82½\82ß\82Ì\97\\96ñ
8637                                 end;
8638                         end;
8639                 end;
8640         end;
8641 end;
8642
8643 procedure TGikoForm.LinkBarChevronMenu;
8644 var
8645         i: Integer;
8646         j: Integer;
8647         w: Integer;
8648         Item: TFavoriteMenuItem;
8649         bw: Integer;
8650         Button: TLinkToolButton;
8651 begin
8652         ChevronPopupMenu.Items.Clear;
8653         ChevronPopupMenu.Images := LinkToolBar.Images;
8654         bw := GetWidthAllToolButton(LinkToolBar);
8655         if LinkToolBar.Width < bw then begin
8656                 w := 0;
8657                 for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
8658                         if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
8659                                 for j := 0 to FavoriteTreeView.Items[i].Count - 1 do begin
8660                                         w := w + LinkToolBar.Buttons[j].Width;
8661                                         if LinkToolBar.Width <= w then begin
8662                                                 if LinkToolBar.Buttons[j] is TLinkToolButton then begin
8663                                                         Button := TLinkToolButton(LinkToolBar.Buttons[j]);
8664                                                         Item := TFavoriteMenuItem.Create(Self);
8665                                                         if TObject(Button.Data) is TFavoriteFolder then begin
8666                                                                 CreateFavMenu(FavoriteTreeView.Items[i].Item[j], Item);
8667                                                         end else if TObject(Button.Data) is TFavoriteBoardItem then begin
8668                                                                 Item.OnClick := FavoriteClick;
8669                                                         end else if TObject(Button.Data) is TFavoriteThreadItem then begin
8670                                                                 Item.OnClick := FavoriteClick;
8671                                                         end;
8672                                                         Item.Data := Button.Data;
8673                                                         Item.Caption := LinkToolBar.Buttons[j].Caption;
8674                                                         Item.ImageIndex := LinkToolBar.Buttons[j].ImageIndex;
8675                                                         ChevronPopupMenu.Items.Add(Item);
8676                                                 end;
8677                                         end;
8678                                 end;
8679                                 break;
8680                         end;
8681                 end;
8682         end;
8683 end;
8684
8685 {!
8686 \brief  \83o\83\93\83h\95\9d\82ð\8dÄ\8cv\8eZ\81E\8dÄ\90Ý\92è\82·\82é
8687 \param  bar             \83o\83\93\83h\82ª\8f\8a\91®\82·\82é CoolBar
8688 \param  band    \8dÄ\8cv\8eZ\81E\8dÄ\90Ý\92è\82·\82é\83o\83\93\83h
8689
8690 \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É
8691 \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
8692 }
8693 procedure TGikoForm.ResetBandInfo( bar : TGikoCoolBar; band : TToolBar );
8694 var
8695         bandInfo        : tagREBARBANDINFOA;
8696         pBandInfo       : PReBarBandInfoA;
8697         lResult         : Integer;
8698         h                                       : HWND;
8699         i, idx          : Integer;
8700 begin
8701
8702         h                                                                               := band.Handle;
8703         pBandInfo := @bandInfo;
8704         ZeroMemory( pBandInfo, sizeof( bandInfo ) );
8705         bandInfo.cbSize                 := sizeof( bandInfo );
8706         bandInfo.hwndChild      := h;
8707         bandInfo.cyMinChild     := bar.Height;
8708         bar.OnBandInfo( nil, pBandInfo );
8709         // band \82Ì\83C\83\93\83f\83b\83N\83X\82ð\92T\82·
8710         idx := 0;
8711         for i := bar.Bands.Count - 1 downto 0 do begin
8712                 if bar.Bands[ i ].Control.Handle = h then begin
8713                         idx := i;
8714                         Break;
8715                 end;
8716         end;
8717         // \90Ý\92è
8718         lResult := SendMessage( bar.Handle, RB_SETBANDINFO, idx, Integer( pBandInfo ) );
8719
8720 end;
8721
8722 procedure TGikoForm.ListCoolBarBandInfo(Sender: TObject; var BandInfo: PReBarBandInfoA);
8723 var
8724         Control: TWinControl;
8725         i, idx  : Integer;
8726 begin
8727         Control := FindControl(BandInfo^.hwndChild);
8728         if Control = nil then
8729                 Exit;
8730         idx := 0;
8731         for i := ListCoolBar.Bands.Count - 1 downto 0 do begin
8732                 if ListCoolBar.Bands[ i ].Control.Handle = Control.Handle then begin
8733                         idx := ListCoolBar.Bands[ i ].ID;
8734                         Break;
8735                 end;
8736         end;
8737         if Control = ListToolBar then begin
8738                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE or RBBIM_STYLE or RBBIM_IDEALSIZE;
8739                 BandInfo^.fStyle                        := BandInfo.fStyle or RBBS_USECHEVRON;
8740                 BandInfo^.cxMinChild    := 0;
8741                 BandInfo^.cx                                    := GikoSys.Setting.ListCoolSet[ idx ].FCoolWidth;
8742                 BandInfo^.cxIdeal                       := GetWidthAllToolButton(TToolBar(Control));
8743         end else begin
8744                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE;
8745                 BandInfo^.cxMinChild    := 0;
8746                 BandInfo^.cx                                    := GikoSys.Setting.ListCoolSet[ idx ].FCoolWidth;
8747         end;
8748 end;
8749
8750 procedure TGikoForm.ListCoolBarChevronClick(Sender: TObject; RebarChevron: PNMRebarChevron);
8751 var
8752         Idx: Integer;
8753         p: TPoint;
8754 begin
8755         ChevronPopupMenu.Items.Clear;
8756         Idx := RebarChevron^.uBand;
8757         if (Idx >= 0) and (ListCoolBar.Bands.Count > Idx) then begin
8758                 if ListCoolBar.Bands[Idx].Control = ListToolBar then begin
8759                         ToolBarChevronMenu(ListToolBar);
8760                 end else
8761                         Exit;
8762                 p := ListCoolBar.ClientToScreen(Point(RebarChevron^.rc.left, RebarChevron^.rc.bottom));
8763                 ChevronPopupMenu.Popup(p.x, p.y);
8764         end;
8765 end;
8766
8767 procedure TGikoForm.BrowserCoolBarBandInfo(Sender: TObject; var BandInfo: PReBarBandInfoA);
8768 var
8769         Control: TWinControl;
8770         i, idx  : Integer;
8771 begin
8772         Control := FindControl(BandInfo^.hwndChild);
8773         if Control = nil then
8774                 Exit;
8775         idx := 0;
8776         for i := BrowserCoolBar.Bands.Count - 1 downto 0 do begin
8777                 if BrowserCoolBar.Bands[ i ].Control.Handle = Control.Handle then begin
8778                         idx := BrowserCoolBar.Bands[ i ].ID;
8779                         Break;
8780                 end;
8781         end;
8782         if Control = BrowserToolBar then begin
8783                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE or RBBIM_STYLE or RBBIM_IDEALSIZE;
8784                 BandInfo^.fStyle                        := BandInfo.fStyle or RBBS_USECHEVRON;
8785                 BandInfo^.cxMinChild    := 0;
8786                 BandInfo^.cx                                    := GikoSys.Setting.BrowserCoolSet[ idx ].FCoolWidth;
8787                 BandInfo^.cxIdeal                       := GetWidthAllToolButton(TToolBar(Control));
8788         end else begin
8789                 BandInfo^.fMask                         := BandInfo.fMask or RBBIM_CHILDSIZE;
8790                 BandInfo^.cxMinChild    := 0;
8791                 BandInfo^.cx                                    := GikoSys.Setting.BrowserCoolSet[ idx ].FCoolWidth;
8792         end;
8793 end;
8794
8795 procedure TGikoForm.BrowserCoolBarChevronClick(Sender: TObject; RebarChevron: PNMRebarChevron);
8796 var
8797         Idx: Integer;
8798         p: TPoint;
8799 begin
8800         ChevronPopupMenu.Items.Clear;
8801         Idx := RebarChevron^.uBand;
8802         if (Idx >= 0) and (BrowserCoolBar.Bands.Count > Idx) then begin
8803                 if BrowserCoolBar.Bands[Idx].Control = BrowserToolBar then
8804                         ToolBarChevronMenu(BrowserToolBar)
8805                 else
8806                         Exit;
8807                 p := BrowserCoolBar.ClientToScreen(Point(RebarChevron^.rc.left, RebarChevron^.rc.bottom));
8808                 ChevronPopupMenu.Popup(p.x, p.y);
8809         end;
8810 end;
8811
8812 procedure TGikoForm.ListViewColumnInfo(Sender: TObject; var Column: PLVColumnA);
8813 begin
8814         if Column^.iImage = -1 then begin
8815                 Column^.mask := Column^.mask or LVCF_FMT;
8816         end else begin
8817                 Column^.mask := Column^.mask or LVCF_FMT or LVCF_IMAGE;
8818                 Column^.fmt := Column^.fmt or LVCFMT_IMAGE or LVCFMT_BITMAP_ON_RIGHT;
8819         end;
8820 end;
8821
8822 procedure TGikoForm.ThreadEditorActionExecute(Sender: TObject);
8823 var
8824         Editor: TEditorForm;
8825 begin
8826         if not (GetActiveList is TBoard) then
8827                 Exit;
8828         Editor := TEditorForm.Create(Self);
8829         Editor.SetBoard(TBoard(GetActiveList));
8830         Editor.Show;
8831         Editor.BodyEdit.SetFocus;
8832 end;
8833
8834 procedure TGikoForm.ToolBarSettingActionExecute(Sender: TObject);
8835 var
8836         Dlg: TToolBarSettingDialog;
8837         i: Integer;
8838         //Component: TComponent;
8839 begin
8840         Dlg := TToolBarSettingDialog.Create(Self, ActionList);
8841         try
8842                 Dlg.AddToolBar(StdToolBar, gttStandard);
8843                 Dlg.AddToolBar(ListToolBar, gttList);
8844                 Dlg.AddToolBar(BrowserToolBar, gttBrowser);
8845                 case FToolBarSettingSender of
8846                 tssMain:                Dlg.ToolBarIndex := 0;
8847                 tssList:                Dlg.ToolBarIndex := 1;
8848                 tssBrowser: Dlg.ToolBarIndex := 2;
8849                 end;
8850                 {
8851                 if ToolBarSettingAction.ActionComponent.GetParentComponent is TPopupMenu then begin
8852                         Component := TPopupMenu( ToolBarSettingAction.ActionComponent.GetParentComponent ).PopupComponent;
8853
8854                         if Component = MainCoolBar then
8855                                 Dlg.ToolBarComboBox.ItemIndex := 0
8856                         else if Component = ListCoolBar then
8857                                 Dlg.ToolBarComboBox.ItemIndex := 1
8858                         else if Component = BrowserCoolBar then
8859                                 Dlg.ToolBarComboBox.ItemIndex := 2;
8860                 end;
8861                 }
8862                 if Dlg.ShowModal = mrOK then begin
8863                         SetToolBarPopup;
8864
8865                         //\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é
8866                         for i := 0 to MainCoolBar.Bands.Count - 1 do begin
8867                                 MainCoolBar.Bands[i].MinWidth := MainCoolBar.Bands[i].MinWidth + 1;
8868                                 MainCoolBar.Bands[i].MinWidth := MainCoolBar.Bands[i].MinWidth - 1;
8869                         end;
8870                         for i := 0 to ListCoolBar.Bands.Count - 1 do begin
8871                                 ListCoolBar.Bands[i].MinWidth := ListCoolBar.Bands[i].MinWidth + 1;
8872                                 ListCoolBar.Bands[i].MinWidth := ListCoolBar.Bands[i].MinWidth - 1;
8873                         end;
8874                         for i := 0 to BrowserCoolBar.Bands.Count - 1 do begin
8875                                 BrowserCoolBar.Bands[i].MinWidth := BrowserCoolBar.Bands[i].MinWidth + 1;
8876                                 BrowserCoolBar.Bands[i].MinWidth := BrowserCoolBar.Bands[i].MinWidth - 1;
8877                         end;
8878                         SaveToolBarSetting(StdToolBar);
8879                         SaveToolBarSetting(ListToolBar);
8880                         for i := ListToolBar.ControlCount - 1 downto 0 do
8881                         begin
8882                                 if ListToolBar.Controls[ i ].Action = SelectItemAction then
8883                                 begin
8884                                         // \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·
8885                                         if (i + 1) < ListToolBar.ControlCount then
8886                                                 if ListToolBar.Controls[ i + 1 ] is TToolButton then
8887                                                         if TToolButton( ListToolBar.Controls[ i + 1 ] ).Style = tbsSeparator then
8888                                                                 ListToolBar.Controls[ i + 1 ].Visible := False;
8889
8890                                         // \83X\83\8c\83b\83h\8di\8d\9e\83{\83^\83\93\82ð\89B\82·
8891                                         ListToolBar.Controls[ i ].Visible := False;
8892                                         // \83X\83\8c\83b\83h\8di\8d\9e\83t\83B\81[\83\8b\83h\82ð\91}\93ü
8893                                         SelectComboBox.Left := ListToolBar.Controls[ i ].Left;
8894                                         SelectComboBox.Width := GikoSys.Setting.SelectComboBoxWidth;
8895                                         SelectComboBox.Parent := ListToolBar;
8896                                         // \83X\83\8c\83b\83h\8di\8d\9e\97p\93Æ\8e©\83Z\83p\83\8c\81[\83^\82ð\91}\93ü
8897                                         SelectComboBoxSplitter.Left := SelectComboBox.Left + SelectComboBox.Width;
8898                                         SelectComboBoxSplitter.Parent := ListToolBar;
8899
8900                                         break;
8901                                 end;
8902                         end;
8903                         ResetBandInfo( ListCoolBar, ListToolBar );
8904                         SaveToolBarSetting(BrowserToolBar);
8905                 end;
8906         finally
8907                 Dlg.Release;
8908                 FToolBarSettingSender := tssNone;
8909         end;
8910 end;
8911
8912 function TGikoForm.FindToolBarButton( bar : TToolBar; action : TAction ) : TToolButton;
8913 var
8914         i : Integer;
8915 begin
8916
8917         for i := bar.ButtonCount - 1 downto 0 do begin
8918                 if bar.Buttons[ i ].Action = action then begin
8919                         Result := bar.Buttons[ i ];
8920                         Exit;
8921                 end;
8922         end;
8923
8924         Result := nil;
8925
8926 end;
8927
8928 procedure TGikoForm.SetToolBarPopup;
8929 var
8930         i                                                                       : Integer;
8931         aIEButton                                       : TToolButton;
8932         aCabinetBBSButton       : TToolButton;
8933         aResRangeButton         : TToolButton;
8934         aThreadRangeButton:     TToolButton;
8935 begin
8936         for i := 0 to StdToolBar.ButtonCount - 1 do begin
8937         end;
8938         for i := 0 to ListToolBar.ButtonCount - 1 do begin
8939                 if ListToolBar.Buttons[i].Action = IconStyle then
8940                         ListToolBar.Buttons[i].DropdownMenu := ListIconPopupMenu;
8941                 if ListToolBar.Buttons[i].Action = SelectReservAction then
8942                         ListToolBar.Buttons[i].DropdownMenu := RoundNamePopupMenu;
8943         end;
8944         aIEButton                                       := FindToolBarButton( BrowserToolBar, IEAction );
8945         if aIEButton <> nil then
8946                 aIEButton.DropdownMenu                                  := BrowserPopupMenu;
8947         aCabinetBBSButton       := FindToolBarButton( StdToolBar, CabinetBBSAction );
8948         if aCabinetBBSButton <> nil then
8949                 aCabinetBBSButton.DropdownMenu  := BBSSelectPopupMenu;
8950         aResRangeButton         := FindToolBarButton( BrowserToolBar, ResRangeAction );
8951         if aResRangeButton <> nil then
8952                 aResRangeButton.DropdownMenu            := ResRangePopupMenu;
8953         aThreadRangeButton:= FindToolBarButton( ListToolBar, ThreadRangeAction );
8954         if aThreadRangeButton <> nil then
8955                 aThreadRangeButton.DropdownMenu := ThreadRangePopupMenu;
8956 end;
8957
8958 procedure TGikoForm.FormMouseWheel(Sender: TObject; Shift: TShiftState;
8959         WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
8960 var
8961         Wnd: THandle;
8962         delta: Integer;
8963 //      browserPos : TPoint;
8964 const
8965         ICON_SIZE = 16;
8966 begin
8967         Wnd := WindowFromPoint(Mouse.CursorPos);
8968         Handled := True;
8969         if WheelDelta > 0 then
8970                 Delta := -1
8971         else
8972                 Delta := 1;
8973
8974         if (Wnd = BrowserTab.Handle) or
8975                  (Wnd = BrowserTab.Parent.Handle) then begin
8976                 BrowserTab.ScrollTabs(Delta);
8977         end else begin
8978                 if FIsHandledWheel then begin
8979                         FIsHandledWheel := False;
8980                         Handled := False;
8981                 end else begin
8982                         FIsHandledWheel := True;
8983                         if (Wnd = TreeView.Handle) or  (Wnd = FavoriteTreeView.Handle)
8984                         or (Wnd = ListView.Handle) or (Wnd = MessageListView.Handle)
8985                         then
8986                                 SendMessage( Wnd, WM_MOUSEWHEEL, WheelDelta shl 16, (Mouse.CursorPos.X shl 16) or Mouse.CursorPos.Y )
8987                         else
8988                                 Handled := False;
8989
8990 {
8991 //                      if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
8992                                 // TWebBrowser \82Ì Handle \82Æ\94ä\8ar\82µ\82Ä\82à\88ê\92v\82µ\82È\82¢\82Ì\82Å\8dÀ\95W\82Å TWebBrowser \82©\82Ç\82¤\82©\94»\92è
8993                                 browserPos.X := 0;
8994                                 browserPos.Y := 0;
8995                                 Windows.ClientToScreen( Browser.Handle, browserPos );
8996                                 if (Longword(Mouse.CursorPos.X - browserPos.X) >= Browser.Width)
8997                                 or (Longword(Mouse.CursorPos.Y - browserPos.Y) >= Browser.Height)
8998                                 or (Longword(Mouse.CursorPos.Y - browserPos.Y) < 0)
8999                                 or (Longword(Mouse.CursorPos.Y - browserPos.Y) < 0) then begin
9000 //                              or not FActiveContent.Browser.Focused then
9001                                         // TWebBrowser \82Í\96³\8cÀ\83\8b\81[\83v\82·\82é\82Ì\82Å\82»\82ê\88È\8aO\82È\82ç\83R\83\93\83g\83\8d\81[\83\8b\82É\91\97\90M
9002                                         if (Wnd <> BrowserToolBar.Handle) and (Wnd <> BrowserNameToolBar.Handle) then
9003                                                 SendMessage( Wnd, WM_MOUSEWHEEL, WheelDelta shl 16, (Mouse.CursorPos.X shl 16) or Mouse.CursorPos.Y )
9004                                         else
9005                                                 Handled := False;
9006                                 end else begin
9007                                         Handled := False;
9008                                 end;
9009 //                      end else begin
9010 //                              SendMessage( Wnd, WM_MOUSEWHEEL, WheelDelta shl 16, (MousePos.X shl 16) or MousePos.Y );
9011 //                      end;
9012 }               end;
9013         end;
9014 end;
9015
9016
9017 procedure TGikoForm.SelectComboBoxChange(Sender: TObject);
9018 begin
9019         if Length( SelectComboBox.Text ) = 0 then
9020         begin
9021                 AllItemAction.Checked := True;
9022                 LogItemAction.Checked := False;
9023                 NewItemAction.Checked := False;
9024         end else begin
9025                 // \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é
9026                 if AllItemAction.Checked then
9027                                                 AllItemAction.Checked := False;
9028                 if LogItemAction.Checked then
9029                                                 LogItemAction.Checked := False;
9030                 if NewItemAction.Checked then
9031                                                 NewItemaction.Checked := False;
9032         end;
9033
9034         if Length( SelectComboBox.Text ) = 0 then
9035                 SetListViewType( gvtAll )
9036         else
9037                 SetListViewType( gvtUser, SelectComboBox.Text, false);
9038 end;
9039
9040 procedure TGikoForm.SelectComboBoxKeyDown(Sender: TObject; var Key: Word;
9041         Shift: TShiftState);
9042 begin
9043
9044         if Key = VK_Return then
9045         begin
9046                 ModifySelectList;
9047         end else if Length( SelectComboBox.Text ) = 0 then
9048         begin
9049                 {* SelectComboBox.Text\82ª\8bó\82Å\82à\81A\93ü\97Í\93r\92\86\82ÅEsc\82µ\82½\82Æ\82©
9050                  * \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
9051                  * \81i\82±\82±\82Å\82Í\89½\82à\82µ\82È\82¢\81j
9052                  *}
9053         end else begin
9054                 // \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é
9055                 if AllItemAction.Checked then
9056                         AllItemAction.Checked := False;
9057                 if LogItemAction.Checked then
9058                         LogItemAction.Checked := False;
9059                 if NewItemAction.Checked then
9060                         NewItemaction.Checked := False;
9061         end;
9062
9063 end;
9064
9065 procedure TGikoForm.SelectComboBoxExit(Sender: TObject);
9066 begin
9067
9068         ModifySelectList;
9069
9070         if Length( SelectComboBox.Text ) = 0 then
9071         begin
9072                 SelectComboBox.Text := SELECTCOMBOBOX_NAME;
9073                 SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
9074         end;
9075
9076 end;
9077
9078 // \8di\82è\8d\9e\82Ý\8c\9f\8dõ\82Ì\97\9a\97ð\8dX\90V
9079 procedure TGikoForm.ModifySelectList;
9080 var
9081         idx : Integer;
9082         oldText : string;
9083 begin
9084
9085         try
9086                 if SelectComboBox.Parent = nil then
9087                         exit;
9088
9089                 if Length( SelectComboBox.Text ) > 0 then
9090                 begin
9091                         oldText := SelectComboBox.Text;
9092                         idx := GikoSys.Setting.SelectTextList.IndexOf( oldText );
9093                         if idx <> -1 then
9094                                 GikoSys.Setting.SelectTextList.Delete( idx );
9095                         idx := SelectComboBox.Items.IndexOf( oldText );
9096                         if idx <> -1 then
9097                                 SelectComboBox.Items.Delete( idx );
9098                         GikoSys.Setting.SelectTextList.Insert( 0, oldText );
9099                         SelectComboBox.Items.Insert( 0, oldText );
9100                         SelectComboBox.Text := oldText;
9101                 end;
9102         except
9103         end;
9104
9105 end;
9106
9107
9108 //NG\83\8f\81[\83h\83t\83@\83C\83\8b\82ð\8dÄ\93Ç\82Ý\8d\9e\82Ý\82·\82é
9109 procedure TGikoForm.SelectResActionExecute(Sender: TObject);
9110 var
9111         Dlg: TListSelectDialog;
9112         ThreadItem : TThreadItem;
9113         FilterList : TStringList;
9114         i, idx : Integer;
9115 begin
9116         Dlg := TListSelectDialog.Create(Self);
9117         try
9118                 Dlg.SelectComboBox.Items.Assign(GikoSys.Setting.SelectTextList);
9119                 Dlg.SelectComboBox.Text := FSelectResWord;
9120                 Dlg.ShowModal;
9121                 if Dlg.ModalResult = mrOK then begin
9122                         SelectResAction.Checked := True;
9123                         if Length( Dlg.SelectComboBox.Text ) = 0 then begin
9124                                 // \8bó\93ü\97Í\82Å OK \82Í\8di\82è\8d\9e\82Ý\89ð\8f\9c\82Æ\93¯\88Ó\8b`
9125                                 ResRangeAction.Execute;
9126                         end else begin
9127                                 GikoSys.ResRange := Ord( grrSelect );
9128
9129                                 // \8dÅ\8cã\82É\90Ý\92è\82µ\82½\82à\82Ì\82ð\8ao\82¦\82Ä\82¨\82­
9130                                 FSelectResWord := Dlg.SelectComboBox.Text;
9131
9132                                 // \8c\9f\8dõ\97\9a\97ð\82Ì\8dX\90V
9133                                 idx := GikoSys.Setting.SelectTextList.IndexOf(Dlg.SelectComboBox.Text);
9134                                 if idx <> -1 then
9135                                         GikoSys.Setting.SelectTextList.Delete(idx);
9136                                 GikoSys.Setting.SelectTextList.Insert(0, Dlg.SelectComboBox.Text);
9137                                 while Dlg.SelectComboBox.Items.Count > 100 do begin
9138                                         Dlg.SelectComboBox.Items.Delete(Dlg.SelectComboBox.Items.Count - 1);
9139                                 end;
9140
9141                                 try
9142                                         if SelectComboBox.Parent <> nil then
9143                                                 SelectComboBox.Items.Assign( GikoSys.Setting.SelectTextList );
9144                                 except
9145                                 end;
9146
9147                                 // \83t\83B\83\8b\83^\82Ì\90Ý\92è
9148                                 FilterList := TStringList.Create;
9149                                 try
9150                                         GikoSys.FSelectResFilter.Reverse := True;
9151                                         FilterList.Delimiter := ' '; //\8bæ\90Ø\82è\8eq\82ð\94¼\8ap\83X\83y\81[\83X\82É\90Ý\92è
9152                                         FilterList.DelimitedText := Dlg.SelectComboBox.Text;
9153
9154                                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
9155                                 finally
9156                                         FilterList.Destroy;
9157                                 end;
9158
9159                                 // \83X\83\8c\83b\83h\82Ì\8dÄ\95`\89æ
9160                                 for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
9161                     TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
9162                                 end;
9163                                 ThreadItem := GetActiveContent;
9164                                 if ThreadItem <> nil then
9165                                         InsertBrowserTab( ThreadItem, True );
9166                         end;
9167                 end else begin
9168                         // \83L\83\83\83\93\83Z\83\8b
9169                         if GikoSys.ResRange <> Ord( grrSelect ) then
9170                                 ResRangeAction.Execute;
9171                 end;
9172         finally
9173                 Dlg.Release;
9174         end;
9175
9176 end;
9177
9178 procedure TGikoForm.SelectResActionUpdate(Sender: TObject);
9179 begin
9180         SelectResAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
9181 end;
9182
9183 // \91S\82Ä\82Ì\83\8c\83X\82ð\95\\8e¦
9184 procedure TGikoForm.AllResActionExecute(Sender: TObject);
9185 var
9186         ThreadItem : TThreadItem;
9187         FilterList : TStringList;
9188         i: Integer;
9189 begin
9190         if(FActiveContent <> nil) and (FActiveContent.FBrowser <> nil )
9191                 and (FActiveContent.FBrowser.Busy) then Exit;
9192
9193         FResRangeMenuSelect                             := Ord( grrAll );
9194         AllResAction.Checked                    := True;
9195
9196         if GikoSys.ResRange <> Ord( grrAll ) then begin
9197                 GikoSys.ResRange := Ord( grrAll );
9198
9199                 // \83t\83B\83\8b\83^\95\8e\9a\97ñ\82ð\8bó\82É\82·\82é
9200                 FilterList := TStringList.Create;
9201                 try
9202                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
9203                         GikoSys.FSelectResFilter.Reverse := False;
9204                 finally
9205                         FilterList.Destroy;
9206                 end;
9207
9208                 FSelectResWord := '';
9209
9210                 // \83X\83\8c\83b\83h\82ð\8dÄ\95`\89æ
9211                 for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
9212                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
9213                 end;
9214                 ThreadItem := GetActiveContent;
9215                 if ThreadItem <> nil then
9216                         InsertBrowserTab( ThreadItem, True );
9217         end;
9218 end;
9219
9220 procedure TGikoForm.AllResActionUpdate(Sender: TObject);
9221 begin
9222         AllResAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
9223 end;
9224
9225 procedure TGikoForm.ReloadClick(Sender: TObject);
9226 var
9227         ThreadItem : TThreadItem;
9228         i: Integer;
9229 begin
9230         if GikoSys.FAbon.ReLoadFromNGwordFile =false then begin
9231                 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);
9232         end else begin
9233                 for i := BrowserTab.Tabs.Count - 1 downto 0 do
9234                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
9235                         
9236                 ThreadItem := GetActiveContent;
9237                 if ThreadItem <> nil then
9238                         InsertBrowserTab( ThreadItem, True );
9239         end;
9240
9241 end;
9242
9243 procedure TGikoForm.GoBackClick(Sender: TObject);
9244 var
9245         ThreadItem : TThreadItem;
9246         s: string;
9247         i: Integer;
9248 begin
9249         if GikoSys.FAbon.GoForward =false then begin
9250                 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);
9251         end else begin
9252                 s := GikoSys.FAbon.NGwordname;
9253                 StatusBar.Panels.Items[2].Text := s;
9254                 StatusBar.Panels[2].Width := Max(StatusBar.Canvas.TextWidth(s), 100);
9255                 StatusBarResize(Sender);
9256                 for i := BrowserTab.Tabs.Count - 1 downto 0 do
9257                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
9258
9259                 ThreadItem := GetActiveContent;
9260                 if ThreadItem <> nil then
9261                         InsertBrowserTab( ThreadItem, True );
9262         end;
9263
9264 end;
9265
9266 procedure TGikoForm.GoFowardClick(Sender: TObject);
9267 var
9268         ThreadItem : TThreadItem;
9269         s: string;
9270         i: Integer;
9271 begin
9272         if GikoSys.FAbon.GoBack =false then begin
9273                 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);
9274         end else begin
9275                 s := GikoSys.FAbon.NGwordname;
9276                 StatusBar.Panels.Items[2].Text := s;
9277                 StatusBar.Panels[2].Width := Max(StatusBar.Canvas.TextWidth(s), 100);
9278                 StatusBarResize(Sender);
9279                 for i := BrowserTab.Tabs.Count - 1 downto 0 do
9280                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
9281
9282                 ThreadItem := GetActiveContent;
9283                 if ThreadItem <> nil then
9284                         InsertBrowserTab( ThreadItem, True );
9285         end;
9286
9287 end;
9288
9289 procedure TGikoForm.SelectComboBoxSplitterMouseMove(Sender: TObject;
9290         Shift: TShiftState; X, Y: Integer);
9291 var
9292         pos                             : TPoint;
9293         w                                       : Integer;
9294 begin
9295         If (SelectComboBox.Parent <> nil) and (IsDraggingSelectComboBox) Then begin
9296                 pos.X := X;
9297                 pos.Y := Y;
9298                 pos := SelectComboBoxSplitter.ClientToScreen( pos );
9299                 w := SelectComboBox.Width + (pos.X - DraggingSelectComboBoxPosition.X);
9300
9301                 If w <= 50 Then Begin
9302                         // \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­
9303                         // \81u\8e~\82Ü\82Á\82½(50pixel)\88Ê\92u\81v\82É\82È\82é\82æ\82¤\82É
9304                         pos.X := pos.X + (50 - w);
9305
9306                         // \8f¬\82³\82­\82È\82è\82·\82¬\82È\82¢\82æ\82¤\82É
9307                         w := 50;
9308                 End;
9309
9310                 // \83`\83\89\82Â\82«\8cy\8c¸\82Ì\88×
9311                 If SelectComboBox.Width <> w Then Begin
9312                         SelectComboBox.Width := w;
9313                         GikoSys.Setting.SelectComboBoxWidth := w;
9314                         DraggingSelectComboBoxPosition := pos;
9315
9316                         // \83V\83F\83u\83\8d\83\93\88Ê\92u\82ª\95Ï\82í\82é\82Ì\82Å BandInfo \82Ì\8dÄ\90Ý\92è
9317                         ResetBandInfo( ListCoolBar, ListToolBar );
9318                 End;
9319         End;
9320 end;
9321
9322 procedure TGikoForm.SelectComboBoxSplitterMouseDown(Sender: TObject;
9323         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
9324 var
9325         pos : TPoint;
9326 begin
9327         IsDraggingSelectComboBox := True;
9328         pos.X := X;
9329         pos.Y := Y;
9330         DraggingSelectComboBoxPosition := SelectComboBoxSplitter.ClientToScreen( pos );
9331 end;
9332
9333 procedure TGikoForm.SelectComboBoxSplitterMouseUp(Sender: TObject;
9334         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
9335 begin
9336         IsDraggingSelectComboBox := False;
9337 end;
9338
9339 procedure TGikoForm.StatusBarResize(Sender: TObject);
9340 begin
9341         StatusBar.Panels[1].Width := StatusBar.Width -
9342                                                                                                                          StatusBar.Panels[0].Width -
9343                                                                                                                          StatusBar.Panels[2].Width;
9344 end;
9345 //\8cÂ\95Ê\82 \82Ú\81[\82ñ\81u\92Ê\8fí\81v
9346 procedure TGikoForm.IndividualAbon1Click(Sender: TObject);
9347 var
9348         ThreadItem      : TThreadItem;
9349         ReadList                : TStringList;
9350         wordCount               : TWordCount;
9351 begin
9352         ThreadItem      := GetActiveContent;
9353         ReadList                := TStringList.Create;
9354         wordCount               := TWordCount.Create;
9355         try
9356                 ThreadItem.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
9357                 // \83X\83p\83\80\82É\90Ý\92è
9358                 ReadList.LoadFromFile( ThreadItem.GetThreadFileName );
9359                 GikoSys.SpamCountWord( ReadList[ KokoPopupMenu.Tag - 1 ], wordCount );
9360                 GikoSys.SpamForget( wordCount, False ); // \83n\83\80\82ð\89ð\8f\9c
9361                 GikoSys.SpamLearn( wordCount, True );           // \83X\83p\83\80\82É\90Ý\92è
9362                 // \82 \82Ú\81[\82ñ\82É\90Ý\92è
9363                 GikoSys.FAbon.AddIndividualAbon(KokoPopupMenu.Tag, 1, ChangeFileExt(ThreadItem.GetThreadFileName, '.NG'));
9364         finally
9365                 wordCount.Free;
9366                 ReadList.Free;
9367         end;
9368         FActiveContent.Repaint := true;
9369         if ThreadItem <> nil then
9370                 InsertBrowserTab( ThreadItem, True );
9371 end;
9372 //\8cÂ\95Ê\82 \82Ú\81[\82ñ\81u\93§\96¾\81v
9373 procedure TGikoForm.IndividualAbon2Click(Sender: TObject);
9374 var
9375         ThreadItem : TThreadItem;
9376         ReadList                : TStringList;
9377         wordCount               : TWordCount;
9378 begin
9379         ThreadItem := GetActiveContent;
9380         ReadList                := TStringList.Create;
9381         wordCount               := TWordCount.Create;
9382         try
9383                 ThreadItem.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
9384                 // \83X\83p\83\80\82É\90Ý\92è
9385                 ReadList.LoadFromFile( ThreadItem.GetThreadFileName );
9386                 GikoSys.SpamCountWord( ReadList[ KokoPopupMenu.Tag - 1 ], wordCount );
9387                 GikoSys.SpamForget( wordCount, False ); // \83n\83\80\82ð\89ð\8f\9c
9388                 GikoSys.SpamLearn( wordCount, True );           // \83X\83p\83\80\82É\90Ý\92è
9389                 // \82 \82Ú\81[\82ñ\82É\90Ý\92è
9390                 GikoSys.FAbon.AddIndividualAbon(KokoPopupMenu.Tag, 0, ChangeFileExt(ThreadItem.GetThreadFileName, '.NG'));
9391         finally
9392                 wordCount.Free;
9393                 ReadList.Free;
9394         end;
9395         FActiveContent.Repaint := true;
9396         if ThreadItem <> nil then
9397                 InsertBrowserTab( ThreadItem, True );
9398 end;
9399 //\8cÂ\95Ê\82 \82Ú\81[\82ñ\89ð\8f\9c\81i\81j
9400 procedure TGikoForm.AntiIndividualAbonClick(Sender: TObject);
9401 var
9402         IndividualForm :TIndividualAbonForm;
9403         ThreadItem : TThreadItem;
9404         msg : String;
9405         ReadList                : TStringList;
9406         wordCount               : TWordCount;
9407 begin
9408         IndividualForm := TIndividualAbonForm.Create(Self);
9409         try
9410                 ThreadItem := GetActiveContent;
9411                 ThreadItem.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
9412                 if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
9413                         if IndividualForm.SetThreadLogFileName(ThreadItem.GetThreadFileName) then begin
9414                                 ReadList                := TStringList.Create;
9415                                 wordCount               := TWordCount.Create;
9416                                 try
9417                                         // \83X\83p\83\80\82ð\89ð\8f\9c
9418                                         ReadList.LoadFromFile( ThreadItem.GetThreadFileName );
9419                                         GikoSys.SpamCountWord( ReadList[ KokoPopupMenu.Tag - 1 ], wordCount );
9420                                         GikoSys.SpamForget( wordCount, True );  // \83X\83p\83\80\82ð\89ð\8f\9c
9421                                         GikoSys.SpamLearn( wordCount, False );  // \83n\83\80\82É\90Ý\92è
9422                                         if IndividualForm.DeleteNG(KokoPopupMenu.Tag) then begin
9423                                                 FActiveContent.Repaint := true;
9424                                                 InsertBrowserTab( ThreadItem, True );
9425                                         end;
9426                                 finally
9427                                         wordCount.Free;
9428                                         ReadList.Free;
9429                                 end;
9430                         end else begin
9431                                 msg := '\82±\82Ì\83X\83\8c\83b\83h\82Å\82Í\8cÂ\95Ê\82 \82Ú\81`\82ñ\82ð\8ds\82Á\82Ä\82Ü\82¹\82ñ';
9432                                 MsgBox(Handle, msg, '\83\81\83b\83Z\81[\83W', MB_OK);
9433                         end;
9434                 end;
9435         finally
9436                 IndividualForm.Release;
9437         end;
9438 end;
9439 //\8cÂ\95Ê\82 \82Ú\81[\82ñ\89ð\8f\9c
9440 procedure TGikoForm.N42Click(Sender: TObject);
9441 var
9442         IndividualForm :TIndividualAbonForm;
9443         ThreadItem : TThreadItem;
9444         msg : String;
9445         ReadList                : TStringList;
9446         wordCount               : TWordCount;
9447 begin
9448         IndividualForm := TIndividualAbonForm.Create(Self);
9449         try
9450                 ThreadItem := GetActiveContent;
9451                 ThreadItem.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
9452                 if (ThreadItem <> nil) and (ThreadItem.IsLogFile) then begin
9453                         if IndividualForm.SetThreadLogFileName(ThreadItem.GetThreadFileName) then begin
9454                                 if IndividualForm.ShowModal = mrOK then begin
9455                                         ReadList                := TStringList.Create;
9456                                         wordCount               := TWordCount.Create;
9457                                         try
9458                                                 // \83X\83p\83\80\82ð\89ð\8f\9c
9459                                                 ReadList.LoadFromFile( ThreadItem.GetThreadFileName );
9460                                                 GikoSys.SpamCountWord( ReadList[ KokoPopupMenu.Tag - 1 ], wordCount );
9461                                                 GikoSys.SpamForget( wordCount, True );  // \83X\83p\83\80\82ð\89ð\8f\9c
9462                                                 GikoSys.SpamLearn( wordCount, False );  // \83n\83\80\82É\90Ý\92è
9463                                                 if IndividualForm.FRepaint then begin
9464                                                         FActiveContent.Repaint := true;
9465                                                         InsertBrowserTab( ThreadItem, True );
9466                                                 end;
9467                                         finally
9468                                                 wordCount.Free;
9469                                                 ReadList.Free;
9470                                         end;
9471                                 end;
9472                         end else begin
9473                                 msg := '\82±\82Ì\83X\83\8c\83b\83h\82Å\82Í\8cÂ\95Ê\82 \82Ú\81`\82ñ\82ð\8ds\82Á\82Ä\82Ü\82¹\82ñ';
9474                                 MsgBox(Handle, msg, '\83\81\83b\83Z\81[\83W', MB_OK);
9475                         end;
9476                 end;
9477         finally
9478                 IndividualForm.Release;
9479         end;
9480 end;
9481
9482 procedure TGikoForm.SelectComboBoxEnter(Sender: TObject);
9483 begin
9484
9485         if (Length( SelectComboBox.Text ) = 0) or
9486                 (SelectComboBox.Text = SELECTCOMBOBOX_NAME) then
9487         begin
9488                 SelectComboBox.Text := '';
9489                 SelectComboBox.Color := clWindow;
9490         end;
9491
9492 end;
9493
9494 procedure TGikoForm.N51Click(Sender: TObject);
9495 begin
9496         N42Click(Sender);
9497 end;
9498 //\94Â\96¼\8c\9f\8dõ
9499 procedure TGikoForm.TreeSelectSearchBoardNameExecute(Sender: TObject);
9500 var
9501         s : String;
9502         msg : String;
9503         CurItem : TTreeNode;
9504         next : boolean;
9505 begin
9506         if InputQuery('\94Â\96¼\8c\9f\8dõ','\94Â\96¼\82Ì\93ü\97Í',s) then begin
9507                 next := true;
9508                 while next do begin
9509                         if TreeView.Selected = nil then
9510                                 CurItem := TreeView.Items.GetFirstNode
9511                         else begin
9512                                 CurItem := TreeView.Selected.GetNext;
9513                                 if CurItem = nil then
9514                                         CurItem := TreeView.Items.GetFirstNode;
9515                         end;
9516                         while CurItem <> nil do begin
9517                                 if (CurItem.ImageIndex <> 2) and (VaguePos(s,CurItem.Text) <> 0) then begin
9518                                         break;
9519                                 end;
9520                                 CurItem := CurItem.GetNext;
9521                         end;
9522                         try
9523                                 if CurItem = nil then begin
9524                                         msg := '\90æ\93ª\82É\96ß\82è\82Ü\82·\82©\81H';
9525                                         if MsgBox(Handle, msg, '', MB_YESNO or MB_ICONEXCLAMATION) = mrYes      then begin
9526                                                 CurItem := TreeView.Items.GetFirstNode;
9527                                         end else begin
9528                                                 Exit;
9529                                         end;
9530                                         TreeView.Select(CurItem);
9531                                         TreeView.SetFocus;
9532                                 end else begin
9533                                         TreeView.Select(CurItem);
9534                                         TreeView.SetFocus;
9535                                         msg := '\8e\9f\82É\8ds\82«\82Ü\82·\82©\81H';
9536                                         if MsgBox(Handle, msg, '', MB_YESNO or MB_ICONEXCLAMATION) = mrYes      then begin
9537                                                 next := true;
9538                                         end else begin
9539                                                 next := false;
9540                                         end;
9541                                 end;
9542
9543                         except
9544                                 Exit;
9545                         end;
9546                 end;
9547         end;
9548 end;
9549
9550 procedure TGikoForm.CabinetFavoriteActionExecute(Sender: TObject);
9551 var
9552         i, b : Integer;
9553         item : TMenuItem;
9554 begin
9555
9556         if CabinetPanel.Visible then begin
9557                 if FTreeType = gttFavorite then begin
9558                         CabinetVisible( False );
9559                         CabinetFavoriteAction.Checked := False;
9560                 end else begin
9561                         CabinetFavoriteAction.Checked := True;
9562                 end;
9563         end else begin
9564                 CabinetVisible( True );
9565                 CabinetFavoriteAction.Checked := True;
9566         end;
9567
9568         // BBS...BBS, History, Favorite
9569         GikoSys.Setting.CabinetIndex := CabinetSelectPopupMenu.Items.Count - 1;
9570
9571         b := CabinetSelectPopupMenu.Items.Count - 1;
9572         for i := 0 to b do begin
9573                 item := CabinetSelectPopupMenu.Items[ i ];
9574                 if item is TBBSMenuItem then begin
9575                         item.Checked := False;
9576                         // CabinetMenu \82Í CabinetSelectPopupMenu \82Æ\93¯\82\82Æ\8c\88\82ß\82¤\82¿\82µ\82¿\82á\82¤
9577                         CabinetMenu.Items[ i ].Checked := False;
9578                 end;
9579         end;
9580
9581         // \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Ö
9582         HistoryToolBar.Hide;
9583         FavoriteToolBar.Show;
9584         TreeView.Visible := False;
9585         FavoriteTreeView.Visible := True;
9586
9587         CabinetSelectToolButton.Caption := '\82¨\8bC\82É\93ü\82è';
9588         FTreeType := gttFavorite;
9589
9590         // \83\81\83j\83\85\81[\8by\82Ñ\83{\83^\83\93\82Ì\83`\83F\83b\83N\82ð\90Ý\92è
9591         CabinetBBSAction.Checked := False;
9592         CabinetHistoryAction.Checked := False;
9593
9594         // \82¨\8bC\82É\93ü\82è\82Ì\83c\83\8a\81[\82ð\93W\8aJ
9595         FavoriteTreeView.Items.GetFirstNode.Expanded := True;
9596
9597 end;
9598
9599 procedure TGikoForm.FavoriteMoveTo( SenderNode, SourceNode: TTreeNode );
9600 begin
9601
9602         if (SenderNode = nil) or (SourceNode = nil) or (SenderNode = SourceNode) then
9603                 Exit;
9604
9605         if TObject(SenderNode.Data) is TFavoriteFolder then
9606                 SourceNode.MoveTo(SenderNode, naAddChild)
9607         else
9608                 SourceNode.MoveTo(SenderNode, naInsert);
9609
9610 end;
9611
9612 procedure TGikoForm.FavoriteAddTo( SenderNode: TTreeNode; Source: TObject );
9613 var
9614         Node: TTreeNode;
9615         FavNode: TTreeNode;
9616         FavoBoardItem: TFavoriteBoardItem;
9617         FavoThreadItem: TFavoriteThreadItem;
9618         Board: TBoard;
9619         ThreadItem: TThreadItem;
9620 begin
9621
9622         if (SenderNode = nil) or (Source = nil) then
9623                 Exit;
9624
9625         if not (TObject(SenderNode.Data) is TFavoriteFolder) then
9626                 FavNode := SenderNode.Parent
9627         else
9628                 FavNode := SenderNode;
9629
9630         Node := nil;
9631
9632         if Source is TBoard then begin
9633                 Board := TBoard( Source );
9634                 FavoBoardItem                           := TFavoriteBoardItem.CreateWithItem( Board );
9635                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, Board.Title, FavoBoardItem);
9636                 Node.ImageIndex := 15;
9637                 Node.SelectedIndex := 15;
9638         end else if Source is TFavoriteBoardItem then begin
9639                 FavoBoardItem := TFavoriteBoardItem( Source );
9640                 Board := FavoBoardItem.Item;
9641                 if Board <> nil then
9642                         if not Board.IsThreadDatRead then
9643                                 GikoSys.ReadSubjectFile(Board);
9644                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, Board.Title, Source);
9645                 Node.ImageIndex := 15;
9646                 Node.SelectedIndex := 15;
9647         end else if Source is TThreadItem then begin
9648                 ThreadItem := TThreadItem( Source );
9649                 FavoThreadItem                          := TFavoriteThreadItem.CreateWithItem( ThreadItem );
9650                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, ThreadItem.Title, FavoThreadItem);
9651                 Node.ImageIndex := 16;
9652                 Node.SelectedIndex := 16;
9653         end else if Source is TBrowserRecord then begin
9654                 ThreadItem := TBrowserRecord( Source ).FThread;
9655                 FavoThreadItem                          := TFavoriteThreadItem.CreateWithItem( ThreadItem );
9656                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, ThreadItem.Title, FavoThreadItem);
9657                 Node.ImageIndex := 16;
9658                 Node.SelectedIndex := 16;
9659         end else if Source is TFavoriteThreadItem then begin
9660                 FavoThreadItem := TFavoriteThreadItem( Source );
9661                 ThreadItem := FavoThreadItem.Item;
9662                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, ThreadItem.Title, Source);
9663                 Node.ImageIndex := 16;
9664                 Node.SelectedIndex := 16;
9665         end;
9666
9667         if not (TObject(SenderNode.Data) is TFavoriteFolder) then
9668                 if Node <> nil then
9669                         FavoriteMoveTo( SenderNode, Node );
9670
9671 end;
9672
9673 procedure TGikoForm.FavoriteDragDrop( SenderNode: TTreeNode; Source: TObject );
9674 var
9675         idx: Integer;
9676         SourceNode: TTreeNode;
9677         LinkToolButton: TLinkToolButton;
9678 begin
9679
9680         if SenderNode = nil then
9681                 Exit;
9682
9683         if not (TObject( SenderNode.Data ) is TFavoriteFolder) then
9684                 if FDropSpaceNode <> nil then
9685                         SenderNode := FDropSpaceNode;
9686
9687         if Source = FavoriteTreeView then begin
9688
9689                 SourceNode := FavoriteTreeView.Selected;
9690                 FavoriteMoveTo( SenderNode, SourceNode );
9691
9692         end else if Source is TLinkToolButton then begin
9693
9694                 LinkToolButton := TLinkToolButton( Source );
9695                 //ShowMessage(LinkToolButton.Text);
9696                 SourceNode := TreeNodeDataFind( FavoriteTreeView.Items.GetFirstNode, LinkToolButton.Data );
9697                 FavoriteMoveTo( SenderNode, SourceNode );
9698
9699         end else if Source = BrowserTab then begin
9700
9701                 idx := BrowserTab.TabIndex;
9702                 FavoriteAddTo( SenderNode, BrowserTab.Tabs.Objects[idx] );
9703         end else if Source = ListView then begin
9704
9705                 FavoriteAddTo( SenderNode, ListView.Selected.Data );
9706
9707         end else if Source = TreeView then begin
9708
9709                 FavoriteAddTo( SenderNode, TreeView.Selected.Data );
9710
9711         end;
9712
9713         SetLinkBar;
9714
9715 end;
9716
9717 procedure TGikoForm.FavoriteTreeViewDragDrop(Sender, Source: TObject; X,
9718         Y: Integer);
9719 var
9720         SenderNode: TTreeNode;
9721 begin
9722
9723         SenderNode := FavoriteTreeView.GetNodeAt(X, Y);
9724         if SenderNode <> nil then begin
9725                 FavoriteDragDrop( SenderNode, Source );
9726         end;
9727
9728         if FDropSpaceNode <> nil then begin
9729                 FDropSpaceNode.Free;
9730                 FDropSpaceNode := nil;
9731         end;
9732
9733 end;
9734
9735 procedure TGikoForm.FavoriteTreeViewEdited(Sender: TObject;
9736         Node: TTreeNode; var S: String);
9737 begin
9738
9739         FavoriteTreeView.ReadOnly := True;
9740         SetLinkBar;
9741
9742 end;
9743
9744 procedure TGikoForm.FavoriteTreeViewKeyDown(Sender: TObject; var Key: Word;
9745         Shift: TShiftState);
9746 begin
9747         if not TTreeView(Sender).IsEditing then begin
9748                 Case Key of
9749                 VK_F2:
9750                         begin
9751                                 FClickNode := FavoriteTreeView.Selected;
9752                                 FavoriteTreeViewRenameActionExecute( Sender );
9753                         end;
9754                 VK_DELETE:
9755                         begin
9756                                 FClickNode := FavoriteTreeView.Selected;
9757                                 FavoriteTreeViewDeleteActionExecute( Sender );
9758                         end;
9759                 VK_RETURN:
9760                         begin
9761                         FavoriteClick( FavoriteTreeView.Selected );
9762                         FavoriteTreeView.Selected.Expanded := not FavoriteTreeView.Selected.Expanded;
9763                         end;
9764                 VK_SPACE:
9765                         FavoriteTreeViewDblClick( Sender );
9766                 end;
9767         end;
9768
9769 end;
9770
9771 procedure TGikoForm.FavoriteTreePopupMenuPopup(Sender: TObject);
9772 var
9773         i: Integer;
9774         LinkToolButton: TLinkToolButton;
9775 begin
9776
9777         if FavoriteTreePopupMenu.PopupComponent = FavoriteTreeView then begin
9778         
9779                 FClickNode := FavoriteTreeView.Selected;
9780
9781         end else if FavoriteTreePopupMenu.PopupComponent is TLinkToolButton then begin
9782
9783                 LinkToolButton := TLinkToolButton( FavoriteTreePopupMenu.PopupComponent );
9784                 for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
9785                         if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
9786                                 FClickNode := FavoriteTreeView.Items[i];
9787                                 Break;
9788                         end;
9789                 end;
9790                 for i := 0 to FClickNode.Count - 1 do begin
9791                         if FClickNode.Item[i].Data = LinkToolButton.Data then begin
9792                                 FClickNode := FClickNode.Item[i];
9793                                 Break;
9794                         end;
9795                 end;
9796
9797         end;
9798
9799         if FClickNode = nil then begin
9800                 FavoriteTreeBrowseFolderPopupMenu.Visible := False;
9801                 FavoriteTreeDeletePopupMenu.Visible := False;
9802                 FavoriteTreeRenamePopupMenu.Visible := False;
9803                 FavoriteTreeNewFolderPopupMenu.Visible := False;
9804                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
9805                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9806                 FavoriteTreeURLCopyPopupMenu.Visible := False;
9807                 FavoriteTreeNameCopyPopupMenu.Visible := False;
9808                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
9809                 FavoriteTreeReloadPopupMenu.Visible := False;
9810                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9811         end else if FClickNode.IsFirstNode then begin
9812                 FavoriteTreeBrowseFolderPopupMenu.Visible := True;
9813                 FavoriteTreeDeletePopupMenu.Visible := False;
9814                 FavoriteTreeRenamePopupMenu.Visible := False;
9815                 FavoriteTreeNewFolderPopupMenu.Visible := True;
9816                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
9817                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9818                 FavoriteTreeURLCopyPopupMenu.Visible := False;
9819                 FavoriteTreeNameCopyPopupMenu.Visible := True;
9820                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
9821                 FavoriteTreeReloadPopupMenu.Visible := False;
9822                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9823         end else if FClickNode.Text = Favorite.FAVORITE_LINK_NAME then begin
9824                 FavoriteTreeBrowseFolderPopupMenu.Visible := True;
9825                 FavoriteTreeDeletePopupMenu.Visible := True;
9826                 FavoriteTreeRenamePopupMenu.Visible := False;
9827                 FavoriteTreeNewFolderPopupMenu.Visible := True;
9828                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
9829                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9830                 FavoriteTreeURLCopyPopupMenu.Visible := False;
9831                 FavoriteTreeNameCopyPopupMenu.Visible := True;
9832                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
9833                 FavoriteTreeReloadPopupMenu.Visible := False;
9834                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9835         end else if TObject(FClickNode.Data) is TFavoriteFolder then begin
9836                 FavoriteTreeBrowseFolderPopupMenu.Visible := True;
9837                 FavoriteTreeDeletePopupMenu.Visible := True;
9838                 FavoriteTreeRenamePopupMenu.Visible := True;
9839                 FavoriteTreeNewFolderPopupMenu.Visible := True;
9840                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
9841                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9842                 FavoriteTreeURLCopyPopupMenu.Visible := False;
9843                 FavoriteTreeNameCopyPopupMenu.Visible := True;
9844                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
9845                 FavoriteTreeReloadPopupMenu.Visible := False;
9846                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9847         end else if TObject(FClickNode.Data) is TFavoriteThreadItem then begin
9848                 FavoriteTreeBrowseFolderPopupMenu.Visible := False;
9849                 FavoriteTreeDeletePopupMenu.Visible := True;
9850                 FavoriteTreeRenamePopupMenu.Visible := True;
9851                 FavoriteTreeNewFolderPopupMenu.Visible := True;
9852                 //FavoriteTreeBrowseBoardPopupMenu.Visible := True;
9853                 //FavoriteTreeBrowseThreadPopupMenu.Visible := True;
9854                 FavoriteTreeURLCopyPopupMenu.Visible := True;
9855                 FavoriteTreeNameCopyPopupMenu.Visible := True;
9856                 FavoriteTreeNameURLCopyPopupMenu.Visible := True;
9857                 FavoriteTreeReloadPopupMenu.Visible := True;
9858                 FavoriteTreeLogDeletePopupMenu.Visible := True;
9859         end else if TObject(FClickNode.Data) is TFavoriteBoardItem then begin
9860                 FavoriteTreeBrowseFolderPopupMenu.Visible := False;
9861                 FavoriteTreeDeletePopupMenu.Visible := True;
9862                 FavoriteTreeRenamePopupMenu.Visible := True;
9863                 FavoriteTreeNewFolderPopupMenu.Visible := True;
9864                 //FavoriteTreeBrowseBoardPopupMenu.Visible := True;
9865                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9866                 FavoriteTreeURLCopyPopupMenu.Visible := True;
9867                 FavoriteTreeNameCopyPopupMenu.Visible := True;
9868                 FavoriteTreeNameURLCopyPopupMenu.Visible := True;
9869                 FavoriteTreeReloadPopupMenu.Visible := True;
9870                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9871         end else begin
9872                 FavoriteTreeBrowseFolderPopupMenu.Visible := False;
9873                 FavoriteTreeDeletePopupMenu.Visible := False;
9874                 FavoriteTreeRenamePopupMenu.Visible := False;
9875                 FavoriteTreeNewFolderPopupMenu.Visible := False;
9876                 //FavoriteTreeBrowseBoardPopupMenu.Visible := False;
9877                 //FavoriteTreeBrowseThreadPopupMenu.Visible := False;
9878                 FavoriteTreeURLCopyPopupMenu.Visible := False;
9879                 FavoriteTreeNameCopyPopupMenu.Visible := False;
9880                 FavoriteTreeNameURLCopyPopupMenu.Visible := False;
9881                 FavoriteTreeReloadPopupMenu.Visible := False;
9882                 FavoriteTreeLogDeletePopupMenu.Visible := False;
9883         end;
9884
9885 end;
9886
9887 procedure TGikoForm.FavoriteTreeViewDeleteActionExecute(Sender: TObject);
9888 const
9889         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';
9890         DEL_MSG = '\81g^0\81h\82ð\8dí\8f\9c\82µ\82Ü\82·\81B\82æ\82ë\82µ\82¢\82Å\82·\82©\81H';
9891         DEL_TITLE = '\8dí\8f\9c\8am\94F';
9892 begin
9893
9894         if FClickNode = nil then
9895                 Exit;
9896         if FClickNode.IsFirstNode then
9897                 Exit;
9898         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then begin
9899                 if FClickNode.Text = Favorite.FAVORITE_LINK_NAME then begin
9900                         if MsgBox(Handle, DEL_LINK_MSG, DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
9901                                 Exit;
9902                 end else begin
9903                         if MsgBox(Handle, StringReplace( DEL_MSG, '^0', FClickNode.Text, [rfReplaceAll] ) , DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
9904                                 Exit;
9905                 end;
9906         end;
9907
9908         //FDeleteList.Add(FClickNode.Data);
9909         //SetDeleteItemList(FClickNode);
9910
9911         FClickNode.Delete;
9912
9913         SetLinkBar;
9914
9915 end;
9916
9917 procedure TGikoForm.FavoriteTreeViewRenameActionExecute(Sender: TObject);
9918 var
9919         node : TTreeNode;
9920 begin
9921
9922         if FClickNode = nil then
9923                 Exit;
9924         if FClickNode.IsFirstNode then
9925                 Exit;
9926         if FClickNode.Text = Favorite.FAVORITE_LINK_NAME then
9927                 Exit;
9928         FavoriteTreeView.ReadOnly := False;
9929         if (FTreeType = gttFavorite) and (CabinetPanel.Visible) then begin
9930                 node := FClickNode.Parent;
9931                 while node <> nil do begin
9932                         node.Expanded   := True;
9933                         node                                    := node.Parent;
9934                 end;
9935                 FClickNode.EditText;
9936         end else begin
9937                 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 );
9938         end;
9939
9940         SetLinkBar;
9941
9942 end;
9943
9944 procedure TGikoForm.FavoriteTreeViewNewFolderActionExecute(
9945         Sender: TObject);
9946 var
9947         NewFavFolder: TFavoriteFolder;
9948         Node: TTreeNode;
9949 begin
9950
9951         if FClickNode = nil then
9952                 Exit;
9953
9954         try
9955                 if not (TObject(FClickNode.Data) is TFavoriteFolder) then begin
9956                         FavoriteTreeView.Selected := FClickNode.Parent;
9957                         FClickNode := FClickNode.Parent;
9958                 end;
9959
9960                 NewFavFolder := TFavoriteFolder.Create;
9961                 Node := FavoriteTreeView.Items.AddChildObject(FClickNode, '\90V\82µ\82¢\83t\83H\83\8b\83_', NewFavFolder);
9962                 Node.ImageIndex := 14;
9963                 Node.SelectedIndex := 14;
9964         //                      FClickNode.Selected.Expanded := True;
9965                 FavoriteTreeView.Selected := Node;
9966                 FClickNode := Node;
9967                 FavoriteTreeViewRenameAction.Execute;
9968         finally
9969         end;
9970
9971 end;
9972
9973 procedure TGikoForm.ToolButton19Click(Sender: TObject);
9974 begin
9975
9976         FavoriteArrangeActionExecute( nil );
9977         
9978 end;
9979
9980 procedure TGikoForm.FavoriteBrowseFolder( node: TTreeNode );
9981 var
9982         i: Integer;
9983 begin
9984
9985         if not (TObject(node.Data) is TFavoriteFolder) then
9986                 exit;
9987
9988         for i := 0 to node.Count - 1 do
9989         begin
9990                 if TObject(node.Item[i].Data) is TFavoriteFolder then
9991                         FavoriteBrowseFolder( node.Item[i] )
9992                 else if TObject(node.Item[i].Data) is TFavoriteThreadItem then
9993                         FavoriteClick( node.Item[i], False );
9994         end;
9995
9996 end;
9997
9998 procedure TGikoForm.FavoriteTreeViewBrowseFolderActionExecute(
9999         Sender: TObject);
10000 begin
10001
10002         FavoriteBrowseFolder( FClickNode );
10003         //BrowserTab.OnChange(nil);
10004
10005 end;
10006
10007 procedure TGikoForm.FavoriteTreeViewDblClick(Sender: TObject);
10008 begin
10009
10010         FClickNode := FavoriteTreeView.Selected;
10011         FavoriteTreeViewReloadActionExecute( Sender );
10012
10013 end;
10014
10015 procedure TGikoForm.FavoriteTreeViewLogDeleteActionExecute(
10016         Sender: TObject);
10017 const
10018         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';
10019         DEL_TITLE = '\8dí\8f\9c\8am\94F';
10020 var
10021         ThreadItem: TThreadItem;
10022         FavThread: TFavoriteThreadItem;
10023 begin
10024
10025         if FClickNode = nil then Exit;
10026         if not (TObject(FClickNode.Data) is TFavoriteThreadItem) then Exit;
10027
10028         FavThread := TFavoriteThreadItem( FClickNode.Data );
10029         ThreadItem := FavThread.Item;
10030
10031         try
10032                 if GikoSys.Setting.DeleteMsg then begin
10033                         if (GetKeyState( VK_SHIFT ) and $80000000) = 0 then
10034                                 if MsgBox(Handle, StringReplace( DEL_MSG, '^0', FClickNode.Text, [rfReplaceAll] ) , DEL_TITLE, MB_YESNO or MB_ICONWARNING or MB_DEFBUTTON2) <> ID_YES then
10035                                         Exit;
10036                 end;
10037
10038                 DeleteHistory(ThreadItem);
10039                 DeleteTab(ThreadItem);
10040                 ThreadItem.DeleteLogFile;
10041
10042                 ListView.Refresh;
10043         finally
10044         end;
10045
10046 end;
10047
10048 procedure TGikoForm.FavoriteTreeViewReloadActionExecute(Sender: TObject);
10049 var
10050         ThreadItem: TThreadItem;
10051         FavThread: TFavoriteThreadItem;
10052         Board: TBoard;
10053         FavBoard: TFavoriteBoardItem;
10054         shiftDown: Boolean;
10055 begin
10056
10057         if FClickNode = nil then Exit;
10058
10059         shiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
10060
10061         if TObject( FClickNode.Data ) is TFavoriteThreadItem then begin
10062                 FavThread := TFavoriteThreadItem( FClickNode.Data );
10063                 ThreadItem := FavThread.Item;
10064                 if ThreadItem <> nil then
10065                         DownloadContent(ThreadItem, shiftDown);
10066         end else if TObject( FClickNode.Data ) is TFavoriteBoardItem then begin
10067                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
10068                 Board := FavBoard.Item;
10069                 DownloadList(Board, shiftDown);
10070         end;
10071
10072 end;
10073
10074 procedure TGikoForm.FavoriteTreeViewURLCopyActionExecute(Sender: TObject);
10075 var
10076         FavThread       : TFavoriteThreadItem;
10077         FavBoard        : TFavoriteBoardItem;
10078         s                                       : string;
10079 begin
10080
10081         if FClickNode = nil then Exit;
10082
10083         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
10084
10085                 FavThread := TFavoriteThreadItem( FClickNode.Data );
10086                 s := FavThread.URL + #13#10;
10087                 if s <> '' then
10088                         Clipboard.AsText := s;
10089
10090         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
10091
10092                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
10093                 s := FavBoard.URL + #13#10;
10094                 if s <> '' then
10095                         Clipboard.AsText := s;
10096
10097         end;
10098
10099 end;
10100
10101 procedure TGikoForm.FavoriteTreeViewNameCopyActionExecute(Sender: TObject);
10102 var
10103         ThreadItem: TThreadItem;
10104         FavThread: TFavoriteThreadItem;
10105         Board: TBoard;
10106         FavBoard: TFavoriteBoardItem;
10107         s: string;
10108 begin
10109
10110         if FClickNode = nil then Exit;
10111
10112         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
10113
10114                 FavThread := TFavoriteThreadItem( FClickNode.Data );
10115                 ThreadItem := FavThread.Item;
10116
10117                 try
10118                         s := ThreadItem.Title + #13#10;
10119                         if s <> '' then
10120                                 Clipboard.AsText := s;
10121                 finally
10122                 end;
10123
10124         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
10125
10126                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
10127                 Board := FavBoard.Item;
10128                 if Board <> nil then
10129                         if not Board.IsThreadDatRead then
10130                                 GikoSys.ReadSubjectFile(Board);
10131
10132                 try
10133                         s := Board.Title + #13#10;
10134                         if s <> '' then
10135                                 Clipboard.AsText := s;
10136                 finally
10137                 end;
10138
10139         end;
10140
10141 end;
10142
10143 procedure TGikoForm.FavoriteTreeViewNameURLCopyActionExecute(
10144         Sender: TObject);
10145 var
10146         ThreadItem: TThreadItem;
10147         FavThread: TFavoriteThreadItem;
10148         Board: TBoard;
10149         FavBoard: TFavoriteBoardItem;
10150         s: string;
10151 begin
10152
10153         if FClickNode = nil then Exit;
10154
10155         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
10156
10157                 FavThread := TFavoriteThreadItem( FClickNode.Data );
10158                 ThreadItem := FavThread.Item;
10159
10160                 try
10161                         s := ThreadItem.Title + #13#10 + ThreadItem.URL + #13#10;
10162                         if s <> '' then
10163                                 Clipboard.AsText := s;
10164                 finally
10165                 end;
10166
10167         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
10168
10169                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
10170                 Board := FavBoard.Item;
10171                 if Board <> nil then
10172                         if not Board.IsThreadDatRead then
10173                                 GikoSys.ReadSubjectFile(Board);
10174
10175                 try
10176                         s := Board.Title + #13#10 + Board.URL + #13#10;
10177                         if s <> '' then
10178                                 Clipboard.AsText := s;
10179                 finally
10180                 end;
10181
10182         end;
10183
10184 end;
10185
10186 function TGikoForm.TreeNodeDataFind(Node: TTreeNode; FindPointer: Pointer): TTreeNode;
10187 var
10188         Found: TTreeNode;
10189         i: Integer;
10190 begin
10191
10192         for i := 0 to Node.Count - 1 do begin
10193                 if Node.Item[i].Data = FindPointer then begin
10194                         Result := Node.Item[i];
10195                         Exit;
10196                 end else if Node.Item[i].Count > 0 then begin
10197                         Found := TreeNodeDataFind( Node.Item[i], FindPointer );
10198                         if Found <> nil then begin
10199                                 Result := Found;
10200                                 Exit;
10201                         end;
10202                 end;
10203         end;
10204
10205         Result := nil;
10206
10207 end;
10208
10209 procedure TGikoForm.LinkToolBarDragDrop(Sender, Source: TObject; X,
10210         Y: Integer);
10211 var
10212         i: Integer;
10213         SenderNode: TTreeNode;
10214 begin
10215
10216         SenderNode := nil;
10217         for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
10218                 if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
10219                         SenderNode := FavoriteTreeView.Items[i];
10220                         Break;
10221                 end;
10222         end;
10223
10224         FavoriteDragDrop( SenderNode, Source );
10225
10226 end;
10227
10228 procedure TGikoForm.BrowserTabMouseUp(Sender: TObject;
10229         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
10230 begin
10231         if FDragWFirst <> true then begin
10232                 FDragWFirst := false;
10233 {
10234         end else if (abs( X - FMouseDownPos.X ) < Mouse.DragThreshold)
10235         and (abs( Y - FMouseDownPos.Y ) < Mouse.DragThreshold) then begin
10236 (*}
10237         end else begin
10238 //*)
10239                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
10240                         if GikoSys.Setting.ListWidthState = glsMin then begin
10241                                 BrowserMaxAndFocusAction.Execute;
10242                         end;
10243                 end else begin
10244                         if GikoSys.Setting.ListHeightState = glsMin then begin
10245                                 BrowserMaxAndFocusAction.Execute;
10246                         end;
10247                 end;
10248         end;
10249 end;
10250
10251 procedure TGikoForm.LinkToolBarDragOver(Sender, Source: TObject; X,
10252         Y: Integer; State: TDragState; var Accept: Boolean);
10253 begin
10254
10255         FavoriteDragOver( Sender, Source, X, Y, State, Accept );
10256
10257 end;
10258
10259 procedure TGikoForm.ResRangeActionExecute(Sender: TObject);
10260 begin
10261         case FResRangeMenuSelect of
10262         Ord( grrAll ):  AllResAction.Execute;
10263         Ord( grrKoko ): OnlyKokoResAction.Execute;
10264         Ord( grrNew ):  OnlyNewResAction.Execute;
10265         100:                                            OnlyAHundredResAction.Execute;
10266         end;
10267 end;
10268
10269 procedure TGikoForm.FavoriteTreeViewEndDrag(Sender, Target: TObject; X,
10270         Y: Integer);
10271 begin
10272
10273         if FDropSpaceNode <> nil then begin
10274                 FDropSpaceNode.Free;
10275                 FDropSpaceNode := nil;
10276                 SetLinkBar;
10277         end;
10278
10279 end;
10280
10281 procedure TGikoForm.ListCoolBarContextPopup(Sender: TObject;
10282         MousePos: TPoint; var Handled: Boolean);
10283 begin
10284
10285         FToolBarSettingSender := tssList;
10286         MousePos := ListCoolBar.ClientToScreen( MousePos );
10287         MainCoolBarPopupMenu.Popup( MousePos.X, MousePos.Y );
10288
10289 end;
10290
10291 procedure TGikoForm.MainCoolBarContextPopup(Sender: TObject;
10292         MousePos: TPoint; var Handled: Boolean);
10293 begin
10294
10295         FToolBarSettingSender := tssMain;
10296         MousePos := MainCoolBar.ClientToScreen( MousePos );
10297         MainCoolBarPopupMenu.Popup( MousePos.X, MousePos.Y );
10298
10299 end;
10300
10301 procedure TGikoForm.BrowserCoolBarContextPopup(Sender: TObject;
10302         MousePos: TPoint; var Handled: Boolean);
10303 begin
10304
10305         FToolBarSettingSender := tssBrowser;
10306         MousePos := BrowserCoolBar.ClientToScreen( MousePos );
10307         MainCoolBarPopupMenu.Popup( MousePos.X, MousePos.Y );
10308
10309 end;
10310 procedure TGikoForm.ExportFavoriteFileAccept(Sender: TObject);
10311 begin
10312
10313         if FavoriteDM.SaveFavoriteFile( ExportFavoriteFile.Dialog.FileName ) Then begin
10314                 ShowMessage('\83t\83@\83C\83\8b\82ð\8fo\97Í\82µ\82Ü\82µ\82½');
10315         end else begin
10316                 ShowMessage('\83t\83@\83C\83\8b\82Ì\8fo\97Í\82É\8e¸\94s\82µ\82Ü\82µ\82½');
10317         end;
10318 end;
10319 procedure TGikoForm.SetListViewBackGroundColor(value: TColor);
10320 begin
10321         if FListViewBackGroundColor <> value then begin
10322                 FListViewBackGroundColor := value;
10323                 ListView.Color := FListViewBackGroundColor;
10324         end;
10325 end;
10326 procedure TGikoForm.ExportFavoriteFileBeforeExecute(Sender: TObject);
10327 begin
10328         ExportFavoriteFile.Dialog.FileName := FavoriteDM.GetFavoriteFilePath;
10329 end;
10330
10331 procedure TGikoForm.CabinetBBSActionExecute(Sender: TObject);
10332 begin
10333
10334         if CabinetPanel.Visible then begin
10335                 if FTreeType = gtt2ch then begin
10336                         CabinetVisible( False );
10337
10338                         CabinetBBSAction.Checked := False;
10339                 end else begin
10340                         CabinetBBSAction.Checked := True;
10341                 end;
10342         end else begin
10343                 CabinetVisible( True );
10344                 CabinetBBSAction.Checked := True;
10345         end;
10346
10347         if FActiveBBS = nil then
10348                 ShowBBSTree( BBSs[ 0 ] )
10349         else
10350                 ShowBBSTree( FActiveBBS );
10351
10352 end;
10353
10354 procedure TGikoForm.FavoriteTreeViewBrowseThreadActionExecute(
10355         Sender: TObject);
10356 var
10357         threadItem      : TThreadItem;
10358 begin
10359
10360         if FClickNode = nil then Exit;
10361
10362         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
10363
10364                 threadItem := TFavoriteThreadItem( FClickNode.Data ).Item;
10365                 if threadItem = nil then
10366                         Exit;
10367                 GikoSys.OpenBrowser( threadItem.URL, gbtAuto );
10368
10369         end;
10370
10371 end;
10372
10373 procedure TGikoForm.FavoriteTreeBrowseBoardPopupMenuClick(Sender: TObject);
10374 var
10375         threadItem      : TThreadItem;
10376         boardItem               : TBoard;
10377 begin
10378
10379         if FClickNode = nil then Exit;
10380
10381         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
10382
10383                 threadItem := TFavoriteThreadItem( FClickNode.Data ).Item;
10384                 if threadItem = nil then
10385                         Exit;
10386                 GikoSys.OpenBrowser( threadItem.ParentBoard.URL, gbtAuto );
10387
10388         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
10389
10390                 boardItem := TFavoriteBoardItem( FClickNode.Data ).Item;
10391                 if boardItem = nil then
10392                         Exit;
10393                 GikoSys.OpenBrowser( boardItem.URL, gbtAuto );
10394
10395         end;
10396
10397 end;
10398
10399 procedure TGikoForm.UpBoardActionExecute(Sender: TObject);
10400 begin
10401
10402         SelectTreeNode( GetActiveContent.ParentBoard, True );
10403
10404 end;
10405
10406 procedure TGikoForm.UpBoardActionUpdate(Sender: TObject);
10407 begin
10408
10409         UpBoardAction.Enabled := GetActiveContent <> nil;
10410
10411 end;
10412
10413 procedure TGikoForm.BrowserTabContextPopup(Sender: TObject;
10414         MousePos: TPoint; var Handled: Boolean);
10415 var
10416         idx : Integer;
10417 begin
10418                 idx := BrowserTab.IndexOfTabAt(MousePos.X, MousePos.Y);
10419                 if BrowserTab.TabIndex <> idx then begin
10420                 BrowserTab.TabIndex := idx;
10421                         BrowserTab.OnChange(nil);
10422                 end;
10423
10424 end;
10425
10426 procedure TGikoForm.KoreCopyExecute(Sender: TObject);
10427 begin
10428         KonoresCopy(KokoPopupMenu.Tag, true);
10429 end;
10430 procedure TGikoForm.KonoresCopy(Number: Integer; ReplaceTag : Boolean);
10431 var
10432         ThreadItem: TThreadItem;
10433         tmp: string;
10434         FileName: string;
10435         Res: TResRec;
10436         Header: string;
10437         Body: string;
10438         boardPlugIn : TBoardPlugIn;
10439 begin
10440         if Number = 0 then Exit;
10441         ThreadItem := GetActiveContent;
10442
10443         if ThreadItem <> nil then begin
10444                 if ThreadItem.IsBoardPlugInAvailable then begin
10445                         //===== \83v\83\89\83O\83C\83\93\82É\82æ\82é\95\\8e¦
10446                         boardPlugIn             := ThreadItem.BoardPlugIn;
10447
10448                         // \83t\83H\83\93\83g\82â\83T\83C\83Y\82Ì\90Ý\92è
10449                         // \95\8e\9a\83R\81[\83h\82Í\83v\83\89\83O\83C\83\93\82É\94C\82¹\82é
10450                         //\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
10451                         tmp := boardPlugIn.GetDat( DWORD( threadItem ), Number );
10452                 end else begin
10453       FileName := ThreadItem.FilePath;
10454       tmp := GikoSys.ReadThreadFile(FileName, Number);
10455                 end;
10456                 if tmp <> '' then begin
10457                         Res := GikoSys.DivideStrLine(tmp);
10458
10459                         Header := IntToStr(Number) + ' \81F' + Res.FName + ' \81F' + Res.FDateTime + #13#10;
10460                         if ReplaceTag then begin
10461                                 Header := CustomStringReplace(Header, '</b>', '',true);
10462                                 Header := CustomStringReplace(Header, '<b>', '',true);
10463                         end;
10464                         if ThreadItem.IsBoardPlugInAvailable then begin
10465                                 Body := CustomStringReplace(Res.FBody, '<br>', #13#10,true);
10466                                 Body := CustomStringReplace(Body, '<br>', #13#10,true);
10467                         end else begin
10468                                 Body := CustomStringReplace(Res.FBody, ' <br> ', #13#10,true);
10469                                 Body := CustomStringReplace(Body, ' <br>', #13#10,true);
10470                                 Body := CustomStringReplace(Body, '<br> ', #13#10,true);
10471                                 Body := CustomStringReplace(Body, '<br>', #13#10,true);
10472
10473                         end;
10474                         Body := CustomStringReplace(Body, '</a>', '',true);
10475
10476                         Body := GikoSys.DeleteLink(Body);
10477                         if ReplaceTag then begin
10478                                 Body := CustomStringReplace(Body, '&lt;', '<');
10479                                 Body := CustomStringReplace(Body, '&gt;', '>');
10480                                 Body := CustomStringReplace(Body, '&quot;', '"');
10481                                 Body := CustomStringReplace(Body, '&amp;', '&');
10482                                 //Body := CustomStringReplace(Body, '&nbsp;', ' ');
10483                         end;
10484
10485                         Header := Header + Body;
10486
10487                         Clipboard.SetTextBuf( PChar(Header) );
10488                 end;
10489         end;
10490 end;
10491
10492
10493 procedure TGikoForm.BrowserTabPopupMenuPopup(Sender: TObject);
10494 begin
10495         AddRoundNameMenu(dummy1);
10496 end;
10497
10498 procedure TGikoForm.FavoritesURLReplace(oldURLs: TStringList; newURLs: TStringList);
10499 begin
10500         FavoriteDM.URLReplace(oldURLs, newURLs);
10501 end;
10502
10503 procedure TGikoForm.RoundListURLReplace(oldURLs: TStringList; newURLs: TStringList);
10504 begin
10505         RoundList.URLReplace(oldURLs, newURLs);
10506 end;
10507
10508 procedure TGikoForm.TabFileURLReplace(oldURLs: TStringList; newURLs: TStringList);
10509 const
10510         Filename = 'tab.sav';
10511         bFilename = '~tab.sav';
10512 var
10513         i, j: Integer;
10514         tempString: string;
10515         tmpURL: string;
10516         oldHost: string;
10517         oldBoardName: string;
10518         newHost: string;
10519         newBoardName: string;
10520         TabList: TStringList;
10521 begin
10522
10523         if oldURLs.Count <> newURLs.Count then begin
10524                 Exit;
10525         end;
10526         if FileExists(GikoSys.GetAppDir + 'tab.sav') then begin
10527                 TabList := TStringList.Create;
10528                 try
10529                         TabList.LoadFromFile(GikoSys.GetAppDir + Filename);
10530
10531                         //\82±\82±\82©\82ç\81AThread\82ÌURL\82Ì\95Ï\8dX
10532                         //\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
10533                         for i := 0 to oldURLs.Count - 1 do begin
10534                                         tmpURL                  := Copy(oldURLs[i], 1, Length(oldURLs[i]) -1);
10535                                         oldHost                 := Copy(tmpURL, 1, LastDelimiter('/', tmpURL) );
10536                                         oldBoardName    := Copy(tmpURL, LastDelimiter('/', tmpURL), Length(tmpURL) ) + '/';
10537                                         tmpURL                  := Copy(newURLs[i], 1, Length(newURLs[i]) -1);
10538                                         newHost                 := Copy(tmpURL, 1, LastDelimiter('/', tmpURL) );
10539                                         newBoardName    := Copy(tmpURL, LastDelimiter('/', tmpURL), Length(tmpURL) ) + '/';
10540
10541                                         for j := 0 to TabList.Count - 1 do begin
10542                                                         tempString := TabList[j];
10543                                                         if ( AnsiPos(oldBoardName, tempString) <> 0 ) and ( AnsiPos(oldHost, tempString ) <> 0 ) then begin
10544                                                                 tempString := StringReplace(tempString, oldHost, newHost,[]);
10545                                                                 TabList[j] := tempString;
10546                                                         end;
10547                                         end;
10548                         end;
10549                         //\82±\82±\82Ü\82Å\81AThread\82ÌURL\82Ì\95Ï\8dX
10550
10551                         if FileExists( GikoSys.GetAppDir + Filename) then begin
10552                                 if FileExists( GikoSys.GetAppDir + bFilename) then
10553                                         DeleteFile(GikoSys.GetAppDir + bFilename);
10554
10555                                 //\83o\83b\83N\83A\83b\83v\82ð\8dì\82é\81B
10556                                 RenameFile(GikoSys.GetAppDir + Filename, GikoSys.GetAppDir + bFilename);
10557                         end;
10558
10559                         TabList.SaveToFile(GikoSys.GetAppDir + Filename);
10560                 finally
10561                         TabList.Free;
10562                 end;
10563         end;
10564
10565 end;
10566
10567 /// \8dÅ\8f¬\89»\82³\82ê\82é
10568 procedure TGikoForm.OnMinimize;
10569 begin
10570         if FActiveContent <> nil then begin
10571                 FIsMinimize := mtMinimizing;
10572                 FActiveContent.Thread.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
10573         end;
10574 end;
10575
10576 /// \8dÅ\8f¬\89»\82³\82ê\82½ (OnResized \82©\82ç\8cÄ\82Î\82ê\82é)
10577 procedure TGikoForm.OnMinimized;
10578 begin
10579         FIsMinimize := mtMinimized;
10580 end;
10581
10582
10583 procedure TGikoForm.BrowserTabResize(Sender: TObject);
10584 begin
10585 end;
10586
10587 // *************************************************************************
10588 // ExternalBoardPlugInMain
10589 // \83v\83\89\83O\83C\83\93\83\81\83j\83\85\81[\82Ì\8d\80\96Ú\82ª\8eÀ\8ds\82³\82ê\82½
10590 // *************************************************************************
10591 procedure TGikoForm.OnPlugInMenuItem( Sender : TObject );
10592 var
10593         item                            : TMenuItem;
10594         boardPlugIn     : TBoardPlugIn;
10595 begin
10596
10597         if not (Sender is TMenuItem) then
10598                 Exit;
10599
10600         item := TMenuItem( Sender );
10601         if not Assigned( Pointer( item.Tag ) ) then
10602                 Exit;
10603
10604         // \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·
10605         boardPlugIn := TBoardPlugIn( item.Tag );
10606         boardPlugIn.PlugInMenu( item.Handle );
10607
10608 end;
10609 // TreeView \82ª\83N\83\8a\83b\83N\82³\82ê\82½
10610 procedure TGikoForm.TreeClick( Node : TTreeNode );
10611 begin
10612
10613         if Node = nil then
10614                 Exit;
10615
10616         if FTreeType = gttHistory then begin
10617                 if Node <> nil then
10618                         if TObject( Node.Data ) is TFavoriteThreadItem then
10619                                 if GetActiveContent <> TFavoriteThreadItem( Node.Data ).Item then
10620                                         FavoriteClick( Node );
10621                 Exit;
10622         end;
10623
10624         ActiveListColumnSave;
10625
10626         if TObject(Node.Data) is TBBS then begin
10627                 SetActiveList(Node.data);
10628         end else if TObject(Node.Data) is TCategory then begin
10629                 SetActiveList(Node.data);
10630         end else if TObject(Node.Data) is TBoard then begin
10631                 if not TBoard(Node.Data).IsThreadDatRead then begin
10632                         Screen.Cursor := crHourGlass;
10633                         try
10634         if not TBoard(Node.Data).IsThreadDatRead then
10635                                         GikoSys.ReadSubjectFile(Node.Data);
10636                         finally
10637                                 Screen.Cursor := crDefault;
10638                         end;
10639                 end;
10640                 SetActiveList(Node.data);
10641         end;
10642
10643         if TObject( Node.Data ) is TBoard then begin // not TCategory
10644                 if GikoSys.Setting.ListOrientation = gloHorizontal then begin
10645                         if GikoSys.Setting.ListWidthState = glsMax then begin
10646                                 BrowserMinAction.Execute;
10647                                 if GikoForm.Visible then
10648                                         ListView.SetFocus;
10649                         end;
10650                 end else begin
10651                         if GikoSys.Setting.ListHeightState = glsMax then begin
10652                                 BrowserMinAction.Execute;
10653                                 if GikoForm.Visible then
10654                                         ListView.SetFocus;
10655                         end;
10656                 end;
10657         end;
10658
10659 end;
10660
10661 // TreeView \82ª\83_\83u\83\8b\83N\83\8a\83b\83N\82³\82ê\82½
10662 procedure TGikoForm.TreeDoubleClick( Node : TTreeNode );
10663 var
10664         Board                           : TBoard;
10665         ThreadItem      : TThreadItem;
10666         shiftDown       : Boolean;
10667 begin
10668
10669         if Node = nil then Exit;
10670
10671         shiftDown       := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
10672
10673         if FTreeType = gtt2ch then begin
10674                 if not (TObject(Node.Data) is TBoard) then Exit;
10675                 Board := TBoard(Node.Data);
10676                 DownloadList(Board, shiftDown);
10677         end else if FTreeType = gttHistory then begin
10678                 if not (TObject(Node.Data) is TFavoriteThreadItem) then Exit;
10679                 ThreadItem := TFavoriteThreadItem(Node.Data).Item;
10680                 DownloadContent(ThreadItem, shiftDown);
10681         end;
10682
10683 end;
10684
10685 procedure TGikoForm.TreeViewClick(Sender: TObject);
10686 begin
10687         TreeClick( TreeView.Selected );
10688 end;
10689
10690 procedure TGikoForm.TreeViewKeyDown(Sender: TObject; var Key: Word;
10691         Shift: TShiftState);
10692 begin
10693         if Key = VK_BACK then begin
10694 //              UpFolderButtonClick(Sender);
10695         end else if Key = VK_SPACE then begin
10696                 TreeDoubleClick( TreeView.Selected );
10697         end else if Key = VK_RETURN then begin
10698                 TreeClick( TreeView.Selected );
10699                 TreeView.Selected.Expanded := not TreeView.Selected.Expanded;
10700         end;
10701 end;
10702
10703
10704 // \83M\83R\83i\83r\82Ì\83\81\83b\83Z\81[\83W\83\8b\81[\83v\82ð\89¡\8eæ\82è\82µ\82Ü\82·
10705 procedure TGikoForm.HandleAppMessage(var Msg: TMsg; var Handled: Boolean);
10706 //var
10707 //      key                             : Word;
10708 begin
10709         case Msg.message of
10710         {WM_KEYDOWN:
10711                 if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
10712                         if IsDialogMessage( FActiveContent.Browser.Handle, Msg ) then begin
10713                                 key := Msg.wParam;
10714                                 Handled := BrowserKeyDown( Msg, key, KeyDataToShiftState( Msg.lParam ) );
10715                         end;
10716                 end;}
10717
10718         WM_XBUTTONDOWN:
10719                 case Msg.wParam shr 16 of
10720                         XBUTTON1:
10721                         begin
10722                                         if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
10723                                                 if IsDialogMessage( FActiveContent.Browser.Handle, Msg ) then begin
10724                                                         UpBoardAction.Execute;
10725                                                         Handled := True;
10726                                                 end;
10727                                         end;
10728                                         if not Handled then begin
10729                                                 if IsDialogMessage( ListView.Handle, Msg ) then begin
10730                                                         UpFolderAction.Execute;
10731                                                         Handled := True;
10732                                                 end;
10733                                         end;
10734                         end;
10735                         XBUTTON2:
10736                 end;
10737         end;
10738 end;
10739
10740 procedure TGikoForm.FavoriteTreeViewMouseDown(Sender: TObject;
10741         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
10742 var
10743         favItem                         : TTreeNode;
10744         favThreadItem   : TFavoriteThreadItem;
10745 begin
10746
10747         case Button of
10748         mbLeft:
10749                 begin
10750                         FMouseDownPos.X := X;
10751                         FMouseDownPos.Y := Y;
10752                 end;
10753         mbMiddle:
10754                 begin
10755                         favItem := FavoriteTreeView.GetNodeAt( X, Y );
10756                         if favItem = nil then Exit;
10757
10758                         if TObject( favItem.Data ) is TFavoriteThreadItem then begin
10759                                 favThreadItem := TFavoriteThreadItem( favItem.Data );
10760                                 if favThreadItem.Item <> nil then
10761                                         InsertBrowserTab( favThreadItem.Item, False );
10762                         end;
10763                 end;
10764         end;
10765
10766 end;
10767
10768 procedure TGikoForm.MessagePanelResize(Sender: TObject);
10769 begin
10770
10771         if FIsIgnoreResize <> rtNone then
10772                 Exit;
10773
10774         if GikoSys.Setting.ListOrientation = gloVertical then begin
10775                 if GikoSys.Setting.ListHeightState = glsMin then begin
10776                         // \8dÅ\8f¬\95\\8e¦\82É\82·\82é
10777                         ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
10778                 end;
10779         end;
10780
10781 end;
10782
10783 procedure TGikoForm.OnResized;
10784 var
10785         doc                                             : Variant;
10786 begin
10787
10788         FOldFormWidth := Width;
10789         FIsIgnoreResize := rtNone;
10790
10791         case FIsMinimize of
10792         mtMinimizing:
10793                 begin
10794                         // \8dÅ\8f¬\89»\92\86\82Å\82 \82é
10795                         PostMessage( Handle, USER_MINIMIZED, 0, 0 );
10796                 end;
10797
10798         mtMinimized:
10799                 begin
10800                         // \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)
10801                         if FActiveContent <> nil then begin
10802                                 doc := Idispatch( olevariant(FActiveContent.Browser.ControlInterface).Document) as IHTMLDocument2;
10803                                 doc.Body.ScrollTop := FActiveContent.Thread.ScrollTop;
10804                         end;
10805                         FIsMinimize := mtNone;
10806                 end;
10807         end;
10808
10809 end;
10810
10811 procedure TGikoForm.TreeSelectNameCopyExecute(Sender: TObject);
10812 var
10813         s: string;
10814 begin
10815         TreeView.Selected := FClickNode;
10816         s := FClickNode.Text;
10817         Clipboard.AsText := s;
10818 end;
10819
10820 procedure TGikoForm.FavoriteTreeViewMouseUp(Sender: TObject;
10821   Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
10822 begin
10823
10824         if (abs( X - FMouseDownPos.X ) < Mouse.DragThreshold) and
10825                  (abs( Y - FMouseDownPos.Y ) < Mouse.DragThreshold) then begin
10826                 FavoriteClick( TObject( FavoriteTreeView.Selected ) );
10827         end;
10828
10829 end;
10830
10831 destructor      TBrowserRecord.Destroy;
10832 var
10833         doc :OleVariant;
10834 begin
10835         if Self.FEvent <> nil then
10836                 Self.FEvent.Free;
10837         if Self.FBrowser <> nil then begin
10838                 if Self.Thread <> nil then begin
10839                         //\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Å
10840                         //\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
10841                         if Self.FBrowser.OleObject.Document.documentElement.innerText <> '' then begin
10842                                 doc := Idispatch( olevariant(Self.FBrowser.ControlInterface).Document) as IHTMLDocument2;
10843                                 Self.Thread.ScrollTop := doc.Body.ScrollTop;
10844                         end;
10845                 end;
10846                 //TOleControl(Self.FBrowser).Visible := false;
10847                 ShowWindow(Self.FBrowser.Handle, SW_HIDE);
10848         end;
10849
10850 end;
10851
10852 procedure TGikoForm.ResRangeActionUpdate(Sender: TObject);
10853 begin
10854         ResRangeAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
10855 end;
10856
10857 function TGikoForm.WebBrowserClick(Sender: TObject): WordBool;
10858 begin
10859   result := true;
10860   try
10861         if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then
10862                 FActiveContent.FBrowser.SetFocus;
10863   except
10864   end;
10865 end;
10866
10867 function TGikoForm.WebBrowserOnMouseDown(Sender: TObject): WordBool;
10868 var
10869         p :TPoint;
10870         i : Integer;
10871         e: IHTMLElement;
10872         a: IHTMLElement;
10873         document: IHTMLDocument2;
10874         docAll: IHTMLElementCollection;
10875         firstElement: IHTMLElement;
10876         nCSS, body, id : string;
10877         doc : Variant;
10878 begin
10879         result := true;
10880 {$IFDEF DEBUG}
10881         try
10882                 if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
10883                         GetCursorPos(p);
10884                         p.x := p.x - FActiveContent.Browser.ClientOrigin.x;
10885                         p.y := p.y - FActiveContent.Browser.ClientOrigin.y;
10886                         e := IHTMLDocument2(FActiveContent.Browser.Document).elementFromPoint(p.x, p.y);
10887                         document := FActiveContent.Browser.Document as IHTMLDocument2;
10888                         if (Assigned(e)) and  Assigned(document) then begin
10889                                 docAll := document.all;
10890                                 firstElement := docAll.item('idSearch', 0) as IHTMLElement;
10891                                 if ( e.className = 'date' ) and (Assigned(firstElement)) and (AnsiPos('id', AnsiLowerCase(e.innerText)) > 0) then begin
10892                                         id := Copy(e.innerText, AnsiPos('id', AnsiLowerCase(e.innerText)), Length(e.innerText));
10893                                         body := GikoSys.GetSameIDResAnchor(id, FActiveContent.FThread);
10894                                         doc := Idispatch( olevariant(FActiveContent.Browser.ControlInterface).Document) as IHTMLDocument2;
10895                                         nCSS := '<p id="idSearch" style="position:absolute;top:'+ IntToStr(p.y + doc.Body.ScrollTop - firstElement.offsetHeight - 5) + 'px;right:5px;'
10896                                                          + 'background-color:window; border:outset 1px infobackground; overflow-y:auto; z-index:5; border-top:none">'
10897                                                          + body + '</p>';
10898                                         firstElement.outerHTML := nCSS;
10899                                 end else if (Assigned(firstElement)) then begin
10900                                         firstElement.outerHTML := '<p id="idSearch"></p>';
10901                                 end;
10902                         end;
10903                 end;
10904         except
10905         end;
10906 {$ENDIF}
10907 end;
10908
10909 procedure TGikoForm.SetFocusForBrowserActionExecute(Sender: TObject);
10910 begin
10911         FActiveContent.FBrowser.SetFocus;
10912 end;
10913
10914 procedure TGikoForm.SetFocusForBrowserActionUpdate(Sender: TObject);
10915 begin
10916         if( FActiveContent <> nil) and (FActiveContent.Browser <> nil) and
10917                 (FActiveContent.Browser <> BrowserNullTab.Browser) then
10918                 SetFocusForBrowserAction.Enabled := true
10919         else
10920                 SetFocusForBrowserAction.Enabled := false;
10921 end;
10922
10923 procedure TGikoForm.SetFocusForThreadListActionExecute(Sender: TObject);
10924 var
10925         rct: TRect;
10926 begin
10927         if FActiveContent <> nil then
10928                 WebBrowserClick(FActiveContent.Browser); //\88ê\89ñBrowser\82É\93\96\82Ä\82È\82¢\82Æ\93®\82©\82È\82¢\82Æ\82«\82ª\82 \82é
10929         ListView.SetFocus;
10930         if( ListView.Items.Count > 0 ) and (ListView.ItemFocused = nil) then
10931                 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é
10932         else if ListView.Items.Count > 0 then begin
10933                 ListView.Scroll(-ListView.ClientWidth, -ListView.ClientHeight);
10934                 rct := ListView.ItemFocused.DisplayRect(drBounds);
10935                 ListView.Scroll(0, 2 * rct.Top - rct.Bottom);
10936                 if ListView.ViewStyle <> vsReport then begin
10937                         ListView.Scroll(rct.Left, 0);
10938                 end;
10939         end;
10940 end;
10941
10942 procedure TGikoForm.SetFocusForCabinetActionExecute(Sender: TObject);
10943 begin
10944         if FActiveContent <> nil then
10945                 WebBrowserClick(FActiveContent.Browser); //\88ê\89ñBrowser\82É\93\96\82Ä\82È\82¢\82Æ\93®\82©\82È\82¢\82Æ\82«\82ª\82 \82é
10946         if TreeView.Visible then begin
10947                 TreeView.SetFocus;
10948                 if(TreeView.Items.Count > 0) and ( TreeView.Selected = nil ) then
10949                         TreeView.Items.Item[0].Selected := true;
10950         end else if FavoriteTreeView.Visible then begin
10951                 FavoriteTreeView.SetFocus;
10952                 if(FavoriteTreeView.Items.Count > 0) and (FavoriteTreeView.Selected = nil) then
10953                         FavoriteTreeView.Items.Item[0].Selected := true;
10954         end;
10955 end;
10956 procedure TGikoForm.SetFocusForCabinetActionUpdate(Sender: TObject);
10957 begin
10958         SetFocusForCabinetAction.Enabled := CabinetPanel.Visible;
10959 end;
10960
10961 //\83u\83\89\83E\83U\82ð\8dÅ\91å\89»\82µ\82Ä\83t\83H\81[\83J\83X\82ð\93\96\82Ä\82é\81B
10962 procedure TGikoForm.BrowserMaxAndFocusActionExecute(Sender: TObject);
10963 begin
10964         BrowserMaxAction.Execute;
10965         SetFocusForBrowserAction.Execute;
10966 end;
10967
10968 procedure TGikoForm.BrowserMaxAndFocusActionUpdate(Sender: TObject);
10969 begin
10970         if( FActiveContent <> nil) and (FActiveContent.Browser <> nil) and
10971                 (FActiveContent.Browser <> BrowserNullTab.Browser) then
10972                 BrowserMaxAndFocusAction.Enabled := true
10973         else
10974                 BrowserMaxAndFocusAction.Enabled := false;
10975 end;
10976 //\83X\83\8c\83b\83h\88ê\97\97\82ð\8dÅ\91å\89»\82µ\82Ä\83t\83H\81[\83J\83X\82ð\93\96\82Ä\82é
10977 procedure TGikoForm.ThreadlistMaxAndFocusActionExecute(Sender: TObject);
10978 begin
10979         BrowserMinAction.Execute;
10980         SetFocusForThreadListAction.Execute;
10981 end;
10982
10983 procedure TGikoForm.ListViewSelectItem(Sender: TObject; Item: TListItem;
10984   Selected: Boolean);
10985 begin
10986
10987         if not (GikoSys.Setting.BrowserTabVisible) and (Item <> nil) then
10988                         if (TObject( Item.Data ) is TThreadItem) then begin
10989                                 SelectTimer.Interval := GikoSys.Setting.SelectInterval;
10990                         end else
10991                                 SelectTimer.Interval := 0
10992         else
10993                 SelectTimer.Interval := 0;
10994
10995 end;
10996
10997 procedure TGikoForm.SelectTimerTimer(Sender: TObject);
10998 begin
10999         if not (ListView.Selected = nil) then
11000                 if( FActiveContent = nil) or
11001                                 (GetActiveContent <> TThreadItem(ListView.Selected.Data) ) then begin
11002                         SelectTimer.Interval := 0;
11003                         ListClick;
11004                 end;
11005 end;
11006
11007 procedure TGikoForm.SelectItemSaveForDatExecute(Sender: TObject);
11008 var
11009         List: TList;
11010         i: Integer;
11011 begin
11012         List := TList.Create;
11013         try
11014                 Screen.Cursor := crHourGlass;
11015                 SelectListItem(List);
11016                 if ((GikoSys.Setting.ListOrientation = gloVertical) and
11017                         (GikoSys.Setting.ListHeightState = glsMax)) or
11018                         ((GikoSys.Setting.ListOrientation = gloHorizontal) and
11019                         (GikoSys.Setting.ListWidthState = glsMax)) then
11020                         ShowMessage('\83X\83\8c\83b\83h\88ê\97\97\82ð\95\\8e¦\82µ\82Ä\82­\82¾\82³\82¢')
11021                 else if(List.Count = 0) then
11022                         ShowMessage('\83X\83\8c\83b\83h\82ð\91I\91ð\82µ\82Ä\82­\82¾\82³\82¢')
11023                 else begin
11024                         FileSaveAs1.Dialog.Title := '\91I\91ð\83X\83\8c\83b\83h\82ðdat\82Ì\82Ü\82Ü\95Û\91¶';
11025                         FileSaveAs1.Dialog.Filter := 'DAT\83t\83@\83C\83\8b(*.dat)|*.dat';
11026                         for i := 0 to List.Count - 1 do begin
11027                                 if (TObject(List[i]) is TThreadItem) and (TThreadItem(List[i]).IsLogFile) then begin
11028                                         FileSaveAs1.Dialog.FileName := TThreadItem(List[i]).FileName;
11029                                         if FileSaveAs1.Execute then begin
11030                                                 //\82È\82º\82©\83L\83\83\83\93\83Z\83\8b\82Å\82à\82±\82Á\82¿\82É\93ü\82Á\82Ä\82­\82é
11031                                                 if ExtractFilePath(FileSaveAs1.Dialog.FileName) <> '' then begin
11032                                                         CopyFile(PChar(TThreadItem(List[i]).FilePath),
11033                                                                 PChar(FileSaveAs1.Dialog.FileName), true);
11034                                                 end;
11035                                         end;
11036                                 end;
11037                         end;
11038                 end;
11039         finally
11040                 Screen.Cursor := crDefault;
11041                 List.Free;
11042         end;
11043
11044 end;
11045
11046 procedure TGikoForm.SelectItemSaveForHTMLExecute(Sender: TObject);
11047 var
11048         List: TList;
11049         i: Integer;
11050         html: TStringList;
11051         title: string;
11052 begin
11053         List := TList.Create;
11054         try
11055                 Screen.Cursor := crHourGlass;
11056                 SelectListItem(List);
11057                 if ((GikoSys.Setting.ListOrientation = gloVertical) and
11058                         (GikoSys.Setting.ListHeightState = glsMax)) or
11059                         ((GikoSys.Setting.ListOrientation = gloHorizontal) and
11060                         (GikoSys.Setting.ListWidthState = glsMax))      then
11061                         ShowMessage('\83X\83\8c\83b\83h\88ê\97\97\82ð\95\\8e¦\82µ\82Ä\82­\82¾\82³\82¢')
11062                 else if(List.Count = 0) then
11063                         ShowMessage('\83X\83\8c\83b\83h\82ð\91I\91ð\82µ\82Ä\82­\82¾\82³\82¢')
11064                 else begin
11065                         FileSaveAs1.Dialog.Title := '\91I\91ð\83X\83\8c\83b\83h\82ðHTML\89»\82µ\82Ä\95Û\91¶';
11066                         FileSaveAs1.Dialog.Filter := 'HTML\83t\83@\83C\83\8b(*.html)|*.html';
11067                         for i := 0 to List.Count - 1 do begin
11068                                 if (TObject(List[i]) is TThreadItem) and (TThreadItem(List[i]).IsLogFile) then begin
11069                                         FileSaveAs1.Dialog.FileName := TThreadItem(List[i]).Title + '.html';
11070                                         if FileSaveAs1.Execute then begin
11071                                                 //\82È\82º\82©\83L\83\83\83\93\83Z\83\8b\82Å\82à\82±\82Á\82¿\82É\93ü\82Á\82Ä\82­\82é
11072                                                 if ExtractFilePath(FileSaveAs1.Dialog.FileName) <> '' then begin
11073                                                         html := TStringList.Create;
11074                                                         title := TThreadItem(List[i]).Title;
11075                                                         try
11076                                                                 GikoSys.CreateHTML3(html, TThreadItem(List[i]), title);
11077                                                                 html.SaveToFile(FileSaveAs1.Dialog.FileName);
11078                                                                 SkinorCSSFilesCopy(ExtractFilePath(FileSaveAs1.Dialog.FileName));
11079                                                         finally
11080                                                                 html.Free;
11081                                                         end;
11082                                                 end;
11083                                         end;
11084                                 end;
11085                         end;
11086                 end;
11087         finally
11088                 Screen.Cursor := crDefault;
11089                 List.Free;
11090         end;
11091 end;
11092 procedure TGikoForm.SkinorCSSFilesCopy(path: string);
11093 var
11094         tmp, tmpD, tmpF: string;
11095         current: string;
11096         dirs: TStringList;
11097         files: TStringList;
11098         i, j: Integer;
11099 begin
11100         if GikoSys.Setting.UseSkin then begin
11101                 current := ExtractFilePath(GikoSys.GetSkinDir);
11102                 tmp := GikoSys.Setting.CSSFileName;
11103         end else if GikoSys.Setting.UseCSS then begin
11104                 current := ExtractFilePath(GikoSys.GetStyleSheetDir);
11105                 tmp := ExtractFilePath(GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName);
11106         end;
11107         dirs := TStringList.Create;
11108         try
11109                 dirs.Add(tmp);
11110                 if tmp <> current then begin
11111                         GikoSys.GetDirectoryList(current, '*.*', dirs, true);
11112                         for i := 0 to dirs.Count - 1 do begin
11113                                 files := TStringList.Create;
11114                                 try
11115                                         gikoSys.GetFileList(dirs[i], '*.*', files, true);
11116                                         tmpD := CustomStringReplace(dirs[i], GikoSys.GetConfigDir, path);
11117                                         if (AnsiPos(dirs[i], tmp) <> 0) and not (DirectoryExists(tmpD)) then
11118                                                 ForceDirectories(tmpD);
11119
11120                                         if(dirs[i] = tmp) and (dirs[i] <> current) then begin
11121                                                 for j := 0 to files.Count - 1 do begin
11122                                                         tmpF := CustomStringReplace(files[j], GikoSys.GetConfigDir, path);
11123                                                         if not FileExists(tmpF) then begin
11124                                                                 CopyFile(PChar(files[j]), PChar(tmpF),True);
11125                                                         end;
11126                                                 end;
11127                                         end;
11128                                 finally
11129                                         files.Free;
11130                                 end;
11131                         end;
11132                 end else begin
11133                         tmpD := CustomStringReplace(dirs[0], GikoSys.GetConfigDir, path);
11134                         if not DirectoryExists(tmpD) then
11135                                 ForceDirectories(tmpD);
11136                         tmpF := CustomStringReplace(GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName
11137                                         , GikoSys.GetConfigDir, path);
11138                         if not FileExists(tmpF) then begin
11139                                 CopyFile(PChar(GikoSys.GetStyleSheetDir + GikoSys.Setting.CSSFileName)
11140                                         , PChar(tmpF), True);
11141                         end;
11142                 end;
11143         finally
11144                 dirs.Free;
11145         end;
11146
11147
11148 end;
11149 procedure TGikoForm.KidokuActionExecute(Sender: TObject);
11150 var
11151         List: TList;
11152         i: Integer;
11153 begin
11154         List := TList.Create;
11155         try
11156                 SelectListItem(List);
11157                 for i := 0 to List.Count - 1 do begin
11158                         if TObject(List[i]) is TThreadItem then begin
11159                                 if (TThreadItem(List[i]).UnRead) then begin
11160                                         TThreadItem(List[i]).UnRead := false;
11161                                         TThreadItem(List[i]).ParentBoard.UnRead := TThreadItem(List[i]).ParentBoard.UnRead - 1;
11162                                 end;
11163                         end;
11164                 end;
11165                 if TreeView.Visible then
11166                         TreeView.Refresh;
11167                 if ListView.Visible then
11168                 ListView.Refresh;
11169         finally
11170                 List.Free;
11171         end;
11172 end;
11173
11174 procedure TGikoForm.MidokuActionExecute(Sender: TObject);
11175 var
11176         List: TList;
11177         i: Integer;
11178 begin
11179         List := TList.Create;
11180         try
11181                 SelectListItem(List);
11182                 for i := 0 to List.Count - 1 do begin
11183                         if TObject(List[i]) is TThreadItem then begin
11184                                 if (TThreadItem(List[i]).IsLogFile) and (not TThreadItem(List[i]).UnRead) then begin
11185                                         TThreadItem(List[i]).UnRead := true;
11186                                         TThreadItem(List[i]).ParentBoard.UnRead := TThreadItem(List[i]).ParentBoard.UnRead + 1;
11187                                 end;
11188                         end;
11189                 end;
11190                 if TreeView.Visible then
11191                         TreeView.Refresh;
11192                 if ListView.Visible then
11193                 ListView.Refresh;
11194         finally
11195                 List.Free;
11196         end;
11197 end;
11198
11199 procedure TGikoForm.LogFolderOpenActionExecute(Sender: TObject);
11200 var
11201         List: TList;
11202 begin
11203         if ((GikoSys.Setting.ListOrientation = gloVertical) and
11204                 (GikoSys.Setting.ListHeightState = glsMax)) or
11205                 ((GikoSys.Setting.ListOrientation = gloHorizontal) and
11206                 (GikoSys.Setting.ListWidthState = glsMax))      then begin
11207                 if(GetActiveContent <> nil) then begin
11208                         GikoSys.CreateProcess('explorer.exe', '/e,"' + ExtractFilePath(GetActiveContent.FilePath) + '"');
11209                 end;
11210         end else if GetActiveList is TCategory then begin
11211                 List := TList.Create;
11212                 try
11213                         SelectListItem(List);
11214                         GikoSys.CreateProcess('explorer.exe', '/e,"' + ExtractFilePath(TBoard(List[0]).FilePath) + '"');
11215                 finally
11216                         List.Free;
11217                 end;
11218         end else if GetActiveList is TBoard then begin
11219                 GikoSys.CreateProcess('explorer.exe', '/e,"' + ExtractFilePath(TBoard(GetActiveList).FilePath) + '"');
11220         end;
11221
11222 end;
11223
11224 procedure TGikoForm.LogFolderOpenActionUpdate(Sender: TObject);
11225 begin
11226         if (GetActiveList is TCategory) and (ListView.SelCount > 0) then
11227                 LogFolderOpenAction.Enabled := True
11228         else if GetActiveList is TBoard then
11229                 LogFolderOpenAction.Enabled := True
11230         else
11231                 LogFolderOpenAction.Enabled := False;
11232 end;
11233
11234 function TGikoForm.GetTabURLs(AStringList: TStringList) : Boolean;
11235 var
11236   rec : TBrowserRecord;
11237   i, bound : Integer;
11238 begin
11239   bound := BrowserTab.Tabs.Count -1;
11240         if bound = -1 then begin
11241                 Result := False;
11242                 Exit; //for\82É\94ò\82Î\82È\82¢\82Å\91\80\8dì\82ð\94²\82¯\82é
11243   end;
11244
11245   for i := 0 to bound do begin
11246         rec := TBrowserRecord( BrowserTab.Tabs.Objects[ i ] );
11247         if( rec <> nil) and (rec.Thread <> nil) then
11248                 AStringList.Add( rec.Thread.URL );
11249   end;
11250   Result := True;
11251 end;
11252
11253 procedure TGikoForm.TabsSaveActionExecute(Sender: TObject);
11254 begin
11255         if not SaveTabURLs then begin
11256                 ShowMessage('\95Û\91\82·\82é\83^\83u\82ª\82 \82è\82Ü\82¹\82ñ');
11257         end;
11258 end;
11259
11260 function TGikoForm.SaveTabURLs : Boolean;
11261 const
11262         Filename = 'tab.sav';
11263         bFilename = '~tab.sav';
11264 var
11265         SaveStringList: TStringList;
11266 begin
11267         if FileExists( GikoSys.GetAppDir + Filename) then begin
11268                 if FileExists( GikoSys.GetAppDir + bFilename) then
11269                         DeleteFile(GikoSys.GetAppDir + bFilename);
11270
11271                 //\83o\83b\83N\83A\83b\83v\82ð\8dì\82é\81B
11272                 RenameFile(GikoSys.GetAppDir + Filename, GikoSys.GetAppDir + bFilename);
11273    end;
11274
11275         SaveStringList := TStringList.Create;
11276         try
11277                 if GetTabURLs(SaveStringList) then begin
11278                         SaveStringList.SaveToFile(GikoSys.GetAppDir + Filename);
11279                         Result := true;
11280                 end;
11281         finally
11282                 SaveStringList.Free;
11283         end;
11284 end;
11285
11286 procedure TGikoForm.TabsOpenActionExecute(Sender: TObject);
11287 begin
11288         if not LoadTabURLs then begin
11289                 ShowMessage('\95\\8e¦\82·\82é\83^\83u\82ª\82 \82è\82Ü\82¹\82ñ\81B');
11290         end;
11291 end;
11292 {
11293  procedure TGikoForm.FileTabSaveClick(Sender: TObject);
11294 var
11295         SaveStringList: TStringList;
11296 begin
11297                  SaveTabList := TStringList.Create;
11298                  SaveTabList := GetTabURLs;
11299                  if TabSaveDialog.Execute then begin
11300                                  SaveTabList.SaveToFile(TabSaveDialog.FileName);
11301                  end;
11302 end;
11303 }
11304
11305 function TGikoForm.LoadTabURLs : Boolean;
11306 var
11307         i, bound    : Integer;
11308         item        : TThreadItem;
11309         URLs                            : TStringList;
11310         GikoTab                 : TGikoTabAppend;
11311         fileName                : string;
11312 begin
11313         fileName := ExtractFilePath(Application.ExeName) + 'tab.sav';
11314         URLs := TStringList.Create();
11315         GikoTab := GikoSys.Setting.BrowserTabAppend;
11316         try
11317                 try
11318                         if FileExists(fileName) then
11319                                 URLs.LoadFromFile(fileName);
11320                 except
11321                         on EFOpenError do
11322                                 ShowMessage('\83^\83u\83t\83@\83C\83\8b\82ª\8aJ\82¯\82Ü\82¹\82ñ');
11323                 end;
11324                 bound    := URLs.Count - 1;
11325                 if bound = -1 then begin
11326                         Result := False;
11327                         Exit;
11328                 end;
11329
11330
11331                 GikoSys.Setting.BrowserTabAppend := gtpLast;//TGikoTabAppend(1);
11332                 for i := 0 to URLs.Count - 1 do begin
11333                         item := BBSsFindThreadFromURL( URLs[ i ] );
11334                         if item <> nil then
11335                                 InsertBrowserTab( item, false );
11336                 end;
11337         finally
11338                 GikoSys.Setting.BrowserTabAppend := GikoTab;
11339                 URLs.Free;
11340         end;
11341         Result := True;
11342 end;
11343
11344 procedure TGikoForm.TabsSaveToFileActionExecute(Sender: TObject);
11345 var
11346         SaveTabList: TStringList;
11347         Result: Boolean;
11348 begin
11349         SaveTabList := TStringList.Create;
11350         try
11351                 Result := GetTabURLs(SaveTabList);
11352 //              if TabSaveDialog.Execute then begin
11353 //                      SaveTabList.SaveToFile(TabSaveDialog.FileName);
11354 //              end;
11355         finally
11356                 SaveTabList.Free;
11357         end;
11358 end;
11359
11360 procedure TGikoForm.TabsOpenFromFileActionExecute(Sender: TObject);
11361 var
11362         i    : Integer;
11363         item        : TThreadItem;
11364         URLs : TStringList;
11365         GikoTab: TGikoTabAppend;
11366 begin
11367         URLs := TStringList.Create();
11368         GikoTab := GikoSys.Setting.BrowserTabAppend;
11369         try
11370                 try
11371 //                      if TabOpenDialog.Execute then begin
11372 //                              URLs.LoadFromFile(TabOpenDialog.FileName);
11373 //                      end;
11374                 except
11375                         on EFOpenError do ShowMessage('\83^\83u\83t\83@\83C\83\8b\82ª\8aJ\82¯\82Ü\82¹\82ñ');
11376                 end;
11377
11378                 GikoSys.Setting.BrowserTabAppend := gtpLast;//TGikoTabAppend(1);
11379                 for i := 0 to URLs.Count - 1 do begin
11380                         item := BBSsFindThreadFromURL( URLs[ i ] );
11381                         if item <> nil then
11382                                 InsertBrowserTab( item, false );
11383                 end;
11384         finally
11385                 GikoSys.Setting.BrowserTabAppend := GikoTab;
11386                 URLs.Free;
11387         end;
11388 end;
11389
11390 procedure TGikoForm.OnlyAHundredResActionExecute(Sender: TObject);
11391 var
11392         ThreadItem : TThreadItem;
11393         FilterList : TStringList;
11394         i: Integer;
11395 begin
11396         if (FActiveContent <> nil) and (FActiveContent.FBrowser <> nil)
11397                 and (FActiveContent.FBrowser.Busy) then Exit;
11398
11399         FResRangeMenuSelect                                             := 100;
11400         OnlyAHundredResAction.Checked   := True;
11401
11402         if GikoSys.ResRange <> 100 then begin
11403                 GikoSys.ResRange                                        := 100;
11404
11405                 // \83t\83B\83\8b\83^\95\8e\9a\97ñ\82ð\8bó\82É\82·\82é
11406                 FilterList := TStringList.Create;
11407                 try
11408                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
11409                         GikoSys.FSelectResFilter.Reverse := False;
11410                 finally
11411                         FilterList.Destroy;
11412                 end;
11413
11414                 FSelectResWord := '';
11415
11416                 // \83X\83\8c\83b\83h\82ð\8dÄ\95`\89æ
11417                 for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
11418                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
11419                 end;
11420                 ThreadItem := GetActiveContent;
11421                 if ThreadItem <> nil then
11422                         InsertBrowserTab( ThreadItem, True );
11423         end;
11424 end;
11425
11426 procedure TGikoForm.OnlyKokoResActionExecute(Sender: TObject);
11427 var
11428         ThreadItem : TThreadItem;
11429         FilterList : TStringList;
11430         i: Integer;
11431 begin
11432         if (FActiveContent <> nil) and (FActiveContent.FBrowser <> nil)
11433                 and (FActiveContent.FBrowser.Busy) then Exit;
11434
11435         FResRangeMenuSelect                             := Ord( grrKoko );
11436         OnlyKokoResAction.Checked       := True;
11437
11438         if GikoSys.ResRange <> Ord( grrKoko ) then begin
11439                 GikoSys.ResRange                                        := Ord( grrKoko );
11440
11441                 // \83t\83B\83\8b\83^\95\8e\9a\97ñ\82ð\8bó\82É\82·\82é
11442                 FilterList := TStringList.Create;
11443                 try
11444                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
11445                         GikoSys.FSelectResFilter.Reverse := False;
11446                 finally
11447                         FilterList.Destroy;
11448                 end;
11449
11450                 FSelectResWord := '';
11451
11452                 // \83X\83\8c\83b\83h\82ð\8dÄ\95`\89æ
11453                 for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
11454                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
11455                 end;
11456                 ThreadItem := GetActiveContent;
11457                 if ThreadItem <> nil then
11458                         InsertBrowserTab( ThreadItem, True );
11459         end;
11460 end;
11461
11462 procedure TGikoForm.OnlyNewResActionExecute(Sender: TObject);
11463 var
11464         ThreadItem : TThreadItem;
11465         FilterList : TStringList;
11466         i: Integer;
11467 begin
11468         if (FActiveContent <> nil) and (FActiveContent.FBrowser <> nil)
11469                 and (FActiveContent.FBrowser.Busy) then Exit;
11470
11471         FResRangeMenuSelect                             := Ord( grrNew );
11472         OnlyNewResAction.Checked        := True;
11473
11474         if GikoSys.ResRange <> Ord( grrNew ) then begin
11475                 GikoSys.ResRange                                        := Ord( grrNew );
11476
11477                 // \83t\83B\83\8b\83^\95\8e\9a\97ñ\82ð\8bó\82É\82·\82é
11478                 FilterList := TStringList.Create;
11479                 try
11480                         GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
11481                         GikoSys.FSelectResFilter.Reverse := False;
11482                 finally
11483                         FilterList.Destroy;
11484                 end;
11485
11486                 FSelectResWord := '';
11487
11488                 // \83X\83\8c\83b\83h\82ð\8dÄ\95`\89æ
11489                 for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
11490                         TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
11491                 end;
11492                 ThreadItem := GetActiveContent;
11493                 if ThreadItem <> nil then
11494                         InsertBrowserTab( ThreadItem, True );
11495         end;
11496 end;
11497
11498 procedure TGikoForm.BrowsBoradHeadActionExecute(Sender: TObject);
11499 var
11500         RefURL, URL : string;
11501         List : TList;
11502 begin
11503         RefURL := '';
11504         if GetActiveList is TCategory then begin
11505                 List := TList.Create;
11506                 try
11507                         SelectListItem(List);
11508                         RefURL := TBoard(List[0]).URL;
11509                 finally
11510                         List.Free;
11511                 end;
11512         end else if GetActiveList is TBoard then begin
11513                 RefURL := TBoard(GetActiveList).URL
11514         end;
11515         if RefURL <> '' then begin
11516                 if RefURL[Length(RefURL)] <> '/' then
11517                         URL     := RefURL + '/' + 'head.txt'
11518                 else
11519                         URL     := RefURL + 'head.txt';
11520
11521                 MoveToURL(URL);
11522         end else begin
11523                 ShowMessage('\94Â\82ð\93Á\92è\82Å\82«\82Ü\82¹\82ñ\82Å\82µ\82½\81B');
11524         end;
11525
11526 end;
11527
11528 procedure TGikoForm.BrowsBoradHeadActionUpdate(Sender: TObject);
11529 begin
11530         if (GetActiveList is TCategory) and (ListView.SelCount > 0) then
11531                 BrowsBoradHeadAction.Enabled := True
11532         else if GetActiveList is TBoard then
11533                 BrowsBoradHeadAction.Enabled := True
11534         else
11535                 BrowsBoradHeadAction.Enabled := False;
11536
11537 end;
11538 //NG\83\8f\81[\83h\83t\83@\83C\83\8b\82ð\95Ò\8fW\82·\82é\82½\82ß\82É\8aJ\82­
11539 procedure TGikoForm.EditNGActionExecute(Sender: TObject);
11540 begin
11541         GikoSys.FAbon.EditNGwords;
11542 end;
11543
11544 procedure TGikoForm.ThreadRangeActionUpdate(Sender: TObject);
11545 begin
11546         ThreadRangeAction.Enabled := (GetActiveList is TBoard);
11547 end;
11548
11549 procedure TGikoForm.ThreadRangeActionExecute(Sender: TObject);
11550 begin
11551         case GikoSys.Setting.ThreadRange of
11552         gtrAll: AllItemAction.Execute;
11553         gtrLog: LogItemAction.Execute;
11554         gtrNew: NewItemAction.Execute;
11555         end;
11556 end;
11557
11558 procedure TGikoForm.TabAutoSaveActionExecute(Sender: TObject);
11559 begin
11560         SaveTabURLs;
11561 end;
11562
11563 procedure TGikoForm.TabAutoLoadActionExecute(Sender: TObject);
11564 begin
11565         LoadTabURLs;
11566 end;
11567
11568 /// ListView \82Ì\83J\83\89\83\80\95\9d\82¨\82æ\82Ñ\88Ê\92u\82Ì\95Û\91
11569 procedure TGikoForm.ActiveListColumnSave;
11570 var
11571         ActivListObj    : TObject;
11572         i, id, idx              : Integer;
11573         BBSOrder                        : TGikoBBSColumnList;
11574         CategoryOrder   : TGikoCategoryColumnList;
11575         BoardOrder              : TGikoBoardColumnList;
11576 begin
11577
11578         ActivListObj := ActiveList;
11579         if ActivListObj is TBBS then begin
11580                 //===== \83J\83e\83S\83\8a\83\8a\83X\83g =====
11581                 BBSOrder := TGikoBBSColumnList.Create;
11582                 try
11583                         for i := 0 to ListView.Columns.Count - 1 do begin
11584                                 // \8f\87\8f\98\82Ì\8eæ\93¾
11585                                 idx := ListView.Column[ i ].Tag;
11586                                 id := Ord( GikoSys.Setting.BBSColumnOrder[ idx ] );
11587                                 BBSOrder.Add( TGikoBBSColumnID( id ) );
11588                                 // \95\9d\82Ì\95Û\91
11589                                 GikoSys.Setting.BBSColumnWidth[ id ] := ListView.Column[ i ].Width;
11590                         end;
11591                         for i := 0 to ListView.Columns.Count - 1 do
11592                                 // \8f\87\8f\98\82Ì\95Û\91
11593                                 GikoSys.Setting.BBSColumnOrder[ i ] := BBSOrder[ i ];
11594                 finally
11595                         BBSOrder.Free;
11596                 end;
11597         end else if ActivListObj is TCategory then begin
11598                 //===== \94Â\83\8a\83X\83g =====
11599                 CategoryOrder := TGikoCategoryColumnList.Create;
11600                 try
11601                         for i := 0 to ListView.Columns.Count - 1 do begin
11602                                 // \8f\87\8f\98\82Ì\8eæ\93¾
11603                                 idx := ListView.Column[ i ].Tag;
11604                                 id := Ord( GikoSys.Setting.CategoryColumnOrder[ idx ] );
11605                                 CategoryOrder.Add( TGikoCategoryColumnID( id ) );
11606                                 // \95\9d\82Ì\95Û\91
11607                                 GikoSys.Setting.CategoryColumnWidth[ id ] := ListView.Column[ i ].Width;
11608                         end;
11609                         for i := 0 to ListView.Columns.Count - 1 do
11610                                 // \8f\87\8f\98\82Ì\95Û\91
11611                                 GikoSys.Setting.CategoryColumnOrder[ i ] := CategoryOrder[ i ];
11612                 finally
11613                         CategoryOrder.Free;
11614                 end;
11615         end else if ActivListObj is TBoard then begin
11616                 //===== \83X\83\8c\83\8a\83X\83g =====
11617                 BoardOrder := TGikoBoardColumnList.Create;
11618                 try
11619                         for i := 0 to ListView.Columns.Count - 1 do begin
11620                                 // \8f\87\8f\98\82Ì\8eæ\93¾
11621                                 idx := ListView.Column[ i ].Tag;
11622                                 id := Ord( GikoSys.Setting.BoardColumnOrder[ idx ] );
11623                                 BoardOrder.Add( TGikoBoardColumnID( id ) );
11624                                 // \95\9d\82Ì\95Û\91
11625                                 GikoSys.Setting.BoardColumnWidth[ id ] := ListView.Column[ i ].Width;
11626                         end;
11627                         for i := 0 to ListView.Columns.Count - 1 do
11628                                 // \8f\87\8f\98\82Ì\95Û\91
11629                                 GikoSys.Setting.BoardColumnOrder[ i ] := BoardOrder[ i ];
11630                 finally
11631                         BoardOrder.Free;
11632                 end;
11633         end;
11634         
11635 end;
11636
11637 procedure TGikoForm.ListViewColumnRightClick(Sender: TObject;
11638         Column: TListColumn; Point: TPoint);
11639 var
11640         i, j    : Integer;
11641         item    : TMenuItem;
11642 begin
11643
11644         // \83|\83b\83v\83A\83b\83v\83\81\83j\83\85\81[\82ð\83N\83\8a\83A
11645         for i := ListColumnPopupMenu.Items.Count - 1 downto 0 do
11646                 ListColumnPopupMenu.Items.Items[ i ].Free;
11647
11648         // \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¢)
11649         if TObject( FActiveList ) is TBBS then begin
11650
11651                 //===== \83J\83e\83S\83\8a\83\8a\83X\83g =====
11652                 for i := 1 to Length( GikoBBSColumnCaption ) - 1 do begin
11653                         item := TMenuItem.Create( ListColumnPopupMenu );
11654                         item.Caption := GikoBBSColumnCaption[ i ];
11655                         item.Tag := i;
11656                         item.OnClick := ListColumnPopupMenuOnClick;
11657                         for j := GikoSys.Setting.BBSColumnOrder.Count - 1 downto 0 do begin
11658                                 if GikoSys.Setting.BBSColumnOrder[ j ] = TGikoBBSColumnID( i ) then begin
11659                                         item.Checked := True;
11660                                         Break;
11661                                 end;
11662                         end;
11663                         ListColumnPopupMenu.Items.Add( item );
11664                 end;
11665
11666         end else if TObject( FActiveList ) is TCategory then begin
11667
11668                 //===== \94Â\83\8a\83X\83g =====
11669                 for i := 1 to Length( GikoCategoryColumnCaption ) - 1 do begin
11670                         item := TMenuItem.Create( ListColumnPopupMenu );
11671                         item.Caption := GikoCategoryColumnCaption[ i ];
11672                         item.Tag := i;
11673                         item.OnClick := ListColumnPopupMenuOnClick;
11674                         for j := GikoSys.Setting.CategoryColumnOrder.Count - 1 downto 0 do begin
11675                                 if GikoSys.Setting.CategoryColumnOrder[ j ] = TGikoCategoryColumnID( i ) then begin
11676                                         item.Checked := True;
11677                                         Break;
11678                                 end;
11679                         end;
11680                         ListColumnPopupMenu.Items.Add( item );
11681                 end;
11682
11683         end else if TObject( FActiveList ) is TBoard then begin
11684
11685                 //===== \83X\83\8c\83\8a\83X\83g =====
11686                 for i := 1 to Length( GikoBoardColumnCaption ) - 1 do begin
11687                         item := TMenuItem.Create( ListColumnPopupMenu );
11688                         item.Caption := GikoBoardColumnCaption[ i ];
11689                         item.Tag := i;
11690                         item.OnClick := ListColumnPopupMenuOnClick;
11691                         for j := GikoSys.Setting.BoardColumnOrder.Count - 1 downto 0 do begin
11692                                 if GikoSys.Setting.BoardColumnOrder[ j ] = TGikoBoardColumnID( i ) then begin
11693                                         item.Checked := True;
11694                                         Break;
11695                                 end;
11696                         end;
11697                         ListColumnPopupMenu.Items.Add( item );
11698                 end;
11699
11700         end;
11701
11702         // \83\81\83j\83\85\81[\82Ì\95\\8e¦
11703         Point := ListView.ClientToScreen( Point );
11704         if ListColumnPopupMenu.Items.Count > 0 then
11705                 ListColumnPopupMenu.Popup( Point.X, Point.Y );
11706
11707 end;
11708
11709 /// ListColumnPopupMenu \83A\83C\83e\83\80\82Ì\83N\83\8a\83b\83N\83C\83x\83\93\83g
11710 procedure       TGikoForm.ListColumnPopupMenuOnClick( Sender : TObject );
11711 var
11712         i                                       : Integer;
11713         orderList       : TList;
11714         item                    : TMenuItem;
11715 begin
11716
11717         if not (Sender is TMenuItem) then
11718                 Exit;
11719
11720         ActiveListColumnSave;
11721         item := TMenuItem( Sender );
11722
11723         if TObject( FActiveList ) is TBBS then
11724                 orderList := GikoSys.Setting.BBSColumnOrder
11725         else if TObject( FActiveList ) is TCategory then
11726                 orderList := GikoSys.Setting.CategoryColumnOrder
11727         else if TObject( FActiveList ) is TBoard then
11728                 orderList := GikoSys.Setting.BoardColumnOrder
11729         else
11730                 Exit;
11731
11732         if item.Checked then begin
11733                 // \83J\83\89\83\80\82Ì\8dí\8f\9c
11734                 for i := orderList.Count - 1 downto 0 do begin
11735                         if Integer( orderList[ i ] ) = item.Tag then begin
11736                                 orderList.Delete( i );
11737                                 Break;
11738                         end;
11739                 end;
11740         end else begin
11741                 // \83J\83\89\83\80\82Ì\92Ç\89Á
11742                 orderList.Add( Pointer( item.Tag ) );
11743         end;
11744
11745         SetActiveList( FActiveList );
11746
11747 end;
11748 //\8ew\92è\82µ\82½\94Ô\8d\86\82Ì\83\8c\83X\82Éjump\82·\82éAction
11749 procedure TGikoForm.JumpToNumOfResActionExecute(Sender: TObject);
11750 var
11751         str: string;
11752         res: integer;
11753 begin
11754         str := '1';
11755         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
11756                 str := ZenToHan(str);
11757                 res := StrToIntDef(str, -1);
11758                 if (res > 0) and (res <= GetActiveContent.Count) then begin
11759                         BrowserMovement(IntToStr(res), FActiveContent);
11760                         SetFocusForBrowserAction.Execute;
11761                 end else if res > GetActiveContent.Count then begin
11762                         BrowserMovement(IntToStr(GetActiveContent.Count), FActiveContent);
11763                         SetFocusForBrowserAction.Execute;
11764                 end;
11765         end;
11766 end;
11767
11768 procedure TGikoForm.JumpToNumOfResActionUpdate(Sender: TObject);
11769 begin
11770         JumpToNumOfResAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
11771 end;
11772
11773 procedure TGikoForm.FavoriteTreeViewCollapseActionExecute(Sender: TObject);
11774 var
11775         node    : TTreeNode;
11776 begin
11777
11778         node := FavoriteTreeView.Items.GetFirstNode;
11779         while node <> nil do begin
11780                 if node.HasChildren then
11781                         node.Expanded := False;
11782                 node := node.GetNext;
11783         end;
11784
11785 end;
11786 procedure TGikoForm.ReleaseBrowser( BRecord: TBrowserRecord);
11787 begin
11788         if BRecord <> nil then begin
11789                 BRecord.Browser := nil;
11790                 if BRecord.FEvent <> nil then begin
11791                         BRecord.FEvent.Free;
11792                         BRecord.FEvent := nil;
11793                 end;
11794                 BRecord.Repaint := true;
11795         end;
11796 end;
11797
11798 procedure TGikoForm.OnGestureStart(Sender: TObject);
11799 begin
11800 //
11801 end;
11802
11803 procedure TGikoForm.OnGestureMove(Sender: TObject);
11804 var
11805         s: string;
11806         Action: TAction;
11807         ActStr: string;
11808 begin
11809         s := MouseGesture.GetGestureStr;
11810         ActStr := '';
11811         Action := GikoSys.Setting.Gestures.GetGestureAction(s);
11812         if Action <> nil then
11813                 ActStr := '\81i' + Action.Caption + '\81j';
11814         s := '\83W\83F\83X\83`\83\83\81[: ' + s + ActStr;
11815         StatusBar.Panels[1].Text := s;
11816 end;
11817
11818 procedure TGikoForm.OnGestureEnd(Sender: TObject);
11819 var
11820         s: string;
11821         Action: TAction;
11822 begin
11823         s := MouseGesture.GetGestureStr;
11824         Action := GikoSys.Setting.Gestures.GetGestureAction(s);
11825         if Action <> nil then
11826                 Action.Execute;
11827         StatusBar.Panels[1].Text := '';
11828 end;
11829
11830 procedure TGikoForm.ListViewCustomDrawItem(Sender: TCustomListView;
11831   Item: TListItem; State: TCustomDrawState; var DefaultDraw: Boolean);
11832 var
11833         ThreadItem: TThreadItem;
11834 begin
11835     DefaultDraw := true;
11836         if TObject(Item.Data) is TThreadItem then begin
11837                 ThreadItem := TThreadItem(Item.Data);
11838                 if ( FUseOddResOddColor ) and ( ThreadItem.Count <> 0 ) and ( ThreadItem.AllResCount <> ThreadItem.Count) then begin
11839                         ListView.Canvas.Brush.Color := FOddColor;
11840                 end else begin
11841                         ListView.Canvas.Brush.Color := FListViewBackGroundColor;
11842                 end;
11843 //              if (ThreadItem.Kokomade <> ThreadItem.Count) and (ThreadItem.IsLogFile) then
11844                 if ThreadItem.UnRead then
11845                         TListView(Sender).Canvas.Font.Style := [fsBold];
11846         end;
11847
11848 end;
11849
11850 procedure TGikoForm.FormActivate(Sender: TObject);
11851 begin
11852         MouseGesture.UnHook;
11853         if GikoSys.Setting.GestureEnabled then begin
11854                 MouseGesture.OnGestureStart := OnGestureStart;
11855                 MouseGesture.OnGestureMove := OnGestureMove;
11856                 MouseGesture.OnGestureEnd := OnGestureEnd;
11857                 MouseGesture.SetHook(Handle);
11858         end else begin
11859                 MouseGesture.OnGestureStart := nil;
11860                 MouseGesture.OnGestureMove := nil;
11861                 MouseGesture.OnGestureEnd := nil;
11862         end;
11863 end;
11864
11865 procedure TGikoForm.MainCoolBarChange(Sender: TObject);
11866 begin
11867         if not FStartUp then begin
11868         SaveMainCoolBarSettings;
11869         end;
11870 end;
11871
11872 procedure TGikoForm.BrowserCoolBarChange(Sender: TObject);
11873 begin
11874         SaveBrowserCoolBarSettings;
11875 end;
11876
11877 procedure TGikoForm.ListCoolBarChange(Sender: TObject);
11878 begin
11879         SaveBoardCoolBarSettings;
11880 end;
11881
11882 procedure TGikoForm.BrowserCoolBarResize(Sender: TObject);
11883 begin
11884         if not FStartUp then begin
11885         SaveBrowserCoolBarSettings;
11886         end;
11887 end;
11888
11889 procedure TGikoForm.ListCoolBarResize(Sender: TObject);
11890 begin
11891         if not FStartUp then begin
11892         SaveBoardCoolBarSettings;
11893         end;
11894
11895 end;
11896
11897 procedure TGikoForm.BrowserPanelResize(Sender: TObject);
11898 begin
11899         if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
11900                 MoveWindow(FActiveContent.Browser.Handle, 0, 0, BrowserPanel.ClientWidth, BrowserPanel.ClientHeight, false);
11901         end;
11902
11903 end;
11904
11905 initialization
11906                                 OleInitialize(nil);
11907 finalization
11908                                 OleUninitialize;
11909
11910 end.