OSDN Git Service

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