OSDN Git Service

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