OSDN Git Service

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