OSDN Git Service

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