OSDN Git Service

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