OSDN Git Service

(none)
[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,
8 {$IF Defined(DELPRO) }
9         SHDocVw,                                                                                         
10         MSHTML,
11 {$ELSE}
12         SHDocVw_TLB,
13         MSHTML_TLB,
14 {$IFEND}
15         IdHTTP, ActiveX, Clipbrd, Buttons, ToolWin, {HTTPApp,} YofUtils, IdComponent,
16         ShellAPI, ImgList, ActnList, UrlMon, Tabs, IdGlobal, StrUtils,
17         CommCtrl, IniFiles,
18         GikoSystem, GikoUtil, Setting, BoardGroup, ThreadControl, ItemDownload,
19         Editor, RoundData, RoundName, KeySetting, GikoPanel, Favorite, FavoriteAdd,
20         FavoriteArrange, AddressHistory, Preview, HTMLDocumentEvent, Kotehan,
21         HintWindow, GikoCoolBar, GikoListView, ToolBarSetting, ToolBarUtil,
22         IndividualAbon, Dialogs, Search, ExternalBoardManager, StdActns;
23
24 type
25         TGikoTreeType = (gttNone, gtt2ch, gttHistory);
26
27         TGikoForm = class(TForm)
28                 StatusBar: TStatusBar;
29                 MainPanel: TPanel;
30                 ClientPanel: TPanel;
31                 TreeSplitter: TSplitter;
32                 CabinetPanel: TPanel;
33                 TreeView: TTreeView;
34                 ThreadMainPanel: TPanel;
35                 ListSplitter: TSplitter;
36                 ViewPanel: TPanel;
37                 ListView: TGikoListView;
38                 ThreadPanel: TPanel;
39                 Browser: TWebBrowser;
40                 MessagePanel: TPanel;
41                 MessageBar: TPanel;
42                 MessageHideButton: TSpeedButton;
43                 MessageListView: TListView;
44                 MessageSplitter: TSplitter;
45                 Panel3: TPanel;
46                 SpeedButton1: TSpeedButton;
47                 ToolBar1: TToolBar;
48                 CabinetSelectToolButton: TToolButton;
49                 HistoryToolBar: TToolBar;
50                 ToolButton15: TToolButton;
51                 ToolButton18: TToolButton;
52                 ItemIcon16: TImageList;
53                 ItemIcon32: TImageList;
54                 HotToobarImageList: TImageList;
55                 ToobarImageList: TImageList;
56                 ItemImageList: TImageList;
57                 ActionList: TActionList;
58                 LogDeleteAction: TAction;
59                 KidokuAction: TAction;
60                 StdToolBarVisibleAction: TAction;
61                 SearchAction: TAction;
62                 GikoNaviWebPageAction: TAction;
63                 AboutAction: TAction;
64                 ExitAction: TAction;
65                 MsgBarVisibleAction: TAction;
66                 StatusBarVisibleAction: TAction;
67                 LargeIconAction: TAction;
68                 SmallIconAction: TAction;
69                 ListIconAction: TAction;
70                 DetailIconAction: TAction;
71                 Cabinet2chAction: TAction;
72                 CabinetHistoryAction: TAction;
73                 CabinetVisibleAction: TAction;
74                 MidokuAction: TAction;
75                 AllSelectAction: TAction;
76                 UpFolderAction: TAction;
77                 ListNumberVisibleAction: TAction;
78                 AllItemAction: TAction;
79                 LogItemAction: TAction;
80                 NewItemAction: TAction;
81                 SelectItemAction: TAction;
82                 ShowThreadAction: TAction;
83                 StopAction: TAction;
84                 MainMenu: TMainMenu;
85                 FileMenu: TMenuItem;
86                 DeleteMenu: TMenuItem;
87                 ExitMenu: TMenuItem;
88                 KidokuMenu: TMenuItem;
89                 MidokuMenu: TMenuItem;
90                 AllSelectMenu: TMenuItem;
91                 ViewMenu: TMenuItem;
92                 StdToolBarMenu: TMenuItem;
93                 CabinetMenu: TMenuItem;
94                 N6: TMenuItem;
95                 H1: TMenuItem;
96                 N4: TMenuItem;
97                 CabinetVisibleMenu: TMenuItem;
98                 MessageMenu: TMenuItem;
99                 StatusBarMenu: TMenuItem;
100                 MMSep03: TMenuItem;
101                 LargeIconMenu: TMenuItem;
102                 SmallIconMenu: TMenuItem;
103                 ListMenu: TMenuItem;
104                 DetailMenu: TMenuItem;
105                 ToolMenu: TMenuItem;
106                 Find1: TMenuItem;
107                 RoundMenu: TMenuItem;
108                 MMSep04: TMenuItem;
109                 OptionMenu: TMenuItem;
110                 HelpMenu: TMenuItem;
111                 G1: TMenuItem;
112                 N1: TMenuItem;
113                 AboutMenu: TMenuItem;
114                 IconStyle: TAction;
115                 BrowserPopupMenu: TPopupMenu;
116                 ShowThreadMenu: TMenuItem;
117                 ShowBoardMenu: TMenuItem;
118                 ShowBoardAction: TAction;
119                 ListIconPopupMenu: TPopupMenu;
120                 LargeIconPMenu: TMenuItem;
121                 SmallIconPMenu: TMenuItem;
122                 ListPMenu: TMenuItem;
123                 DetailPMenu: TMenuItem;
124                 CabinetCloseAction: TAction;
125                 ClosePopupMenu: TPopupMenu;
126                 CloseMenu: TMenuItem;
127                 OptionAction: TAction;
128                 U1: TMenuItem;
129                 N3: TMenuItem;
130                 B1: TMenuItem;
131                 S1: TMenuItem;
132                 N2: TMenuItem;
133                 A1: TMenuItem;
134                 L1: TMenuItem;
135                 N5: TMenuItem;
136                 S2: TMenuItem;
137                 RoundAction: TAction;
138                 ListPopupMenu: TPopupMenu;
139                 ListRoundPMenu: TMenuItem;
140                 ListReservPMenu: TMenuItem;
141                 LPMSep01: TMenuItem;
142                 ItemRoundPMenu: TMenuItem;
143                 LPMSep02: TMenuItem;
144                 KidokuPMenu: TMenuItem;
145                 MidokuPMenu: TMenuItem;
146                 AllSelectPMenu: TMenuItem;
147                 UrlCopyPMenu: TMenuItem;
148                 LPMSep05: TMenuItem;
149                 DeletePMenu: TMenuItem;
150                 LPMSep06: TMenuItem;
151                 ViewPMenu: TMenuItem;
152                 LargeIconLPMenu: TMenuItem;
153                 SmallIconLPMenu: TMenuItem;
154                 ListLPMenu: TMenuItem;
155                 DetailLPMenu: TMenuItem;
156                 T1: TMenuItem;
157                 B2: TMenuItem;
158                 N8: TMenuItem;
159                 URLCopyAction: TAction;
160                 URLC1: TMenuItem;
161                 N9: TMenuItem;
162                 N10: TMenuItem;
163                 MsgBarCloseAction: TAction;
164                 ScrollTopAction: TAction;
165                 ScrollLastAction: TAction;
166                 ScrollNewAction: TAction;
167                 ScrollKokoAction: TAction;
168                 EditorAction: TAction;
169                 IEAction: TAction;
170                 ItemReloadAction: TAction;
171                 BrowserMaxAction: TAction;
172                 G2: TMenuItem;
173                 N11: TMenuItem;
174                 T3: TMenuItem;
175                 L2: TMenuItem;
176                 N12: TMenuItem;
177                 K1: TMenuItem;
178                 N13: TMenuItem;
179                 N14: TMenuItem;
180                 R1: TMenuItem;
181                 A2: TMenuItem;
182                 N15: TMenuItem;
183                 SelectListReloadAction: TAction;
184                 SelectThreadReloadAction: TAction;
185                 SelectTimer: TTimer;
186                 KokoPopupMenu: TPopupMenu;
187                 KokomadePMenu: TMenuItem;
188                 AllPMenu: TMenuItem;
189                 MenuItem1: TMenuItem;
190                 MenuItem2: TMenuItem;
191                 BrowserTabCloseAction: TAction;
192                 BrowserTabPopupMenu: TPopupMenu;
193                 Close1: TMenuItem;
194                 KokomadeAction: TAction;
195                 ZenbuAction: TAction;
196                 KokoResAction: TAction;
197                 SelectItemURLCopyAction: TAction;
198                 SelectReservAction: TAction;
199                 NotSelectTabCloseAction: TAction;
200                 A3: TMenuItem;
201                 N16: TMenuItem;
202                 A4: TMenuItem;
203                 TreePopupMenu: TPopupMenu;
204                 TreeSelectThreadPupupMenu: TMenuItem;
205                 TreeSelectBoardPupupMenu: TMenuItem;
206                 TPMSep01: TMenuItem;
207                 TreeSelectURLPupupMenu: TMenuItem;
208                 TreeSelectBoradReload: TAction;
209                 TreeSelectThreadReload: TAction;
210                 TreeSelectURLCopy: TAction;
211                 ListToolBarVisibleAction: TAction;
212                 BrowserToolBarVisibleAction: TAction;
213                 T2: TMenuItem;
214                 L3: TMenuItem;
215                 B3: TMenuItem;
216                 BrowserBottomPanel: TGikoPanel;
217                 CabinetSelectPopupMenu: TPopupMenu;
218                 N17: TMenuItem;
219                 H2: TMenuItem;
220                 ItemReservPMenu: TMenuItem;
221                 RoundNamePopupMenu: TPopupMenu;
222                 SelectNewRoundName: TAction;
223                 SelectDeleteRound: TAction;
224                 NewBoardAction: TAction;
225                 N7: TMenuItem;
226                 B4: TMenuItem;
227                 LoginAction: TAction;
228                 L4: TMenuItem;
229                 KeySettingAction: TAction;
230                 K2: TMenuItem;
231                 AllTabCloseAction: TAction;
232                 A5: TMenuItem;
233                 N18: TMenuItem;
234                 A6: TMenuItem;
235                 C1: TMenuItem;
236                 V1: TMenuItem;
237                 N19: TMenuItem;
238                 D1: TMenuItem;
239                 D2: TMenuItem;
240                 N20: TMenuItem;
241                 MessageImageList: TImageList;
242                 ProgressBar: TProgressBar;
243                 ArrangeAction: TAction;
244                 URL1: TMenuItem;
245                 NameURLCopyAction: TAction;
246                 SelectItemNameURLCopyAction: TAction;
247                 NameUrlCopyPMenu: TMenuItem;
248                 URLC2: TMenuItem;
249                 URLN1: TMenuItem;
250                 N21: TMenuItem;
251                 URLC3: TMenuItem;
252                 URLN2: TMenuItem;
253                 N22: TMenuItem;
254                 N23: TMenuItem;
255                 ListCoolBar: TGikoCoolBar;
256                 ListToolBar: TToolBar;
257                 ViewNoButton: TToolButton;
258                 IconToolButton: TToolButton;
259                 UpFolderButton: TToolButton;
260                 Sepa01ToolButton: TToolButton;
261                 AllItemToolButton: TToolButton;
262                 LogItemToolButton: TToolButton;
263                 NewItemToolButton: TToolButton;
264                 ListDownloadToolButton: TToolButton;
265                 ListThreadDownloadToolButton: TToolButton;
266                 ToolButton2: TToolButton;
267                 ToolButton1: TToolButton;
268                 BrowserCoolBar: TGikoCoolBar;
269                 BrowserToolBar: TToolBar;
270                 BrowserSizeButton: TToolButton;
271                 ToolButton3: TToolButton;
272                 TopButton: TToolButton;
273                 LastBotton: TToolButton;
274                 NewButton: TToolButton;
275                 KokoButton: TToolButton;
276                 ToolButton9: TToolButton;
277                 EditorButton: TToolButton;
278                 ToolButton11: TToolButton;
279                 IEButton: TToolButton;
280                 ToolButton5: TToolButton;
281                 ItemReloadButton: TToolButton;
282                 ListNameToolBar: TToolBar;
283                 ListNameLabel: TLabel;
284                 FolderImage: TImage;
285                 BrowserNameToolBar: TToolBar;
286                 ItemBoardImage: TImage;
287                 BrowserBoardNameLabel: TLabel;
288                 ItemImage: TImage;
289                 BrowserNameLabel: TLabel;
290                 ActiveLogDeleteAction: TAction;
291                 N24: TMenuItem;
292                 D3: TMenuItem;
293                 N25: TMenuItem;
294                 N26: TMenuItem;
295                 ListNameBarVisibleAction: TAction;
296                 D4: TMenuItem;
297                 BrowserNameBarVisibleAction: TAction;
298                 S3: TMenuItem;
299                 R2: TMenuItem;
300                 TreeSelectNameURLCopy: TAction;
301                 TreeSelectNameURLPupupMenu: TMenuItem;
302                 N27: TMenuItem;
303                 H3: TMenuItem;
304                 PaneInitAction: TAction;
305                 I1: TMenuItem;
306                 BrowserTabToolBar: TToolBar;
307                 BrowserTab: TTabControl;
308                 ToolButton7: TToolButton;
309                 BrowserMinAction: TAction;
310                 About1: TMenuItem;
311                 N28: TMenuItem;
312                 SelectTextClearAction: TAction;
313                 MailTextClearAction: TAction;
314                 NameTextClearAction: TAction;
315                 S4: TMenuItem;
316                 N29: TMenuItem;
317                 N30: TMenuItem;
318                 LeftmostTabSelectAction: TAction;
319                 LeftTabSelectAction: TAction;
320                 RightTabSelectAction: TAction;
321                 RightmostTabSelectAction: TAction;
322                 N31: TMenuItem;
323                 L5: TMenuItem;
324                 L6: TMenuItem;
325                 A7: TMenuItem;
326                 R3: TMenuItem;
327                 FavoriteMenu: TMenuItem;
328                 FavoriteAddAction: TAction;
329                 N32: TMenuItem;
330                 BoardFavoriteAddMenu: TMenuItem;
331                 BoardFavoriteAddAction: TAction;
332                 ThreadFavoriteAddAction: TAction;
333                 ThreadFavoriteAddMenu: TMenuItem;
334                 TreeSelectFavoriteAddAction: TAction;
335                 N33: TMenuItem;
336                 TreeSelectFavoriteAddPupupMenu: TMenuItem;
337                 FavoriteArrangeAction: TAction;
338                 FavoriteTreeView: TTreeView;
339                 StateIconImageList: TImageList;
340                 TopPanel: TPanel;
341                 TopRightPanel: TPanel;
342                 AnimePanel: TPanel;
343                 Animate: TAnimate;
344                 TopCoolPanel: TPanel;
345                 MainCoolBar: TGikoCoolBar;
346                 MenuToolBar: TToolBar;
347                 StdToolBar: TToolBar;
348                 RoundToolButton: TToolButton;
349                 ToolButton6: TToolButton;
350                 CabinetToolButton: TToolButton;
351                 ToolButton4: TToolButton;
352                 ToolButton13: TToolButton;
353                 AbortToolButton: TToolButton;
354                 LoginToolButton: TToolButton;
355                 AddressToolBar: TToolBar;
356                 AddressComboBox: TComboBox;
357                 MoveToToolButton: TToolButton;
358                 MoveToAction: TAction;
359                 AddressImageList: TImageList;
360                 AddressBarVisibleAction: TAction;
361                 AddressToolBarMenu: TMenuItem;
362                 T4: TMenuItem;
363                 BrowserTabVisibleAction: TAction;
364                 Show1: TMenuItem;
365                 N34: TMenuItem;
366                 BrowserTabTopAction: TAction;
367                 BrowserTabBottomAction: TAction;
368                 T5: TMenuItem;
369                 B5: TMenuItem;
370                 N35: TMenuItem;
371                 BrowserTabTabStyleAction: TAction;
372                 BrowserTabButtonStyleAction: TAction;
373                 BrowserTabFlatStyleAction: TAction;
374                 A8: TMenuItem;
375                 U2: TMenuItem;
376                 F1: TMenuItem;
377                 PreviewTimer: TTimer;
378                 MonazillaWebPageAction: TAction;
379                 MonazillaWebPageAction1: TMenuItem;
380                 GikoHelpAction: TAction;
381                 N36: TMenuItem;
382                 H4: TMenuItem;
383                 KotehanAction: TAction;
384                 K3: TMenuItem;
385                 LinkBarVisibleAction: TAction;
386                 L7: TMenuItem;
387                 N37: TMenuItem;
388                 A9: TMenuItem;
389                 ChevronPopupMenu: TPopupMenu;
390                 BBS2chWebPageAction: TAction;
391                 N2N1: TMenuItem;
392                 N38: TMenuItem;
393                 GikoFolderOpenAction: TAction;
394                 F2: TMenuItem;
395                 LinkToolBar: TToolBar;
396                 a10: TMenuItem;
397                 ToolButton8: TToolButton;
398                 ToolButton10: TToolButton;
399                 ThreadEditorAction: TAction;
400                 N39: TMenuItem;
401                 T6: TMenuItem;
402                 N40: TMenuItem;
403                 LinkBarPopupMenu: TPopupMenu;
404                 ToolBarSettingAction: TAction;
405                 T7: TMenuItem;
406                 ToolButton12: TToolButton;
407                 ToolButton14: TToolButton;
408                 ThreadPopupMenu: TPopupMenu;
409                 MenuItem4: TMenuItem;
410                 MenuItem5: TMenuItem;
411                 MenuItem6: TMenuItem;
412                 T8: TMenuItem;
413                 NameCopyAction: TAction;
414                 BoardIEAction: TAction;
415                 URLN3: TMenuItem;
416                 SelectItemNameCopyAction: TAction;
417                 SelectItemNameCopyAction1: TMenuItem;
418                 B6: TMenuItem;
419                 T9: TMenuItem;
420                 C2: TMenuItem;
421                 SelectComboBox: TComboBox;
422                 MainCoolBarPopupMenu: TPopupMenu;
423                 StdToolBarVisiblePMenu: TMenuItem;
424                 AddressToolBarVisiblePMenu: TMenuItem;
425                 LinkToolBarVisiblePMenu: TMenuItem;
426                 NG1: TMenuItem;
427                 NG2: TMenuItem;
428                 N43: TMenuItem;
429                 N44: TMenuItem;
430                 L9: TMenuItem;
431                 I3: TMenuItem;
432                 N45: TMenuItem;
433                 B9: TMenuItem;
434                 R5: TMenuItem;
435                 T12: TMenuItem;
436                 Show3: TMenuItem;
437                 N46: TMenuItem;
438                 T13: TMenuItem;
439                 B10: TMenuItem;
440                 N47: TMenuItem;
441                 A12: TMenuItem;
442                 U4: TMenuItem;
443                 F4: TMenuItem;
444                 N48: TMenuItem;
445                 T14: TMenuItem;
446                 SelectItemToolButton: TToolButton;
447                 SelectResToolButton: TToolButton;
448                 SelectResAction: TAction;
449                 ToolButton16: TToolButton;
450                 AllResAction: TAction;
451                 AllResToolButton: TToolButton;
452                 N50: TMenuItem;
453                 A11: TMenuItem;
454                 S5: TMenuItem;
455                 Reload: TMenuItem;
456                 GoBack: TMenuItem;
457                 GoFoward: TMenuItem;
458                 EditAction: TAction;
459                 ReloadAction: TAction;
460                 GoFowardAction: TAction;
461                 GoBackAction: TAction;
462                 SelectComboBoxSplitter: TImage;
463                 IndividualAbon1: TMenuItem;
464                 N41: TMenuItem;
465                 IndividualAbon2: TMenuItem;
466                 N42: TMenuItem;
467                 CancellIndividualAbon: TAction;
468                 AntiIndividualAbon: TMenuItem;
469                 N49: TMenuItem;
470                 N51: TMenuItem;
471                 N52: TMenuItem;
472                 N53: TMenuItem;
473                 SearchBoardName: TMenuItem;
474                 N55: TMenuItem;
475                 TreeSelectSearchBoardName: TAction;
476                 CabinetFavoriteAction: TAction;
477                 N54: TMenuItem;
478                 A13: TMenuItem;
479                 FavoriteTreePopupMenu: TPopupMenu;
480                 FavoriteTreeViewRenameAction: TAction;
481                 FavoriteTreeRenamePopupMenu: TMenuItem;
482                 FavoriteTreeViewNewFolderAction: TAction;
483                 FavoriteTreeNewFolderPopupMenu: TMenuItem;
484                 N56: TMenuItem;
485                 FavoriteTreeViewDeleteAction: TAction;
486                 FavoriteTreeDeletePopupMenu: TMenuItem;
487                 FavoriteToolBar: TToolBar;
488                 ToolButton17: TToolButton;
489                 ToolButton19: TToolButton;
490                 FavoriteTreeViewBrowseFolderAction: TAction;
491                 FavoriteTreeBrowseFolderPopupMenu: TMenuItem;
492                 N57: TMenuItem;
493                 FavoriteTreeReloadPopupMenu: TMenuItem;
494                 N58: TMenuItem;
495                 FavoriteTreeURLCopyPopupMenu: TMenuItem;
496                 FavoriteTreeNameCopyPopupMenu: TMenuItem;
497                 FavoriteTreeLogDeletePopupMenu: TMenuItem;
498                 N59: TMenuItem;
499                 FavoriteTreeNameURLCopyPopupMenu: TMenuItem;
500                 FavoriteTreeViewReloadAction: TAction;
501                 FavoriteTreeViewURLCopyAction: TAction;
502                 FavoriteTreeViewNameCopyAction: TAction;
503                 FavoriteTreeViewNameURLCopyAction: TAction;
504                 FavoriteTreeViewLogDeleteAction: TAction;
505                 OnlyAHundredRes: TAction;
506                 ToolButton20: TToolButton;
507                 AHundredResButton: TToolButton;
508                 N60: TMenuItem;
509                 N61: TMenuItem;
510                 ExportFavoriteFileAction1: TMenuItem;
511                 ExportFavoriteFile: TFileSaveAs;
512                 procedure FormCreate(Sender: TObject);
513                 procedure FormDestroy(Sender: TObject);
514                 procedure CabinetPanelHide(Sender: TObject);
515                 procedure FormClose(Sender: TObject; var Action: TCloseAction);
516                 procedure TreeViewChange(Sender: TObject; Node: TTreeNode);
517                 procedure ListViewData(Sender: TObject; Item: TListItem);
518                 procedure ListViewDataFind(Sender: TObject; Find: TItemFind;
519                         const FindString: String; const FindPosition: TPoint;
520                         FindData: Pointer; StartIndex: Integer; Direction: TSearchDirection;
521                         Wrap: Boolean; var Index: Integer);
522                 procedure ListViewDataHint(Sender: TObject; StartIndex,
523                         EndIndex: Integer);
524                 procedure ListViewDataStateChange(Sender: TObject; StartIndex,
525                         EndIndex: Integer; OldState, NewState: TItemStates);
526                 procedure BrowserStatusTextChange(Sender: TObject;
527                         const Text: WideString);
528                 procedure BrowserTitleChange(Sender: TObject; const Text: WideString);
529                 procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
530                 procedure TreeViewChanging(Sender: TObject; Node: TTreeNode;
531                         var AllowChange: Boolean);
532                 procedure ListViewKeyDown(Sender: TObject; var Key: Word;
533                         Shift: TShiftState);
534                 procedure ListViewColumnClick(Sender: TObject; Column: TListColumn);
535                 procedure MenuToolBarCustomDrawButton(Sender: TToolBar;
536                         Button: TToolButton; State: TCustomDrawState;
537                         var DefaultDraw: Boolean);
538                 procedure BrowserBeforeNavigate2(Sender: TObject;
539                         const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
540                         Headers: OleVariant; var Cancel: WordBool);
541                 procedure ListViewAdvancedCustomDrawItem(Sender: TCustomListView;
542                         Item: TListItem; State: TCustomDrawState; Stage: TCustomDrawStage;
543                         var DefaultDraw: Boolean);
544                 procedure TreeViewCustomDraw(Sender: TCustomTreeView;
545                         const ARect: TRect; var DefaultDraw: Boolean);
546                 procedure TreeViewCustomDrawItem(Sender: TCustomTreeView;
547                         Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean);
548                 procedure TreeViewExpanded(Sender: TObject; Node: TTreeNode);
549                 procedure TreeViewDblClick(Sender: TObject);
550                 procedure FavoriteTreeViewClick(Sender: TObject);
551                 procedure ListViewCustomDraw(Sender: TCustomListView;
552                         const ARect: TRect; var DefaultDraw: Boolean);
553                 procedure ListViewMouseDown(Sender: TObject; Button: TMouseButton;
554                         Shift: TShiftState; X, Y: Integer);
555                 procedure TreeViewCollapsed(Sender: TObject; Node: TTreeNode);
556                 procedure MessageListViewResize(Sender: TObject);
557                 procedure ExitActionExecute(Sender: TObject);
558                 procedure AllSelectActionExecute(Sender: TObject);
559                 procedure StdToolBarVisibleActionExecute(Sender: TObject);
560                 procedure MsgBarVisibleActionExecute(Sender: TObject);
561                 procedure StatusBarVisibleActionExecute(Sender: TObject);
562                 procedure LargeIconActionExecute(Sender: TObject);
563                 procedure SmallIconActionExecute(Sender: TObject);
564                 procedure ListIconActionExecute(Sender: TObject);
565                 procedure DetailIconActionExecute(Sender: TObject);
566                 procedure SearchActionExecute(Sender: TObject);
567                 procedure OptionActionExecute(Sender: TObject);
568                 procedure GikoNaviWebPageActionExecute(Sender: TObject);
569                 procedure AboutActionExecute(Sender: TObject);
570                 procedure Cabinet2chActionExecute(Sender: TObject);
571                 procedure CabinetHistoryActionExecute(Sender: TObject);
572                 procedure CabinetVisibleActionExecute(Sender: TObject);
573                 procedure AllItemActionExecute(Sender: TObject);
574                 procedure LogItemActionExecute(Sender: TObject);
575                 procedure NewItemActionExecute(Sender: TObject);
576                 procedure SelectItemActionExecute(Sender: TObject);
577                 procedure ListNumberVisibleActionExecute(Sender: TObject);
578                 procedure UpFolderActionExecute(Sender: TObject);
579                 procedure IconStyleExecute(Sender: TObject);
580                 procedure RoundActionExecute(Sender: TObject);
581                 procedure StopActionExecute(Sender: TObject);
582                 procedure MsgBarCloseActionExecute(Sender: TObject);
583                 procedure BrowserMaxActionExecute(Sender: TObject);
584                 procedure ScrollTopActionExecute(Sender: TObject);
585                 procedure ScrollLastActionExecute(Sender: TObject);
586                 procedure ScrollNewActionExecute(Sender: TObject);
587                 procedure ScrollKokoActionExecute(Sender: TObject);
588                 procedure EditorActionExecute(Sender: TObject);
589                 procedure IEActionExecute(Sender: TObject);
590                 procedure ShowThreadActionExecute(Sender: TObject);
591                 procedure ShowBoardActionExecute(Sender: TObject);
592                 procedure URLCopyActionExecute(Sender: TObject);
593                 procedure ItemReloadActionExecute(Sender: TObject);
594                 procedure SelectListReloadActionExecute(Sender: TObject);
595                 procedure SelectThreadReloadActionExecute(Sender: TObject);
596                 procedure SelectListReloadActionUpdate(Sender: TObject);
597                 procedure AllItemActionUpdate(Sender: TObject);
598                 procedure LogItemActionUpdate(Sender: TObject);
599                 procedure NewItemActionUpdate(Sender: TObject);
600                 procedure SelectItemActionUpdate(Sender: TObject);
601                 procedure UpFolderActionUpdate(Sender: TObject);
602                 procedure FormResize(Sender: TObject);
603                 procedure ScrollTopActionUpdate(Sender: TObject);
604                 procedure ScrollLastActionUpdate(Sender: TObject);
605                 procedure ScrollNewActionUpdate(Sender: TObject);
606                 procedure ScrollKokoActionUpdate(Sender: TObject);
607                 procedure EditorActionUpdate(Sender: TObject);
608                 procedure IEActionUpdate(Sender: TObject);
609                 procedure ShowThreadActionUpdate(Sender: TObject);
610                 procedure ShowBoardActionUpdate(Sender: TObject);
611                 procedure SelectThreadReloadActionUpdate(Sender: TObject);
612                 procedure ListViewSelectItem(Sender: TObject; Item: TListItem;
613                         Selected: Boolean);
614                 procedure SelectTimerTimer(Sender: TObject);
615                 procedure ItemReloadActionUpdate(Sender: TObject);
616                 procedure ListViewDblClick(Sender: TObject);
617                 procedure LogDeleteActionExecute(Sender: TObject);
618                 procedure KokomadeActionExecute(Sender: TObject);
619                 procedure ZenbuActionExecute(Sender: TObject);
620                 procedure KokoResActionExecute(Sender: TObject);
621                 procedure ListPopupMenuPopup(Sender: TObject);
622                 procedure SelectItemURLCopyActionExecute(Sender: TObject);
623                 procedure SelectItemURLCopyActionUpdate(Sender: TObject);
624                 procedure AllSelectActionUpdate(Sender: TObject);
625                 procedure LogDeleteActionUpdate(Sender: TObject);
626                 procedure BrowserTabCloseActionExecute(Sender: TObject);
627                 procedure NotSelectTabCloseActionExecute(Sender: TObject);
628                 procedure TreeSelectBoradReloadExecute(Sender: TObject);
629                 procedure TreeSelectThreadReloadExecute(Sender: TObject);
630                 procedure TreeSelectURLCopyExecute(Sender: TObject);
631                 procedure TreePopupMenuPopup(Sender: TObject);
632                 procedure ListToolBarVisibleActionExecute(Sender: TObject);
633                 procedure BrowserToolBarVisibleActionExecute(Sender: TObject);
634                 procedure BrowserNewWindow2(Sender: TObject; var ppDisp: IDispatch;
635                         var Cancel: WordBool);
636                 procedure ListSplitterCanResize(Sender: TObject; var NewSize: Integer;
637                         var Accept: Boolean);
638                 procedure ListSplitterMoved(Sender: TObject);
639                 procedure BrowserTabChange(Sender: TObject);
640                 procedure BrowserTabMouseDown(Sender: TObject; Button: TMouseButton;
641                         Shift: TShiftState; X, Y: Integer);
642                 procedure BrowserTabDragOver(Sender, Source: TObject; X, Y: Integer;
643                         State: TDragState; var Accept: Boolean);
644                 procedure BrowserTabDragDrop(Sender, Source: TObject; X, Y: Integer);
645                 procedure BrowserTabMouseMove(Sender: TObject; Shift: TShiftState; X,
646                         Y: Integer);
647                 procedure BrowserDocumentComplete(Sender: TObject;
648                         const pDisp: IDispatch; var URL: OleVariant);
649                 procedure SelectReservActionUpdate(Sender: TObject);
650                 procedure RoundNamePopupMenuPopup(Sender: TObject);
651                 procedure SelectNewRoundNameExecute(Sender: TObject);
652                 procedure SelectDeleteRoundExecute(Sender: TObject);
653                 procedure SelectReservActionExecute(Sender: TObject);
654                 procedure NewBoardActionExecute(Sender: TObject);
655                 procedure LoginActionExecute(Sender: TObject);
656                 procedure KeySettingActionExecute(Sender: TObject);
657                 procedure AllTabCloseActionExecute(Sender: TObject);
658                 procedure ArrangeActionExecute(Sender: TObject);
659                 procedure NameURLCopyActionExecute(Sender: TObject);
660                 procedure SelectItemNameURLCopyActionExecute(Sender: TObject);
661                 procedure URLCopyActionUpdate(Sender: TObject);
662                 procedure NameURLCopyActionUpdate(Sender: TObject);
663                 procedure BrowserTabCloseActionUpdate(Sender: TObject);
664                 procedure NotSelectTabCloseActionUpdate(Sender: TObject);
665                 procedure AllTabCloseActionUpdate(Sender: TObject);
666                 procedure SelectItemNameURLCopyActionUpdate(Sender: TObject);
667                 procedure ActiveLogDeleteActionExecute(Sender: TObject);
668                 procedure ActiveLogDeleteActionUpdate(Sender: TObject);
669                 procedure ListNameBarVisibleActionExecute(Sender: TObject);
670                 procedure BrowserNameBarVisibleActionExecute(Sender: TObject);
671                 procedure TreeSelectNameURLCopyExecute(Sender: TObject);
672                 procedure PaneInitActionExecute(Sender: TObject);
673                 procedure FormShow(Sender: TObject);
674                 procedure BrowserTabToolBarResize(Sender: TObject);
675                 procedure BrowserMinActionExecute(Sender: TObject);
676                 procedure SelectTextClearActionExecute(Sender: TObject);
677                 procedure NameTextClearActionExecute(Sender: TObject);
678                 procedure MailTextClearActionExecute(Sender: TObject);
679                 procedure LeftmostTabSelectActionExecute(Sender: TObject);
680                 procedure LeftTabSelectActionExecute(Sender: TObject);
681                 procedure RightTabSelectActionExecute(Sender: TObject);
682                 procedure RightmostTabSelectActionExecute(Sender: TObject);
683                 procedure LeftmostTabSelectActionUpdate(Sender: TObject);
684                 procedure LeftTabSelectActionUpdate(Sender: TObject);
685                 procedure RightTabSelectActionUpdate(Sender: TObject);
686                 procedure RightmostTabSelectActionUpdate(Sender: TObject);
687                 procedure FavoriteMenuClick(Sender: TObject);
688                 procedure FavoriteAddActionExecute(Sender: TObject);
689                 procedure FavoriteAddActionUpdate(Sender: TObject);
690                 procedure BoardFavoriteAddActionExecute(Sender: TObject);
691                 procedure BoardFavoriteAddActionUpdate(Sender: TObject);
692                 procedure ThreadFavoriteAddActionExecute(Sender: TObject);
693                 procedure ThreadFavoriteAddActionUpdate(Sender: TObject);
694                 procedure TreeSelectFavoriteAddActionExecute(Sender: TObject);
695                 procedure FavoriteArrangeActionExecute(Sender: TObject);
696                 procedure MainCoolBarResize(Sender: TObject);
697                 procedure MoveToActionExecute(Sender: TObject);
698                 procedure AddressToolBarResize(Sender: TObject);
699                 procedure AddressComboBoxKeyDown(Sender: TObject; var Key: Word;
700                         Shift: TShiftState);
701                 procedure AddressBarVisibleActionExecute(Sender: TObject);
702                 procedure BrowserEnter(Sender: TObject);
703                 procedure FormShortCut(var Msg: TWMKey; var Handled: Boolean);
704                 procedure BrowserTabVisibleActionExecute(Sender: TObject);
705                 procedure BrowserTabTopActionExecute(Sender: TObject);
706                 procedure BrowserTabBottomActionExecute(Sender: TObject);
707                 procedure BrowserTabTabStyleActionExecute(Sender: TObject);
708                 procedure BrowserTabButtonStyleActionExecute(Sender: TObject);
709                 procedure BrowserTabFlatStyleActionExecute(Sender: TObject);
710                 procedure PreviewTimerTimer(Sender: TObject);
711                 procedure MessageHideButtonClick(Sender: TObject);
712                 procedure MonazillaWebPageActionExecute(Sender: TObject);
713                 procedure GikoHelpActionExecute(Sender: TObject);
714                 procedure ToolButton18Click(Sender: TObject);
715                 procedure KotehanActionExecute(Sender: TObject);
716                 procedure LinkBarVisibleActionExecute(Sender: TObject);
717                 procedure BBS2chWebPageActionExecute(Sender: TObject);
718                 procedure GikoFolderOpenActionExecute(Sender: TObject);
719                 procedure MainCoolBarBandInfo(Sender: TObject;
720                         var BandInfo: PReBarBandInfoA);
721                 procedure MainCoolBarChevronClick(Sender: TObject;
722                         RebarChevron: PNMRebarChevron);
723                 procedure ListCoolBarBandInfo(Sender: TObject;
724                         var BandInfo: PReBarBandInfoA);
725                 procedure ListCoolBarChevronClick(Sender: TObject;
726                         RebarChevron: PNMRebarChevron);
727                 procedure BrowserCoolBarBandInfo(Sender: TObject;
728                         var BandInfo: PReBarBandInfoA);
729                 procedure BrowserCoolBarChevronClick(Sender: TObject;
730                         RebarChevron: PNMRebarChevron);
731                 procedure ListViewColumnInfo(Sender: TObject; var Column: PLVColumnA);
732                 procedure ThreadEditorActionExecute(Sender: TObject);
733                 procedure ThreadEditorActionUpdate(Sender: TObject);
734                 procedure ToolBarSettingActionExecute(Sender: TObject);
735                 procedure NameCopyActionExecute(Sender: TObject);
736                 procedure BoardIEActionExecute(Sender: TObject);
737                 procedure SelectItemNameCopyActionExecute(Sender: TObject);
738                 procedure SelectItemNameCopyActionUpdate(Sender: TObject);
739                 procedure BoardIEActionUpdate(Sender: TObject);
740                 procedure FormMouseWheel(Sender: TObject; Shift: TShiftState;
741                         WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
742                 procedure NameCopyActionUpdate(Sender: TObject);
743                 procedure SelectComboBoxChange(Sender: TObject);
744                 procedure SelectComboBoxKeyDown(Sender: TObject; var Key: Word;
745                         Shift: TShiftState);
746                 procedure SelectComboBoxExit(Sender: TObject);
747                 procedure NG1Click(Sender: TObject);
748                 procedure SelectResActionExecute(Sender: TObject);
749                 procedure SelectResActionUpdate(Sender: TObject);
750                 procedure FormKeyDown(Sender: TObject; var Key: Word;
751                         Shift: TShiftState);
752                 procedure FormKeyUp(Sender: TObject; var Key: Word;
753                         Shift: TShiftState);
754                 procedure AllResActionExecute(Sender: TObject);
755                 procedure AllResActionUpdate(Sender: TObject);
756                 procedure ReloadClick(Sender: TObject);
757                 procedure GoBackClick(Sender: TObject);
758                 procedure GoFowardClick(Sender: TObject);
759                 procedure SelectComboBoxSplitterMouseMove(Sender: TObject;
760                         Shift: TShiftState; X, Y: Integer);
761                 procedure SelectComboBoxSplitterMouseDown(Sender: TObject;
762                         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
763                 procedure SelectComboBoxSplitterMouseUp(Sender: TObject;
764                         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
765                 procedure StatusBarResize(Sender: TObject);
766                 procedure IndividualAbon1Click(Sender: TObject);
767                 procedure IndividualAbon2Click(Sender: TObject);
768                 procedure N42Click(Sender: TObject);
769                 procedure SelectComboBoxEnter(Sender: TObject);
770                 procedure AntiIndividualAbonClick(Sender: TObject);
771                 procedure N51Click(Sender: TObject);
772                 procedure TreeSelectSearchBoardNameExecute(Sender: TObject);
773                 procedure CabinetFavoriteActionExecute(Sender: TObject);
774                 procedure FavoriteTreeViewDragDrop(Sender, Source: TObject; X,
775                         Y: Integer);
776                 procedure FavoriteTreeViewDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
777                 procedure FavoriteTreeViewEdited(Sender: TObject; Node: TTreeNode;
778                         var S: String);
779                 procedure FavoriteTreeViewKeyDown(Sender: TObject; var Key: Word;
780                         Shift: TShiftState);
781                 procedure FavoriteTreePopupMenuPopup(Sender: TObject);
782                 procedure FavoriteTreeViewDeleteActionExecute(Sender: TObject);
783                 procedure FavoriteTreeViewRenameActionExecute(Sender: TObject);
784                 procedure FavoriteTreeViewNewFolderActionExecute(Sender: TObject);
785                 procedure ToolButton19Click(Sender: TObject);
786                 procedure FavoriteTreeViewBrowseFolderActionExecute(Sender: TObject);
787                 procedure FavoriteTreeViewChange(Sender: TObject; Node: TTreeNode);
788                 procedure FavoriteTreeViewDblClick(Sender: TObject);
789                 procedure FavoriteTreeViewLogDeleteActionExecute(Sender: TObject);
790                 procedure FavoriteTreeViewReloadActionExecute(Sender: TObject);
791                 procedure FavoriteTreeViewURLCopyActionExecute(Sender: TObject);
792                 procedure FavoriteTreeViewNameCopyActionExecute(Sender: TObject);
793                 procedure FavoriteTreeViewNameURLCopyActionExecute(Sender: TObject);
794                 procedure LinkToolBarDragDrop(Sender, Source: TObject; X, Y: Integer);
795                 procedure BrowserTabMouseUp(Sender: TObject; Button: TMouseButton;
796                         Shift: TShiftState; X, Y: Integer);
797                 procedure LinkToolBarDragOver(Sender, Source: TObject; X, Y: Integer;
798                         State: TDragState; var Accept: Boolean);
799                 procedure OnlyAHundredResExecute(Sender: TObject);
800                 procedure FavoriteTreeViewEndDrag(Sender, Target: TObject; X,
801                         Y: Integer);
802                 procedure ListCoolBarContextPopup(Sender: TObject; MousePos: TPoint;
803                         var Handled: Boolean);
804                 procedure MainCoolBarContextPopup(Sender: TObject; MousePos: TPoint;
805                         var Handled: Boolean);
806                 procedure BrowserCoolBarContextPopup(Sender: TObject; MousePos: TPoint;
807                         var Handled: Boolean);
808                 procedure ExportFavoriteFileAccept(Sender: TObject);
809                 procedure ExportFavoriteFileBeforeExecute(Sender: TObject);
810         private
811                 { Private \90é\8c¾ }
812
813                 FSortIndex: Integer;
814                 FSortOrder: Boolean;
815
816                 FEnabledCloseButton: Boolean;
817 //              ThreadCreate: TThreadCreate;
818
819                 FClickNode: TTreeNode;
820                 FHttpState: Boolean;
821                 FHint: TResPopup;
822                 FPreviewBrowser: TPreviewBrowser;
823                 FPreviewURL: string;
824
825                 FBrowserSizeHeight: Integer;
826                 FBrowserSizeWidth: Integer;
827
828 //              FFavorite: TFavorite;
829                 FBrowserComplete: Boolean;
830                 FTabHintIndex: Integer;
831                 FListStyle: TViewStyle;                         //\83\8a\83X\83g\83A\83C\83R\83\93\83X\83^\83C\83\8b
832                 FItemNoVisible: Boolean;                        //\83\8a\83X\83g\94Ô\8d\86\95\\8e¦\83t\83\89\83O
833                 FViewType: TGikoViewType;                       //\83\8a\83X\83g\83A\83C\83e\83\80\95\\8e¦\83^\83C\83v
834                 FActiveList: TObject;
835                 FActiveContent: TThreadItem;    //
836                 FHistoryList: TList;                                    //\83q\83X\83g\83\8a\83\8a\83X\83g
837                 FTreeType: TGikoTreeType;
838                 FWorkCount: Integer;
839                 FNameCookie: string;
840                 FMailCookie: string;
841 //              FLastRoundTime: TDateTime;
842                 BrowserNullTab: TThreadItem;
843 //              DoubleClickOccurred: array [TMouseButton] of Boolean;
844                 FDownloadTitle: string;                         //\83_\83E\83\93\83\8d\81[\83h\92\86\82Ì\83^\83C\83g\83\8b\96¼
845                 FDownloadMax: Integer;                          //\83_\83E\83\93\83\8d\81[\83h\92\86\82Ì\8dÅ\91å\83T\83C\83Y
846                 FEvent: THTMLDocumentEventSink;//\83u\83\89\83E\83U\83h\83L\83\85\83\81\83\93\83g\83C\83x\83\93\83g
847
848                 Fkeynum : Integer; //\83L\81[\83{\81[\83h\83\8c\83X\83|\83b\83v\83A\83b\83v\97p
849
850                 IsDraggingSelectComboBox : Boolean;
851                 DraggingSelectComboBoxPosition : TPoint;
852
853                 FSearchDialog: TSearchDialog;
854
855                 FDropSpaceNode: TTreeNode;
856
857                 FDragTime : Cardinal;   //\83\8a\83\93\83N\82ÌD&D\97p
858                 FDragButton : TToolButton;      //\83\8a\83\93\83N\82ÌD&D\97p\82ÉDrag\82µ\82Ä\82éButton\95Û\91
859                 FDragWFirst : Boolean;  //WebTab\82ÌD&D\97p
860
861         FListViewBackGroundColor : TColor; //ListView\82ÌBackGroundColor
862         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¦
863         FOddColor : TColor;           //\82»\82Ì\90F
864                 procedure SetBoardTreeNode;
865                 function SetCategoryListItem(ABBS2ch: TBBS2ch): Integer;
866                 function SetBoardListItem(Category: TCategory): Integer;
867                 function SetThreadListItem(Board: TBoard): Integer;
868 //              function GetRoundName(index: integer): string;
869
870                 procedure DownloadEnd(Sender: TObject; Item: TDownloadItem);
871                 procedure DownloadMsg(Sender: TObject; Item: TDownloadItem; Msg: string; Icon: TGikoMessageIcon);
872                 procedure WorkBegin(Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer; Number: Integer);
873                 procedure WorkEnd(Sender: TObject; AWorkMode: TWorkMode; Number: Integer);
874                 procedure Work(Sender: TObject; AWorkMode: TWorkMode; const AWorkCount: Integer; Number: Integer);
875
876                 procedure SetActiveList(Obj: TObject);
877                 procedure ListClick;
878                 procedure ListDoubleClick;
879                 procedure BrowserMovement(AName: string);
880                 procedure SelectListItem(List: TList);
881 //              procedure SetProgressValue(Number: Integer; Value: Integer; Max: Integer = -1);
882                 procedure DeleteTab(ThreadItem: TThreadItem);
883                 function Hook(var Message: TMessage): Boolean;
884                 procedure AddRoundNameMenu(MenuItem: TMenuItem);
885                 procedure SetSelectItemRound(RoundFlag: Boolean; RoundName: string);
886                 procedure SetSelectRoundName(Sender: TObject);
887                 function GetCoolBand(CoolBar: TCoolBar; Control: TWinControl): TCoolBand;
888
889                 procedure SetMenuFont;
890 //              procedure CreateFavMenu(Folder: TFavoriteFolder);
891                 procedure CreateFavMenu(Node: TTreeNode; MenuItem: TMenuItem);
892                 procedure FavoriteClick(Sender: TObject; ActiveTab: Boolean); overload;
893                 procedure FavoriteClick(Sender: TObject); overload;
894                 procedure FavoriteDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
895                 procedure SelectTreeNode(Item: TObject; CallEvent: Boolean);
896                 function OnDocumentContextMenu(Sender: TObject): WordBool;
897 //              function GetThreadText(sBoard: string; sThread: string; StNum, ToNum: Integer; Title, First: Boolean): string;
898                 procedure SetResPopupText(sBoard: string; sThread: string; StNum, ToNum: Integer; Title, First: Boolean);
899                 procedure ShowTextPopup;
900                 //procedure ShowTextPopup(HintData: THintData);
901 //              procedure SetStdToolBar;
902 //              function GetAction(ActionName: string): TContainedAction;
903                 procedure SetLinkBar;
904                 function GetWidthAllToolButton(ToolBar: TToolBar): Integer;
905                 procedure MenuBarChevronMenu;
906                 procedure LinkBarChevronMenu;
907                 procedure ToolBarChevronMenu(ToolBar: TToolBar);
908                 procedure ModifySelectList;
909                 procedure FavoriteBrowseFolder( node: TTreeNode );
910                 procedure LinkToolButtonDragDrop(Sender, Source: TObject; X, Y: Integer);
911                 procedure LinkToolButtonOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
912                 procedure LinkToolButtonOnMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
913                 procedure LinkToolButtonOnMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
914                 procedure LinkToolButtonStartDrag(Sender: TObject; var DragObject: TDragObject);
915                 function TreeNodeDataFind(Node: TTreeNode; FindPointer: Pointer): TTreeNode;
916                 procedure FavoriteMoveTo( SenderNode, SourceNode: TTreeNode );
917                 procedure FavoriteAddTo( SenderNode: TTreeNode; Source: TObject );
918                 procedure FavoriteDragDrop( SenderNode: TTreeNode; Source: TObject );
919                                 //
920                                 procedure BrowserTabClick(Sender: TObject);
921         procedure SetListViewBackGroundColor(value: TColor);
922         protected
923                 procedure CreateParams(var Params: TCreateParams); override;
924                 procedure WndProc(var Message: TMessage); override;
925                 procedure WMSetCursor(var Message: TWMSetCursor); message WM_SETCURSOR;
926                 procedure WMSettingChange(var Message: TWMWinIniChange); message WM_SETTINGCHANGE;
927                 procedure WMCopyData(var Message: TWMCopyData); message WM_COPYDATA;
928         public
929                 { Public \90é\8c¾ }
930 //              FDownload: TDownload;
931                 FControlThread: TThreadControl;
932                 procedure MoveToURL(URL: string);
933                 procedure InsertBrowserTab(ThreadItem: TThreadItem; ActiveTab: Boolean = True);
934                 procedure ReloadBBS;
935                 function GetHttpState: Boolean;
936                 procedure SetEnabledCloseButton(Enabled: Boolean);
937                 function GetTreeNode(Data: TObject): TTreeNode;
938                 procedure AppFormDeactivate(Sender: TObject);
939 //              procedure CabinetPanelVisible(PanelVisible: Boolean);
940                 procedure ListViewAllSelect;
941
942                 property ListStyle: TViewStyle read FListStyle write FListStyle;
943                 property ItemNoVisible: Boolean read FItemNoVisible write FItemNoVisible;
944                 property ViewType: TGikoViewType read FViewType write FViewType;
945
946                 property NameCookie: string read FNameCookie write FNameCookie;
947                 property MailCookie: string read FMailCookie write FMailCookie;
948
949                 procedure SetContent(ThreadItem: TThreadItem);
950                 function GetActiveContent: TThreadItem;
951                 function GetActiveList: TObject;
952
953                 property ActiveList: TObject read GetActiveList write SetActiveList;
954 //              property LastRoundTime: TDateTime read FLastRoundTime write FLastRoundTime;
955
956                 procedure SetListViewType(AViewType: TGikoViewType); overload;
957                 procedure SetListViewType(AViewType: TGikoViewType; SelectText: string; KubetsuChk: Boolean); overload;
958                 procedure DownloadContent(ThreadItem: TThreadItem);
959                 procedure DownloadList(Board: TBoard);
960                 procedure PlaySound(SoundEventName: string);
961
962                 function AddHistory(ThreadItem: TThreadItem): Boolean;
963                 procedure DeleteHistory(ThreadItem: TThreadItem);
964                 procedure ClearHistory;
965                 procedure Show2chTree;
966                 procedure ShowHistoryTree;
967                 procedure SetHistoryTreeNode;
968 //              procedure SelectTreeNode(Item: TObject);
969                 procedure AddMessageList(ACaption: string; AObject: TObject; Icon: TGikoMessageIcon);
970                 procedure SetBrowserTabState;
971 //              property Favorite: TFavorite read FFavorite write FFavorite;
972                 procedure SetToolBarPopup;
973                 procedure ShowFavoriteAddDialog( Item : TObject );
974         property ListViewBackGroundColor: TColor read FListViewBackGroundColor write SetListViewBackGroundColor;
975         property UseOddResOddColor : Boolean read FUseOddResOddColor write FUseOddResOddColor;
976         property OddColor : TColor read FOddColor write FOddColor;
977
978         published
979                 property EnabledCloseButton: Boolean read FEnabledCloseButton write SetEnabledCloseButton;
980         end;
981
982         TFavoriteMenuItem = class(TMenuItem)
983         private
984                 FData : Pointer;
985         public
986                 property Data: Pointer read FData write FData;
987         end;
988
989         TLinkToolButton = class(TToolButton)
990         private
991                 FData : Pointer;
992         public
993                 property Data: Pointer read FData write FData;
994         end;
995
996 var
997         GikoForm: TGikoForm;
998
999 implementation
1000
1001 uses
1002         About, Option, Round, Splash, Sort, ListSelect,
1003         NewBoard;
1004
1005 const
1006         CAPTION_NAME: string = '\83M\83R\83i\83r';
1007         BLANK_HTML: string = 'about:blank';
1008         SELECTCOMBOBOX_NAME: string = ''; // '\83X\83\8c\83b\83h\8di\8d\9e\8c\9f\8dõ';
1009         SELECTCOMBOBOX_COLOR: TColor = clWindow;
1010                 //D&D臒l
1011                 DandD_THRESHOLD = 5;    //D&D\82Ìè\87\92l\81ipixcel)
1012         //\83c\83\8a\81[\81E\83\8a\83X\83g\83A\83C\83R\83\93
1013         ITEM_ICON_2CH1                                  = 0;            //2ch\83A\83C\83R\83\93
1014         ITEM_ICON_2CH2                                  = 1;            //2ch\83A\83C\83R\83\93
1015         ITEM_ICON_CATEGORY1                     = 2;            //\83J\83e\83S\83\8a\83A\83C\83R\83\93
1016         ITEM_ICON_CATEGORY2                     = 3;            //\83J\83e\83S\83\8a\83A\83C\83R\83\93
1017         ITEM_ICON_BOARD1                                = 4;            //\94Â\83A\83C\83R\83\93
1018         ITEM_ICON_BOARD2                                = 5;            //\94Â\83A\83C\83R\83\93
1019         ITEM_ICON_THREADLOG1            = 6;            //\83X\83\8c\83A\83C\83R\83\93\81i\83\8d\83O\82 \82è\81j
1020         ITEM_ICON_THREADLOG2            = 7;            //\83X\83\8c\83A\83C\83R\83\93\81i\83\8d\83O\82 \82è\81j
1021         ITEM_ICON_THREAD1                               = 8;            //\83X\83\8c\83A\83C\83R\83\93\81i\83\8d\83O\82È\82µ\81j
1022         ITEM_ICON_THREAD2                               = 9;            //\83X\83\8c\83A\83C\83R\83\93\81i\83\8d\83O\82È\82µ\81j
1023         ITEM_ICON_THREADNEW1            = 10;           //\83X\83\8c\83A\83C\83R\83\93\81i\90V\92\85\81j
1024         ITEM_ICON_THREADNEW2            = 11;           //\83X\83\8c\83A\83C\83R\83\93\81i\90V\92\85\81j
1025         ITEM_ICON_SORT1                                 = 12;           //\83\\81[\83g\83A\83C\83R\83\93
1026         ITEM_ICON_SORT2                                 = 13;           //\83\\81[\83g\83A\83C\83R\83\93
1027
1028         //\83c\81[\83\8b\83o\81[\83A\83C\83R\83\93
1029         TOOL_ICON_HEIGHT_MAX            = 16;           //\8d\82\82³\8dÅ\91å\83A\83C\83R\83\93
1030         TOOL_ICON_HEIGHT_MIN            = 17;           //\8d\82\82³\8dÅ\8f¬\83A\83C\83R\83\93
1031         TOOL_ICON_HEIGHT_NORMAL = 18;           //\8d\82\82³\95W\8f\80\83A\83C\83R\83\93
1032         TOOL_ICON_WIDTH_MAX             = 19;           //\95\9d\8dÅ\91å\83A\83C\83R\83\93
1033         TOOL_ICON_WIDTH_MIN             = 20;           //\95\9d\8dÅ\8f¬\83A\83C\83R\83\93
1034         TOOL_ICON_WIDTH_NORMAL  = 21;           //\95\9d\95W\8f\80\83A\83C\83R\83\93
1035
1036         TOOL_ICON_FAV_FOLDER            = 30;           //\82¨\8bC\82É\93ü\82è\83t\83H\83\8b\83_\83A\83C\83R\83\93
1037         TOOL_ICON_FAV_BOARD                     = 31;           //\82¨\8bC\82É\93ü\82è\94Â\83A\83C\83R\83\93
1038         TOOL_ICON_FAV_THREAD            = 32;           //\82¨\8bC\82É\93ü\82è\83X\83\8c\83A\83C\83R\83\93
1039
1040         HTML_FILE_NAME  = 'temp_preview.html';
1041
1042 {$R *.DFM}
1043
1044 procedure TGikoForm.CreateParams(var Params: TCreateParams);
1045 begin
1046         inherited;
1047         if FormStyle in [fsNormal, fsStayOnTop] then begin
1048                 if BorderStyle in [bsSingle, bsSizeable] then begin
1049                         Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
1050                         Params.WndParent := 0;
1051                 end;
1052         end;
1053 end;
1054
1055 procedure TGikoForm.FormCreate(Sender: TObject);
1056 const
1057         TVS_NOTOOLTIPS = $0080;
1058 var
1059         FileName: string;
1060         Style: DWORD;
1061         msg: string;
1062         i: Integer;
1063         wp: TWindowPlacement;
1064         s: string;
1065 begin
1066 {$IFDEF DEBUG}
1067         AllocConsole;
1068         Writeln('============================================================');
1069         Writeln(' \83M\83R\83i\83r\83f\83o\83b\83\83R\83\93\83\\81[\83\8b');
1070         Writeln('');
1071         Writeln(' \82±\82Ì\89æ\96Ê\82ð\95Â\82\82È\82¢\82Å\82­\82¾\82³\82¢\81B');
1072         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¢');
1073         Writeln('============================================================');
1074 {$ENDIF}
1075         Application.OnDeactivate := AppFormDeactivate;
1076         Self.OnDeactivate := AppFormDeactivate;
1077         Application.HookMainWindow(Hook);
1078
1079         FTreeType := gttNone;
1080
1081         FSearchDialog := nil;
1082
1083         //\8eè\82Ì\83J\81[\83\\83\8b
1084         Screen.Cursors[5] := LoadCursor(HInstance, 'GIKOHAND');
1085
1086         //\8f\84\89ñ\83f\81[\83^\93Ç\82Ý\8d\9e\82Ý
1087         RoundList := TRoundList.Create;
1088         RoundList.LoadRoundFile;
1089
1090         //BBS\8dì\90¬
1091         BBS2ch := TBBS2ch.Create(GikoSys.Setting.LogFolder);
1092
1093         //\82¨\8bC\82É\93ü\82è\93Ç\82Ý\8d\9e\82Ý
1094 //      FFavorite := TFavorite.Create(FavoriteTreeView);
1095         FavoriteDM.SetFavTreeView(FavoriteTreeView);
1096         FavoriteDM.ReadFavorite;
1097
1098         //\83A\83h\83\8c\83X\97\9a\97ð\93Ç\82Ý\8d\9e\82Ý
1099         AddressHistoryDM.ReadHistory(AddressComboBox.Items, GikoSys.Setting.AddressHistoryCount);
1100
1101         // \8aO\95\94\94Â\83v\83\89\83O\83C\83\93\82ð\83\8d\81[\83h(ReadBoardFile \82æ\82è\90æ\82É\8ds\82¤\82±\82Æ)
1102         InitializeBoardPlugIns;
1103
1104         EnabledCloseButton := True;
1105         BoardGroup.BBS2ch.ReadBoardFile;                //\83{\81[\83h\83t\83@\83C\83\8b\93Ç\8d\9e
1106 //      SetBoardTreeNode;                                                                               //\83c\83\8a\81[\82É\83{\81[\83h\92Ç\89Á
1107
1108         //\83\8a\83X\83g\83X\83^\83C\83\8b
1109         ListView.ViewStyle := GikoSys.Setting.ListStyle;
1110
1111         //\83\81\83C\83\93\83N\81[\83\8b\83o\81[\88Ê\92u
1112 //      MainCoolBar.Top := 0;
1113 //      MainCoolBar.Left := 0;
1114
1115         //\83A\83j\83\81\83p\83l\83\8b\88Ê\92u
1116         AnimePanel.Top := 0;
1117         AnimePanel.Left := 0;
1118
1119         //\8ae\8eí\89Â\8e\8b\8fó\91Ô\82È\82Ç\90Ý\92è
1120
1121         //\83L\83\83\83r\83l\83b\83g
1122         CabinetVisibleAction.Checked := not GikoSys.Setting.CabinetVisible;
1123         CabinetVisibleAction.Execute;
1124         CabinetPanel.Width := GikoSys.Setting.CabinetWidth;
1125
1126         //\83\81\83b\83Z\81[\83W\83o\81[
1127         MsgBarVisibleAction.Checked := GikoSys.Setting.MessageBarVisible;
1128         MsgBarVisibleActionExecute(nil);
1129         MessagePanel.Height := GikoSys.Setting.MessegeBarHeight;
1130
1131         //\83X\83e\81[\83^\83X\83o\81[
1132         StatusBarVisibleAction.Checked := GikoSys.Setting.StatusBarVisible;
1133         StatusBarVisibleActionExecute(nil);
1134
1135         //\83t\83H\83\93\83g\81E\90F\90Ý\92è
1136         TreeView.Items.BeginUpdate;
1137         FavoriteTreeView.Items.BeginUpdate;
1138         ListView.Items.BeginUpdate;
1139         try
1140                 TreeView.Font.Name := GikoSys.Setting.CabinetFontName;
1141                 TreeView.Font.Size := GikoSys.Setting.CabinetFontSize;
1142                 TreeView.Font.Color := GikoSys.Setting.CabinetFontColor;
1143                 TreeView.Color := GikoSys.Setting.CabinetBackColor;
1144
1145                 FavoriteTreeView.Font.Name := GikoSys.Setting.CabinetFontName;
1146                 FavoriteTreeView.Font.Size := GikoSys.Setting.CabinetFontSize;
1147                 FavoriteTreeView.Font.Color := GikoSys.Setting.CabinetFontColor;
1148                 FavoriteTreeView.Color := GikoSys.Setting.CabinetBackColor;
1149
1150                 ListView.Font.Name := GikoSys.Setting.ListFontName;
1151                 ListView.Font.Size := GikoSys.Setting.ListFontSize;
1152                 ListView.Font.Color := GikoSys.Setting.ListFontColor;
1153                 //ListView.Color := GikoSys.Setting.ListBackColor;
1154         ListViewBackGroundColor := GikoSys.Setting.ListBackColor;
1155         FUseOddResOddColor := GikoSys.Setting.UseOddColorOddResNum;
1156         FOddColor := GikoSys.Setting.OddColor;
1157
1158         finally
1159                 TreeView.Items.EndUpdate;
1160                 FavoriteTreeView.Items.EndUpdate;
1161                 ListView.Items.EndUpdate;
1162         end;
1163         //ViewNoButton.Down := GikoSys.Setting.ListViewNo;
1164         ListNumberVisibleAction.Checked := GikoSys.Setting.ListViewNo;
1165
1166         //\83u\83\89\83E\83U\83^\83u\83t\83H\83\93\83g
1167         BrowserTab.Font.Name := GikoSys.Setting.BrowserTabFontName;
1168         BrowserTab.Font.Size := GikoSys.Setting.BrowserTabFontSize;
1169                 FDragWFirst := false;
1170
1171 //      TreeView.TopItem.Expanded := True;                              //\83c\83\8a\81[\83g\83b\83v\8d\80\96Ú\82¾\82¯\82ð\8aJ\82­
1172 //      TreeView.Selected := TreeView.Items[0];         //\83c\83\8a\81[\82Ì\83g\83b\83v\8d\80\96Ú\82ð\91I\91ð\82·\82é
1173         SetContent(nil);                                                                                                        //\83u\83\89\83E\83U\82ð\8bó\94\92\95\\8e¦
1174
1175         //\8dÅ\91å\89»\81E\83E\83B\83\93\83h\83E\88Ê\92u\95\9c\8c³
1176         wp.length := sizeof(wp);
1177         wp.rcNormalPosition.Top := GikoSys.Setting.WindowTop;
1178         wp.rcNormalPosition.Left := GikoSys.Setting.WindowLeft;
1179         wp.rcNormalPosition.Bottom := GikoSys.Setting.WindowTop + GikoSys.Setting.WindowHeight;
1180         wp.rcNormalPosition.Right := GikoSys.Setting.WindowLeft + GikoSys.Setting.WindowWidth;
1181         wp.showCmd := SW_HIDE;
1182         SetWindowPlacement(Handle, @wp);
1183
1184 //      SetBounds(GikoSys.Setting.WindowLeft, GikoSys.Setting.WindowTop,
1185 //                                              GikoSys.Setting.WindowWidth, GikoSys.Setting.WindowHeight);
1186         if GikoSys.Setting.WindowMax then
1187                 WindowState := wsMaximized;
1188
1189         //\83M\83R\83A\83j\83\81
1190         try
1191                 FileName := GikoSys.GetAppDir + 'gikoNavi.avi';
1192                 if FileExists(FileName) then
1193                         Animate.FileName := FileName;
1194         except
1195         end;
1196 //      AnimePanel.Height := 26;
1197 //      AnimePanel.Width := 39;
1198 //      AnimePanel.Top := 2;
1199 //      AnimePanel.Left := Width - 48;
1200
1201         //\83N\83b\83L\81[
1202         FNameCookie := '';
1203         FMailCookie := '';
1204
1205         //\83X\83\8c\91S\95\94\95\\8e¦\83{\83^\83\93\82ð\89\9f\82³\82ê\82½\8fó\91Ô\82É\82·\82é
1206         AllItemAction.Checked := True;
1207                                 AllResAction.Checked := True;
1208
1209         //TreeView\82Ì\8e×\96\82\8fL\82¢ToolTip\82ð\94ñ\95\\8e¦
1210         Style := GetWindowLong(TreeView.Handle, GWL_STYLE);
1211         Style := Style or TVS_NOTOOLTIPS;
1212         SetWindowLong(TreeView.Handle, GWL_STYLE, Style);
1213
1214         // \83c\83\8a\81[\82ð\83\81\83C\83\93\82¾\82¯\95\\8e¦\82É\82µ\82Ä\8dÅ\91å\89»
1215         TreeView.Align := alClient;
1216         FavoriteTreeView.Align := alClient;
1217         FavoriteTreeView.Visible := False;
1218
1219         //\83u\83\89\83E\83U\83T\83C\83Y\95Ï\8dX\82Ì\8f\89\8aú\89»
1220 //      FBrowserSizeFlag := False;
1221 //      FBrowserSizeHeight := ViewPanel.Height;
1222
1223         FBrowserSizeHeight := GikoSys.Setting.ListHeight;
1224         FBrowserSizeWidth := GikoSys.Setting.ListWidth;
1225
1226         ArrangeAction.Checked := not (GikoSys.Setting.ListOrientation = gloVertical);
1227         ArrangeAction.Execute;
1228
1229         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
1230                 case GikoSys.Setting.ListWidthState of
1231                         glsMax: begin
1232                                 ViewPanel.Width := 1;
1233                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
1234                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
1235                         end;
1236                         glsMin: begin
1237                                 ViewPanel.Width := GikoSys.Setting.ListWidth;
1238                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
1239                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
1240                         end;
1241                         else begin
1242                                 ViewPanel.Width := GikoSys.Setting.ListWidth;
1243                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
1244                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
1245                         end;
1246                 end;
1247 //              if GikoSys.Setting.ListWidthMax then begin
1248 //                      ViewPanel.Width := 1;
1249 //                      BrowserSizeAction.ImageIndex := ICON_WIDTH_MIN;
1250 //              end else begin
1251 //                      ViewPanel.Width := GikoSys.Setting.ListWidth;
1252 //                      BrowserSizeAction.ImageIndex := ICON_WIDTH_MAX;
1253 //              end;
1254         end else begin
1255                 case GikoSys.Setting.ListHeightState of
1256                         glsMax: begin
1257                                 ViewPanel.Height := 1;
1258                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
1259                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
1260                         end;
1261                         glsMin: begin
1262                                 ViewPanel.Height := GikoSys.Setting.ListHeight;
1263                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
1264                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
1265                         end;
1266                         else begin
1267                                 ViewPanel.Height := GikoSys.Setting.ListHeight;
1268                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
1269                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
1270                         end;
1271                 end;
1272 //              if GikoSys.Setting.ListHeightState = glsMax then begin
1273 //              end else begin
1274 //                      ViewPanel.Height := GikoSys.Setting.ListHeight;
1275 //                      BrowserSizeAction.ImageIndex := ICON_HEIGHT_MAX;
1276 //              end;
1277         end;
1278
1279         //\83v\83\8d\83O\83\8c\83X\83o\81[\82Ì\8f\89\8aú\89»
1280 //      ProgressBar.Visible := False;
1281         ProgressBar.Parent := StatusBar;
1282         ProgressBar.Top := 2;
1283         ProgressBar.Left := 0;
1284         ProgressBar.Width := StatusBar.Panels[0].Width;
1285         ProgressBar.Height := StatusBar.Height - 2;
1286         ProgressBar.Position := 0;
1287
1288         //\83c\81[\83\8b\83o\81[\95\\8e¦
1289         //formshow()\82É\88Ú\93®
1290
1291         //\83_\83E\83\93\83\8d\81[\83h\83I\83u\83W\83F\83N\83g
1292 //      FDownload := TDownload.Create;
1293 //      FDownload.OnDownloadEnd := OnDonloadEnd;
1294 //      FDownload.OnWork := Work;
1295 //      FDownload.OnWorkBegin := WorkBegin;
1296 //      FDownload.OnWorkEnd := WorkEnd;
1297
1298         //\83_\83E\83\93\83\8d\81[\83h\83I\83u\83W\83F\83N\83g
1299         FControlThread := TThreadControl.Create(True);
1300         FControlThread.MaxThreadCount := 1;
1301         FControlThread.Resume;
1302         FControlThread.OnDownloadEnd := DownloadEnd;
1303         FControlThread.OnDownloadMsg := DownloadMsg;
1304         FControlThread.OnWork := Work;
1305         FControlThread.OnWorkBegin := WorkBegin;
1306         FControlThread.OnWorkEnd := WorkEnd;
1307 //      ProgressPanel.Width := FControlThread.MaxThreadCount * 12;
1308
1309         //\83q\83X\83g\83\8a\83\8a\83X\83g
1310         FHistoryList := TList.Create;
1311
1312         // \8di\8d\9e\8c\9f\8dõ\97\9a\97ð
1313         SelectComboBox.Items.Assign( GikoSys.Setting.SelectTextList );
1314
1315         //\83u\83\89\83E\83U\83^\83u\90Ý\92è
1316         SetBrowserTabState;
1317
1318         BrowserBoardNameLabel.Caption := '';
1319         BrowserNameLabel.Caption := '';
1320         FWorkCount := 0;
1321
1322 //      DetailIconAction.Execute;
1323
1324 //      FBrowserSizeHeight := ViewPanel.Height;
1325         FTabHintIndex := -1;
1326
1327         //\83\8d\83O\83t\83H\83\8b\83_\82ª\91\8dÝ\82µ\82È\82¢\8fê\8d\87\82Í\8dì\90¬\82·\82é
1328 //      if not GikoSys.DirectoryExistsEx(BBS2ch.GetLogFolder) then begin
1329 //              GikoSys.ForceDirectoriesEx(BBS2ch.GetLogFolder);
1330 //      end;
1331 //      FormResize(Sender);
1332 //      MainCoolBarResize(Sender);
1333 //      Application.ProcessMessages;
1334
1335         //\83\8a\83\93\83N\83o\81[
1336         SetLinkBar;
1337
1338         //\83\81\83j\83\85\81[\83t\83H\83\93\83g
1339         SetMenuFont;
1340
1341         //\83c\81[\83\8b\83o\81[Wrapable
1342         ListToolBar.Wrapable := GikoSys.Setting.ListToolBarWrapable;
1343         BrowserToolBar.Wrapable := GikoSys.Setting.BrowserToolBarWrapable;
1344
1345         //\83c\81[\83\8b\83{\83^\83\93\93Ç\82Ý\8d\9e\82Ý
1346         ReadToolBarSetting(ActionList, StdToolBar);
1347         ReadToolBarSetting(ActionList, ListToolBar);
1348         try
1349                 for i := ListToolBar.ControlCount - 1 downto 0 do
1350                 begin
1351                         if ListToolBar.Controls[ i ].Action = SelectItemAction then
1352                         begin
1353                                 // \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·
1354                                 if (i + 1) < ListToolBar.ControlCount then
1355                                         if ListToolBar.Controls[ i + 1 ] is TToolButton then
1356                                                 if TToolButton( ListToolBar.Controls[ i + 1 ] ).Style = tbsSeparator then
1357                                                         ListToolBar.Controls[ i + 1 ].Visible := False;
1358
1359                                 // \83X\83\8c\83b\83h\8di\8d\9e\83{\83^\83\93\82ð\89B\82·
1360                                 ListToolBar.Controls[ i ].Visible := False;
1361                                 // \83X\83\8c\83b\83h\8di\8d\9e\83t\83B\81[\83\8b\83h\82ð\91}\93ü
1362                                 SelectComboBox.Left := ListToolBar.Controls[ i ].Left;
1363                                 SelectComboBox.Width := GikoSys.Setting.SelectComboBoxWidth;
1364                                 SelectComboBox.Parent := ListToolBar;
1365                                 // \83X\83\8c\83b\83h\8di\8d\9e\97p\93Æ\8e©\83Z\83p\83\8c\81[\83^\82ð\91}\93ü
1366                                 SelectComboBoxSplitter.Left := SelectComboBox.Left + SelectComboBox.Width;
1367                                 SelectComboBoxSplitter.Parent := ListToolBar;
1368
1369                                 break;
1370                         end;
1371                 end;
1372         except
1373         end;
1374         ReadToolBarSetting(ActionList, BrowserToolBar);
1375         SetToolBarPopup;
1376                 OnlyAHundredRes.Checked := GikoSys.Setting.OnlyAHundredRes;
1377         //\83A\83h\83\8c\83X\83o\81[
1378         AddressComboBox.TabStop := GikoSys.Setting.AddressBarTabStop;
1379
1380         //\83N\81[\83\8b\83o\81[\95\9c\8c³\82ÍFormShow\82É\88Ú\93®\82µ\82½
1381
1382         //\83{\81[\83h\83t\83@\83C\83\8b\82ª\96³\82¢\8fê\8d\87\82Í\83\81\83b\83Z\81[\83W\95\\8e¦
1383         if not FileExists(GikoSys.GetBoardFileName) then begin
1384                 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
1385                                  + '\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
1386                                  + '\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';
1387                 MsgBox(SplashWindow.Handle, msg, '\83M\83R\83i\83r', MB_OK or MB_ICONINFORMATION);
1388                 NewBoardAction.Execute;
1389         end;
1390
1391         //\83L\81[\90Ý\92è\93Ç\82Ý\8d\9e\82Ý
1392         GikoSys.LoadKeySetting(ActionList);
1393
1394         //\8dÅ\8fI\8f\84\89ñ\8e\9e\8aÔ
1395 //      FLastRoundTime := 0;
1396
1397         //ResHint
1398         FHint := TResPopup.Create(Self);
1399
1400         // \82Q\82¿\82á\82ñ\82Ë\82é\83L\83\83\83r\83l\83b\83g\82Ì\8fó\91Ô\95\9c\8c³(\96¢\8eÀ\91\95)
1401         // \82¨\82æ\82Ñ\83X\83\8c\88ê\97\97\83y\83C\83\93\82Ì\8fó\91Ô\95\9c\8c³(\96¢\8eÀ\91\95\81A\8c»\8dÝ\82Í\8f\89\8aú\95\\8e¦\97p)
1402         i := GikoSys.Setting.CabinetIndex;
1403         Cabinet2chAction.Execute;
1404         GikoSys.Setting.CabinetIndex := i;
1405
1406         // \8dÅ\8cã\82É\91I\91ð\82³\82ê\82½\83L\83\83\83r\83l\83b\83g\82Ì\95\9c\8c³
1407         Case GikoSys.Setting.CabinetIndex of
1408         0: Cabinet2chAction.Execute;
1409         1: CabinetHistoryAction.Execute;
1410         2: CabinetFavoriteAction.Execute;
1411         end;
1412
1413         //\83I\81[\83g\83\8d\83O\83C\83\93
1414         if GikoSys.Setting.AutoLogin then
1415                 LoginAction.Execute;
1416
1417         //\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
1418         for i := 1 to ParamCount do     begin
1419                 MoveToURL(ParamStr(i));
1420         end;
1421 //      SetStdToolBar;
1422 //      SetLinkBar;
1423
1424         s := GikoSys.FAbon.NGwordname;
1425         StatusBar.Panels[2].Text := s;
1426         StatusBar.Panels[2].Width := Max(StatusBar.Canvas.TextWidth(s), 100);
1427         StatusBarResize(Sender);
1428 end;
1429
1430 //
1431 //
1432 //
1433 procedure TGikoForm.FormShow(Sender: TObject);
1434 var
1435         i: Integer;
1436         CoolSet: TCoolSet;
1437 begin
1438         ShowWindow(Application.Handle, SW_HIDE);
1439
1440         //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½
1441         //\83c\81[\83\8b\83o\81[\95\\8e¦
1442         StdToolBarVisibleAction.Checked := GikoSys.Setting.StdToolBarVisible;
1443         StdToolBarVisibleActionExecute( nil );
1444         AddressBarVisibleAction.Checked := GikoSys.Setting.AddressBarVisible;
1445         AddressBarVisibleActionExecute( nil );
1446         LinkBarVisibleAction.Checked := GikoSys.Setting.LinkBarVisible;
1447         LinkBarVisibleActionExecute( nil );
1448         ListToolBarVisibleAction.Checked := GikoSys.Setting.ListToolBarVisible;
1449         ListToolBarVisibleActionExecute( nil );
1450         ListNameBarVisibleAction.Checked := GikoSys.Setting.ListNameBarVisible;
1451         ListNameBarVisibleActionExecute( nil );
1452         BrowserToolBarVisibleAction.Checked := GikoSys.Setting.BrowserToolBarVisible;
1453         BrowserToolBarVisibleActionExecute( nil );
1454         BrowserNameBarVisibleAction.Checked := GikoSys.Setting.BrowserNameBarVisible;
1455         BrowserNameBarVisibleActionExecute( nil );
1456
1457         //\83u\83\89\83E\83U\83^\83u
1458         BrowserTabVisibleAction.Checked := GikoSys.Setting.BrowserTabVisible;
1459         BrowserTabVisibleActionExecute(nil);
1460
1461         if GikoSys.Setting.BrowserTabPosition = gtpTop then begin
1462                 BrowserTabTopAction.Checked := True;
1463                 BrowserTabTopActionExecute(nil);
1464         end else begin
1465                 BrowserTabBottomAction.Checked := True;
1466                 BrowserTabBottomActionExecute(nil);
1467         end;
1468
1469         if GikoSys.Setting.BrowserTabStyle = gtsTab then begin
1470                 BrowserTabTabStyleAction.Checked := True;
1471                 BrowserTabTabStyleActionExecute(nil);
1472         end else if GikoSys.Setting.BrowserTabStyle = gtsButton then begin
1473                 BrowserTabButtonStyleAction.Checked := True;
1474                 BrowserTabButtonStyleActionExecute(nil);
1475         end else begin
1476                 BrowserTabFlatStyleAction.Checked := True;
1477                 BrowserTabFlatStyleActionExecute(nil);
1478         end;
1479
1480
1481         //\83N\81[\83\8b\83o\81[\95\9c\8c³(Main)
1482         MainCoolBar.Bands.BeginUpdate;
1483         try
1484                 for i := 0 to MainCoolBar.Bands.Count - 1 do begin
1485                         CoolSet := GikoSys.Setting.MainCoolSet[i];
1486                         if (CoolSet.FCoolID = -1) or (CoolSet.FCoolWidth = -1) then
1487                                 Continue;
1488                         MainCoolBar.Bands.FindItemID(CoolSet.FCoolID).Index := i;
1489                         MainCoolBar.Bands[i].Break := CoolSet.FCoolBreak;
1490                         MainCoolBar.Bands[i].Width := CoolSet.FCoolWidth;
1491                 end;
1492         finally
1493                 MainCoolBar.Bands.EndUpdate;
1494         end;
1495
1496         //\83N\81[\83\8b\83o\81[\95\9c\8c³(Board)
1497         ListCoolBar.Bands.BeginUpdate;
1498         try
1499                 for i := 0 to ListCoolBar.Bands.Count - 1 do begin
1500                         CoolSet := GikoSys.Setting.ListCoolSet[i];
1501                         if (CoolSet.FCoolID = -1) or (CoolSet.FCoolWidth = -1) then
1502                                 Continue;
1503                         ListCoolBar.Bands.FindItemID(CoolSet.FCoolID).Index := i;
1504                         ListCoolBar.Bands[i].Break := CoolSet.FCoolBreak;
1505                         ListCoolBar.Bands[i].Width := CoolSet.FCoolWidth;
1506                 end;
1507         finally
1508                 ListCoolBar.Bands.EndUpdate;
1509         end;
1510
1511         //\83N\81[\83\8b\83o\81[\95\9c\8c³(Browser)
1512         BrowserCoolBar.Bands.BeginUpdate;
1513         try
1514                 for i := 0 to BrowserCoolBar.Bands.Count - 1 do begin
1515                         CoolSet := GikoSys.Setting.BrowserCoolSet[i];
1516                         if (CoolSet.FCoolID = -1) or (CoolSet.FCoolWidth = -1) then
1517                                 Continue;
1518                         BrowserCoolBar.Bands.FindItemID(CoolSet.FCoolID).Index := i;
1519                         BrowserCoolBar.Bands[i].Break := CoolSet.FCoolBreak;
1520                         BrowserCoolBar.Bands[i].Width := CoolSet.FCoolWidth;
1521                 end;
1522         finally
1523                 BrowserCoolBar.Bands.EndUpdate;
1524         end;
1525
1526 end;
1527 {
1528 procedure TGikoForm.SetStdToolBar;
1529 var
1530         i: Integer;
1531         FileName: string;
1532         ini: TMemIniFile;
1533         s: string;
1534         Action: TContainedAction;
1535         ToolButton: TToolButton;
1536 begin
1537         exit;
1538         for i := StdToolBar.ButtonCount - 1 downto 0 do begin
1539                 StdToolBar.RemoveControl(StdToolBar.Buttons[i]);
1540                 //StdToolBar.Buttons[i].Free;
1541         end;
1542         FileName := GikoSys.GetConfigDir + 'ToolBar.ini';
1543         ini := TMemIniFile.Create(FileName);
1544         i := 0;
1545         while true do begin
1546                 s := ini.ReadString('StdToolBar', IntToStr(i), '');
1547                 if s = '' then
1548                         Break;
1549                 if s = '-' then begin
1550                         ToolButton := TToolButton.Create(StdToolBar);
1551                         ToolButton.Style := tbsSeparator;
1552                         ToolButton.Width := 8;
1553                         ToolButton.Left := 10000;
1554                         StdToolBar.InsertControl(ToolButton);
1555                 end else begin
1556                         Action := GetAction(s);
1557                         if Action <> nil then begin
1558                                 ToolButton := TToolButton.Create(StdToolBar);
1559                                 ToolButton.Action := Action;
1560                                 ToolButton.Left := 10000;
1561                                 StdToolBar.InsertControl(ToolButton);
1562                         end;
1563                 end;
1564                 Inc(i);
1565         end;
1566 end;
1567 }
1568 {function TGikoForm.GetAction(ActionName: string): TContainedAction;
1569 var
1570         i: Integer;
1571 begin
1572         for i := 0 to ActionList.ActionCount - 1 do begin
1573                 if ActionList.Actions[i].Name = ActionName then begin
1574                         Result := ActionList.Actions[i];
1575                         Exit;
1576                 end;
1577         end;
1578         Result := nil;
1579 end;}
1580
1581 procedure TGikoForm.FormCloseQuery(Sender: TObject; var CanClose: Boolean);
1582 var
1583         i: Integer;
1584         CoolSet: TCoolSet;
1585         wp: TWindowPlacement;
1586 begin
1587                 if ( GikoSys.Setting.ShowDialogForEnd ) and
1588                                 (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
1589                         CanClose := false;
1590                                 Exit;
1591                 end else begin
1592                         CanClose := True;
1593                 end;
1594         Application.OnDeactivate := nil;
1595         Self.OnDeactivate := nil;
1596
1597         //column\95\9d
1598         if GetActiveList is TBBS2ch then begin
1599                 for i := 0 to ListView.Columns.Count - 1 do
1600                         GikoSys.Setting.BBSColumnWidth[i] := ListView.Column[i].Width;
1601         end else if GetActiveList is TCategory then begin
1602                 for i := 0 to ListView.Columns.Count - 1 do
1603                         GikoSys.Setting.CategoryColumnWidth[i] := ListView.Column[i].Width;
1604         end else if GetActiveList is TBoard then begin
1605                 for i := 0 to ListView.Columns.Count - 1 do
1606                         GikoSys.Setting.BoardColumnWidth[i] := ListView.Column[i].Width;
1607         end;
1608
1609         //\8dÅ\91å\89»\81E\83E\83B\83\93\83h\83E\88Ê\92u\95Û\91
1610         wp.length := sizeof(wp);
1611         GetWindowPlacement(Handle, @wp);
1612         GikoSys.Setting.WindowTop := wp.rcNormalPosition.Top;
1613         GikoSys.Setting.WindowLeft := wp.rcNormalPosition.Left;
1614         GikoSys.Setting.WindowHeight := wp.rcNormalPosition.Bottom - wp.rcNormalPosition.Top;
1615         GikoSys.Setting.WindowWidth := wp.rcNormalPosition.Right - wp.rcNormalPosition.Left;
1616         GikoSys.Setting.WindowMax := WindowState = wsMaximized;
1617
1618         GikoSys.Setting.ListStyle := ListView.ViewStyle;
1619         GikoSys.Setting.CabinetVisible := CabinetVisibleAction.Checked;
1620         GikoSys.Setting.CabinetWidth := CabinetPanel.Width;
1621         GikoSys.Setting.ListHeight := FBrowserSizeHeight;
1622         GikoSys.Setting.ListWidth := FBrowserSizeWidth;
1623         if ArrangeAction.Checked then
1624                 GikoSys.Setting.ListOrientation := gloVertical
1625         else
1626                 GikoSys.Setting.ListOrientation := gloHorizontal;
1627         GikoSys.Setting.MessegeBarHeight := MessagePanel.Height;
1628
1629         //\83N\81[\83\8b\83o\81[\95Û\91¶(Main)
1630         for i := 0 to MAIN_COOLBAND_COUNT - 1 do begin
1631                 CoolSet.FCoolID := MainCoolBar.Bands[i].ID;
1632                 CoolSet.FCoolWidth := MainCoolBar.Bands[i].Width;
1633                 CoolSet.FCoolBreak := MainCoolBar.Bands[i].Break;
1634                 GikoSys.Setting.MainCoolSet[i] := CoolSet;
1635         end;
1636         //\83N\81[\83\8b\83o\81[\95Û\91¶(Board)
1637         for i := 0 to LIST_COOLBAND_COUNT - 1 do begin
1638                 CoolSet.FCoolID := ListCoolBar.Bands[i].ID;
1639                 CoolSet.FCoolWidth := ListCoolBar.Bands[i].Width;
1640                 CoolSet.FCoolBreak := ListCoolBar.Bands[i].Break;
1641                 GikoSys.Setting.ListCoolSet[i] := CoolSet;
1642         end;
1643         //\83N\81[\83\8b\83o\81[\95Û\91¶(Browser)
1644         for i := 0 to BROWSER_COOLBAND_COUNT - 1 do begin
1645                 CoolSet.FCoolID := BrowserCoolBar.Bands[i].ID;
1646                 CoolSet.FCoolWidth := BrowserCoolBar.Bands[i].Width;
1647                 CoolSet.FCoolBreak := BrowserCoolBar.Bands[i].Break;
1648                 GikoSys.Setting.BrowserCoolSet[i] := CoolSet;
1649         end;
1650
1651         GikoSys.Setting.WriteWindowSettingFile;
1652         GikoSys.Setting.WriteNameMailSettingFile;
1653
1654         //\82¨\8bC\82É\93ü\82è\95Û\91
1655         try
1656                 FavoriteDM.WriteFavorite;
1657         except
1658         end;
1659 //      Favorite.Free;
1660
1661         try
1662                 //\83^\83u\83N\83\8d\81[\83Y
1663                 NotSelectTabCloseAction.Execute;
1664                 if BrowserTab.Tabs.Count >= 1 then begin
1665                         DeleteTab(TThreadItem(BrowserTab.Tabs.Objects[0]));
1666                 end;
1667         except
1668         end;
1669
1670         //\8f\84\89ñ\83\8a\83X\83g\95Û\91¶&\94j\8aü
1671         try
1672                 RoundList.SaveRoundFile;
1673         except
1674         end;
1675         try
1676                 RoundList.Clear;
1677         except
1678         end;
1679         try
1680                 RoundList.Free;
1681         except
1682         end;
1683
1684         //\83q\83X\83g\83\8a\83\8a\83X\83g
1685         try
1686                 FHistoryList.Free;
1687         except
1688         end;
1689
1690         //\83A\83h\83\8c\83X\97\9a\97ð\95Û\91
1691         try
1692                 AddressHistoryDM.WriteHistory(AddressComboBox.Items, GikoSys.Setting.AddressHistoryCount);
1693         except
1694         end;
1695
1696         try
1697                 FControlThread.Terminate;
1698         except
1699         end;
1700
1701 //      FDownload.Free;
1702         try
1703                 SetActiveList(nil);
1704         except
1705         end;
1706         //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
1707         Sleep(10);
1708         try
1709                 TreeView.Items.Clear;
1710         except
1711         end;
1712
1713         try
1714                 if FavoriteDM <> nil then
1715                         FavoriteDM.Free;
1716                 FavoriteDM := nil;
1717                 if AddressHistoryDM <> nil then
1718                         AddressHistoryDM.Free;
1719                 AddressHistoryDM := nil;
1720         except
1721         end;
1722         try
1723                 if BBS2ch <> nil then
1724                         BBS2ch.Free;
1725                 BBS2ch := nil;
1726         except
1727         end;
1728
1729         try
1730                 //Hint\94j\8aü
1731                 if FHint <> nil then begin
1732                         FHint.ReleaseHandle;
1733                         FHint.Free;
1734                         FHint := nil;
1735                 end;
1736                 //Preview\94j\8aü
1737                 if TPreviewBrowser <> nil then begin
1738                         FPreviewBrowser.Free;
1739                         FPreviewBrowser := nil;
1740                 end;
1741         except
1742         end;
1743 end;
1744
1745 procedure TGikoForm.FormDestroy(Sender: TObject);
1746 //var
1747 //      wp: TWindowPlacement;
1748 begin
1749 {       //\83q\83X\83g\83\8a\83\8a\83X\83g
1750         FHistoryList.Free;
1751
1752         //\8dÅ\91å\89»\81E\83E\83B\83\93\83h\83E\88Ê\92u\95Û\91
1753         wp.length := sizeof(wp);
1754         GetWindowPlacement(Handle, @wp);
1755
1756         GikoSys.Setting.WindowTop := wp.rcNormalPosition.Top;
1757         GikoSys.Setting.WindowLeft := wp.rcNormalPosition.Left;
1758         GikoSys.Setting.WindowHeight := wp.rcNormalPosition.Bottom - wp.rcNormalPosition.Top;
1759         GikoSys.Setting.WindowWidth := wp.rcNormalPosition.Right - wp.rcNormalPosition.Left;
1760         GikoSys.Setting.WindowMax := WindowState = wsMaximized;
1761
1762         GikoSys.Setting.CabinetVisible := CabinetPanel.Visible;
1763         GikoSys.Setting.CabinetWidth := CabinetPanel.Width;
1764
1765         GikoSys.Setting.WriteWindowSettingFile;
1766         GikoSys.Setting.WriteNameMailSettingFile;
1767         FDownload.Free;
1768         BBS2ch.Free;}
1769 end;
1770
1771 //\83t\83H\81[\83\80\83N\83\8d\81[\83Y
1772 procedure TGikoForm.FormClose(Sender: TObject; var Action: TCloseAction);
1773 begin
1774         Application.Terminate;
1775         Action := caFree;
1776 end;
1777
1778 //\83L\83\83\83r\83l\83b\83g\81~\83{\83^\83\93\83N\83\8a\83b\83N
1779 procedure TGikoForm.CabinetPanelHide(Sender: TObject);
1780 begin
1781         CabinetVisibleAction.Execute;
1782 //      CabinetPanelVisible(false);
1783 end;
1784
1785 procedure TGikoForm.ReloadBBS;
1786 begin
1787         //\83^\83u\83N\83\8d\81[\83Y
1788         NotSelectTabCloseAction.Execute;
1789         if BrowserTab.Tabs.Count >= 1 then
1790                 DeleteTab(TThreadItem(BrowserTab.Tabs.Objects[0]));
1791         //\83q\83X\83g\83\8a\83\8a\83X\83g
1792         FHistoryList.Clear;
1793         //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
1794         TreeView.Items.Clear;
1795
1796         //BBS\94j\8aü
1797         BBS2ch.Free;
1798
1799         SetActiveList(nil);
1800
1801         FTreeType := gttNone;
1802
1803         //BBS\8dì\90¬
1804         BBS2ch := TBBS2ch.Create(GikoSys.Setting.LogFolder);
1805
1806         BBS2ch.ReadBoardFile;           //\83{\81[\83h\83t\83@\83C\83\8b\93Ç\8d\9e
1807         Show2chTree;
1808 end;
1809
1810 //\83{\81[\83h\83c\83\8a\81[\90Ý\92è
1811 procedure TGikoForm.SetBoardTreeNode;
1812 var
1813         i, j: integer;
1814         Root: TTreeNode;
1815         CategoryNode: TTreeNode;
1816         BoardNode: TTreeNode;
1817         Category: TCategory;
1818         Board: TBoard;
1819 begin
1820         TreeView.Items.BeginUpdate;
1821         TreeView.Items.Clear;
1822         try
1823                 Root := TreeView.Items.Add(nil, BBS2ch.Title);
1824                 Root.ImageIndex := ITEM_ICON_2CH1;
1825                 Root.SelectedIndex := ITEM_ICON_2CH2;
1826                 Root.Data := BBS2ch;
1827                 if SplashWindow <> nil then
1828                         SplashWindow.ProgressBar.Max := BoardGroup.BBS2ch.Count;
1829
1830                 for i := 0 to BoardGroup.BBS2ch.Count - 1 do begin
1831                         Category := TCategory(BoardGroup.BBS2ch.Items[i]);
1832                         CategoryNode := TreeView.Items.AddChild(Root, Category.Title);
1833                         CategoryNode.Data := Category;
1834                         CategoryNode.ImageIndex := ITEM_ICON_CATEGORY1;
1835                         CategoryNode.SelectedIndex := ITEM_ICON_CATEGORY2;
1836
1837                         for j := 0 to Category.Count - 1 do begin
1838                                 Board := TBoard(Category.Items[j]);
1839                                 Board.BeginUpdate;
1840                                 BoardNode := TreeView.Items.AddChild(CategoryNode, Board.Title);
1841                                 BoardNode.Data := Board;
1842                                 BoardNode.ImageIndex := ITEM_ICON_BOARD1;
1843                                 BoardNode.SelectedIndex := ITEM_ICON_BOARD2;
1844                                 Board.LoadSettings;
1845                                 Board.EndUpdate;
1846                         end;
1847
1848                         CategoryNode.Expanded := Category.NodeExpand;
1849
1850                         if SplashWindow <> nil then begin
1851                                 SplashWindow.ProgressBar.StepIt;
1852                                 Application.ProcessMessages;
1853                         end;
1854
1855                 end;
1856         finally
1857                 TreeView.Items.EndUpdate;
1858         end;
1859 end;
1860
1861 function TGikoForm.SetCategoryListItem(ABBS2ch: TBBS2ch): Integer;
1862 const
1863         COLUMN: array[0..0] of string = ('\83J\83e\83S\83\8a\96¼');
1864 var
1865         ListColumn: TListColumn;
1866         i: Integer;
1867 begin
1868         ListView.Items.BeginUpdate;
1869         try
1870                 Screen.Cursor := crHourGlass;
1871
1872                 ListView.Columns.Clear;
1873                 for i := 0 to Length(COLUMN) - 1 do begin
1874                         ListColumn := ListView.Columns.Add;
1875                         ListColumn.Caption := COLUMN[i];
1876                         ListColumn.Width := GikoSys.Setting.BBSColumnWidth[i];
1877                 end;
1878
1879                 ListView.Items.Count := 0;
1880                 ListView.Items.Clear;
1881                 ListView.Items.Count := ABBS2ch.Count;
1882
1883 //              UpFolderAction.Enabled := False;
1884 //              AllItemAction.Enabled := False;
1885 //              LogItemAction.Enabled := False;
1886 //              NewItemAction.Enabled := False;
1887 //              SelectItemAction.Enabled := False;
1888 //              ListDownloadToolButton.Enabled := False;
1889 //              BoardReservToolButton.Enabled := False;
1890 //              ListThreadDownloadToolButton.Enabled := False;
1891
1892                 ListNameLabel.Caption := ABBS2ch.Title;
1893                 FolderImage.Picture := nil;
1894                 ItemIcon16.GetBitmap(1, FolderImage.Picture.Bitmap);
1895
1896                 FSortIndex := 0;
1897                 FSortOrder := False;
1898                 ListViewColumnClick(nil, ListView.Column[0]);
1899
1900                 Result := ABBS2ch.Count;
1901         finally
1902                 Screen.Cursor := crDefault;
1903                 ListView.Items.EndUpdate;
1904         end;
1905 end;
1906
1907 function TGikoForm.SetBoardListItem(Category: TCategory): Integer;
1908 const
1909         COLUMN: array[0..2] of string = ('\94Â\96¼', '\8f\84\89ñ\97\\96ñ', '\8eæ\93¾\93ú\8e\9e');
1910 var
1911         ListColumn: TListColumn;
1912         i: Integer;
1913 begin
1914         ListView.Items.BeginUpdate;
1915         try
1916                 Screen.Cursor := crHourGlass;
1917
1918                 ListView.Columns.Clear;
1919                 for i := 0 to Length(COLUMN) - 1 do begin
1920                         ListColumn := ListView.Columns.Add;
1921                         ListColumn.Caption := COLUMN[i];
1922                         ListColumn.Width := GikoSys.Setting.CategoryColumnWidth[i];
1923                 end;
1924
1925                 ListView.Items.Count := 0;
1926                 ListView.Items.Clear;
1927                 ListView.Items.Count := Category.Count;
1928
1929 //              UpFolderAction.Enabled := True;
1930 //              AllItemAction.Enabled := False;
1931 //              LogItemAction.Enabled := False;
1932 //              NewItemAction.Enabled := False;
1933 //              SelectItemAction.Enabled := False;
1934 //              ListDownloadToolButton.Enabled := False;
1935 //              BoardReservToolButton.Enabled := False;
1936 //              ListThreadDownloadToolButton.Enabled := False;
1937
1938                 ListNameLabel.Caption := Category.Title;
1939                 FolderImage.Picture := nil;
1940                 ItemIcon16.GetBitmap(3, FolderImage.Picture.Bitmap);
1941
1942                 FSortIndex := 0;
1943                 FSortOrder := False;
1944                 ListViewColumnClick(nil, ListView.Column[0]);
1945
1946                 Result := Category.Count;
1947         finally
1948                 Screen.Cursor := crDefault;
1949                 ListView.Items.EndUpdate;
1950         end;
1951 end;
1952
1953 function TGikoForm.SetThreadListItem(Board: TBoard): Integer;
1954 const
1955         COLUMN: array[0..6] of string = ('\83X\83\8c\83b\83h\96¼', '\83J\83E\83\93\83g', '\8eæ\93¾', '\90V\92\85',
1956                                                                                                                                          '\96¢\93Ç', '\8f\84\89ñ\97\\96ñ', '\8eæ\93¾\93ú\8e\9e');
1957         COLUMN_ALIGNMENT: array[0..6] of TAlignment = (taLeftJustify, taRightJustify,
1958                                                                                                                                                                                                  taRightJustify, taRightJustify,
1959                                                                                                                                                                                                  taRightJustify, taLeftJustify,
1960                                                                                                                                                                                                  taLeftJustify);
1961         //No, \83X\83\8c\83b\83h\96¼, \83J\83E\83\93\83g, \8f\84\89ñ\97\\96ñ, \8eæ\93¾\93ú\8e\9e
1962 var
1963         ListColumn: TListColumn;
1964         i: Integer;
1965 begin
1966         ListView.Items.BeginUpdate;
1967         try
1968                 Screen.Cursor := crHourGlass;
1969
1970                 // \83`\83\89\82Â\82«\96h\8e~\82Ì\82½\82ß\81A\95Ï\8dX\82³\82ê\82Ä\82¢\82é\8fê\8d\87\82Ì\82Ý
1971                 // \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Ó
1972                 if ListView.Columns.Count <> (High( COLUMN ) - Low( COLUMN ) + 1) then
1973                 begin
1974                         ListView.Columns.Clear;
1975                         for i := 0 to Length(COLUMN) - 1 do begin
1976                                 ListColumn := ListView.Columns.Add;
1977                                 ListColumn.Caption := COLUMN[i];
1978                                 ListColumn.Width := GikoSys.Setting.BoardColumnWidth[i];
1979                                 ListColumn.Alignment := COLUMN_ALIGNMENT[i];
1980                         end;
1981                 end;
1982
1983                 ListView.Items.Count := 0;
1984                 ListView.Items.Clear;
1985
1986                 case GikoForm.ViewType of
1987                         gvtAll: ListView.Items.Count := Board.Count;
1988                         gvtLog: ListView.Items.Count := Board.GetLogThreadCount;
1989                         gvtNew: ListView.Items.Count := Board.GetNewThreadCount;
1990                         gvtUser: ListView.Items.Count := Board.GetUserThreadCount;
1991                 end;
1992
1993                 ListNameLabel.Caption := Board.Title;
1994                 FolderImage.Picture := nil;
1995                 ItemIcon16.GetBitmap(5, FolderImage.Picture.Bitmap);
1996
1997                 FSortIndex := 0;
1998                 FSortOrder := False;
1999                 ListViewColumnClick(nil, ListView.Column[0]);
2000
2001                 Result := Board.Count;
2002         finally
2003                 Screen.Cursor := crDefault;
2004                 ListView.Items.EndUpdate;
2005         end;
2006 end;
2007
2008 procedure TGikoForm.TreeViewChange(Sender: TObject; Node: TTreeNode);
2009 var
2010         i: Integer;
2011 begin
2012         if FTreeType = gttHistory then begin
2013 //              SetContent(TThreadItem(Node.Data));
2014                 InsertBrowserTab(TThreadItem(Node.Data));
2015                 Exit;
2016         end;
2017
2018         ListView.Selected := nil;
2019         ListView.Items.Count := 0;
2020         ListView.Items.Clear;
2021 //      ListView.Columns.Clear;
2022
2023         Caption := CAPTION_NAME;
2024         //Application.Title := CAPTION_NAME;
2025
2026
2027         if GetActiveList is TBBS2ch then begin
2028                 for i := 0 to ListView.Columns.Count - 1 do
2029                         GikoSys.Setting.BBSColumnWidth[i] := ListView.Column[i].Width;
2030         end else if GetActiveList is TCategory then begin
2031                 for i := 0 to ListView.Columns.Count - 1 do
2032                         GikoSys.Setting.CategoryColumnWidth[i] := ListView.Column[i].Width;
2033         end else if GetActiveList is TBoard then begin
2034                 for i := 0 to ListView.Columns.Count - 1 do
2035                         GikoSys.Setting.BoardColumnWidth[i] := ListView.Column[i].Width;
2036         end;
2037
2038         if TObject(Node.Data) is TBBS2ch then begin
2039                 SetActiveList(Node.data);
2040         end else if TObject(Node.Data) is TCategory then begin
2041                 SetActiveList(Node.data);
2042         end else if TObject(Node.Data) is TBoard then begin
2043                 if not TBoard(Node.Data).IsThreadDatRead then begin
2044                         Screen.Cursor := crHourGlass;
2045                         try
2046                                 GikoSys.ReadSubjectFile(TBoard(Node.Data));
2047                         finally
2048                                 Screen.Cursor := crDefault;
2049                         end;
2050                 end;
2051                 SetActiveList(Node.data);
2052         end;
2053 end;
2054
2055 procedure TGikoForm.ListViewData(Sender: TObject; Item: TListItem);
2056 var
2057 //      FileName: string;
2058 //      DateTime: TDateTime;
2059         BoardCnt: Integer;
2060         BBS: TBBS2ch;
2061         Category: TCategory;
2062         Board: TBoard;
2063         ThreadItem: TThreadItem;
2064         RepStr: string;
2065 begin
2066         if ActiveList is TBBS2ch then begin
2067                 BBS := TBBS2ch(ActiveList);
2068
2069                 ListView.StateImages := nil;
2070
2071                 if BBS = nil then Exit;
2072                 if BBS.Count <= 0 then Exit;
2073                 if Item = nil then Exit;
2074                 if Item.Index > BBS.Count then Exit;
2075                 if ListView.Items.Count = 0 then Exit;
2076
2077                 if not (BBS.Items[Item.Index] is TCategory) then Exit;
2078                 Category := TCategory(BBS.Items[Item.Index]);
2079
2080                 if Category = nil then Exit;
2081
2082                 if ListNumberVisibleAction.Checked then
2083                         Item.Caption := IntToStr(Category.No) + ': ' + Category.Title
2084                 else
2085                         Item.Caption := Category.Title;
2086
2087                 Item.ImageIndex := ITEM_ICON_CATEGORY1;
2088                 Item.Data := Category;
2089         end else if ActiveList is TCategory then begin
2090                 Category := TCategory(ActiveList);
2091
2092                 ListView.StateImages := nil;
2093
2094                 if Category = nil then Exit;
2095                 if Category.Count <= 0 then Exit;
2096                 if Item = nil then Exit;
2097                 if Item.Index >= Category.Count then Exit;
2098                 if ListView.Items.Count = 0 then Exit;
2099
2100                 if not (Category.Items[Item.Index] is TBoard) then Exit;
2101                 Board := TBoard(Category.Items[Item.Index]);
2102
2103                 if Board = nil then Exit;
2104
2105                 if ListNumberVisibleAction.Checked then
2106                         Item.Caption := IntToStr(Board.No) + ': ' + Board.Title
2107                 else
2108                         Item.Caption := Board.Title;
2109
2110                 if Item.SubItems.Count <> 2 then begin
2111                         Item.SubItems.Clear;
2112                         Item.SubItems.Add('');
2113                         Item.SubItems.Add('');
2114                 end;
2115
2116                 Item.ImageIndex := ITEM_ICON_BOARD1;
2117
2118                 if Board.Round then
2119                         Item.SubItems[0] := Board.RoundName     // '\97\\96ñ'
2120                 else
2121                         Item.SubItems[0] := '';
2122
2123                 if Board.RoundDate = ZERO_DATE then begin
2124                         Item.SubItems[1] := '';
2125                 end else
2126                         Item.SubItems[1] := FormatDateTime('yyyy/mm/dd hh:mm:ss', Board.RoundDate);
2127                 Item.Data := Board;
2128         end else if ActiveList is TBoard then begin
2129                 Board := TBoard(ActiveList);
2130
2131                 if GikoSys.Setting.ListIconVisible then
2132                         ListView.StateImages := StateIconImageList
2133                 else
2134                         ListView.StateImages := nil;
2135
2136                 case GikoForm.ViewType of
2137                         gvtAll: BoardCnt := Board.Count;
2138                         gvtLog: BoardCnt := Board.GetLogThreadCount;
2139                         gvtNew: BoardCnt := Board.GetNewThreadCount;
2140                         gvtUser: BoardCnt := Board.GetUserThreadCount;
2141                         else
2142                                 BoardCnt := 0;
2143                 end;
2144
2145 //              if Board = nil then Exit;
2146                 if BoardCnt <= 0 then Exit;
2147                 if Item = nil then Exit;
2148                 if Item.Index > BoardCnt then Exit;
2149                 if ListView.Items.Count = 0 then Exit;
2150
2151 //              if not (Board.Items[Item.Index] is TThreadItem) then Exit;
2152
2153                 ThreadItem := nil;
2154                 case GikoForm.ViewType of
2155                         gvtAll: ThreadItem := TThreadItem(Board.Items[Item.Index]);
2156                         gvtLog: ThreadItem := Board.GetLogThread(Item.Index);
2157                         gvtNew: ThreadItem := Board.GetNewThread(Item.Index);
2158                         gvtUser: ThreadItem := Board.GetUserThread(Item.Index);
2159                 end;
2160
2161                 if ThreadItem = nil then Exit;
2162
2163 //              if ListNumberVisibleAction.Checked then
2164 //                      RepStr := IntToStr(ThreadItem.No) + ': ' + ThreadItem.Title
2165 //              else
2166                 RepStr := ThreadItem.Title;
2167                 //RepStr := StringReplace(RepStr, '&amp;', '&', [rfReplaceAll]);
2168                 RepStr := StringReplace(RepStr, '&lt;', '<', [rfReplaceAll]);
2169                 RepStr := StringReplace(RepStr, '&gt;', '>', [rfReplaceAll]);
2170                 RepStr := StringReplace(RepStr, '&quot;', '"', [rfReplaceAll]);
2171                 RepStr := StringReplace(RepStr, '&amp', '&', [rfReplaceAll]);
2172                 //RepStr := StringReplace(RepStr, '\81\97\81M', ',', [rfReplaceAll]);
2173
2174                 if Item.SubItems.Count <> 6 then begin
2175                         Item.SubItems.Clear;
2176                         Item.SubItems.Add('');
2177                         Item.SubItems.Add('');
2178                         Item.SubItems.Add('');
2179                         Item.SubItems.Add('');
2180                         Item.SubItems.Add('');
2181                         Item.SubItems.Add('');
2182                 end;
2183
2184                 if ListNumberVisibleAction.Checked then
2185                         Item.Caption := IntToStr(ThreadItem.No) + ': ' + RepStr
2186                 else
2187                         Item.Caption := RepStr;
2188
2189                 case ThreadItem.AgeSage of
2190                         gasNone: Item.StateIndex := -1;
2191                         gasNew: Item.StateIndex := 0;
2192                         gasAge: Item.StateIndex := 1;
2193                         gasSage: Item.StateIndex := 2;
2194                 end;
2195
2196                 if ThreadItem.IsLogFile then begin
2197                         Item.ImageIndex := ITEM_ICON_THREADLOG1;
2198                         Item.SubItems[0] := IntToStr(ThreadItem.AllResCount);
2199                         Item.SubItems[1] := IntToStr(ThreadItem.Count);
2200                         if ThreadItem.NewResCount = 0 then
2201                                 Item.SubItems[2] := ''
2202                         else
2203                                 Item.SubItems[2] := IntToStr(ThreadItem.NewResCount);
2204                         Item.SubItems[3] := '';
2205                         if ThreadItem.Round then
2206                                 Item.SubItems[4] := ThreadItem.RoundName
2207                         else
2208                                 Item.SubItems[4] := '';
2209                         if ThreadItem.RoundDate = ZERO_DATE then begin
2210                                 Item.SubItems[5] := '';
2211                         end else
2212                                 Item.SubItems[5] := FormatDateTime('yyyy/mm/dd hh:mm:ss', ThreadItem.RoundDate);
2213                         if ThreadItem.NewArrival then
2214                                 Item.ImageIndex := ITEM_ICON_THREADNEW1;
2215                 end else begin
2216                         Item.ImageIndex := ITEM_ICON_THREAD1;
2217                         Item.SubItems[0] := IntToStr(ThreadItem.AllResCount);
2218                         Item.SubItems[1] := '';
2219                         Item.SubItems[2] := '';
2220                         Item.SubItems[3] := '';
2221                         Item.SubItems[4] := '';
2222                         Item.SubItems[5] := '';
2223                 end;
2224                 Item.Data := ThreadItem;
2225         end;
2226 end;
2227
2228 procedure TGikoForm.ListViewDataFind(Sender: TObject; Find: TItemFind;
2229         const FindString: String; const FindPosition: TPoint; FindData: Pointer;
2230         StartIndex: Integer; Direction: TSearchDirection; Wrap: Boolean;
2231         var Index: Integer);
2232 begin
2233 //
2234 end;
2235
2236 procedure TGikoForm.ListViewDataHint(Sender: TObject; StartIndex,
2237         EndIndex: Integer);
2238 begin
2239 //
2240 end;
2241
2242 procedure TGikoForm.ListViewDataStateChange(Sender: TObject; StartIndex,
2243         EndIndex: Integer; OldState, NewState: TItemStates);
2244 begin
2245 //
2246 end;
2247
2248 procedure TGikoForm.BrowserStatusTextChange(Sender: TObject; const Text: WideString);
2249 var
2250         p: TPoint;
2251         s: string;
2252         tmp2: string;
2253         URL: string;
2254         ATitle: Boolean;
2255
2256         wkBBS: string;
2257         wkKey: string;
2258
2259         //wkInt: Integer;
2260         wkIntSt: Integer;
2261         wkIntTo: Integer;
2262
2263         ActiveFileName: string;
2264         e: IHTMLElement;
2265         Ext: string;
2266         PathRec: TPathRec;
2267 begin
2268         try
2269                 try
2270                         if (FActiveContent <> nil) and (Assigned(Browser.Document)) then begin
2271                                 if LowerCase(OleVariant(IHTMLDocument2(Browser.Document)).charset) <> 'shift_jis' then
2272                                         OleVariant(IHTMLDocument2(Browser.Document)).charset := 'shift_jis';
2273                         end;
2274                 except
2275                 end;
2276         finally
2277         end;
2278         if PreviewTimer.Enabled then
2279                 PreviewTimer.Enabled := False;
2280         Application.CancelHint;
2281         if GetActiveContent <> nil then
2282                 ActiveFileName := ChangeFileExt(ExtractFileName(GetActiveContent.FileName), '')
2283         else
2284                 ActiveFileName := '';
2285
2286         StatusBar.Panels[1].Text := Text;
2287
2288         if FHint <> nil then begin
2289                 FHint.ReleaseHandle;
2290                 FHint.ClearAllRes;
2291         end;
2292         if FPreviewBrowser <> nil then
2293                 ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
2294
2295         if not GikoSys.Setting.UnActivePopup then
2296                 if not GikoForm.Active then
2297                         Exit;
2298
2299 //file:///C:/Borland/Projects/gikoNavi/test/read.cgi/qa/990576336/10
2300 //file:///C:/Borland/Projects/gikoNavi/test/read.cgi/qa/990576336/10-15
2301
2302         s := '';
2303         Ext := AnsiLowerCase(ExtractFileExt(Text));
2304         if (Pos('http://', Text) = 1) and (GikoSys.Setting.PreviewVisible) and
2305                         ((Ext = '.jpg') or (Ext = '.jpeg') or (Ext = '.gif') or (Ext = '.png')) then begin
2306                 if FPreviewBrowser = nil then begin
2307                         FPreviewBrowser := TPreviewBrowser.Create(Self);
2308                         ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
2309                         TOleControl(FPreviewBrowser).Parent := nil;
2310                 end;
2311                 FPreviewBrowser.Navigate('about:blank');//\91O\89ñ\82Ì\83v\83\8c\83r\83\85\81[\89æ\91\9c\8fÁ\8b\8e\97p
2312                 FPreviewURL := Text;
2313                 PreviewTimer.Interval := GikoSys.Setting.PreviewWait;
2314                 PreviewTimer.Enabled := True;
2315         end else if (Pos('about:blank', Text) = 1) or (Pos('http://', Text) = 1) or (Pos('mailto:', Text) = 1) then begin
2316                 if Pos('mailto:', Text) = 1 then begin
2317                         s := StringReplace(Text, 'mailto:', '', [rfIgnoreCase]);
2318                         //\83M\83R\83i\83r\83X\83\8c \83p\81[\83g3\82Ì466\8e\81\82É\8a´\8eÓ
2319                         GetCursorPos(p);
2320                         p.x := p.x - TWebBrowser(Sender).ClientOrigin.x;
2321                         p.y := p.y - TWebBrowser(Sender).ClientOrigin.y;
2322                         e := IHTMLDocument2(TWebBrowser(Sender).Document).elementFromPoint(p.x, p.y);
2323                         if (Assigned(e)) then begin
2324                                 tmp2 := GikoSys.ZenToHan(e.Get_outerText);
2325                                 if (GikoSys.IsNumeric(tmp2)) then begin
2326                                         //\82\93\82Í\83\8c\83X\94Ô\8d\86\82Á\82Û\82¢\82Á\82·\81B
2327                                         wkBBS := GetActiveContent.ParentBoard.BBSID;
2328                                         wkKey := ChangeFileExt(GetActiveContent.FileName, '');
2329                                         wkIntSt := StrToInt(tmp2);
2330                                         wkIntTo := StrToInt(tmp2);
2331                                                 //s := GetThreadText(wkBBS, wkKey, wkIntSt, wkIntTo, False, False);
2332                                         FHint.PopupType := gptThread;
2333                                         SetResPopupText(wkBBS, wkKey, wkIntSt, wkIntTo, False, False);
2334                                 end else begin
2335                                         FHint.PopupType := gptRaw;
2336                                         FHint.Caption := s;
2337                                 end;
2338                         end;
2339                 end else begin
2340                         URL := Text;
2341
2342                         if Pos('about:blank..', URL) = 1 then
2343                                 URL := StringReplace(URL, 'about:blank..', 'http://www.2ch.net', []);
2344
2345                         PathRec := Gikosys.Parse2chURL2(URL);
2346
2347                         if PathRec.FDone then begin
2348
2349                                 wkIntSt := PathRec.FSt;
2350                                 wkIntTo := PathRec.FTo;
2351
2352                                 if (wkIntSt = 0) and (wkIntTo = 0) then begin
2353                                         wkIntSt := 1;
2354                                         wkIntTo := 1;
2355                                 end else if (wkIntSt = 0) and (wkIntTo > 0) then begin
2356                                         wkIntSt := wkIntTo;
2357                                 end else if (wkIntSt > 0) and (wkIntTo = 0) then begin
2358                                         wkIntTo := wkIntSt;
2359                                 end else if wkIntSt > wkIntTo then begin
2360                                         //wkInt := wkIntTo;
2361                                         wkIntTo := wkIntSt;
2362                                         wkIntSt := wkIntTo;
2363                                 end;
2364                                 //if wkIntSt = 0 then
2365                                 //      wkIntSt := 1;
2366                                 //if wkINtTo = 0 then
2367                                 //      wkIntTo := 1;
2368                                 //if PathRec.FFirst then
2369                                 //      wkIntSt := 1;
2370                                 if PathRec.FStBegin then
2371                                         wkIntSt := 1;
2372                                 if PathRec.FToEnd then
2373                                         wkIntTo := 9999;
2374
2375                                 ATitle := ActiveFileName <> PathRec.FKey;
2376
2377                                 //HintData := GetThreadText(PathRec.FBBS, PathRec.FKey, wkIntSt, wkIntTo, ATitle, PathRec.FFirst);
2378                                 FHint.PopupType := gptThread;
2379                                 SetResPopupText(PathRec.FBBS, PathRec.FKey, wkIntSt, wkIntTo, ATitle, PathRec.FFirst);
2380                         end;
2381                 end;
2382
2383                 //if s <> '' then
2384                 //      ShowTextPopup(s);
2385                 if FHint.PopupType = gptRaw then begin
2386                         if FHint.Caption <> '' then
2387                                 ShowTextPopup;
2388                 end else begin
2389                         if (FHint.ResCount <> 0) or (FHint.Title <> '') then
2390                                 ShowTextPopup;
2391                 end;
2392         end;
2393 end;
2394
2395 procedure TGikoForm.BrowserTitleChange(Sender: TObject;
2396         const Text: WideString);
2397 var
2398         Title: string;
2399 begin
2400         if (Text = BLANK_HTML) or (Text = GikoSys.GetHtmlTempFileName) then
2401                 Title := CAPTION_NAME
2402         else
2403                 Title := CAPTION_NAME + ' - [' + Text + ']';
2404         Caption := Title;
2405         //Application.Title := Title;
2406 end;
2407
2408 procedure TGikoForm.SetEnabledCloseButton(Enabled: Boolean);
2409 var
2410         SysMenu: HMenu;
2411         //SysMenuApp: HMenu;
2412 begin
2413         FEnabledCloseButton := Enabled;
2414         SysMenu := GetSystemMenu(Handle, False);
2415         //SysMenuApp := GetSystemMenu(Application.Handle, False);
2416
2417         if Enabled then begin
2418                 EnableMenuItem(SysMenu, SC_CLOSE, MF_BYCOMMAND or MF_ENABLED);
2419                 //EnableMenuItem(SysMenuApp, SC_CLOSE, MF_BYCOMMAND or MF_ENABLED);
2420         end else begin
2421                 EnableMenuItem(SysMenu, SC_CLOSE, MF_BYCOMMAND or MF_GRAYED);
2422                 //EnableMenuItem(SysMenuApp, SC_CLOSE, MF_BYCOMMAND or MF_GRAYED);
2423         end;
2424
2425         DrawMenuBar(Handle);
2426         //DrawMenuBar(Application.Handle);
2427 end;
2428
2429 procedure TGikoForm.TreeViewChanging(Sender: TObject; Node: TTreeNode;
2430         var AllowChange: Boolean);
2431 begin
2432         if FTreeType = gtt2ch then
2433                 FSortIndex := -1;
2434 end;
2435
2436 procedure TGikoForm.ListViewKeyDown(Sender: TObject; var Key: Word;
2437         Shift: TShiftState);
2438 begin
2439         if Key = VK_BACK then begin
2440 //              UpFolderButtonClick(Sender);
2441         end else if Key = VK_SPACE then begin
2442 //              ListClick;
2443         end else if Key = VK_RETURN then begin
2444                 ListDoubleClick;
2445         end;
2446 end;
2447
2448 function TGikoForm.GetHttpState: Boolean;
2449 begin
2450         Result := FHttpState;
2451 end;
2452
2453 procedure TGikoForm.ListViewColumnClick(Sender: TObject;
2454         Column: TListColumn);
2455 var
2456         i: Integer;
2457         wkBBS: TBBS2ch;
2458         wkCategory: TCategory;
2459         wkBoard: TBoard;
2460 begin
2461         if FSortIndex = Column.Index then
2462                 FSortOrder := not FSortOrder
2463         else
2464                 FSortOrder := False;
2465
2466         for i := 0 to ListView.Columns.Count - 1 do
2467                 ListView.Column[i].ImageIndex := -1;
2468         if FSortOrder then
2469                 ListView.Column[Column.Index].ImageIndex := ITEM_ICON_SORT1
2470         else
2471                 ListView.Column[Column.Index].ImageIndex := ITEM_ICON_SORT2;
2472
2473         Sort.SortNoFlag := ListNumberVisibleAction.Checked;
2474
2475         if TObject(TreeView.Selected.Data) is TBBS2ch then begin
2476                 wkBBS := TBBS2ch(TreeView.Selected.Data);
2477                 Sort.SortOrder := FSortOrder;
2478                 Sort.SortIndex := Column.Index;
2479                 wkBBS.Sort(CategorySortProc);
2480                 ListView.Refresh;
2481         end else if TObject(TreeView.Selected.Data) is TCategory then begin
2482                 wkCategory := TCategory(TreeView.Selected.Data);
2483                 Sort.SortOrder := FSortOrder;
2484                 Sort.SortIndex := Column.Index;
2485                 wkCategory.Sort(BoardSortProc);
2486                 ListView.Refresh;
2487         end else if TObject(TreeView.Selected.Data) is TBoard then begin
2488                 wkBoard := TBoard(TreeView.Selected.Data);
2489                 Sort.SortOrder := FSortOrder;
2490                 Sort.SortIndex := Column.Index;
2491                 wkBoard.Sort(ThreadItemSortProc);
2492                 ListView.Refresh;
2493         end;
2494         FSortIndex := Column.Index;
2495 end;
2496
2497 procedure TGikoForm.MenuToolBarCustomDrawButton(Sender: TToolBar;
2498         Button: TToolButton; State: TCustomDrawState; var DefaultDraw: Boolean);
2499 var
2500         ARect: TRect;
2501 begin
2502         DefaultDraw := True;
2503         Exit;
2504         DefaultDraw := False;
2505         if (cdsSelected in State) or (cdsHot in State) then begin
2506                 Sender.Canvas.Brush.Color := clHighlight;
2507                 Sender.Canvas.Font.Color := clHighlightText;
2508         end else begin
2509                 Sender.Canvas.Brush.Color := clBtnFace;
2510                 Sender.Canvas.Font.Color := clBtnText;
2511         end;
2512         ARect := Rect(Button.Left, Button.Top, Button.Left + Button.Width, Button.Top + Button.Height);
2513         Sender.Canvas.FillRect(ARect);
2514         DrawText(Sender.Canvas.Handle, PChar(Button.Caption), -1, ARect, DT_SINGLELINE or DT_VCENTER or DT_CENTER);
2515 end;
2516
2517 function TGikoForm.GetTreeNode(Data: TObject): TTreeNode;
2518 var
2519         Nodes: TTreeNodes;
2520         i: integer;
2521 begin
2522         Nodes := TreeView.Items;
2523
2524         for i := 0 to Nodes.Count - 1 do begin
2525                 if Nodes.Item[i].Data = Data then begin
2526                         Result := Nodes.Item[i];
2527                         Exit;
2528                 end;
2529         end;
2530         Result := nil;
2531 end;
2532
2533 procedure TGikoForm.BrowserBeforeNavigate2(Sender: TObject;
2534         const pDisp: IDispatch; var URL, Flags, TargetFrameName, PostData,
2535         Headers: OleVariant; var Cancel: WordBool);
2536 var
2537         sNo: string;
2538         p: TPoint;
2539 const
2540         kMenuName: string = 'menu:';
2541 begin
2542
2543         if Pos(kMenuName, URL) <> 0 then begin
2544                 sNo := Copy( URL, Pos( kMenuName, URL ) + Length( kMenuName ), Length( URL ) );
2545                 
2546                 if not GikoSys.IsNumeric(sNo) then Exit;
2547
2548                 Cancel := True;
2549                 GetCursorpos(p);
2550                 KokoPopupMenu.Tag := StrToInt(sNo);
2551                 KokoPopupMenu.Popup(p.x, p.y);
2552         end else if Pos('mailto', LowerCase(URL)) <> 0 then begin
2553                 Cancel := not GikoSys.Setting.OpenMailer;
2554         end;
2555
2556 end;
2557
2558 procedure TGikoForm.ListViewAdvancedCustomDrawItem(Sender: TCustomListView;
2559         Item: TListItem; State: TCustomDrawState; Stage: TCustomDrawStage;
2560         var DefaultDraw: Boolean);
2561 var
2562         ThreadItem: TThreadItem;
2563 begin
2564         //
2565 //      TListView(Sender).Canvas.Font.Style := [];
2566         if TObject(Item.Data) is TThreadItem then begin
2567                 ThreadItem := TThreadItem(Item.Data);
2568                 if ( FUseOddResOddColor ) and ( ThreadItem.Count <> 0 ) and ( ThreadItem.AllResCount <> ThreadItem.Count) then begin
2569             ListView.Canvas.Brush.Color := FOddColor;
2570         end else begin
2571                 ListView.Canvas.Brush.Color := FListViewBackGroundColor;
2572         end;
2573 //              if (ThreadItem.Kokomade <> ThreadItem.Count) and (ThreadItem.IsLogFile) then
2574                 if ThreadItem.UnRead then
2575                         TListView(Sender).Canvas.Font.Style := [fsBold];
2576         end;
2577 end;
2578
2579 procedure TGikoForm.AppFormDeactivate(Sender: TObject);
2580 begin
2581         if Application.Terminated then
2582                 Exit;
2583         if PreviewTimer.Enabled then
2584                 PreviewTimer.Enabled := False;
2585         //\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
2586         if FHint <> nil then begin
2587                 FHint.ReleaseHandle;
2588                 FHint.ClearAllRes;
2589 //              FHint.Free;
2590 //              FHint := nil;
2591         end;
2592         if FPreviewBrowser <> nil then
2593                 ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
2594
2595 end;
2596
2597 procedure TGikoForm.TreeViewCustomDraw(Sender: TCustomTreeView;
2598         const ARect: TRect; var DefaultDraw: Boolean);
2599 var
2600         NodeRect: TRect;
2601         i, j: Integer;
2602         IsBoardNode: Boolean;
2603         Cnt: Integer;
2604         CntText: string;
2605         TextWidth: Integer;
2606         TextRect: TRect;
2607         Board: TBoard;
2608         Category: TCategory;
2609         Bitmap: TBitmap;
2610         NodeWidth: Integer;
2611 begin
2612         DefaultDraw := True;
2613
2614         if FTreeType = gttHistory then Exit;
2615
2616         TreeView.Canvas.Font.Color := clBlue;
2617         IsBoardNode := False;
2618
2619         for i := 0 to TreeView.Items.Count - 1 do begin
2620                 Cnt := 0;
2621                 if not TreeView.Items[i].IsVisible then
2622                         continue;
2623
2624                 if TObject(TreeView.Items[i].Data) is TCategory then begin
2625                         if TreeView.Items[i].Expanded then
2626                                 continue;
2627
2628                         IsBoardNode := False;
2629                         Category := TCategory(TreeView.Items[i].Data);
2630                         for j := 0 to Category.Count - 1 do begin
2631                                 Board := Category.Items[j];
2632                                 if Board <> nil then begin
2633                                         if Board.UnRead > 0 then begin
2634                                                 Cnt := 1;
2635                                                 Break;
2636                                         end;
2637                                 end;
2638                         end;
2639                         if Cnt <> 1 then
2640                                 continue;
2641                 end else if TObject(TreeView.Items[i].Data) is TBoard then begin
2642                         IsBoardNode := True;
2643                         Board := TBoard(TreeView.Items[i].Data);
2644                         Cnt := Board.UnRead;
2645                         if Cnt <= 0 then
2646                                 continue;
2647                 end else
2648                         continue;
2649
2650                 Bitmap := TBitmap.Create;
2651                 try
2652                         Bitmap.Canvas.Font.Assign(TreeView.Canvas.Font);
2653                         Bitmap.Canvas.Font.Style := [fsBold];
2654                         NodeWidth := Bitmap.Canvas.TextWidth(TreeView.Items[i].Text);
2655                 finally
2656                         Bitmap.Free;
2657                 end;
2658
2659                 NodeRect := TreeView.Items[i].DisplayRect(True);
2660
2661                 if IsBoardNode then
2662                         CntText := '(' + IntToStr(Cnt) + ')'
2663                 else if Cnt = 1 then
2664                         CntText := '(+)';
2665
2666
2667                 TextWidth := TreeView.Canvas.TextWidth(CntText);
2668
2669                 TextRect := Rect(NodeRect.Left + NodeWidth + 8,
2670                                                                                  NodeRect.Top,
2671                                                                                  NodeRect.Left + NodeWidth + TextWidth + 8,
2672                                                                                  NodeRect.Bottom);
2673                 DrawText(TreeView.Canvas.Handle,
2674                                                  PChar(CntText),
2675                                                  -1,
2676                                                  TextRect,
2677                                                  DT_SINGLELINE or DT_VCENTER);
2678         end;
2679         TreeViewCustomDrawItem(nil, nil, [], DefaultDraw);
2680 end;
2681
2682 procedure TGikoForm.TreeViewCustomDrawItem(Sender: TCustomTreeView;
2683         Node: TTreeNode; State: TCustomDrawState; var DefaultDraw: Boolean);
2684 var
2685         Board: TBoard;
2686         Category: TCategory;
2687         i: Integer;
2688 begin
2689         DefaultDraw := True;
2690
2691         if FTreeType = gttHistory then Exit;
2692
2693         TreeView.Canvas.Font.Style := [];
2694         if Node <> nil then begin
2695                 if TObject(Node.Data) is TCategory then begin
2696                         Category := TCategory(Node.Data);
2697                         for i := 0 to Category.Count - 1 do begin
2698                                 Board := Category.Items[i];
2699                                 if Board <> nil then begin
2700                                         if Board.UnRead > 0 then begin
2701                                                 TreeView.Canvas.Font.Style := [fsBold];
2702                                                 Break;
2703                                         end;
2704                                 end;
2705                         end;
2706                 end else if TObject(Node.Data) is TBoard then begin
2707                         Board := TBoard(Node.Data);
2708                         if Board.UnRead > 0 then
2709                                 TreeView.Canvas.Font.Style := [fsBold];
2710                 end;
2711         end;
2712 end;
2713
2714 procedure TGikoForm.TreeViewExpanded(Sender: TObject; Node: TTreeNode);
2715 begin
2716         TreeView.Invalidate;
2717
2718         if TObject(Node.Data) is TBBS2ch then begin
2719                 TBBS2ch(Node.Data).NodeExpand := True;
2720         end else if TObject(Node.Data) is TCategory then begin
2721                 TCategory(Node.Data).NodeExpand := True;
2722         end else if TObject(Node.Data) is TBoard then begin
2723                 TBoard(Node.Data).NodeExpand := True;
2724         end;
2725 end;
2726
2727 {procedure TGikoForm.CabinetPanelVisible(PanelVisible: Boolean);
2728 begin
2729         TreeSplitter.Visible := PanelVisible;
2730         CabinetPanel.Visible := PanelVisible;
2731         CabinetToolButton.Down := PanelVisible;
2732 end;}
2733
2734 procedure TGikoForm.ListViewAllSelect;
2735 begin
2736         ListView.SetFocus;
2737         ListView.SelectAll;
2738 end;
2739
2740 procedure TGikoForm.TreeViewDblClick(Sender: TObject);
2741 var
2742         Board: TBoard;
2743         ThreadItem: TThreadItem;
2744         APoint: TPoint;
2745         HitTest: THitTests;
2746 begin
2747         GetCursorPos(APoint);
2748         APoint := TreeView.ScreenToClient(APoint);
2749         HitTest := TreeView.GetHitTestInfoAt(APoint.x, APoint.y);
2750         if not (htOnLabel in HitTest) then Exit;
2751         if TreeView.Selected = nil then Exit;
2752
2753         if FTreeType = gtt2ch then begin
2754                 if not (TObject(TreeView.Selected.Data) is TBoard) then Exit;
2755                 Board := TBoard(TreeView.Selected.Data);
2756                 DownloadList(Board);
2757         end else if FTreeType = gttHistory then begin
2758                 if not (TObject(TreeView.Selected.Data) is TThreadItem) then Exit;
2759                 ThreadItem := TThreadItem(TreeView.Selected.Data);
2760                 DownloadContent(ThreadItem);
2761         end;
2762 end;
2763
2764 procedure TGikoForm.FavoriteTreeViewClick(Sender: TObject);
2765 begin
2766
2767         FavoriteClick( TObject( FavoriteTreeView.Selected ) );
2768
2769 end;
2770
2771 procedure TGikoForm.DownloadMsg(Sender: TObject; Item: TDownloadItem; Msg: string; Icon: TGikoMessageIcon);
2772 begin
2773         AddMessageList(Msg, nil, Icon);
2774 end;
2775
2776 procedure TGikoForm.DownloadEnd(Sender: TObject; Item: TDownloadItem);
2777 var
2778         ATitle: string;
2779         s: string;
2780 begin
2781         try
2782                 if Item.DownType = gdtBoard then
2783                         ATitle := Item.Board.Title
2784                 else
2785                         ATitle := Item.ThreadItem.Title;
2786                 if ATitle = '' then
2787                         ATitle := '\81i\96¼\8fÌ\95s\96¾\81j';
2788
2789                 if Item.State in [gdsComplete, gdsDiffComplete] then begin
2790                         //\90³\8fí\8fI\97¹
2791                         if Item.DownType = gdtBoard then begin
2792                                 //\94Â
2793                                 Item.SaveListFile;
2794                                 AddMessageList(ATitle + ' [\83X\83\8c\88ê\97\97\8eæ\93¾\8a®\97¹]', nil, gmiOK);
2795                                 if GetActiveList = Item.Board then
2796                                         SetActiveList(Item.Board);
2797                                 Item.Board.Modified := True;
2798                                 Item.Board.IsThreadDatRead := True;
2799                                 PlaySound('New');
2800                         end else if Item.DownType = gdtThread then begin
2801                                 //\83X\83\8c
2802                                 Item.SaveItemFile;
2803                                 Item.ThreadItem.NewArrival := True;
2804                                 if AddHistory(Item.ThreadItem) then begin
2805                                         if GetActiveContent = Item.ThreadItem then
2806                                                 InsertBrowserTab(Item.ThreadItem)
2807                                         else
2808                                                 InsertBrowserTab(Item.ThreadItem, False);
2809                                 end;
2810
2811                                 if Item.State = gdsComplete then begin
2812                                         PlaySound('New');
2813                                         AddMessageList(ATitle + ' [\83X\83\8c\8eæ\93¾\8a®\97¹]', nil, gmiOK);
2814                                 end else begin
2815                                         PlaySound('NewDiff');
2816                                         AddMessageList(ATitle + ' [\83X\83\8c\8d·\95ª\8eæ\93¾\8a®\97¹]', nil, gmiOK);
2817                                 end;
2818
2819                                 //\8f\84\89ñ\82 \82è\82Ì\8fê\8d\87\81\95\82P\82O\82O\82O\92´\82Í\8f\84\89ñ\8dí\8f\9c
2820                                 if (Item.ThreadItem.Round) and (Item.ThreadItem.Count > 1000) then begin
2821                                         Item.ThreadItem.Round := False;
2822                                         Item.ThreadItem.RoundName := '';
2823                                         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);
2824                                 end;
2825
2826                                 TreeView.Refresh;
2827                         end;
2828                         ListView.Refresh;
2829                 end else if Item.State = gdsNotModify then begin
2830                         //\95Ï\8dX\83i\83V
2831 {                       if (Item.DownType = gdtThread) and (AddHistory(Item.ThreadItem)) then begin
2832                                 //SetContent(Item.ThreadItem);
2833                                 InsertBrowserTab(Item.ThreadItem);
2834                         end;}
2835                         AddMessageList(ATitle + ' [\96¢\8dX\90V]', nil, gmiSAD);
2836                         PlaySound('NoChange');
2837                         Screen.Cursor := crDefault;
2838                 end else if Item.State = gdsAbort then begin
2839                         //\92\86\92f
2840                         AddMessageList(ATitle + ' [\92\86\92f]', nil, gmiSAD);
2841                 end else if Item.State = gdsError then begin
2842                         //\83G\83\89\81[
2843                         s := Item.ErrText;
2844                         if s <> '' then
2845                                 s := ':' + s;
2846                         AddMessageList(ATitle + ' [\83G\83\89\81[(' + IntToStr(Item.ResponseCode) + s + ')]', nil, gmiNG);
2847 //                      if Item.ResponseCode = 302 then
2848 //                              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);
2849                         PlaySound('Error');
2850                 end;
2851         finally
2852                 Item.Free;
2853                 Dec(FWorkCount);
2854                 if FWorkCount < 0 then FWorkCount := 0;
2855                 if FWorkCount = 0 then begin
2856                         try
2857                                 Animate.Active := False;
2858                         except
2859                                 Screen.Cursor := crDefault;
2860                         end;
2861                 end;
2862
2863         end;
2864 end;
2865
2866 procedure TGikoForm.WorkBegin(Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer; Number: Integer);
2867 begin
2868 //      SetProgressValue(Number, 0, AWorkCountMax);
2869 //      ProgressBar.Visible := True;
2870         ProgressBar.Position := 0;
2871         ProgressBar.Max := AWorkCountMax;
2872         StatusBar.Panels[1].Text := FDownloadTitle + ' - \83_\83E\83\93\83\8d\81[\83h\82ð\8aJ\8en\82µ\82Ü\82·';
2873         FDownloadMax := AWorkCountMax;
2874 end;
2875
2876 procedure TGikoForm.WorkEnd(Sender: TObject; AWorkMode: TWorkMode; Number: Integer);
2877 begin
2878 //      ProgressBar.Visible := False;
2879         ProgressBar.Position := 0;
2880 //      SetProgressValue(Number, 0);
2881         if FDownloadMax <> 0 then
2882                 StatusBar.Panels[1].Text := FDownloadTitle + ' - \83_\83E\83\93\83\8d\81[\83h\82ª\8a®\97¹\82µ\82Ü\82µ\82½';
2883 end;
2884
2885 procedure TGikoForm.Work(Sender: TObject; AWorkMode: TWorkMode; const AWorkCount: Integer; Number: Integer);
2886 begin
2887         ProgressBar.Position := AWorkCount;
2888 //      SetProgressValue(Number, AWorkCount);
2889         StatusBar.Panels[1].Text := FDownloadTitle + ' - \83_\83E\83\93\83\8d\81[\83h\92\86 (' + IntToStr(AWorkCount) + '/' + IntToStr(FDownloadMax) + ')';
2890 end;
2891
2892 {
2893 procedure TGikoForm.SetProgressValue(Number: Integer; Value: Integer; Max: Integer = -1);
2894 var
2895         Component: TComponent;
2896 begin
2897         Component := FindComponent('ProgressBar' + IntToStr(Number + 1));
2898         if Component <> nil then begin
2899                 if not (Component is TProgressBar) then Exit;
2900                 if Max <> -1 then
2901                         TProgressBar(Component).Max := Max;
2902                 TProgressBar(Component).Position := Value;
2903         end;
2904 end;
2905 }
2906
2907 procedure TGikoForm.AddMessageList(ACaption: string; AObject: TObject; Icon: TGikoMessageIcon);
2908 var
2909         ListItem: TListItem;
2910 begin
2911         MessageListView.Items.BeginUpdate;
2912         try
2913                 ListItem := MessageListView.Items.Add;
2914                 ListItem.Caption := ACaption;
2915                 ListItem.Data := AObject;
2916                 ListItem.MakeVisible(False);
2917                 case Icon of
2918                         gmiOK:   ListItem.ImageIndex := 0;
2919                         gmiSAD: ListItem.ImageIndex := 1;
2920                         gmiNG:   ListItem.ImageIndex := 2;
2921                         gmiWhat: ListItem.ImageIndex := 3;
2922                 end;
2923         finally
2924                 MessageListView.Items.EndUpdate;
2925         end;
2926 end;
2927
2928 {procedure TGikoForm.BrowserTabChange(Sender: TObject);
2929 var
2930         index: Integer;
2931         ThreadItem: TThreadItem;
2932 begin
2933         ThreadItem := GetActiveContent;
2934         if ThreadItem <> nil then begin
2935                 SetContent(ThreadItem);
2936         end;
2937 end;}
2938
2939 procedure TGikoForm.InsertBrowserTab(ThreadItem: TThreadItem; ActiveTab: Boolean = True);
2940 var
2941         i: Integer;
2942          //     OldIndex: Integer;
2943 begin
2944         if ThreadItem.IsLogFile then begin
2945                 for i := 0 to BrowserTab.Tabs.Count - 1 do begin
2946                         if TObject(BrowserTab.Tabs.Objects[i]) is TThreadItem then begin
2947                                 if TThreadItem(BrowserTab.Tabs.Objects[i]) = ThreadItem then begin
2948                                         if ActiveTab then begin
2949                                                 //OldIndex := BrowserTab.TabIndex;
2950                                                 BrowserTab.TabIndex := i;
2951 //                                              if OldIndex <> i then
2952                                                         BrowserTab.OnChange(nil);
2953                                                 BrowserTab.Repaint;
2954                                         end;
2955                                         Exit;
2956                                 end;
2957                         end;
2958                 end;
2959                 if GikoSys.Setting.BrowserTabAppend = gtaFirst then begin
2960                         BrowserTab.Tabs.Insert(0, GikoSys.GetShortName(ThreadItem.Title, 20));
2961                         BrowserTab.Tabs.Objects[0] := ThreadItem;
2962                         if ActiveTab then
2963                                 BrowserTab.TabIndex := 0;
2964                 end else begin
2965                         i := BrowserTab.Tabs.Add(GikoSys.GetShortName(ThreadItem.Title, 20));
2966                         BrowserTab.Tabs.Objects[i] := ThreadItem;
2967                         if ActiveTab then
2968                                 BrowserTab.TabIndex := i;
2969                 end;
2970                 if ActiveTab then begin
2971                         BrowserTab.OnChange(nil);
2972                         BrowserNullTab := nil;
2973                 end;
2974         end else begin
2975                 //OldIndex := BrowserTab.TabIndex;
2976                 BrowserNullTab := ThreadItem;
2977                 BrowserTab.TabIndex := -1;
2978 //              if OldIndex = -1 then
2979                 BrowserTab.OnChange(nil);
2980         end;
2981         BrowserTab.Repaint;
2982         if GikoSys.Setting.URLDisplay then
2983                 AddressComboBox.Text := GikoSys.GetURL(ThreadItem.ParentBoard.BBSID, ThreadItem.FileName);
2984 end;
2985
2986 procedure TGikoForm.SetContent(ThreadItem: TThreadItem);
2987 var
2988         BBSID: string;
2989         FileName: string;
2990         sTitle: string;
2991 //      HtmlName: string;
2992         doc: Variant;
2993         s: string;
2994         OldCursor: TCursor;
2995         //i: Integer;
2996 begin
2997         while (Browser.ReadyState <> READYSTATE_COMPLETE) and
2998                                 (Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin
2999                 Application.ProcessMessages;
3000         end;
3001
3002         if (FActiveContent <> nil) and (Assigned(Browser.Document)) then begin
3003                 try
3004                 try
3005                         Sleep(1);
3006                         Application.ProcessMessages;
3007                         FActiveContent.ScrollTop := OleVariant(IHTMLDocument2(Browser.Document)).Body.ScrollTop;
3008                 except
3009                         on E: Exception do
3010                                 MsgBox(Handle, E.Message, 'SetContent[<-ScrollTop]', 0);
3011                 end;
3012                 finally
3013                 end;
3014         end;
3015
3016         FActiveContent := ThreadItem;
3017
3018         if ThreadItem = nil then begin
3019                 Browser.Navigate(BLANK_HTML);
3020                 BrowserBoardNameLabel.Caption := '';
3021                 ItemBoardImage.Picture := nil;
3022                 BrowserNameLabel.Caption := '';
3023                 ItemImage.Picture := nil;
3024                 FActiveContent := nil;
3025                 Exit;
3026         end;
3027
3028         BBSID := ThreadItem.ParentBoard.BBSID;
3029         FileName := ThreadItem.FileName;
3030
3031         if GetCapture = ListView.Handle then
3032                 ReleaseCapture;
3033
3034                 //OldCursor := Screen.Cursor;
3035         Screen.Cursor := crHourGlass;
3036         try
3037                 if ThreadItem.UnRead then begin
3038                         ThreadItem.ParentBoard.UnRead := ThreadItem.ParentBoard.UnRead - 1;
3039                         if ThreadItem.ParentBoard.UnRead < 0 then ThreadItem.ParentBoard.UnRead := 0;
3040                         TreeView.Refresh;
3041                 end;
3042
3043                 if not ThreadItem.IsLogFile then begin
3044
3045                         if (not Assigned(Browser.Document)) then begin
3046                                 Browser.Navigate('about:blank');
3047                                 while (not Assigned(Browser.Document)) do begin
3048                                         Application.ProcessMessages;
3049                                 end;
3050                         end;
3051                         try
3052                                 s := '<HTML><BODY><CENTER>\82±\82Ì\83X\83\8c\83b\83h\82Í\8eæ\93¾\82µ\82Ä\82¢\82Ü\82¹\82ñ</CENTER></BODY></HTML>';
3053                                 doc := Browser.Document;
3054                                 doc.open;
3055                                 doc.charset := 'Shift_JIS';
3056                                 doc.Write(s);
3057                                 doc.Close;
3058                         finally
3059                         end;
3060                 end else begin
3061                                                 //Application.ProcessMessages;
3062                         GikoSys.CreateHTML2(Browser.Document, ThreadItem, sTitle);
3063                         while (Browser.ReadyState <> READYSTATE_COMPLETE) and
3064                                                 (Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin
3065                                 Application.ProcessMessages;
3066                         end;
3067                         //Sleep(1);
3068                         Application.ProcessMessages;
3069                         try
3070                                 if ThreadItem.UnRead then
3071                                         BrowserMovement('new');
3072                         except
3073                         end;
3074                         if (ThreadItem.ScrollTop <> 0) and (not ThreadItem.UnRead) then begin
3075                                 //i := 0;
3076                                 try
3077                                         try
3078                                                 doc := Browser.Document;
3079                                                 doc.Body.ScrollTop := ThreadItem.ScrollTop;
3080                                         except
3081                                                 on E: Exception do
3082                                                         MsgBox(Handle, E.Message, 'SetContent[ScrollTop<-]', 0);
3083                                         end;
3084                                 finally
3085                                 end;
3086                         end;
3087                         ThreadItem.UnRead := False;
3088                         ListView.Refresh;
3089                 end;
3090
3091                 BrowserBoardNameLabel.Caption := ThreadItem.ParentBoard.Title;
3092                 ItemIcon16.GetBitmap(4, ItemBoardImage.Picture.Bitmap);
3093                 BrowserNameLabel.Caption := ThreadItem.Title;
3094                 ItemImage.Picture := nil;
3095                 if ThreadItem.IsLogFile then
3096                         if ThreadItem.NewArrival then
3097                                 ItemImageList.GetBitmap(2, ItemImage.Picture.Bitmap)
3098                         else
3099                                 ItemImageList.GetBitmap(0, ItemImage.Picture.Bitmap)
3100                 else
3101                         ItemImageList.GetBitmap(1, ItemImage.Picture.Bitmap);
3102
3103                 ItemImage.Left := BrowserBoardNameLabel.Left + BrowserBoardNameLabel.Width + 8;
3104                 BrowserNameLabel.Left := ItemImage.Left + 20;
3105         finally
3106                                 //if Screen.Cursor <> crDefault then
3107                 //      Screen.Cursor := OldCursor
3108                                 //else
3109                                         Screen.Cursor := crDefault;
3110         end;
3111 end;
3112
3113 function TGikoForm.GetActiveContent: TThreadItem;
3114 var
3115         Index: Integer;
3116 begin
3117         Result := nil;
3118         if BrowserTab.TabIndex = -1 then begin
3119                 Result := BrowserNullTab;
3120                 Exit;
3121         end;
3122         Index := BrowserTab.TabIndex;
3123         if BrowserTab.Tabs.Objects[Index] is TThreadItem then
3124                 Result := TThreadItem(BrowserTab.Tabs.Objects[Index]);
3125
3126 //      Result := FActiveContent;
3127 end;
3128
3129 procedure TGikoForm.SetActiveList(Obj: TObject);
3130 var
3131         i: Integer;
3132 begin
3133         FActiveList := Obj;
3134
3135         if Obj is TBBS2ch then begin
3136                 for i := 0 to ListView.Columns.Count - 1 do
3137                         ListView.Column[i].Width := GikoSys.Setting.BBSColumnWidth[i];
3138                 SetCategoryListItem(TBBS2ch(Obj));
3139         end else if Obj is TCategory then begin
3140                 for i := 0 to ListView.Columns.Count - 1 do
3141                         ListView.Column[i].Width := GikoSys.Setting.CategoryColumnWidth[i];
3142                 SetBoardListItem(TCategory(Obj));
3143         end else if Obj is TBoard then begin
3144                 // SetThreadListItem \8cÄ\82Ô\82È\82ç\82¢\82ç\82È\82¢\82ñ\82\82á\82Ë\82¥\81H
3145                 {
3146                 for i := 0 to ListView.Columns.Count - 1 do
3147                         ListView.Column[i].Width := GikoSys.Setting.BoardColumnWidth[i];
3148                 }
3149                 SetThreadListItem(TBoard(Obj));
3150         end;
3151 end;
3152
3153
3154 //\81\9a\81\9a\83q\83\8d\83\86\83L\83\81\83\82
3155 //\82»\82Ì\82¤\82¿interface\82ð\8eg\82¤
3156 function TGikoForm.GetActiveList: TObject;
3157 begin
3158         Result := FActiveList;
3159 end;
3160
3161 procedure TGikoForm.SetListViewType(AViewType: TGikoViewType);
3162 begin
3163         SetListViewType(AViewType, '', False);
3164 end;
3165
3166 procedure TGikoForm.SetListViewType(AViewType: TGikoViewType; SelectText: string; KubetsuChk: Boolean);
3167 var
3168         Board: TBoard;
3169 begin
3170         if ActiveList is TBoard then begin
3171                 Board := TBoard(ActiveList);
3172
3173                 Board.ParentCategory.ParentBBS2ch.SelectText := SelectText;
3174                 Board.ParentCategory.ParentBBS2ch.KubetsuChk := KubetsuChk;
3175 //              Board.SelectText := SelectText;
3176 //              Board.KubetsuChk := KubetsuChk;
3177                 ViewType := AViewType;
3178                 SetActiveList(Board);
3179                 SetThreadListItem(Board);
3180         end;
3181 end;
3182
3183 procedure TGikoForm.ListViewCustomDraw(Sender: TCustomListView;
3184         const ARect: TRect; var DefaultDraw: Boolean);
3185 var
3186         s: string;
3187         p: TPoint;
3188 //      Board: TBoard;
3189 begin
3190         if ListView.Items.Count = 0 then begin
3191                 DefaultDraw := True;
3192
3193                 ListView.Canvas.Brush.Color := ListView.Color;
3194                 ListView.Canvas.FillRect(ARect);
3195
3196                 case ViewType of
3197                         gvtAll: begin
3198                                 ListView.Canvas.Font.Color := clWindowText;
3199                                 s := '\82±\82Ì\83r\83\85\81[\82É\82Í\83A\83C\83e\83\80\82ª\82 \82è\82Ü\82¹\82ñ\81B';
3200                         end;
3201                         gvtLog: begin
3202                                 ListView.Canvas.Font.Color := clBlue;
3203                                 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';
3204                         end;
3205                         gvtNew: begin
3206                                 ListView.Canvas.Font.Color := clGreen;
3207                                 s := '\82±\82Ì\83r\83\85\81[\82É\82Í\90V\92\85\83A\83C\83e\83\80\82ª\82 \82è\82Ü\82¹\82ñ\81B';
3208                         end;
3209                         gvtUser: begin
3210                                 ListView.Canvas.Font.Color := clNavy;
3211                                 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';
3212                                 if GetActiveList is TBoard then
3213                                         s := Format(s, [TBoard(GetActiveList).ParentCategory.ParentBBS2ch.SelectText]);
3214 //                                      SelectText]);
3215                         end;
3216                         else begin
3217                                 s := '';
3218                         end;
3219                 end;
3220
3221                 p := Point((ListView.ClientWidth div 2) - (ListView.Canvas.TextWidth(s) div 2),
3222                                                          (ListView.ClientHeight div 2) - (ListView.Canvas.TextHeight(s) div 2));
3223                 ListView.Canvas.TextOut(p.X, p.Y, s);
3224         end else begin
3225                 DefaultDraw := True;
3226         end;
3227 end;
3228
3229 procedure TGikoForm.DownloadList(Board: TBoard);
3230 var
3231         Item: TDownloadItem;
3232 begin
3233         if Board.Title = '' then
3234                 FDownloadTitle := '\81i\96¼\8fÌ\95s\96¾\81j'
3235         else
3236                 FDownloadTitle := Board.Title;
3237
3238         if not Board.IsThreadDatRead then
3239                 GikoSys.ReadSubjectFile(Board);
3240         Item := TDownloadItem.Create;
3241         try
3242                 Item.Board := Board;
3243                 Item.DownType := gdtBoard;
3244 //              AbortToolButton.Enabled := True;
3245 //              Animate.Active := True;
3246 //              FDownload.Add(Item);
3247                 FControlThread.AddItem(Item);
3248 //              Animate.Active := False;
3249 //              AbortToolButton.Enabled := False;
3250                 if FWorkCount = 0 then begin
3251                         try
3252                                 Animate.Active := True;
3253                         except
3254                         end;
3255                         Screen.Cursor := crAppStart;
3256                 end;
3257                 Inc(FWorkCount);
3258         finally
3259                 //Item.Free;
3260         end;
3261 end;
3262
3263 procedure TGikoForm.DownloadContent(ThreadItem: TThreadItem);
3264 var
3265         Item: TDownloadItem;
3266 begin
3267         if ThreadItem.Title = '' then
3268                 FDownloadTitle := '\81i\96¼\8fÌ\95s\96¾\81j'
3269         else
3270                 FDownloadTitle := ThreadItem.Title;
3271         Item := TDownloadItem.Create;
3272         try
3273                 Item.ThreadItem := ThreadItem;
3274                 Item.DownType := gdtThread;
3275 //              AbortToolButton.Enabled := True;
3276 //              Animate.Active := True;
3277 //              FDownload.Add(Item);
3278                 FControlThread.AddItem(Item);
3279 //              Animate.Active := False;
3280 //              AbortToolButton.Enabled := False;
3281                 if FWorkCount = 0 then begin
3282                         try
3283                                 Animate.Active := True;
3284                         except
3285                         end;
3286                         Screen.Cursor := crAppStart;
3287                 end;
3288                 Inc(FWorkCount);
3289         finally
3290 //              Item.Free;
3291         end;
3292 end;
3293
3294 procedure TGikoForm.PlaySound(SoundEventName: string);
3295 var
3296         FileName: string;
3297 begin
3298         FileName := GikoSys.Setting.FindSoundFileName(SoundEventName);
3299         if FileExists(FileName) then begin
3300                 if not sndPlaySound(PChar(FileName), SND_ASYNC or SND_NOSTOP) then begin
3301                         sndPlaySound(nil, SND_SYNC);
3302                         Application.ProcessMessages;
3303                         Sleep(10);
3304                         sndPlaySound(PChar(FileName), SND_ASYNC);
3305                 end;
3306         end;
3307 end;
3308
3309 function TGikoForm.AddHistory(ThreadItem: TThreadItem): Boolean;
3310 var
3311         i: Integer;
3312         Item: TThreadItem;
3313         Node: TTreeNode;
3314 begin
3315 //      Result := False;
3316 //      if (GetActiveContent = ThreadItem) and
3317 //                      (ThreadItem.Count <= ThreadItem.Kokomade) then
3318 //              Exit;
3319 //      if GetActiveContent = ThreadItem then
3320 //              Exit;
3321
3322         Result := True;
3323                 item := nil;
3324         for i := 0 to FHistoryList.Count - 1 do begin
3325                 if TObject(FHistoryList[i]) is TThreadItem then begin
3326                         Item := TThreadItem(FHistoryList[i]);
3327                         if Item = ThreadItem then begin
3328 //                              SetContent(ThreadItem);
3329                                 FHistoryList.Move(i, 0);
3330                                 Exit;
3331                         end;
3332                 end;
3333         end;
3334         FHistoryList.Add(ThreadItem);
3335 //      SetContent(ThreadItem);
3336
3337         if FTreeType = gttHistory then begin
3338                 Node := TreeView.Items.Add(nil, ThreadItem.Title);
3339                 if Item.NewArrival then begin
3340                         Node.ImageIndex := ITEM_ICON_THREADNEW1;
3341                         Node.SelectedIndex := ITEM_ICON_THREADNEW2;
3342                 end else begin
3343                         Node.ImageIndex := ITEM_ICON_THREADLOG1;
3344                         Node.SelectedIndex := ITEM_ICON_THREADLOG2;
3345                 end;
3346                 Node.Data := ThreadItem;
3347         end;
3348 end;
3349
3350 procedure TGikoForm.DeleteHistory(ThreadItem: TThreadItem);
3351 var
3352         i: Integer;
3353 begin
3354         for i := 0 to FHistoryList.Count - 1 do begin
3355                 if ThreadItem = FHistoryList.Items[i] then begin
3356                         FHistoryList.Delete(i);
3357                         Break;
3358                 end;
3359         end;
3360 end;
3361
3362 procedure TGikoForm.ClearHistory;
3363 begin
3364         FHistoryList.Clear;
3365 end;
3366
3367 procedure TGikoForm.Show2chTree;
3368 var
3369         i: Integer;
3370 begin
3371         GikoSys.Setting.CabinetIndex := 0;
3372
3373         FavoriteTreeView.Visible := False;
3374         FavoriteToolBar.Hide;
3375         TreeView.Visible := True;
3376
3377         CabinetSelectToolButton.Caption := '\82Q\82¿\82á\82ñ\82Ë\82é';
3378
3379         Cabinet2chAction.Checked := True;
3380         CabinetHistoryAction.Checked := False;
3381         CabinetFavoriteAction.Checked := False;
3382
3383         if FTreeType <> gtt2ch then begin
3384                 FTreeType := gtt2ch;
3385                 HistoryToolBar.Hide;
3386                 SetBoardTreeNode;
3387                 TreeView.TopItem.Expanded := True;                              //\83c\83\8a\81[\83g\83b\83v\8d\80\96Ú\82¾\82¯\82ð\8aJ\82­
3388                 //TreeView.Selected := TreeView.Items[0];               //\83c\83\8a\81[\82Ì\83g\83b\83v\8d\80\96Ú\82ð\91I\91ð\82·\82é
3389                 if GetActiveList = nil then
3390                         TreeView.Selected := TreeView.Items[0]
3391                 else begin
3392                         for i := 0 to TreeView.Items.Count - 1 do begin
3393                                 if TreeView.Items[i].Data = GetActiveList then
3394                                         TreeView.Selected := TreeView.Items[i];
3395                         end;
3396                 end;
3397         end;
3398 end;
3399
3400 procedure TGikoForm.ShowHistoryTree;
3401 begin
3402         GikoSys.Setting.CabinetIndex := 1;
3403
3404         FavoriteTreeView.Visible := False;
3405         TreeView.Visible := True;
3406
3407         Cabinet2chAction.Checked := False;
3408         CabinetHistoryAction.Checked := True;
3409         CabinetFavoriteAction.Checked := False;
3410         
3411         if FTreeType <> gttHistory then begin
3412                 FTreeType := gttHistory;
3413                 HistoryToolBar.Show;
3414                 FavoriteToolBar.Hide;
3415                 SetHistoryTreeNode;
3416                 CabinetSelectToolButton.Caption := '\97\9a\97ð\83\8a\83X\83g';
3417         end;
3418 end;
3419
3420 procedure TGikoForm.SetHistoryTreeNode;
3421 var
3422         i: Integer;
3423         Node: TTreeNode;
3424         Item: TThreadItem;
3425 begin
3426         TreeView.Items.BeginUpdate;
3427         try
3428                 TreeView.Items.Clear;
3429                 for i := 0 to FHistoryList.Count - 1 do begin
3430                         Item := TThreadItem(FHistoryList[i]);
3431                         Node := TreeView.Items.Add(nil, Item.Title);
3432
3433                         if Item.NewArrival then begin
3434                                 Node.ImageIndex := ITEM_ICON_THREADNEW1;
3435                                 Node.SelectedIndex := ITEM_ICON_THREADNEW2;
3436                         end else begin
3437                                 Node.ImageIndex := ITEM_ICON_THREADLOG1;
3438                                 Node.SelectedIndex := ITEM_ICON_THREADLOG2;
3439                         end;
3440                         Node.Data := Item;
3441                 end;
3442         finally
3443                 TreeView.Items.EndUpdate;
3444         end;
3445 end;
3446
3447 procedure TGikoForm.SelectTreeNode(Item: TObject; CallEvent: Boolean);
3448 var
3449         ChangeEvent: TTVChangedEvent;
3450         ChangingEvent: TTVChangingEvent;
3451         i: Integer;
3452 begin
3453         ChangeEvent := nil;
3454                 ChangingEvent := nil;
3455
3456         if not CallEvent then begin
3457                 ChangeEvent := TreeView.OnChange;
3458                 ChangingEvent := TreeView.OnChanging;
3459         end;
3460         try
3461                 if not CallEvent then begin
3462                         TreeView.OnChange := nil;
3463                         TreeView.OnChanging := nil;
3464                 end;
3465                 Application.ProcessMessages;
3466                 for i := 0 to TreeView.Items.Count - 1 do begin
3467                         if TreeView.Items[i].Data = Item then begin
3468                                 TreeView.Items[i].Selected := True;
3469                                 if CallEvent then
3470                                         TreeViewChange(TreeView, TreeView.Items[i]);
3471                                 Break;
3472                         end;
3473                 end;
3474                 Application.ProcessMessages;
3475         finally
3476                 if not CallEvent then begin
3477                         TreeView.OnChange := ChangeEvent;
3478                         TreeView.OnChanging := ChangingEvent;
3479                 end;
3480         end;
3481 end;
3482
3483 procedure TGikoForm.ListViewMouseDown(Sender: TObject;
3484         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
3485 //var
3486 //      t: Cardinal;
3487 begin
3488 {       if ssDouble in Shift then begin
3489                 DoubleClickOccurred[Button] := True;
3490         end else begin
3491                 DoubleClickOccurred[Button] := False;
3492                 t := GetTickCount+GetDoubleClickTime;
3493                 while GetTickCount < t do begin
3494                         Application.ProcessMessages;
3495                         if DoubleClickOccurred[Button] then
3496                                 Exit;
3497                 end;
3498         end;
3499
3500         if ssDouble in Shift then begin
3501                 case Button of
3502                         mbLeft: ListDoubleClick;
3503 //                      mbMiddle: ;
3504 //                      mbRight:        ;
3505                 end;
3506         end else begin
3507                 case Button of
3508                         mbLeft: ListClick;
3509 //                      mbMiddle: ;
3510 //                      mbRight:        ;
3511                 end;
3512         end;}
3513 end;
3514
3515 procedure TGikoForm.ListClick;
3516 var
3517         ListItem: TListItem;
3518         ThreadItem: TThreadItem;
3519 begin
3520         if ListView.SelCount <> 1 then Exit;
3521         ListItem := ListView.Selected;
3522         if ListItem = nil then Exit;
3523         if not (TObject(ListItem.Data) is TThreadItem) then Exit;
3524
3525         ThreadItem := TThreadItem(ListItem.Data);
3526         if ThreadItem.IsLogFile then begin
3527 //              if AddHistory(ThreadItem) then
3528 //              SetContent(ThreadItem);
3529                 InsertBrowserTab(ThreadItem);
3530                 ListView.UpdateItems(ListItem.Index, ListItem.Index);
3531         end else begin
3532 //              SetContent(ThreadItem);
3533                 InsertBrowserTab(ThreadItem);
3534         end;
3535 end;
3536
3537 procedure TGikoForm.ListDoubleClick;
3538 var
3539         ThreadItem: TThreadItem;
3540 begin
3541 //      PostMessage(ListView.Handle, WM_CANCELMODE, 0, 0);
3542
3543         if ListView.Selected = nil then Exit;
3544 //      if TreeView.Selected = nil then Exit;
3545
3546         if TObject(ListView.Selected.Data) is TCategory then begin
3547                 SelectTreeNode(ListView.Selected.Data, True);
3548 //              TreeView.Selected.Expanded := True;
3549 //              TreeView.Selected.Item[ListView.Selected.Index].Selected := True;
3550                 //TreeViewChange(nil, TreeView.Selected);
3551         end else if TObject(ListView.Selected.Data) is TBoard then begin
3552                 SelectTreeNode(ListView.Selected.Data, True);
3553 //              TreeView.Selected.Expanded := True;
3554 //              TreeView.Selected.Item[ListView.Selected.Index].Selected := True;
3555                 //TreeViewChange(nil, TreeView.Selected);
3556         end else if TObject(ListView.Selected.Data) is TThreadItem then begin
3557                 //if TObject(ListView.Selected.Data) is TThreadItem then begin
3558                         ThreadItem := TThreadItem(ListView.Selected.Data);
3559                         DownloadContent(ThreadItem);
3560                 //end;
3561         end;
3562 end;
3563
3564 procedure TGikoForm.BrowserMovement(AName: string);
3565 var
3566         nm: OleVariant;
3567 begin
3568 //      OleVariant(Browser.Document).parentWindow.location.hash := AName;
3569         nm := AName;
3570         try
3571                 OleVariant(Browser.Document as IHTMLDocument2).body.scrollTop :=
3572                                 OleVariant(Browser.Document as IHTMLDocument2).anchors.item(nm).offsetTop;
3573         except
3574         end;
3575 end;
3576
3577 procedure TGikoForm.TreeViewCollapsed(Sender: TObject; Node: TTreeNode);
3578 begin
3579         if TObject(Node.Data) is TBBS2ch then begin
3580                 TBBS2ch(Node.Data).NodeExpand := False;
3581         end else if TObject(Node.Data) is TCategory then begin
3582                 TCategory(Node.Data).NodeExpand := False;
3583         end else if TObject(Node.Data) is TBoard then begin
3584                 TBoard(Node.Data).NodeExpand := False;
3585         end;
3586 end;
3587
3588 procedure TGikoForm.MessageListViewResize(Sender: TObject);
3589 begin
3590 //      MessageListView.Column[0].Width := MessageListView.ClientWidth - 16;
3591 end;
3592
3593 procedure TGikoForm.SelectListItem(List: TList);
3594 var
3595 //      TmpTreeNode: TTreeNode;
3596         TmpListItem: TListItem;
3597 begin
3598         List.Clear;
3599         TmpListItem := ListView.Selected;
3600         while TmpListItem <> nil do begin
3601                 List.Add(TmpListItem.Data);
3602                 TmpListItem := ListView.GetNextItem(TmpListItem, sdAll, [isSelected]);
3603         end;
3604 end;
3605
3606 procedure TGikoForm.ExitActionExecute(Sender: TObject);
3607 begin
3608         Close;
3609 end;
3610
3611 procedure TGikoForm.AllSelectActionExecute(Sender: TObject);
3612 begin
3613         ListViewAllSelect;
3614 end;
3615
3616 procedure TGikoForm.StdToolBarVisibleActionExecute(Sender: TObject);
3617 var
3618         CoolBand: TCoolBand;
3619 begin
3620         CoolBand := GetCoolBand(MainCoolBar, StdToolBar);
3621         if CoolBand = nil then
3622                 Exit;
3623         GikoSys.Setting.StdToolBarVisible := StdToolBarVisibleAction.Checked;
3624         CoolBand.Visible := GikoSys.Setting.StdToolBarVisible;
3625 //      StdToolBar.Visible := StdToolBarVisibleAction.Checked;
3626 //      AnimePanel.Visible := StdToolBar.Visible or ListToolBar.Visible;
3627
3628         //StdToolBarVisibleAction.Checked := GikoSys.Setting.StdToolBarVisible;
3629         StdToolBarVisiblePMenu.Checked := GikoSys.Setting.StdToolBarVisible;
3630 end;
3631
3632 procedure TGikoForm.AddressBarVisibleActionExecute(Sender: TObject);
3633 var
3634         CoolBand: TCoolBand;
3635 begin
3636         CoolBand := GetCoolBand(MainCoolBar, AddressToolBar);
3637         if CoolBand = nil then
3638                 Exit;
3639         GikoSys.Setting.AddressBarVisible := AddressBarVisibleAction.Checked;
3640         CoolBand.Visible := GikoSys.Setting.AddressBarVisible;
3641         //AddressBarVisibleAction.Checked := GikoSys.Setting.AddressBarVisible;
3642         AddressToolBarVisiblePMenu.Checked := GikoSys.Setting.AddressBarVisible;
3643 end;
3644
3645 procedure TGikoForm.LinkBarVisibleActionExecute(Sender: TObject);
3646 var
3647         CoolBand: TCoolBand;
3648 begin
3649         CoolBand := GetCoolBand(MainCoolBar, LinkToolBar);
3650         if CoolBand = nil then
3651                 Exit;
3652         GikoSys.Setting.LinkBarVisible := LinkBarVisibleAction.Checked;
3653         CoolBand.Visible := GikoSys.Setting.LinkBarVisible;
3654                                 //LinkBarVisibleAction.Checked := GikoSys.Setting.LinkBarVisible;
3655                                 LinkToolBarVisiblePMenu.Checked := GikoSys.Setting.LinkBarVisible;
3656 end;
3657
3658 procedure TGikoForm.ListToolBarVisibleActionExecute(Sender: TObject);
3659 var
3660         CoolBand: TCoolBand;
3661 begin
3662         CoolBand := GetCoolBand(ListCoolBar, ListToolBar);
3663         if CoolBand = nil then
3664                 Exit;
3665         CoolBand.Visible := ListToolBarVisibleAction.Checked;
3666 //      ListToolBar.Visible := ListToolBarVisibleAction.Checked;
3667 //      AnimePanel.Visible := StdToolBar.Visible or ListToolBar.Visible;
3668         GikoSys.Setting.ListToolBarVisible := ListToolBarVisibleAction.Checked;
3669 end;
3670
3671 procedure TGikoForm.ListNameBarVisibleActionExecute(Sender: TObject);
3672 var
3673         CoolBand: TCoolBand;
3674 begin
3675         CoolBand := GetCoolBand(ListCoolBar, ListNameToolBar);
3676         if CoolBand = nil then
3677                 Exit;
3678         CoolBand.Visible := ListNameBarVisibleAction.Checked;
3679         GikoSys.Setting.ListNameBarVisible := ListNameBarVisibleAction.Checked;
3680 end;
3681
3682 procedure TGikoForm.BrowserToolBarVisibleActionExecute(Sender: TObject);
3683 var
3684         CoolBand: TCoolBand;
3685 begin
3686         CoolBand := GetCoolBand(BrowserCoolBar, BrowserToolBar);
3687         if CoolBand = nil then
3688                 Exit;
3689         CoolBand.Visible := BrowserToolBarVisibleAction.Checked;
3690 //      BrowserToolBar.Visible := BrowserToolBarVisibleAction.Checked;
3691         GikoSys.Setting.BrowserToolBarVisible := BrowserToolBarVisibleAction.Checked;
3692 end;
3693
3694 procedure TGikoForm.BrowserNameBarVisibleActionExecute(Sender: TObject);
3695 var
3696         CoolBand: TCoolBand;
3697 begin
3698         CoolBand := GetCoolBand(BrowserCoolBar, BrowserNameToolBar);
3699         if CoolBand = nil then
3700                 Exit;
3701         CoolBand.Visible := BrowserNameBarVisibleAction.Checked;
3702         GikoSys.Setting.BrowserNameBarVisible := BrowserNameBarVisibleAction.Checked;
3703 end;
3704
3705 procedure TGikoForm.MsgBarVisibleActionExecute(Sender: TObject);
3706 begin
3707         MessageSplitter.Visible := MsgBarVisibleAction.Checked;
3708         MessagePanel.Top := MessageSplitter.Top + MessageSplitter.Height;
3709         MessageSplitter.Top := MessagePanel.Top + 1;
3710         MessagePanel.Visible := MsgBarVisibleAction.Checked;
3711         GikoSys.Setting.MessageBarVisible := MsgBarVisibleAction.Checked;
3712 end;
3713
3714 procedure TGikoForm.StatusBarVisibleActionExecute(Sender: TObject);
3715 begin
3716         StatusBar.Visible := StatusBarVisibleAction.Checked;
3717         GikoSys.Setting.StatusBarVisible := StatusBarVisibleAction.Checked;
3718 end;
3719
3720 procedure TGikoForm.IconStyleExecute(Sender: TObject);
3721 begin
3722         case ListView.ViewStyle of
3723                 vsIcon: SmallIconAction.Execute;
3724                 vsSmallIcon: ListIconAction.Execute;
3725                 vsList: DetailIconAction.Execute;
3726                 vsReport: LargeIconAction.Execute;
3727         end;
3728 end;
3729
3730 procedure TGikoForm.LargeIconActionExecute(Sender: TObject);
3731 begin
3732         ListView.ViewStyle := vsIcon;
3733         LargeIconAction.Checked := True;
3734 end;
3735
3736 procedure TGikoForm.SmallIconActionExecute(Sender: TObject);
3737 begin
3738         ListView.ViewStyle := vsSmallIcon;
3739         SmallIconAction.Checked := True;
3740 end;
3741
3742 procedure TGikoForm.ListIconActionExecute(Sender: TObject);
3743 begin
3744         ListView.ViewStyle := vsList;
3745         ListIconAction.Checked := True;
3746 end;
3747
3748 procedure TGikoForm.DetailIconActionExecute(Sender: TObject);
3749 begin
3750         ListView.ViewStyle := vsReport;
3751         DetailIconAction.Checked := True;
3752 end;
3753
3754 procedure TGikoForm.SearchActionExecute(Sender: TObject);
3755 var
3756         chk: TObject;
3757 begin
3758
3759         if FSearchDialog = nil then begin
3760                 if (GikoForm.GetActiveList is TCategory) or (GikoForm.GetActiveList is TBoard) then
3761                         chk := GikoForm.GetActiveList
3762                 else
3763                         chk := nil;
3764
3765                 FSearchDialog := TSearchDialog.Create(Self, chk);
3766                 FSearchDialog.SearchComboBox.Items.Assign( GikoSys.Setting.SelectTextList );
3767         end;
3768
3769         try
3770                 FSearchDialog.Show;
3771         except
3772         end;
3773         
3774 end;
3775
3776 procedure TGikoForm.OptionActionExecute(Sender: TObject);
3777 var
3778         Dlg: TOptionDialog;
3779 begin
3780         Dlg := TOptionDialog.Create(Self);
3781         try
3782                 Dlg.ShowModal;
3783         finally
3784                 Dlg.Release;
3785         end;
3786 end;
3787
3788 procedure TGikoForm.GikoNaviWebPageActionExecute(Sender: TObject);
3789 const
3790         URL_GIKONAVI: string = 'http://gikonavi.sourceforge.jp/';
3791 begin
3792         GikoSys.OpenBrowser(URL_GIKONAVI, gbtAuto);
3793 end;
3794
3795 procedure TGikoForm.MonazillaWebPageActionExecute(Sender: TObject);
3796 const
3797         URL_MONAZILLA: string = 'http://www.monazilla.org/';
3798 begin
3799         GikoSys.OpenBrowser(URL_MONAZILLA, gbtAuto);
3800 end;
3801
3802 procedure TGikoForm.BBS2chWebPageActionExecute(Sender: TObject);
3803 const
3804         URL_2ch: string = 'http://www.2ch.net/';
3805 begin
3806         GikoSys.OpenBrowser(URL_2ch, gbtAuto);
3807 end;
3808
3809 procedure TGikoForm.GikoFolderOpenActionExecute(Sender: TObject);
3810 begin
3811 //      GikoSys.OpenBrowser(GikoSys.GetAppDir, gbtIE);
3812         GikoSys.CreateProcess('explorer.exe', '/e,"' + GikoSys.GetAppDir + '"');
3813 end;
3814
3815 procedure TGikoForm.AboutActionExecute(Sender: TObject);
3816 var
3817         Dlg: TAboutDialog;
3818 begin
3819         Dlg := TAboutDialog.Create(Self);
3820         try
3821                 Dlg.ShowModal;
3822         finally
3823                 Dlg.Release;
3824         end;
3825 end;
3826
3827 procedure TGikoForm.Cabinet2chActionExecute(Sender: TObject);
3828 begin
3829         Show2chTree;
3830 end;
3831
3832 procedure TGikoForm.CabinetHistoryActionExecute(Sender: TObject);
3833 begin
3834         ShowHistoryTree;
3835 end;
3836
3837 procedure TGikoForm.CabinetVisibleActionExecute(Sender: TObject);
3838 begin
3839         TreeSplitter.Visible := CabinetVisibleAction.Checked;
3840         CabinetPanel.Visible := CabinetVisibleAction.Checked;
3841 end;
3842
3843 procedure TGikoForm.AllItemActionExecute(Sender: TObject);
3844 begin
3845         try
3846                 if ViewType <> gvtAll then
3847                         SetListViewType(gvtAll);
3848                 AllItemAction.Checked := True;
3849                 LogItemAction.Checked := False;
3850                 NewItemAction.Checked := False;
3851                 //SelectItemAction.Checked := False;
3852                 // SelectComboBox \82Ì\97\9a\97ð\82ð\8dX\90V\82µ\82Ä\82¨\82­
3853                 ModifySelectList;
3854                 // SelectComboBox \82Ì\92l\82ð\83N\83\8a\83A
3855                 if SelectComboBox.Parent <> nil then begin
3856                         SelectComboBox.Text := SELECTCOMBOBOX_NAME;
3857                         SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
3858                         ListView.SetFocus;
3859                 end;
3860         except
3861         end;
3862 end;
3863
3864 procedure TGikoForm.LogItemActionExecute(Sender: TObject);
3865 begin
3866         try
3867                 if ViewType <> gvtLog then
3868                         SetListViewType(gvtLog);
3869                 AllItemAction.Checked := False;
3870                 LogItemAction.Checked := True;
3871                 NewItemAction.Checked := False;
3872                 //SelectItemAction.Checked := False;
3873                 // SelectComboBox \82Ì\97\9a\97ð\82ð\8dX\90V\82µ\82Ä\82¨\82­
3874                 ModifySelectList;
3875                 // SelectComboBox \82Ì\92l\82ð\83N\83\8a\83A
3876                 if SelectComboBox.Parent <> nil then begin
3877                         SelectComboBox.Text := SELECTCOMBOBOX_NAME;
3878                         SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
3879                         ListView.SetFocus;
3880                 end;
3881         except
3882         end;
3883 end;
3884
3885 procedure TGikoForm.NewItemActionExecute(Sender: TObject);
3886 begin
3887         try
3888
3889                 if ViewType <> gvtNew then
3890                         SetListViewType(gvtNew);
3891                 AllItemAction.Checked := False;
3892                 LogItemAction.Checked := False;
3893                 NewItemAction.Checked := True;
3894                 //SelectItemAction.Checked := False;
3895                 // SelectComboBox \82Ì\97\9a\97ð\82ð\8dX\90V\82µ\82Ä\82¨\82­
3896                 ModifySelectList;
3897                 // SelectComboBox \82Ì\92l\82ð\83N\83\8a\83A
3898                 if SelectComboBox.Parent <> nil then begin
3899                         SelectComboBox.Text := SELECTCOMBOBOX_NAME;
3900                         SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
3901                         ListView.SetFocus;
3902                 end;
3903         except
3904         end;
3905 end;
3906
3907 procedure TGikoForm.SelectItemActionExecute(Sender: TObject);
3908 var
3909         idx: Integer;
3910         Dlg: TListSelectDialog;
3911 begin
3912         try
3913                 if SelectComboBox.Parent <> nil then begin
3914                         if SelectComboBox.Left + SelectComboBox.Width < ListToolBar.Width then begin
3915                                 // SelectComboBox \82ª\82 \82é\8fê\8d\87\82Í\83t\83H\81[\83J\83X\82ð\88Ú\82·
3916                                 SelectComboBox.SetFocus;
3917                                 exit;
3918                         end;
3919                 end;
3920         except
3921         end;
3922
3923         if SelectComboBox.Text = SELECTCOMBOBOX_NAME then begin
3924                 SelectComboBox.Text := '';
3925                 SelectComboBox.Color := clWindow;
3926         end;
3927
3928         AllItemAction.Checked := False;
3929         LogItemAction.Checked := False;
3930         NewItemAction.Checked := False;
3931         //SelectItemAction.Checked := True;
3932         ModifySelectList;
3933         Dlg := TListSelectDialog.Create(Self);
3934         try
3935                 Dlg.SelectComboBox.Items.Assign(GikoSys.Setting.SelectTextList);
3936                 Dlg.SelectComboBox.Text := SelectComboBox.Text;
3937                 Dlg.ShowModal;
3938                 if Dlg.ModalResult = mrCancel then begin
3939                         if Length( SelectComboBox.Text ) = 0 then begin
3940                                 AllItemAction.Checked := True;
3941                                 SelectComboBox.Text := SELECTCOMBOBOX_NAME;
3942                                 SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
3943                         end;
3944
3945                         if GetActiveList is TBoard then
3946                                 SetListViewType(gvtUser, TBoard(GetActiveList).ParentCategory.ParentBBS2ch.SelectText , Dlg.KubetsuCheckBox.Checked);
3947                 end else begin
3948                         idx := GikoSys.Setting.SelectTextList.IndexOf(Dlg.SelectComboBox.Text);
3949                         if idx <> -1 then
3950                                 GikoSys.Setting.SelectTextList.Delete(idx);
3951                         GikoSys.Setting.SelectTextList.Insert(0, Dlg.SelectComboBox.Text);
3952                         while Dlg.SelectComboBox.Items.Count > 100 do begin
3953                                 Dlg.SelectComboBox.Items.Delete(Dlg.SelectComboBox.Items.Count - 1);
3954                         end;
3955
3956                         if Length( Dlg.SelectComboBox.Text ) = 0 then begin
3957                                 SelectComboBox.Text := SELECTCOMBOBOX_NAME;
3958                                 SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
3959                         end else begin
3960                                 SelectComboBox.Text := Dlg.SelectComboBox.Text;
3961                                 SelectComboBox.Color := clWindow;
3962                         end;
3963                         SetListViewType(gvtUser, Dlg.SelectComboBox.Text, Dlg.KubetsuCheckBox.Checked);
3964                 end;
3965         finally
3966                 Dlg.Release;
3967         end;
3968 end;
3969
3970 procedure TGikoForm.ListNumberVisibleActionExecute(Sender: TObject);
3971 begin
3972         GikoSys.Setting.ListViewNo := ListNumberVisibleAction.Checked;
3973         ListView.Refresh;
3974 end;
3975
3976 procedure TGikoForm.UpFolderActionExecute(Sender: TObject);
3977 begin
3978         if GetActiveList is TBoard then begin
3979                 if FTreeType = gtt2ch then
3980                         SelectTreeNode(TBoard(GetActiveList).ParentCategory, True);
3981                 //SetActiveList(TBoard(GetActiveList).ParentCategory);
3982         end else if GetActiveList is TCategory then begin
3983                 if FTreeType = gtt2ch then
3984                         SelectTreeNode(TCategory(GetActiveList).ParentBBS2ch, True);
3985                 //SetActiveList(TCategory(GetActiveList).ParentBBS2ch);
3986         end;
3987 //      if TreeView.Selected = nil then Exit;
3988 //      if TreeView.Selected.Level = 0 then Exit;
3989 //      TreeView.Selected.Parent.Selected := True;
3990 end;
3991
3992 procedure TGikoForm.RoundActionExecute(Sender: TObject);
3993 var
3994         Dlg: TRoundDialog;
3995 begin
3996         Dlg := TRoundDialog.Create(Self);
3997         try
3998                 Dlg.ShowModal;
3999         finally
4000                 Dlg.Release;
4001         end;
4002 end;
4003
4004 procedure TGikoForm.StopActionExecute(Sender: TObject);
4005 begin
4006         FControlThread.DownloadAbort;
4007         if FWorkCount <> 0 then FWorkCount := 0;
4008         try
4009                 Animate.Active := False;
4010         except
4011         end;
4012         Screen.Cursor := crDefault;
4013 end;
4014
4015 procedure TGikoForm.MsgBarCloseActionExecute(Sender: TObject);
4016 begin
4017 //      MessagePanel.Visible := False;
4018 //      MessageSplitter.Visible := False;
4019 //      MsgBarVisibleAction.Checked := False;
4020         MsgBarVisibleAction.Execute;
4021 end;
4022
4023 procedure TGikoForm.BrowserMaxActionExecute(Sender: TObject);
4024 begin
4025         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
4026                 case GikoSys.Setting.ListWidthState of
4027                         glsMax: begin
4028                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
4029                                 ViewPanel.Width := FBrowserSizeWidth;
4030                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
4031                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
4032                                 GikoSys.Setting.ListWidthState := glsNormal;
4033                         end;
4034                         glsMin, glsNormal: begin
4035                                 //\8dÅ\91å\95\\8e¦\82É\82·\82é
4036                                 if GikoSys.Setting.ListWidthState = glsNormal then
4037                                         FBrowserSizeWidth := ViewPanel.Width;
4038                                 ViewPanel.Width := 1;
4039                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
4040                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
4041                                 GikoSys.Setting.ListWidthState := glsMax;
4042                         end;
4043                 end;
4044         end else begin
4045                 case GikoSys.Setting.ListHeightState of
4046                         glsMax: begin
4047                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
4048                                 ViewPanel.Height := FBrowserSizeHeight;
4049                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
4050                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
4051                                 GikoSys.Setting.ListHeightState := glsNormal;
4052                         end;
4053                         glsMin, glsNormal: begin
4054                                 //\8dÅ\91å\95\\8e¦\82É\82·\82é
4055                                 if GikoSys.Setting.ListHeightState = glsNormal then
4056                                         FBrowserSizeHeight := ViewPanel.Height;
4057                                 ViewPanel.Height := 1;
4058                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
4059                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
4060                                 GikoSys.Setting.ListHeightState := glsMax;
4061                         end;
4062                 end;
4063         end;
4064 //      Mouse.CursorPos := BrowserSizeButton.ClientToScreen(Point(
4065 //                                                                                              System.Round(BrowserToolBar.ButtonWidth div 2),
4066 //                                                                                              System.Round(BrowserToolBar.ButtonHeight div 2)));
4067 end;
4068
4069 procedure TGikoForm.BrowserMinActionExecute(Sender: TObject);
4070 begin
4071         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
4072                 case GikoSys.Setting.ListWidthState of
4073                         glsMax, glsNormal: begin
4074                                 //\8dÅ\8f¬\95\\8e¦\82É\82·\82é
4075                                 if GikoSys.Setting.ListWidthState = glsNormal then
4076                                         FBrowserSizeWidth := ViewPanel.Width;
4077                                 ViewPanel.Width := ThreadMainPanel.Width - 80;
4078                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
4079                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
4080                                 GikoSys.Setting.ListWidthState := glsMin;
4081                         end;
4082                         glsMin: begin
4083                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
4084                                 ViewPanel.Width := FBrowserSizeWidth;
4085                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
4086                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
4087                                 GikoSys.Setting.ListWidthState := glsNormal;
4088                         end;
4089                 end;
4090         end else begin
4091                 case GikoSys.Setting.ListHeightState of
4092                         glsMax, glsNormal: begin
4093                                 //\8dÅ\8f¬\95\\8e¦\82É\82·\82é
4094                                 if GikoSys.Setting.ListHeightState = glsNormal then
4095                                         FBrowserSizeHeight := ViewPanel.Height;
4096                                 ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
4097                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
4098                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
4099                                 GikoSys.Setting.ListHeightState := glsMin;
4100                         end;
4101                         glsMin: begin
4102                                 //\92Ê\8fí\95\\8e¦\82É\82·\82é
4103                                 ViewPanel.Height := FBrowserSizeHeight;
4104                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
4105                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
4106                                 GikoSys.Setting.ListHeightState := glsNormal;
4107                         end;
4108                 end;
4109         end;
4110 end;
4111
4112 procedure TGikoForm.ScrollTopActionExecute(Sender: TObject);
4113 begin
4114         BrowserMovement('top');
4115 end;
4116
4117 procedure TGikoForm.ScrollLastActionExecute(Sender: TObject);
4118 begin
4119         BrowserMovement('bottom');
4120 end;
4121
4122 procedure TGikoForm.ScrollNewActionExecute(Sender: TObject);
4123 begin
4124         BrowserMovement('new');
4125 end;
4126
4127 procedure TGikoForm.ScrollKokoActionExecute(Sender: TObject);
4128 begin
4129         BrowserMovement('koko');
4130 end;
4131
4132 procedure TGikoForm.EditorActionExecute(Sender: TObject);
4133 var
4134         Editor: TEditorForm;
4135         Item: TThreadItem;
4136         msg: string;
4137 begin
4138         Item := GetActiveContent;
4139         if Item = nil then Exit;
4140
4141         if Item.Count >= 1000 then begin
4142                 msg := '\82±\82Ì\83X\83\8c\83b\83h\82Í\83\8c\83X\90\94\82ª\82P\82O\82O\82O\82ð\92´\82¦\82Ä\82¢\82é\82Ì\82Å\8f\91\8d\9e\82Ý\8fo\97\88\82Ü\82¹\82ñ\81B' + #13#10
4143                                  + '\90V\83X\83\8c\83b\83h\82ð\92T\82µ\82Ä\82­\82¾\82³\82¢\81B';
4144                 if MsgBox(Handle, msg, '\8cx\8d\90', MB_YESNO or MB_ICONEXCLAMATION) <> 7 then begin
4145                                                 Exit;
4146                                 end;
4147         end;
4148         Editor := TEditorForm.Create(Self);
4149         Editor.SetThreadItem(Item);
4150         Editor.Show;
4151         Editor.BodyEdit.SetFocus;
4152 end;
4153
4154 procedure TGikoForm.IEActionExecute(Sender: TObject);
4155 begin
4156         ShowThreadAction.Execute;
4157 end;
4158
4159 procedure TGikoForm.ShowThreadActionExecute(Sender: TObject);
4160 var
4161         ThreadItem: TThreadItem;
4162 begin
4163         ThreadItem := GetActiveContent;
4164         if ThreadItem = nil then Exit;
4165         GikoSys.OpenBrowser(ThreadItem.URL, gbtAuto);
4166 end;
4167
4168 procedure TGikoForm.ShowBoardActionExecute(Sender: TObject);
4169 var
4170         ThreadItem: TThreadItem;
4171 begin
4172         ThreadItem := GetActiveContent;
4173         if ThreadItem = nil then Exit;
4174         GikoSys.OpenBrowser(ThreadItem.URL, gbtAuto);
4175 end;
4176
4177 //(Thread)URL\82ð\83R\83s\81[
4178 procedure TGikoForm.URLCopyActionExecute(Sender: TObject);
4179 var
4180         s: string;
4181 begin
4182         s := '';
4183         if TObject(GetActiveContent) is TBoard then
4184                 s := s + TBoard(GetActiveContent).URL + #13#10
4185         else if TObject(GetActiveContent) is TThreadItem then
4186                 s := s + TThreadItem(GetActiveContent).URL + #13#10;
4187         if s <> '' then
4188                 Clipboard.AsText := s;
4189 end;
4190
4191 //(Thread)\83X\83\8c\83b\83h\96¼\82ð\83R\83s\81[
4192 procedure TGikoForm.NameCopyActionExecute(Sender: TObject);
4193 var
4194         s: string;
4195 begin
4196         s := '';
4197         if TObject(GetActiveContent) is TBoard then
4198                 s := s + TBoard(GetActiveContent).Title + #13#10
4199         else if TObject(GetActiveContent) is TThreadItem then
4200                 s := s + TThreadItem(GetActiveContent).Title + #13#10;
4201         if s <> '' then
4202                 Clipboard.AsText := s;
4203 end;
4204
4205 //(Thread)\83X\83\8c\83b\83h\96¼\82ÆURL\82ð\83R\83s\81[
4206 procedure TGikoForm.NameURLCopyActionExecute(Sender: TObject);
4207 var
4208         s: string;
4209 begin
4210         s := '';
4211         if TObject(GetActiveContent) is TBoard then
4212                 s := s + TBoard(GetActiveContent).Title + #13#10 + TBoard(GetActiveContent).URL + #13#10
4213         else if TObject(GetActiveContent) is TThreadItem then
4214                 s := s + TThreadItem(GetActiveContent).Title + #13#10 + TThreadItem(GetActiveContent).URL + #13#10;
4215         if s <> '' then
4216                 Clipboard.AsText := s;
4217 end;
4218
4219 procedure TGikoForm.ItemReloadActionExecute(Sender: TObject);
4220 var
4221         ThreadItem: TThreadItem;
4222 begin
4223         ThreadItem := GetActiveContent;
4224         if ThreadItem <> nil then
4225                 DownloadContent(ThreadItem);
4226 end;
4227
4228 procedure TGikoForm.SelectListReloadActionExecute(Sender: TObject);
4229 var
4230         i: Integer;
4231         List: TList;
4232         msg: string;
4233 begin
4234         if GetActiveList is TCategory then begin
4235                 List := TList.Create;
4236                 try
4237                         SelectListItem(List);
4238                         if List.Count > 5 then begin
4239                                 msg := '5\8cÂ\88È\8fã\82Í\8ew\92è\82Å\82«\82Ü\82¹\82ñ' + #13#10
4240                                                  + '\82Q\82¿\82á\82ñ\82Ë\82é\95\89\89×\8cy\8c¸\82É\82²\8b¦\97Í\82­\82¾\82³\82¢';
4241                                 MsgBox(Handle, msg, '\8cx\8d\90', MB_ICONEXCLAMATION);
4242                                 Exit;
4243                         end;
4244                         for i := 0 to List.Count - 1 do begin
4245                                 if TObject(List[i]) is TBoard then
4246                                         DownloadList(TBoard(List[i]));
4247                         end;
4248                 finally
4249                         List.Free;
4250                 end;
4251         end else if GetActiveList is TBoard then begin
4252                 DownloadList(TBoard(GetActiveList));
4253         end;
4254 end;
4255
4256 procedure TGikoForm.SelectThreadReloadActionExecute(Sender: TObject);
4257 var
4258         List: TList;
4259         i: Integer;
4260         msg: string;
4261 begin
4262         List := TList.Create;
4263         try
4264                 SelectListItem(List);
4265                 if List.Count > 10 then begin
4266                         msg := '10\8cÂ\88È\8fã\82Í\8ew\92è\82Å\82«\82Ü\82¹\82ñ' + #13#10
4267                                          + '\82Q\82¿\82á\82ñ\82Ë\82é\95\89\89×\8cy\8c¸\82É\82²\8b¦\97Í\82­\82¾\82³\82¢';
4268                         MsgBox(Handle, msg, '\8cx\8d\90', MB_ICONEXCLAMATION);
4269                         Exit;
4270                 end;
4271                 for i := 0 to List.Count - 1 do begin
4272                         if TObject(List[i]) is TThreadItem then
4273                                 DownloadContent(TThreadItem(List[i]));
4274                 end;
4275         finally
4276                 List.Free;
4277         end;
4278 end;
4279
4280 procedure TGikoForm.SelectListReloadActionUpdate(Sender: TObject);
4281 begin
4282         if (GetActiveList is TCategory) and (ListView.SelCount > 0) then
4283                 SelectListReloadAction.Enabled := True
4284         else if GetActiveList is TBoard then
4285                 SelectListReloadAction.Enabled := True
4286         else
4287                 SelectListReloadAction.Enabled := False;
4288 end;
4289
4290 procedure TGikoForm.SelectThreadReloadActionUpdate(Sender: TObject);
4291 begin
4292         if (GetActiveList is TBoard) and (ListView.SelCount > 0) then
4293                 SelectThreadReloadAction.Enabled := True
4294         else
4295                 SelectThreadReloadAction.Enabled := False;
4296 end;
4297
4298 procedure TGikoForm.AllItemActionUpdate(Sender: TObject);
4299 begin
4300         AllItemAction.Enabled := (GetActiveList is TBoard);
4301 end;
4302
4303 procedure TGikoForm.LogItemActionUpdate(Sender: TObject);
4304 begin
4305         LogItemAction.Enabled := (GetActiveList is TBoard);
4306 end;
4307
4308 procedure TGikoForm.NewItemActionUpdate(Sender: TObject);
4309 begin
4310         NewItemAction.Enabled := (GetActiveList is TBoard);
4311 end;
4312
4313 procedure TGikoForm.SelectItemActionUpdate(Sender: TObject);
4314 begin
4315         SelectItemAction.Enabled := (GetActiveList is TBoard);
4316 end;
4317
4318 procedure TGikoForm.UpFolderActionUpdate(Sender: TObject);
4319 begin
4320         UpFolderAction.Enabled := not (GetActiveList is TBBS2ch);
4321 end;
4322
4323 procedure TGikoForm.ThreadEditorActionUpdate(Sender: TObject);
4324 begin
4325         ThreadEditorAction.Enabled := (GetActiveList is TBoard);
4326 end;
4327
4328 procedure TGikoForm.FormResize(Sender: TObject);
4329 begin
4330         MessageListView.Column[0].Width := MessageListView.ClientWidth - 32;
4331         MainCoolBar.Width := TopPanel.Width - TopRightPanel.Width;
4332 end;
4333
4334 procedure TGikoForm.ScrollTopActionUpdate(Sender: TObject);
4335 begin
4336         ScrollTopAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
4337 end;
4338
4339 procedure TGikoForm.ScrollLastActionUpdate(Sender: TObject);
4340 begin
4341         ScrollLastAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
4342 end;
4343
4344 procedure TGikoForm.ScrollNewActionUpdate(Sender: TObject);
4345 begin
4346         ScrollNewAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
4347 end;
4348
4349 procedure TGikoForm.ScrollKokoActionUpdate(Sender: TObject);
4350 begin
4351         ScrollKokoAction.Enabled := (GetActiveContent <> nil)
4352                                                                                                         and (GetActiveContent.IsLogFile)
4353                                                                                                         and (GetActiveContent.Kokomade <> -1);
4354
4355 end;
4356
4357 procedure TGikoForm.EditorActionUpdate(Sender: TObject);
4358 begin
4359         EditorAction.Enabled := GetActiveContent <> nil;
4360 end;
4361
4362 procedure TGikoForm.IEActionUpdate(Sender: TObject);
4363 begin
4364         IEAction.Enabled := GetActiveContent <> nil;
4365 end;
4366
4367 procedure TGikoForm.ShowThreadActionUpdate(Sender: TObject);
4368 begin
4369         ShowThreadAction.Enabled := GetActiveContent <> nil;
4370 end;
4371
4372 procedure TGikoForm.ShowBoardActionUpdate(Sender: TObject);
4373 begin
4374         ShowBoardAction.Enabled := GetActiveContent <> nil;
4375 end;
4376
4377 procedure TGikoForm.ItemReloadActionUpdate(Sender: TObject);
4378 begin
4379         ItemReloadAction.Enabled := GetActiveContent <> nil;
4380 end;
4381
4382 procedure TGikoForm.URLCopyActionUpdate(Sender: TObject);
4383 begin
4384         URLCopyAction.Enabled := GetActiveContent <> nil;
4385 end;
4386
4387 procedure TGikoForm.NameCopyActionUpdate(Sender: TObject);
4388 begin
4389         NameCopyAction.Enabled := GetActiveContent <> nil;
4390 end;
4391
4392 procedure TGikoForm.NameURLCopyActionUpdate(Sender: TObject);
4393 begin
4394         NameURLCopyAction.Enabled := GetActiveContent <> nil;
4395 end;
4396
4397 procedure TGikoForm.BrowserTabCloseActionUpdate(Sender: TObject);
4398 begin
4399         BrowserTabCloseAction.Enabled := GetActiveContent <> nil;
4400 end;
4401
4402 procedure TGikoForm.NotSelectTabCloseActionUpdate(Sender: TObject);
4403 begin
4404         NotSelectTabCloseAction.Enabled := GetActiveContent <> nil;
4405 end;
4406
4407 procedure TGikoForm.AllTabCloseActionUpdate(Sender: TObject);
4408 begin
4409         AllTabCloseAction.Enabled := GetActiveContent <> nil;
4410 end;
4411
4412 procedure TGikoForm.ActiveLogDeleteActionUpdate(Sender: TObject);
4413 begin
4414         ActiveLogDeleteAction.Enabled := GetActiveContent <> nil;
4415 end;
4416
4417 procedure TGikoForm.ListViewSelectItem(Sender: TObject; Item: TListItem;
4418         Selected: Boolean);
4419 begin
4420         SelectTimer.Enabled := False;
4421         if Selected then
4422                 SelectTimer.Enabled := True;
4423 end;
4424
4425 procedure TGikoForm.SelectTimerTimer(Sender: TObject);
4426 begin
4427         SelectTimer.Enabled := False;
4428         ListClick;
4429 end;
4430
4431 procedure TGikoForm.ListViewDblClick(Sender: TObject);
4432 begin
4433         ListDoubleClick;
4434 end;
4435
4436 procedure TGikoForm.LogDeleteActionExecute(Sender: TObject);
4437 const
4438         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';
4439         DEL_TITLE = '\8dí\8f\9c\8am\94F';
4440 var
4441         ThreadItem: TThreadItem;
4442         TmpListItem: TListItem;
4443         List: TList;
4444         i: Integer;
4445 begin
4446         List := TList.Create;
4447         try
4448                 TmpListItem := ListView.Selected;
4449                 while TmpListItem <> nil do begin
4450                         if TObject(TmpListItem.Data) is TThreadItem then begin
4451                                 ThreadItem := TThreadItem(TmpListItem.Data);
4452                                 if ThreadItem.IsLogFile then
4453                                         List.Add(ThreadItem);
4454                         end;
4455                         TmpListItem := ListView.GetNextItem(TmpListItem, sdAll, [isSelected]);
4456                 end;
4457
4458                 if GikoSys.Setting.DeleteMsg and (List.Count > 0) then begin
4459                         if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONQUESTION or MB_DEFBUTTON2) <> IDYES then
4460                                 Exit;
4461                 end;
4462
4463                 for i := 0 to List.Count - 1 do begin
4464                         ThreadItem := TThreadItem(List[i]);
4465                         DeleteHistory(ThreadItem);
4466                         DeleteTab(ThreadItem);
4467                         ThreadItem.DeleteLogFile;
4468                 end;
4469                 ListView.Refresh;
4470         finally
4471                 List.Free;
4472         end;
4473 end;
4474
4475 procedure TGikoForm.DeleteTab(ThreadItem: TThreadItem);
4476 var
4477         i: Integer;
4478 begin
4479         FTabHintIndex := -1;
4480         for i := 0 to BrowserTab.Tabs.Count - 1 do begin
4481                 if TThreadItem(BrowserTab.Tabs.Objects[i]) = ThreadItem then begin
4482                         BrowserTab.Tabs.Delete(i);
4483                         if i > (BrowserTab.Tabs.Count - 1) then
4484                                 BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1
4485                         else
4486                                 BrowserTab.TabIndex := i;
4487                         if BrowserTab.Tabs.Count = 0 then
4488                                 SetContent(nil)
4489                         else if BrowserTab.TabIndex <> -1 then
4490                                 SetContent(TThreadItem(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]));
4491                         Exit;
4492                 end;
4493         end;
4494 end;
4495
4496 procedure TGikoForm.KokomadeActionExecute(Sender: TObject);
4497 var
4498         No: Integer;
4499         ThreadItem: TThreadItem;
4500         sTitle: string;
4501         ScrollTop: Integer;
4502         doc: Variant;
4503 begin
4504         No := KokoPopupMenu.Tag;
4505         if No = 0 then Exit;
4506         ThreadItem := GetActiveContent;
4507         if ThreadItem = nil then Exit;
4508         ThreadItem.Kokomade := No;
4509         doc := Browser.Document;
4510         ScrollTop := doc.Body.ScrollTop;
4511
4512         GikoSys.CreateHTML2(doc, ThreadItem, sTitle);
4513 //      HtmlName := GikoSys.CreateHTML(ThreadItem, sTitle) + '#koko';
4514 //      Flags := 2;
4515 //      Browser.Navigate(HtmlName, Flags);
4516 //      Sleep(10);
4517         Application.ProcessMessages;
4518         doc.Body.ScrollTop := ScrollTop;
4519 end;
4520
4521 procedure TGikoForm.ZenbuActionExecute(Sender: TObject);
4522 var
4523         ThreadItem: TThreadItem;
4524         sTitle: string;
4525         ScrollTop: Integer;
4526         doc: Variant;
4527 begin
4528         ThreadItem := GetActiveContent;
4529         if ThreadItem = nil then Exit;
4530         ThreadItem.Kokomade := -1;
4531         doc := Browser.Document;
4532         ScrollTop := doc.Body.ScrollTop;
4533         GikoSys.CreateHTML2(doc, ThreadItem, sTitle);
4534 //      HtmlName := GikoSys.CreateHTML(ThreadItem, sTitle) + '#koko';
4535 //      Flags := 2;
4536 //      Browser.Navigate(HtmlName, Flags);
4537 //      Sleep(10);
4538         Application.ProcessMessages;
4539         doc.Body.ScrollTop := ScrollTop;
4540 end;
4541
4542 function TGikoForm.Hook(var Message: TMessage): Boolean;
4543 begin
4544         Result := False;
4545         if Message.Msg = CM_APPKEYDOWN then Result := True;
4546 end;
4547
4548 procedure TGikoForm.KokoResActionExecute(Sender: TObject);
4549 var
4550         Editor: TEditorForm;
4551         Item: TThreadItem;
4552         msg: string;
4553         Number: Integer;
4554 begin
4555         Number := KokoPopupMenu.Tag;
4556         if Number = 0 then Exit;
4557         Item := GetActiveContent;
4558         if Item = nil then Exit;
4559
4560         if Item.Count >= 1000 then begin
4561                 msg := '\82±\82Ì\83X\83\8c\83b\83h\82Í\83\8c\83X\90\94\82ª\82P\82O\82O\82O\82ð\92´\82¦\82Ä\82¢\82é\82Ì\82Å\8f\91\8d\9e\82Ý\8fo\97\88\82Ü\82¹\82ñ\81B' + #13#10
4562                                  + '\90V\83X\83\8c\83b\83h\82ð\92T\82µ\82Ä\82­\82¾\82³\82¢\81B';
4563                 if MsgBox(Handle, msg, '\8cx\8d\90', MB_YESNO or MB_ICONEXCLAMATION) <> 7 then begin
4564                         Exit;
4565                 end;
4566         end;
4567         Editor := TEditorForm.Create(Self);
4568         Editor.SetThreadItem(Item);
4569         Editor.BodyEdit.Text := '>>' + IntToStr(Number) + #13#10;
4570         Editor.Show;
4571         Editor.BodyEdit.SetFocus;
4572 end;
4573
4574 procedure TGikoForm.ListPopupMenuPopup(Sender: TObject);
4575 begin
4576         ItemRoundPMenu.Visible := (GetActiveList is TBoard);
4577         ItemReservPMenu.Visible := (GetActiveList is TBoard);
4578         LPMSep01.Visible := (GetActiveList is TBoard);
4579         ListRoundPMenu.Visible := (GetActiveList is TCategory);// or (GetActiveList is TBoard);
4580         ListReservPMenu.Visible := (GetActiveList is TCategory);// or (GetActiveList is TBoard);
4581         LPMSep02.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
4582         KidokuPMenu.Visible := (GetActiveList is TBoard);
4583         MidokuPMenu.Visible := (GetActiveList is TBoard);
4584         UrlCopyPMenu.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
4585         NameUrlCopyPMenu.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
4586         AllSelectPMenu.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
4587         LPMSep05.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
4588         DeletePMenu.Visible := (GetActiveList is TBoard);
4589         LPMSep06.Visible := (GetActiveList is TCategory) or (GetActiveList is TBoard);
4590
4591         BoardFavoriteAddMenu.Visible := (GetActiveList is TCategory);
4592         ThreadFavoriteAddMenu.Visible := (GetActiveList is TBoard);
4593
4594         AddRoundNameMenu(ItemReservPMenu);
4595         AddRoundNameMenu(ListReservPMenu);
4596 end;
4597
4598 procedure TGikoForm.BoardIEActionExecute(Sender: TObject);
4599 var
4600         URL: string;
4601 begin
4602         if GetActiveList is TBoard then begin
4603                 URL := TBoard(GetActiveList).URL;
4604                 GikoSys.OpenBrowser(URL, gbtAuto);
4605         end;
4606 end;
4607
4608 procedure TGikoForm.SelectItemURLCopyActionExecute(Sender: TObject);
4609 var
4610         List: TList;
4611         i: Integer;
4612         s: string;
4613 begin
4614         s := '';
4615         List := TList.Create;
4616         try
4617                 SelectListItem(List);
4618                 for i := 0 to List.Count - 1 do begin
4619                         if TObject(List[i]) is TBoard then
4620                                 s := s + TBoard(List[i]).URL + #13#10
4621                         else if TObject(List[i]) is TThreadItem then
4622                                 s := s + TThreadItem(List[i]).URL + #13#10;
4623                 end;
4624                 if s <> '' then
4625                         Clipboard.AsText := s;
4626         finally
4627                 List.Free;
4628         end;
4629 end;
4630
4631 procedure TGikoForm.SelectItemNameCopyActionExecute(Sender: TObject);
4632 var
4633         List: TList;
4634         i: Integer;
4635         s: string;
4636 begin
4637         s := '';
4638         List := TList.Create;
4639         try
4640                 SelectListItem(List);
4641                 for i := 0 to List.Count - 1 do begin
4642                         if TObject(List[i]) is TBoard then
4643                                 s := s + TBoard(List[i]).Title + #13#10
4644                         else if TObject(List[i]) is TThreadItem then
4645                                 s := s + TThreadItem(List[i]).Title + #13#10;
4646                 end;
4647                 if s <> '' then
4648                         Clipboard.AsText := s;
4649         finally
4650                 List.Free;
4651         end;
4652 end;
4653
4654 procedure TGikoForm.SelectItemNameURLCopyActionExecute(Sender: TObject);
4655 var
4656         List: TList;
4657         i: Integer;
4658         s: string;
4659 begin
4660         s := '';
4661         List := TList.Create;
4662         try
4663                 SelectListItem(List);
4664                 for i := 0 to List.Count - 1 do begin
4665                         if TObject(List[i]) is TBoard then
4666                                 s := s + TBoard(List[i]).Title + #13#10 + TBoard(List[i]).URL + #13#10
4667                         else if TObject(List[i]) is TThreadItem then
4668                                 s := s + TThreadItem(List[i]).Title + #13#10 + TThreadItem(List[i]).URL + #13#10;
4669                 end;
4670                 if s <> '' then
4671                         Clipboard.AsText := s;
4672         finally
4673                 List.Free;
4674         end;
4675 end;
4676
4677 procedure TGikoForm.BoardIEActionUpdate(Sender: TObject);
4678 begin
4679         if GetActiveList is TBoard then
4680                 BoardIEAction.Enabled := True
4681         else
4682                 BoardIEAction.Enabled := False;
4683 end;
4684
4685 procedure TGikoForm.SelectItemURLCopyActionUpdate(Sender: TObject);
4686 begin
4687         if ((GetActiveList is TBoard) or (GetActiveList is TCategory))and (ListView.SelCount > 0) then
4688                 SelectItemURLCopyAction.Enabled := True
4689         else
4690                 SelectItemURLCopyAction.Enabled := False;
4691 end;
4692
4693 procedure TGikoForm.SelectItemNameCopyActionUpdate(Sender: TObject);
4694 begin
4695         if ((GetActiveList is TBoard) or (GetActiveList is TCategory))and (ListView.SelCount > 0) then
4696                 SelectItemNameCopyAction.Enabled := True
4697         else
4698                 SelectItemNameCopyAction.Enabled := False;
4699 end;
4700
4701 procedure TGikoForm.SelectItemNameURLCopyActionUpdate(Sender: TObject);
4702 begin
4703         if ((GetActiveList is TBoard) or (GetActiveList is TCategory))and (ListView.SelCount > 0) then
4704                 SelectItemNameURLCopyAction.Enabled := True
4705         else
4706                 SelectItemNameURLCopyAction.Enabled := False;
4707 end;
4708
4709 procedure TGikoForm.AllSelectActionUpdate(Sender: TObject);
4710 begin
4711         if ListView.SelCount > 0 then
4712                 AllSelectAction.Enabled := True
4713         else
4714                 AllSelectAction.Enabled := False;
4715 end;
4716
4717 procedure TGikoForm.LogDeleteActionUpdate(Sender: TObject);
4718 begin
4719         if (GetActiveList is TBoard) and (ListView.SelCount > 0) then
4720                 LogDeleteAction.Enabled := True
4721         else
4722                 LogDeleteAction.Enabled := False;
4723 end;
4724
4725 procedure TGikoForm.BrowserTabCloseActionExecute(Sender: TObject);
4726 var
4727         idx: Integer;
4728         ThreadItem: TThreadItem;
4729 begin
4730         idx := BrowserTab.TabIndex;
4731         if idx <> -1 then begin
4732                 ThreadItem := TThreadItem(BrowserTab.Tabs.Objects[idx]);
4733                 DeleteTab(ThreadItem);
4734         end;
4735 end;
4736
4737 procedure TGikoForm.NotSelectTabCloseActionExecute(Sender: TObject);
4738 var
4739         i: Integer;
4740 begin
4741         for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
4742                 if BrowserTab.TabIndex <> i then begin
4743                         BrowserTab.Tabs.Delete(i);
4744                 end;
4745         end;
4746 end;
4747
4748 procedure TGikoForm.AllTabCloseActionExecute(Sender: TObject);
4749 var
4750         i: Integer;
4751 begin
4752         for i := BrowserTab.Tabs.Count - 1 downto 0 do
4753                 BrowserTab.Tabs.Delete(i);
4754         SetContent(nil);
4755 end;
4756
4757 procedure TGikoForm.TreeSelectBoradReloadExecute(Sender: TObject);
4758 var
4759         Board: TBoard;
4760         TmpTreeNode: TTreeNode;
4761 begin
4762         TmpTreeNode := FClickNode;
4763         TreeView.Selected := FClickNode;
4764         if TObject(TmpTreeNode.Data) is TBoard then begin
4765                 Board := TBoard(TmpTreeNode.Data);
4766                 DownloadList(Board);
4767         end;
4768 end;
4769
4770 procedure TGikoForm.TreeSelectThreadReloadExecute(Sender: TObject);
4771 var
4772         ThreadItem: TThreadItem;
4773         TmpTreeNode: TTreeNode;
4774 begin
4775         TmpTreeNode := FClickNode;
4776         TreeView.Selected := FClickNode;
4777         if TObject(TmpTreeNode.Data) is TThreadItem then begin
4778                 ThreadItem := TThreadItem(TmpTreeNode.Data);
4779                 DownloadContent(ThreadItem);
4780         end;
4781 end;
4782
4783 procedure TGikoForm.TreeSelectURLCopyExecute(Sender: TObject);
4784 var
4785         TmpTreeNode: TTreeNode;
4786         s: string;
4787 begin
4788         TmpTreeNode := FClickNode;
4789         TreeView.Selected := FClickNode;
4790         if TObject(TmpTreeNode.Data) is TBoard then begin
4791                 s := TBoard(TmpTreeNode.Data).URL + #13#10;
4792         end else if (TObject(TmpTreeNode.Data) is TThreadItem) then begin
4793                 s := TThreadItem(TmpTreeNode.Data).URL + #13#10;
4794         end;
4795         Clipboard.AsText := s;
4796 end;
4797
4798 procedure TGikoForm.TreeSelectNameURLCopyExecute(Sender: TObject);
4799 var
4800         TmpTreeNode: TTreeNode;
4801         s: string;
4802 begin
4803         TmpTreeNode := FClickNode;
4804         TreeView.Selected := FClickNode;
4805         if TObject(TmpTreeNode.Data) is TBoard then begin
4806                 s := TBoard(TmpTreeNode.Data).Title + #13#10 + TBoard(TmpTreeNode.Data).URL + #13#10;
4807         end else if (TObject(TmpTreeNode.Data) is TThreadItem) then begin
4808                 s := TThreadItem(TmpTreeNode.Data).Title + #13#10 + TThreadItem(TmpTreeNode.Data).URL + #13#10;
4809         end;
4810         Clipboard.AsText := s;
4811 end;
4812
4813
4814 procedure TGikoForm.TreePopupMenuPopup(Sender: TObject);
4815 begin
4816         FClickNode := TreeView.Selected;
4817         if FClickNode = nil then begin
4818                 TreeSelectThreadPupupMenu.Visible := False;
4819                 TreeSelectBoardPupupMenu.Visible := False;
4820                 TPMSep01.Visible := False;
4821                 TreeSelectURLPupupMenu.Visible := False;
4822                 TreeSelectNameURLPupupMenu.Visible := False;
4823                 TreeSelectFavoriteAddPupupMenu.Visible := False;
4824         end else if TObject(FClickNode.Data) is TBoard then begin
4825                 TreeSelectThreadPupupMenu.Visible := False;
4826                 TreeSelectBoardPupupMenu.Visible := True;
4827                 TPMSep01.Visible := True;
4828                 TreeSelectURLPupupMenu.Visible := True;
4829                 TreeSelectNameURLPupupMenu.Visible := True;
4830                 TreeSelectFavoriteAddPupupMenu.Visible := True;
4831         end else if (TObject(FClickNode.Data) is TThreadItem) then begin
4832                 TreeSelectThreadPupupMenu.Visible := True;
4833                 TreeSelectBoardPupupMenu.Visible := False;
4834                 TPMSep01.Visible := True;
4835                 TreeSelectURLPupupMenu.Visible := True;
4836                 TreeSelectNameURLPupupMenu.Visible := True;
4837                 TreeSelectFavoriteAddPupupMenu.Visible := True;
4838         end else begin
4839                 TreeSelectThreadPupupMenu.Visible := False;
4840                 TreeSelectBoardPupupMenu.Visible := False;
4841                 TPMSep01.Visible := False;
4842                 TreeSelectURLPupupMenu.Visible := False;
4843                 TreeSelectNameURLPupupMenu.Visible := False;
4844                 TreeSelectFavoriteAddPupupMenu.Visible := False;
4845         end;
4846 end;
4847
4848 procedure TGikoForm.BrowserNewWindow2(Sender: TObject;
4849         var ppDisp: IDispatch; var Cancel: WordBool);
4850 var
4851         Text: string;
4852         Html: string;
4853         URL: string;
4854         idx: Integer;
4855         Protocol, Host, Path, Document, Port, Bookmark: string;
4856         BBSID: string;
4857         BBSKey: string;
4858         Board: TBoard;
4859         ThreadItem: TThreadItem;
4860         ShiftDown: Boolean;
4861         CtrlDown: Boolean;
4862 begin
4863         //shift -> \90Ý\92è\83u\83\89\83E\83U\81i\96³\82¯\82ê\82ÎIE\81j
4864         //ctrl  -> IE
4865         ShiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
4866         CtrlDown := GetAsyncKeyState(VK_CONTROL) = Smallint($8001);
4867
4868         Cancel := True;
4869         if      (IHTMLDocument2(TWebBrowser(Sender).Document).activeElement <> nil) then begin
4870                 Text := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerText;
4871                 Html := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerHTML;
4872
4873                 URL := GikoSys.GetHRefText(Html);
4874                 URL := GikoSys.HTMLDecode(URL);
4875
4876                 GikoSys.ParseURI(URL, Protocol, Host, Path, Document, Port, Bookmark);
4877
4878
4879                 //\83A\83h\83\8c\83X\83o\81[\82Ì\97\9a\97ð
4880                 if GikoSys.Setting.LinkAddAddressBar then begin
4881                         idx := AddressComboBox.Items.IndexOf(URL);
4882                         if idx = -1 then begin
4883                                 AddressComboBox.Items.Insert(0, URL);
4884                                 if AddressComboBox.Items.Count > GikoSys.Setting.AddressHistoryCount then
4885                                         AddressComboBox.Items.Delete(AddressComboBox.Items.Count - 1);
4886                         end else begin
4887                                 AddressComboBox.Items.Delete(idx);
4888                                 AddressComboBox.Items.Insert(0, URL);
4889                         end;
4890                 end;
4891
4892                 if GikoSys.Is2chHost(Host) and GikoSys.Parse2chURL(URL, Path, Document, BBSID, BBSKey) then begin
4893                         Board := BBS2ch.FindBBSID(BBSID);
4894                         if Board = nil then begin
4895                                 GikoSys.OpenBrowser(URL, gbtAuto);
4896                                 Exit;
4897                         end;
4898                         if not Board.IsThreadDatRead then
4899                                 GikoSys.ReadSubjectFile(Board);
4900                         ThreadItem := Board.Find(ChangeFileExt(BBSKey, '.dat'));
4901                         if ThreadItem = nil then begin
4902                                 if ShiftDown then
4903                                         GikoSys.OpenBrowser(URL, gbtUserApp)
4904                                 else if CtrlDown then
4905                                         GikoSys.OpenBrowser(URL, gbtIE)
4906                                 else begin
4907                                         ThreadItem := TThreadItem.Create;
4908                                         ThreadItem.FileName := ChangeFileExt(BBSKey, '.dat');
4909                                         if AnsiPos(Host, Board.URL) = 0 then
4910                                                 ThreadItem.DownloadHost := Host
4911                                         else
4912                                                 ThreadItem.DownloadHost := '';
4913                                         Board.Insert(0, ThreadItem);
4914                                         if ActiveList is TBoard then begin
4915                                                 if TBoard(ActiveList) = Board then
4916                                                         ListView.Items.Count := ListView.Items.Count + 1;
4917                                                 InsertBrowserTab(ThreadItem);
4918                                                 DownloadContent(ThreadItem);
4919                                         end;
4920                                 end;
4921                         end else begin
4922                                 if ShiftDown then
4923                                         GikoSys.OpenBrowser(URL, gbtUserApp)
4924                                 else if CtrlDown then
4925                                         GikoSys.OpenBrowser(URL, gbtIE)
4926                                 else begin
4927                                         if ThreadItem.IsLogFile then
4928                                                 InsertBrowserTab(ThreadItem)
4929                                         else begin
4930                                                 if AnsiPos(Host, Board.URL) = 0 then
4931                                                         ThreadItem.DownloadHost := Host
4932                                                 else
4933                                                         ThreadItem.DownloadHost := '';
4934                                                 InsertBrowserTab(ThreadItem);
4935                                                 DownloadContent(ThreadItem);
4936                                         end;
4937                                 end;
4938                         end;
4939                 end else begin
4940                         GikoSys.OpenBrowser(URL, gbtAuto);
4941                 end;
4942         end;
4943
4944 {       ShiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
4945         CtrlDown := GetAsyncKeyState(VK_CONTROL) = Smallint($8001);
4946
4947         if ShiftDown then
4948                 Memo1.Lines.Add('ShiftDown');
4949         if CtrlDown then
4950                 Memo1.Lines.Add('CtrlDown');
4951
4952         if      (IHTMLDocument2(TWebBrowser(Sender).Document).activeElement <> nil) then        begin
4953                 Text := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerText;
4954                 Url := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerHTML;
4955
4956
4957
4958                 URL := GetHRefText(URL);
4959
4960                 ParseURI(URL, Protocol, Host, path, Document, Port, Bookmark);
4961
4962                 b := Parse2chURL(path, document, bbs, num);
4963                 memo1.Lines.Add('bbs: ' + bbs);
4964                 memo1.Lines.Add('key: ' + num);
4965                 if b then
4966                         Memo1.Lines.Add('Parse2chURL: True')
4967                 else
4968                         Memo1.Lines.Add('Parse2chURL: False');
4969
4970 //      AppPath := 'C:\Borland\Projects\Test\TestBrowser\TestBrowser.exe';
4971
4972         end;}
4973 end;
4974
4975 procedure TGikoForm.ListSplitterCanResize(Sender: TObject;
4976         var NewSize: Integer; var Accept: Boolean);
4977 begin
4978         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
4979                 if ViewPanel.Width < 2 then begin
4980                         ViewPanel.Width := 1;
4981                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
4982                         BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
4983                         GikoSys.Setting.ListWidthState := glsMax;
4984                 end else if ViewPanel.Width > (ThreadMainPanel.Width - 80) then begin
4985                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
4986                         BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
4987                         GikoSys.Setting.ListWidthState := glsMin;
4988                 end else begin
4989                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
4990                         BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
4991                         GikoSys.Setting.ListWidthState := glsNormal;
4992                 end;
4993         end else begin
4994                 if ViewPanel.Height < 2 then begin
4995                         ViewPanel.Height := 1;
4996                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
4997                         BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
4998                         GikoSys.Setting.ListHeightState := glsMax;
4999                 end else if ViewPanel.Height > (ThreadMainPanel.Height - BrowserCoolBar.Height - 7) then begin
5000                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
5001                         BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
5002                         GikoSys.Setting.ListHeightState := glsMin;
5003                 end else begin
5004                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
5005                         BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
5006                         GikoSys.Setting.ListHeightState := glsNormal;
5007                 end;
5008         end;
5009 end;
5010
5011 procedure TGikoForm.ListSplitterMoved(Sender: TObject);
5012 begin
5013         if Mouse.Capture <> 0 then
5014                 Exit;
5015         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
5016                 if (ViewPanel.Width > 1) and (ViewPanel.Width <= (ThreadMainPanel.Width - 80)) then
5017                         FBrowserSizeWidth := ViewPanel.Width;
5018         end else begin
5019                 if (ViewPanel.Height > 1) and (ViewPanel.Height <= (ThreadMainPanel.Height - BrowserCoolBar.Height)) then
5020                         FBrowserSizeHeight := ViewPanel.Height;
5021         end;
5022 {       if (Mouse.Capture = 0) and (ViewPanel.Height > 1) and (not ArrangeAction.Checked) then
5023                 FBrowserSizeHeight := ViewPanel.Height
5024         else if (Mouse.Capture = 0) and (ViewPanel.Width > 1) and (ArrangeAction.Checked) then
5025                 FBrowserSizeWidth := ViewPanel.Width;}
5026 end;
5027
5028 procedure TGikoForm.BrowserTabChange(Sender: TObject);
5029 var
5030         idx: Integer;
5031         ThreadItem: TThreadItem;
5032 begin
5033
5034 //      if NewTab = -1 then
5035         if not BrowserTab.Dragging then begin
5036         FTabHintIndex := -1;
5037         BrowserTab.Hint := '';
5038         idx := BrowserTab.TabIndex;
5039         if idx = -1 then
5040                 SetContent(BrowserNullTab)
5041         else if BrowserTab.Tabs.Objects[idx] is TThreadItem then begin
5042                 ThreadItem := TThreadItem(BrowserTab.Tabs.Objects[idx]);
5043                 SetContent(ThreadItem);
5044                 if GikoSys.Setting.URLDisplay then
5045                         AddressComboBox.Text := GikoSys.GetURL(ThreadItem.ParentBoard.BBSID, ThreadItem.FileName);
5046                 end;
5047         end;
5048 end;
5049 procedure TGikoForm.BrowserTabClick(Sender: TObject);
5050 var
5051         idx: Integer;
5052         ThreadItem: TThreadItem;
5053 begin
5054 //      if NewTab = -1 then
5055         FTabHintIndex := -1;
5056         BrowserTab.Hint := '';
5057         idx := BrowserTab.TabIndex;
5058         if idx = -1 then
5059                 SetContent(BrowserNullTab)
5060         else if BrowserTab.Tabs.Objects[idx] is TThreadItem then begin
5061                 ThreadItem := TThreadItem(BrowserTab.Tabs.Objects[idx]);
5062                 SetContent(ThreadItem);
5063                 if GikoSys.Setting.URLDisplay then
5064                         AddressComboBox.Text := GikoSys.GetURL(ThreadItem.ParentBoard.BBSID, ThreadItem.FileName);
5065         end;
5066 end;
5067
5068 procedure TGikoForm.BrowserTabMouseDown(Sender: TObject;
5069         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
5070 var
5071         p: TPoint;
5072         p2: TPoint;
5073         idx: Integer;
5074         OldIndex: Integer;
5075 begin
5076         if Button = mbMiddle then begin
5077                 // \83}\83E\83X\92\86\83{\83^\83\93
5078                 GetCursorPos(p);
5079                 p2 := p;
5080                 p := BrowserTab.ScreenToClient(p);
5081                 idx := BrowserTab.IndexOfTabAt(p.X, p.Y);
5082                 if idx <> -1 then begin
5083                         OldIndex := BrowserTab.TabIndex;
5084                         BrowserTab.Tabs.Delete(idx);
5085                         if idx = OldIndex then begin
5086                                 if BrowserTab.Tabs.Count > idx then
5087                                         BrowserTab.TabIndex := idx
5088                                 else if BrowserTab.Tabs.Count = idx then
5089                                         BrowserTab.TabIndex := idx - 1
5090                                 else if BrowserTab.Tabs.Count > 0 then
5091                                         BrowserTab.TabIndex := 0;
5092                                 BrowserTab.OnChange(nil);
5093                         end;
5094                 end;
5095         end else if Button = mbRight then begin
5096                 // \83}\83E\83X\89E\83{\83^\83\93
5097                 GetCursorPos(p);
5098                 p2 := p;
5099 //              GetCursorPos(p2);
5100                 p := BrowserTab.ScreenToClient(p);
5101 //              idx := BrowserTab.ItemAtPos(p);
5102                 idx := BrowserTab.IndexOfTabAt(p.X, p.Y);
5103                 if idx <> -1 then begin
5104                         OldIndex := BrowserTab.TabIndex;
5105                         BrowserTab.TabIndex := idx;
5106                         if OldIndex <> idx then
5107                                 BrowserTab.OnChange(nil);
5108                         BrowserTabPopupMenu.Tag := idx;
5109                         BrowserTabPopupMenu.Popup(p2.X, p2.Y);
5110                 end;
5111         {end else if BUtton = mbLeft then begin
5112                         FDragWFirst := true;
5113                 }
5114                 end;
5115
5116 end;
5117
5118 procedure TGikoForm.SetBrowserTabState;
5119 var
5120 //      i: Integer;
5121         CoolBand: TCoolBand;
5122 begin
5123         BrowserBottomPanel.AutoSize := False;
5124         if GikoSys.Setting.BrowserTabVisible then begin
5125                 if GikoSys.Setting.BrowserTabStyle = gtsTab then begin
5126                         BrowserTab.Style := tsTabs;
5127                         if GikoSys.Setting.BrowserTabPosition = gtpTop then
5128                                 BrowserTab.TabPosition := tpTop
5129                         else
5130                                 BrowserTab.TabPosition := tpBottom;
5131                 end else if GikoSys.Setting.BrowserTabStyle = gtsButton then begin
5132                         BrowserTab.TabPosition := tpTop;
5133                         BrowserTab.Style := tsButtons;
5134                 end else begin
5135                         BrowserTab.TabPosition := tpTop;
5136                         BrowserTab.Style := tsFlatButtons
5137                 end;
5138
5139                 if GikoSys.Setting.BrowserTabPosition = gtpTop then begin
5140                         BrowserTab.Parent := BrowserTabToolBar;
5141                         BrowserBottomPanel.Hide;
5142                         CoolBand := GetCoolBand(BrowserCoolBar, BrowserTabToolBar);
5143                         if CoolBand <> nil then
5144                                 CoolBand.Visible := True;
5145 //                      BrowserTab.Parent := BrowserTopPanel;
5146 //                      BrowserTab.Parent := BrowserCoolBar;
5147 //                      BrowserTab.Top := 26;
5148 //                      BrowserTopPanel.Height := 44;
5149
5150                 end else begin
5151                         BrowserTab.Parent := BrowserBottomPanel;
5152                         BrowserTab.Top := 0;
5153                         BrowserTab.Left := 0;
5154                         BrowserBottomPanel.Show;
5155                         CoolBand := GetCoolBand(BrowserCoolBar, BrowserTabToolBar);
5156                         if CoolBand <> nil then
5157                                 CoolBand.Visible := False;
5158 //                      BrowserTopPanel.Height := 26;
5159                 end;
5160                 BrowserTab.Show;
5161         end else begin
5162                 CoolBand := GetCoolBand(BrowserCoolBar, BrowserTabToolBar);
5163                 if CoolBand <> nil then
5164                         CoolBand.Visible := False;
5165                 BrowserBottomPanel.Visible := False;
5166 //              BrowserTab.Visible := False;
5167 //              BrowserTopPanel.Height := 26;
5168         end;
5169 end;
5170
5171 procedure TGikoForm.BrowserTabDragOver(Sender, Source: TObject; X,
5172         Y: Integer; State: TDragState; var Accept: Boolean);
5173 var
5174         idx: Integer;
5175 begin
5176         idx := BrowserTab.IndexOfTabAt(X, Y);
5177         Accept := (Source = BrowserTab) and (BrowserTab.TabIndex <> idx);
5178 end;
5179
5180 procedure TGikoForm.BrowserTabDragDrop(Sender, Source: TObject; X,
5181         Y: Integer);
5182 var
5183         idx: Integer;
5184 begin
5185         idx := BrowserTab.IndexOfTabAt(X, Y);
5186         if idx <> -1 then
5187                 BrowserTab.Tabs.Move(BrowserTab.TabIndex, idx);
5188 end;
5189
5190 procedure TGikoForm.BrowserTabMouseMove(Sender: TObject;
5191         Shift: TShiftState; X, Y: Integer);
5192 var
5193         TabIdx: Integer;
5194         ThreadItem: TThreadItem;
5195 begin
5196
5197         TabIdx := BrowserTab.IndexOfTabAt(x, y);
5198
5199         if ( ssLeft in Shift )then begin
5200                 if FDragWFirst = false then begin
5201                 //      FDragWFirst := true;
5202                 end else begin{
5203                         BrowserTab.EndDrag(false);
5204                                 BrowserTab.BeginDrag(false, DandD_THRESHOLD);
5205                                 FDragWFirst := false;
5206                 }end;
5207                 end else begin
5208                 {
5209                         BrowserTab.EndDrag(false);
5210                         FDragWFirst := false;
5211                 }
5212                 end;
5213
5214         if (FTabHintIndex <> TabIdx) and (TabIdx <> -1) then begin
5215                 Application.CancelHint;
5216                 ThreadItem := TThreadItem(BrowserTab.Tabs.Objects[TabIdx]);
5217                 if ThreadItem.Title <> BrowserTab.Tabs[TabIdx] then begin
5218                         BrowserTab.Hint := ThreadItem.Title;
5219                         Application.ShowHint := True;
5220                 end else begin
5221                         BrowserTab.Hint := '';
5222                         Application.ShowHint := True;
5223                 end;
5224                 FTabHintIndex := TabIdx;
5225         end;
5226
5227 end;
5228
5229 procedure TGikoForm.BrowserDocumentComplete(Sender: TObject;
5230         const pDisp: IDispatch; var URL: OleVariant);
5231 var
5232         FDispHtmlDocument: DispHTMLDocument;
5233 begin
5234 //      AddMessageList('DocumentComplete', nil);
5235         FBrowserComplete := True;
5236         if FEvent <> nil then
5237                 FEvent.Free;
5238         FDispHtmlDocument := Browser.Document as DispHTMLDocument;
5239         FEvent := THTMLDocumentEventSink.Create(Self, FDispHtmlDocument, HTMLDocumentEvents2);
5240         FEvent.OnContextMenu := OnDocumentContextMenu;
5241
5242 end;
5243
5244 procedure TGikoForm.SelectReservActionUpdate(Sender: TObject);
5245 var
5246         i: Integer;
5247         List: TList;
5248 begin
5249         if (GetActiveList is TBoard) and (ListView.SelCount > 0) then begin
5250                 List := TList.Create;
5251                 try
5252                         SelectListItem(List);
5253                         for i := 0 to List.Count - 1 do begin
5254                                 if TObject(List[i]) is TThreadItem then begin
5255                                         if TThreadItem(List[i]).IsLogFile then begin
5256                                                 SelectReservAction.Enabled := True;
5257                                                 Exit;
5258                                         end;
5259                                 end;
5260                         end;
5261                         SelectReservAction.Enabled := False;
5262                 finally
5263                         List.Free;
5264                 end;
5265         end else if (GetActiveList is TCategory) and (ListView.SelCount > 0) then
5266                 SelectReservAction.Enabled := True
5267         else
5268                 SelectReservAction.Enabled := False;
5269 end;
5270
5271 procedure TGikoForm.RoundNamePopupMenuPopup(Sender: TObject);
5272 begin
5273         AddRoundNameMenu(RoundNamePopupMenu.Items);
5274 end;
5275
5276 procedure TGikoForm.AddRoundNameMenu(MenuItem: TMenuItem);
5277 var
5278         i: Integer;
5279         Item: TMenuItem;
5280 begin
5281         MenuItem.Clear;
5282         Item := TMenuItem.Create(Self);
5283         Item.Caption := '\90V\82µ\82¢\96¼\91O\82Å\8f\84\89ñ\97\\96ñ(&N)...';
5284         Item.OnClick := SelectNewRoundNameExecute;
5285         MenuItem.Add(Item);
5286         Item := TMenuItem.Create(Self);
5287         Item.Caption := '\8f\84\89ñ\83\8a\83X\83g\82©\82ç\8dí\8f\9c(&D)';
5288         Item.OnClick := SelectDeleteRoundExecute;
5289         MenuItem.Add(Item);
5290         Item := TMenuItem.Create(Self);
5291         Item.Caption := '-';
5292         MenuItem.Add(Item);
5293         for i := 0 to RoundList.RoundNameList.Count - 1 do begin
5294                 Item := TMenuItem.Create(Self);
5295                 Item.Caption := RoundList.RoundNameList[i];
5296                 Item.OnClick := SetSelectRoundName;
5297                 MenuItem.Add(Item);
5298         end;
5299 end;
5300
5301 procedure TGikoForm.SelectNewRoundNameExecute(Sender: TObject);
5302 var
5303         s: string;
5304         Dlg: TRoundNameDialog;
5305 begin
5306         Dlg := TRoundNameDialog.Create(Self);
5307         try
5308                 Dlg.ShowModal;
5309                 if Dlg.ModalResult <> mrCancel then begin
5310                         s := Trim(Dlg.RoundNameEdit.Text);
5311                         RoundList.RoundNameList.Add(s);
5312                         SetSelectItemRound(True, s);
5313                         ListView.Refresh;
5314                 end;
5315         finally
5316                 Dlg.Free;
5317         end;
5318 end;
5319
5320 procedure TGikoForm.SetSelectItemRound(RoundFlag: Boolean; RoundName: string);
5321 var
5322         i: Integer;
5323         List: TList;
5324 begin
5325         List := TList.Create;
5326         try
5327                 SelectListItem(List);
5328                 for i := 0 to List.Count - 1 do begin
5329                         if TObject(List[i]) is TBoard then begin
5330                                 TBoard(List[i]).RoundName := RoundName;
5331                                 TBoard(List[i]).Round := RoundFlag;
5332                         end else if TObject(List[i]) is TThreadItem then begin
5333                                 if TThreadItem(List[i]).IsLogFile then begin
5334                                         TThreadItem(List[i]).RoundName := RoundName;
5335                                         TThreadItem(List[i]).Round := RoundFlag;
5336                                 end;
5337                         end;
5338                 end;
5339         finally
5340                 List.Free;
5341         end;
5342 end;
5343
5344 procedure TGikoForm.SelectDeleteRoundExecute(Sender: TObject);
5345 begin
5346         SetSelectItemRound(False, '');
5347         ListView.Refresh;
5348 end;
5349
5350 procedure TGikoForm.SelectReservActionExecute(Sender: TObject);
5351 begin
5352         // \82±\82Ì\83R\83\81\83\93\83g\8dí\8f\9c\82µ\82Ä\82Í\91Ê\96Ú
5353 end;
5354
5355 procedure TGikoForm.SetSelectRoundName(Sender: TObject);
5356 var
5357         MenuItem: TMenuItem;
5358 begin
5359         if Sender is TMenuItem then begin
5360                 MenuItem := TMenuItem(Sender);
5361                 SetSelectItemRound(True, StripHotKey(MenuItem.Caption));
5362                 ListView.Refresh;
5363         end;
5364 end;
5365
5366 procedure TGikoForm.NewBoardActionExecute(Sender: TObject);
5367 var
5368         Dlg: TNewBoardDialog;
5369         Msg: string;
5370         i: Integer;
5371 begin
5372         for i := 0 to Screen.CustomFormCount - 1 do begin
5373                 if TObject(Screen.CustomForms[i]) is TEditorForm then begin
5374                         Msg := '\83\8c\83X\83G\83f\83B\83^\82ð\91S\82Ä\95Â\82\82Ä\82­\82¾\82³\82¢';
5375                         MsgBox(Handle, Msg, '\83G\83\89\81[', MB_OK or MB_ICONSTOP);
5376                         Exit;
5377                 end;
5378         end;
5379         Dlg := TNewBoardDialog.Create(Self);
5380         try
5381                 Dlg.ShowModal;
5382         finally
5383                 Dlg.Release;
5384         end;
5385 end;
5386
5387 procedure TGikoForm.LoginActionExecute(Sender: TObject);
5388 var
5389         TmpCursor: TCursor;
5390 begin
5391         if GikoSys.Dolib.Connected then begin
5392                 //\83\8d\83O\83A\83E\83g
5393                 GikoSys.Dolib.Disconnect;
5394                 LoginAction.Checked := False;
5395                 AddMessageList('\83\8d\83O\83A\83E\83g\82µ\82Ü\82µ\82½', nil, gmiOK);
5396                 LoginAction.Caption := '\83\8d\83O\83C\83\93(&L)';
5397         end else begin
5398                 TmpCursor := Screen.Cursor;
5399                 Screen.Cursor := crHourGlass;
5400                 try
5401                         GikoSys.Dolib.ClientUA := 'gikoNavi/1.00';
5402                         GikoSys.Dolib.UserName := GikoSys.Setting.UserID;
5403                         GikoSys.Dolib.Password := GikoSys.Setting.Password;
5404                         if GikoSys.Setting.ReadProxy then begin
5405                                 GikoSys.Dolib.ProxyAddress := GikoSys.Setting.ReadProxyAddress;
5406                                 GikoSys.Dolib.ProxyPort := GikoSys.Setting.ReadProxyPort;
5407                         end else begin
5408                                 GikoSys.Dolib.ProxyAddress := '';
5409                                 GikoSys.Dolib.ProxyPort := 0;
5410                         end;
5411                         if GikoSys.Dolib.Connect then begin
5412                                 LoginAction.Checked := True;
5413                                 AddMessageList('\83\8d\83O\83C\83\93\82µ\82Ü\82µ\82½ - ' + GikoSys.Setting.UserID, nil, gmiOK);
5414                                 LoginAction.Caption := '\83\8d\83O\83A\83E\83g(&L)';
5415                         end else begin
5416         //                      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);
5417                                 AddMessageList(GikoSys.Dolib.ErrorMsg, nil, gmiNG);
5418                                 PlaySound('Error');
5419                                 LoginAction.Checked := False;
5420                                 LoginToolButton.Down := False;
5421                         end;
5422                 finally
5423                         Screen.Cursor := TmpCursor;
5424                 end;
5425         end;
5426 end;
5427
5428 procedure TGikoForm.KeySettingActionExecute(Sender: TObject);
5429 var
5430         Dlg: TKeySettingForm;
5431 begin
5432         Dlg := TKeySettingForm.Create(Self);
5433         try
5434                 if Dlg.ShowModal = mrOk then
5435                         GikoSys.SaveKeySetting(ActionList);
5436         finally
5437                 Dlg.Release;
5438         end;
5439 end;
5440
5441 procedure TGikoForm.ArrangeActionExecute(Sender: TObject);
5442 begin
5443         if ArrangeAction.Checked then begin
5444                 //\8fc
5445                 ViewPanel.Align := alNone;
5446                 ListSplitter.Align := alNone;
5447                 ThreadPanel.Align := alNone;
5448
5449                 ViewPanel.Width := FBrowserSizeWidth;
5450                 ViewPanel.Align := alLeft;
5451
5452                 ListSplitter.Width := 5;
5453                 ListSplitter.Align := alLeft;
5454
5455                 ViewPanel.Left := -10;
5456
5457                 ThreadPanel.Align := alClient;
5458
5459                 GikoSys.Setting.ListOrientation := gloHorizontal;
5460                 case GikoSys.Setting.ListWidthState of
5461                         glsMax: begin
5462                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
5463                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
5464                                 ViewPanel.Width := 1;
5465                         end;
5466                         glsNormal: begin
5467                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
5468                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_MIN;
5469                         end;
5470                         glsMin: begin
5471                                 BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
5472                                 BrowserMinAction.ImageIndex := TOOL_ICON_WIDTH_NORMAL;
5473                                 ViewPanel.Width := ThreadMainPanel.Width - 80;
5474                         end;
5475                 end;
5476         end else begin
5477                 //\89¡
5478                 ViewPanel.Align := alNone;
5479                 ListSplitter.Align := alNone;
5480                 ThreadPanel.Align := alNone;
5481
5482                 ViewPanel.Height := FBrowserSizeHeight;
5483                 ViewPanel.Align := alTop;
5484
5485                 ListSplitter.Height := 5;
5486                 ListSplitter.Align := alTop;
5487
5488                 ViewPanel.Top := -10;
5489
5490                 ThreadPanel.Align := alClient;
5491                 GikoSys.Setting.ListOrientation := gloVertical;
5492                 case GikoSys.Setting.ListHeightState of
5493                         glsMax: begin
5494                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
5495                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
5496                                 ViewPanel.Height := 1;
5497                         end;
5498                         glsNormal: begin
5499                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
5500                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_MIN;
5501                         end;
5502                         glsMin: begin
5503                                 BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
5504                                 BrowserMinAction.ImageIndex := TOOL_ICON_HEIGHT_NORMAL;
5505                                 ViewPanel.Height := ThreadMainPanel.Height - BrowserCoolBar.Height - 7;
5506                         end;
5507                 end;
5508         end;
5509
5510 end;
5511
5512 procedure TGikoForm.PaneInitActionExecute(Sender: TObject);
5513 begin
5514         CabinetPanel.Width := 150;
5515         MessagePanel.Height := 40;
5516
5517         FBrowserSizeWidth := 200;
5518         FBrowserSizeHeight := 200;
5519         if ArrangeAction.Checked then begin
5520                 ViewPanel.Width := FBrowserSizeWidth;
5521         end else begin
5522                 ViewPanel.Height := FBrowserSizeHeight;
5523         end;
5524         if GikoSys.Setting.ListOrientation = gloHorizontal then begin
5525                 if GikoSys.Setting.ListHeightState = glsMax then begin
5526                         BrowserMaxAction.ImageIndex := TOOL_ICON_HEIGHT_MAX;
5527                         GikoSys.Setting.ListHeightState := glsNormal;
5528                 end;
5529         end else begin
5530                 if GikoSys.Setting.ListWidthState = glsMax then begin
5531                         BrowserMaxAction.ImageIndex := TOOL_ICON_WIDTH_MAX;
5532                         GikoSys.Setting.ListWidthState := glsNormal;
5533                 end;
5534         end;
5535 end;
5536
5537 procedure TGikoForm.ActiveLogDeleteActionExecute(Sender: TObject);
5538 const
5539         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';
5540         DEL_TITLE = '\8dí\8f\9c\8am\94F';
5541 var
5542         idx: Integer;
5543         ThreadItem: TThreadItem;
5544 begin
5545         idx := BrowserTab.TabIndex;
5546         if idx <> -1 then begin
5547                 if GikoSys.Setting.DeleteMsg then
5548                         if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONQUESTION or MB_DEFBUTTON2) <> IDYES then
5549                                 Exit;
5550                 ThreadItem := TThreadItem(BrowserTab.Tabs.Objects[idx]);
5551                 DeleteTab(ThreadItem);
5552                 ThreadItem.DeleteLogFile;
5553                 if ThreadItem.ParentBoard = FActiveList then
5554                         ListView.Refresh;
5555         end;
5556 end;
5557
5558 function TGikoForm.GetCoolBand(CoolBar: TCoolBar; Control: TWinControl): TCoolBand;
5559 var
5560         i: Integer;
5561 begin
5562         Result := nil;
5563         if CoolBar = nil then
5564                 Exit;
5565         for i := 0 to CoolBar.Bands.Count - 1 do begin
5566                 if CoolBar.Bands[i].Control = Control then begin
5567                         Result := CoolBar.Bands[i];
5568                         Exit;
5569                 end;
5570         end;
5571 end;
5572
5573 procedure TGikoForm.BrowserTabToolBarResize(Sender: TObject);
5574 begin
5575         if BrowserTab.Parent = BrowserTabToolBar then
5576                 BrowserTab.Width := BrowserTabToolBar.Width;
5577 end;
5578
5579 procedure TGikoForm.SelectTextClearActionExecute(Sender: TObject);
5580 begin
5581         GikoSys.Setting.SelectTextList.Clear;
5582         SelectComboBox.Items.Clear;
5583         SelectComboBox.Text := '';
5584         SetListViewType( gvtAll );
5585 end;
5586
5587 procedure TGikoForm.NameTextClearActionExecute(Sender: TObject);
5588 var
5589         i: Integer;
5590 begin
5591         GikoSys.Setting.NameList.Clear;
5592         for i := 0 to Screen.CustomFormCount - 1 do begin
5593                 if TObject(Screen.CustomForms[i]) is TEditorForm then
5594                         TEditorForm(Screen.CustomForms[i]).NameComboBox.Items.Clear;
5595         end;
5596 end;
5597
5598 procedure TGikoForm.MailTextClearActionExecute(Sender: TObject);
5599 var
5600         i: Integer;
5601 begin
5602         GikoSys.Setting.MailList.Clear;
5603         for i := 0 to Screen.CustomFormCount - 1 do begin
5604                 if TObject(Screen.CustomForms[i]) is TEditorForm then
5605                         TEditorForm(Screen.CustomForms[i]).MailComboBox.Items.Clear;
5606         end;
5607 end;
5608
5609 procedure TGikoForm.LeftmostTabSelectActionExecute(Sender: TObject);
5610 begin
5611         if BrowserTab.Tabs.Count > 0 then begin
5612                 BrowserTab.TabIndex := 0;
5613                 BrowserTab.OnChange(nil);
5614         end;
5615 end;
5616
5617 procedure TGikoForm.LeftTabSelectActionExecute(Sender: TObject);
5618 begin
5619         if BrowserTab.Tabs.Count > 0 then begin
5620                 if BrowserTab.TabIndex = -1 then begin
5621                         BrowserTab.TabIndex := 0;
5622                         BrowserTab.OnChange(nil);
5623                 end else if BrowserTab.TabIndex > 0 then begin
5624                         BrowserTab.TabIndex := BrowserTab.TabIndex - 1;
5625                         BrowserTab.OnChange(nil);
5626                 end;
5627         end;
5628 end;
5629
5630 procedure TGikoForm.RightTabSelectActionExecute(Sender: TObject);
5631 begin
5632         if BrowserTab.Tabs.Count > 0 then begin
5633                 if BrowserTab.TabIndex = -1 then begin
5634                         BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1;
5635                         BrowserTab.OnChange(nil);
5636                 end else if BrowserTab.TabIndex < (BrowserTab.Tabs.Count - 1) then begin
5637                         BrowserTab.TabIndex := BrowserTab.TabIndex + 1;
5638                         BrowserTab.OnChange(nil);
5639                 end;
5640         end;
5641 end;
5642
5643 procedure TGikoForm.RightmostTabSelectActionExecute(Sender: TObject);
5644 begin
5645         if BrowserTab.Tabs.Count > 0 then begin
5646                 BrowserTab.TabIndex := BrowserTab.Tabs.Count - 1;
5647                 BrowserTab.OnChange(nil);
5648         end;
5649 end;
5650
5651 procedure TGikoForm.LeftmostTabSelectActionUpdate(Sender: TObject);
5652 begin
5653         LeftmostTabSelectAction.Enabled := (BrowserTab.TabIndex <> 0) and (BrowserTab.Tabs.Count > 0);
5654 end;
5655
5656 procedure TGikoForm.LeftTabSelectActionUpdate(Sender: TObject);
5657 begin
5658         LeftTabSelectAction.Enabled := (BrowserTab.TabIndex <> 0) and (BrowserTab.Tabs.Count > 0);
5659 end;
5660
5661 procedure TGikoForm.RightTabSelectActionUpdate(Sender: TObject);
5662 begin
5663         RightTabSelectAction.Enabled := (BrowserTab.TabIndex <> BrowserTab.Tabs.Count - 1) and (BrowserTab.Tabs.Count > 0);
5664 end;
5665
5666 procedure TGikoForm.RightmostTabSelectActionUpdate(Sender: TObject);
5667 begin
5668         RightmostTabSelectAction.Enabled := (BrowserTab.TabIndex <> BrowserTab.Tabs.Count - 1) and (BrowserTab.Tabs.Count > 0);
5669 end;
5670
5671 procedure TGikoForm.WMSettingChange(var Message: TWMWinIniChange);
5672 begin
5673         SetMenuFont;
5674 end;
5675
5676 procedure TGikoForm.SetMenuFont;
5677 begin
5678 //      GikoSys.MenuFont(MenuToolBar.Font);
5679 //      MenuToolBar.Buttons[0].AutoSize := False;
5680 //      MenuToolBar.Buttons[0].AutoSize := True;
5681 //      MenuToolBar.Font.Color := clMenuText;
5682         GikoSys.MenuFont(MainCoolBar.Font);
5683         MenuToolBar.Buttons[0].AutoSize := False;
5684         MenuToolBar.Buttons[0].AutoSize := True;
5685         MainCoolBar.AutoSize := False;
5686         MainCoolBar.AutoSize := True;
5687
5688         GikoSys.MenuFont(ListCoolBar.Font);
5689         GikoSys.MenuFont(BrowserCoolBar.Font);
5690 //      MenuToolBar.Font.Color := clMenuText;
5691 end;
5692
5693 procedure TGikoForm.FavoriteMenuClick(Sender: TObject);
5694 var
5695         NewMenu: TMenuItem;
5696 begin
5697         FavoriteMenu.Clear;
5698
5699         //\82¨\8bC\82É\93ü\82è\82Ì\92Ç\89Á
5700         NewMenu := TMenuItem.Create(MainMenu);
5701         NewMenu.Action := FavoriteAddAction;
5702         FavoriteMenu.Add(NewMenu);
5703         //\82¨\8bC\82É\93ü\82è\82Ì\90®\97\9d
5704         NewMenu := TMenuItem.Create(FavoriteMenu);
5705         NewMenu.Action := FavoriteArrangeAction;
5706         FavoriteMenu.Add(NewMenu);
5707         //\83Z\83p\83\8c\81[\83^
5708         NewMenu := TMenuItem.Create(FavoriteMenu);
5709         NewMenu.Caption := '-';
5710         FavoriteMenu.Add(NewMenu);
5711
5712         CreateFavMenu(FavoriteDM.TreeView.Items.GetFirstNode, FavoriteMenu);
5713 end;
5714
5715 procedure TGikoForm.CreateFavMenu(Node: TTreeNode; MenuItem: TMenuItem);
5716 var
5717         i: Integer;
5718         NewMenu: TMenuItem;
5719 begin
5720         for i := 0 to Node.Count - 1 do begin
5721                 NewMenu := TFavoriteMenuItem.Create(Self);
5722                 NewMenu.AutoHotkeys := maAutomatic;
5723                 NewMenu.Caption := StringReplace(Node.Item[i].Text, '&', '&&', [rfReplaceAll]);
5724                 TFavoriteMenuItem(NewMenu).Data := Node.Item[i].Data;
5725                 MenuItem.Add(NewMenu);
5726
5727                 if TObject(Node.Item[i].Data) is TFavoriteFolder then begin
5728                         NewMenu.ImageIndex := TOOL_ICON_FAV_FOLDER;
5729                         CreateFavMenu(Node.Item[i], NewMenu);
5730                 end else if TObject(Node.Item[i].Data) is TFavoriteBoardItem then begin
5731                         NewMenu.ImageIndex := TOOL_ICON_FAV_BOARD;
5732                         NewMenu.OnClick := FavoriteClick;
5733                 end else if TObject(Node.Item[i].Data) is TFavoriteThreadItem then begin
5734                         NewMenu.ImageIndex := TOOL_ICON_FAV_THREAD;
5735                         NewMenu.OnClick := FavoriteClick;
5736                 end;
5737         end;
5738 end;
5739
5740 procedure TGikoForm.ShowFavoriteAddDialog( Item : TObject );
5741 var
5742         Dlg: TFavoriteAddDialog;
5743         i, b: Integer;
5744         ThreadItem: TThreadItem;
5745         Board: TBoard;
5746         FavThread: TFavoriteThreadItem;
5747         FavBoard: TFavoriteBoardItem;
5748 begin
5749
5750         b := FavoriteTreeView.Items.Count - 1;
5751         if Item is TBoard then begin
5752                 for i := 0 to b do begin
5753                         if TObject(FavoriteTreeView.Items.Item[ i ].Data) is TFavoriteBoardItem then begin
5754                                 FavBoard := TFavoriteBoardItem( FavoriteTreeView.Items.Item[ i ].Data );
5755                                 Board := BBS2ch.FindBBSID(FavBoard.BBSID);
5756
5757                                 if Board = Item then begin
5758                                         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
5759                                                 Exit;
5760                                         Break;
5761                                 end;
5762                         end;
5763                 end;
5764
5765                 Dlg := TFavoriteAddDialog.Create(Self);
5766                 try
5767                         Dlg.SetBoard( TBoard(Item) );
5768                         Dlg.ShowModal;
5769                 finally
5770                         Dlg.Free;
5771                 end;
5772         end else if Item is TThreadItem then begin
5773                 for i := 0 to b do begin
5774                         if TObject(FavoriteTreeView.Items.Item[ i ].Data) is TFavoriteThreadItem then begin
5775                                 FavThread := TFavoriteThreadItem( FavoriteTreeView.Items.Item[ i ].Data );
5776                                 Board := BBS2ch.FindBBSID(FavThread.BBSID);
5777                                 if Board <> nil then
5778                                         if not Board.IsThreadDatRead then
5779                                                 GikoSys.ReadSubjectFile(Board);
5780                                 ThreadItem := BBS2ch.FindThreadItem(FavThread.BBSID, FavThread.ThreadID);
5781
5782                                 if ThreadItem = Item then begin
5783                                         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
5784                                                 Exit;
5785                                         Break;
5786                                 end;
5787                         end;
5788                 end;
5789
5790                 Dlg := TFavoriteAddDialog.Create(Self);
5791                 try
5792                         Dlg.SetThreadItem( TThreadItem(Item) );
5793                         Dlg.ShowModal;
5794                 finally
5795                         Dlg.Free;
5796                 end;
5797         end;
5798
5799         SetLinkBar;
5800
5801 end;
5802
5803 procedure TGikoForm.FavoriteAddActionExecute(Sender: TObject);
5804 begin
5805         ShowFavoriteAddDialog(GetActiveContent);
5806 end;
5807
5808 procedure TGikoForm.FavoriteClick(Sender: TObject);
5809 begin
5810
5811         FavoriteClick( Sender, True );
5812
5813 end;
5814 procedure TGikoForm.FavoriteClick(Sender: TObject; ActiveTab: Boolean);
5815 var
5816         Board: TBoard;
5817         ThreadItem: TThreadItem;
5818         FavBoard: TFavoriteBoardItem;
5819         FavThread: TFavoriteThreadItem;
5820         Item: TObject;
5821 begin
5822 //      Item := nil;
5823         if Sender is TFavoriteMenuItem then
5824                 Item := TFavoriteMenuItem(Sender).Data
5825         else if Sender is TLinkToolButton then
5826                 Item := TLinkToolButton(Sender).Data
5827         else if Sender is TTreeNode then
5828                 Item := TTreeNode( Sender ).Data
5829         else
5830                 Exit;
5831
5832         if TObject(Item) is TFavoriteBoardItem then begin
5833                 FavBoard := TFavoriteBoardItem(Item);
5834                 Board := BBS2ch.FindBBSID(FavBoard.BBSID);
5835                 if Board <> nil then begin
5836                         if not Board.IsThreadDatRead then
5837                                 GikoSys.ReadSubjectFile(Board);
5838                         SelectTreeNode(Board, True);
5839                 end;
5840         end else if TObject(Item) is TFavoriteThreadItem then begin
5841                 FavThread := TFavoriteThreadItem(Item);
5842                 Board := BBS2ch.FindBBSID(FavThread.BBSID);
5843                 if Board <> nil then
5844                         if not Board.IsThreadDatRead then
5845                                 GikoSys.ReadSubjectFile(Board);
5846                 ThreadItem := BBS2ch.FindThreadItem(FavThread.BBSID, FavThread.ThreadID);
5847                 if ThreadItem <> nil then
5848                         InsertBrowserTab(ThreadItem, ActiveTab);
5849         end;
5850 end;
5851
5852 procedure TGikoForm.FavoriteAddActionUpdate(Sender: TObject);
5853 begin
5854         FavoriteAddAction.Enabled := (GetActiveContent <> nil);
5855 end;
5856
5857 procedure TGikoForm.BoardFavoriteAddActionExecute(Sender: TObject);
5858 begin
5859         if TObject(ListView.Selected.Data) is TBoard then
5860                 ShowFavoriteAddDialog(TObject(ListView.Selected.Data));
5861 end;
5862
5863 procedure TGikoForm.BoardFavoriteAddActionUpdate(Sender: TObject);
5864 begin
5865         BoardFavoriteAddAction.Enabled := (GetActiveList is TCategory) and (ListView.SelCount > 0);
5866 end;
5867
5868 procedure TGikoForm.ThreadFavoriteAddActionExecute(Sender: TObject);
5869 begin
5870         if TObject(ListView.Selected.Data) is TThreadItem then
5871                 ShowFavoriteAddDialog(TObject(ListView.Selected.Data));
5872 end;
5873
5874 procedure TGikoForm.ThreadFavoriteAddActionUpdate(Sender: TObject);
5875 begin
5876         ThreadFavoriteAddAction.Enabled := (GetActiveList is TBoard) and (ListView.SelCount > 0);
5877 end;
5878
5879 procedure TGikoForm.TreeSelectFavoriteAddActionExecute(Sender: TObject);
5880 begin
5881         ShowFavoriteAddDialog(TObject(TreeView.Selected.Data));
5882 end;
5883
5884 procedure TGikoForm.FavoriteArrangeActionExecute(Sender: TObject);
5885 var
5886         Dlg: TFavoriteArrangeDialog;
5887 begin
5888         Dlg := TFavoriteArrangeDialog.Create(Self);
5889         try
5890                 Dlg.ShowModal;
5891         finally
5892                 Dlg.Free;
5893         end;
5894         SetLinkBar;
5895 end;
5896
5897 procedure TGikoForm.MainCoolBarResize(Sender: TObject);
5898 begin
5899         TopPanel.Height := Max(MainCoolBar.Height, AnimePanel.Height);
5900 end;
5901
5902 procedure TGikoForm.MoveToActionExecute(Sender: TObject);
5903 var
5904         URL: string;
5905         idx: Integer;
5906 begin
5907         URL := Trim(AddressComboBox.Text);
5908         MoveToURL(URL);
5909
5910         idx := AddressComboBox.Items.IndexOf(URL);
5911         if idx = -1 then begin
5912                 AddressComboBox.Items.Insert(0, URL);
5913                 if AddressComboBox.Items.Count > GikoSys.Setting.AddressHistoryCount then
5914                         AddressComboBox.Items.Delete(AddressComboBox.Items.Count - 1);
5915         end else begin
5916                 AddressComboBox.Items.Delete(idx);
5917                 AddressComboBox.Items.Insert(0, URL);
5918         end;
5919 end;
5920
5921 procedure TGikoForm.MoveToURL(URL: string);
5922 var
5923         Protocol, Host, Path, Document, Port, Bookmark: string;
5924         BBSID: string;
5925         BBSKey: string;
5926         Board: TBoard;
5927         ThreadItem: TThreadItem;
5928         i, bi : Integer;
5929         boardURL : string;
5930         tmpThread : TThreadItem;
5931 begin
5932
5933         //===== \83v\83\89\83O\83C\83\93
5934         try
5935                 bi := High( BoardPlugIns );
5936                 for i := Low( BoardPlugIns ) to bi do begin
5937                         if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
5938                                 if BoardPlugIns[ i ].AcceptURL( URL ) then begin
5939                                         tmpThread               := TThreadItem.Create( BoardPlugIns[ i ], URL );
5940                                         boardURL                := tmpThread.BoardPlugIn.GetBoardURL( DWORD( tmpThread ) );
5941                                         Board                           := BBS2ch.FindBoardFromURL( boardURL );
5942                                         if Board = nil then begin
5943                                                 Board := TBoard.Create( tmpThread.BoardPlugIn, boardURL );
5944                                                 // \88È\89º\82â\82è\95û\82ª\95ª\82©\82ç\82È\82¢\82©\82ç\95Û\97¯
5945                                                 //Category.Add( Board );
5946                                                 //BBS2ch.Add( Category );
5947                                         end else begin
5948                                                 if not Board.IsThreadDatRead then
5949                                                         GikoSys.ReadSubjectFile( Board );
5950                                         end;
5951
5952                                         ThreadItem := Board.Find( tmpThread.FileName );
5953                                         if ThreadItem = nil then begin
5954                                                 ThreadItem := tmpThread;
5955                                                 Board.Insert( 0, ThreadItem );
5956                                                 if ActiveList is TBoard then begin
5957                                                         if TBoard(ActiveList) = Board then
5958                                                                 ListView.Items.Count := ListView.Items.Count + 1;
5959                                                         InsertBrowserTab(ThreadItem);
5960                                                         DownloadContent(ThreadItem);
5961                                                 end;
5962                                         end else begin
5963                                                 tmpThread.Free;
5964                                                 InsertBrowserTab( ThreadItem );
5965                                                 if not ThreadItem.IsLogFile then
5966                                                         DownloadContent( ThreadItem );
5967                                         end;
5968
5969
5970                                         Exit;
5971                                 end;
5972                         end;
5973                 end;
5974         except
5975                 // 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¢
5976         end;
5977
5978         GikoSys.ParseURI(URL, Protocol, Host, Path, Document, Port, Bookmark);
5979
5980         if GikoSys.Is2chHost(Host) and GikoSys.Parse2chURL(URL, Path, Document, BBSID, BBSKey) then begin
5981                 Board := BBS2ch.FindBBSID(BBSID);
5982                 if Board = nil then begin
5983                         GikoSys.OpenBrowser(URL, gbtAuto);
5984                         Exit;
5985                 end;
5986                 if Trim(BBSKey) = '' then begin
5987                         GikoSys.OpenBrowser(URL, gbtAuto);
5988                         Exit;
5989                 end;
5990                 if not Board.IsThreadDatRead then
5991                         GikoSys.ReadSubjectFile(Board);
5992                 ThreadItem := Board.Find(ChangeFileExt(BBSKey, '.dat'));
5993                 if ThreadItem = nil then begin
5994                         ThreadItem := TThreadItem.Create;
5995                         ThreadItem.FileName := ChangeFileExt(BBSKey, '.dat');
5996                         if AnsiPos(Host, Board.URL) = 0 then
5997                                 ThreadItem.DownloadHost := Host
5998                         else
5999                                 ThreadItem.DownloadHost := '';
6000                         Board.Insert(0, ThreadItem);
6001                         if ActiveList is TBoard then begin
6002                                 if TBoard(ActiveList) = Board then
6003                                         ListView.Items.Count := ListView.Items.Count + 1;
6004                                 InsertBrowserTab(ThreadItem);
6005                                 DownloadContent(ThreadItem);
6006                         end;
6007                 end else begin
6008                         if ThreadItem.IsLogFile then
6009                                 InsertBrowserTab(ThreadItem)
6010                         else begin
6011                                 if AnsiPos(Host, Board.URL) = 0 then
6012                                         ThreadItem.DownloadHost := Host
6013                                 else
6014                                         ThreadItem.DownloadHost := '';
6015                                 InsertBrowserTab(ThreadItem);
6016                                 DownloadContent(ThreadItem);
6017                         end;
6018                 end;
6019         end else begin
6020                 GikoSys.OpenBrowser(URL, gbtAuto);
6021         end;
6022 end;
6023
6024 procedure TGikoForm.AddressToolBarResize(Sender: TObject);
6025 begin
6026         AddressComboBox.Width := AddressToolBar.Width - MoveToToolButton.Width - 10;
6027 end;
6028
6029 procedure TGikoForm.AddressComboBoxKeyDown(Sender: TObject; var Key: Word;
6030         Shift: TShiftState);
6031 begin
6032         if Key = VK_RETURN then
6033                 MoveToAction.Execute;
6034 end;
6035
6036 procedure TGikoForm.BrowserEnter(Sender: TObject);
6037 begin
6038         Browser.DoObjectVerb(OLEIVERB_UIACTIVATE);
6039 end;
6040
6041 procedure TGikoForm.WMCopyData(var Message: TWMCopyData);
6042 var
6043         CDS:PCopyDataStruct;
6044         PC:PChar;
6045         sURL: string;
6046 begin
6047         CDS := Message.CopyDataStruct;
6048         GetMem(PC, CDS^.cbData);
6049         try
6050                 lstrcpy(PC,CDS^.lpData);
6051                 SetString(sURL, PC,lstrlen(PC));
6052                 MoveToURL(sURL);
6053         finally
6054                 FreeMem(PC);
6055         end;
6056         Message.Result := 1;
6057 end;
6058
6059 procedure TGikoForm.WndProc(var Message: TMessage);
6060 begin
6061         if (Message.Msg = CM_DIALOGCHAR) then
6062                 if not (ssAlt in KeyDataToShiftState(TWMChar(Message).KeyData)) then
6063                         Exit;
6064         inherited;
6065 end;
6066
6067 procedure TGikoForm.FormShortCut(var Msg: TWMKey; var Handled: Boolean);
6068 var
6069         hComboEdit: THandle;
6070 //      KeyData: Integer;
6071 begin
6072         Handled := False;
6073         if AddressComboBox.Focused or SelectComboBox.Focused then begin
6074                 if Msg.CharCode in [VK_BACK] then begin
6075                         hComboEdit := GetFocus;
6076                         if hComboEdit <> 0 then
6077                                 SendMessage(hComboEdit, WM_CHAR, Msg.CharCode, Msg.KeyData);
6078 //                              SendMessage(hComboEdit, WM_CHAR, Msg.CharCode, $000E0001);
6079                         Handled := True;
6080                 end;
6081                 if Msg.CharCode in [VK_INSERT, VK_DELETE, VK_HOME, VK_END, VK_PRIOR, VK_NEXT] then begin
6082                         hComboEdit := GetFocus;
6083                         if hComboEdit <> 0 then
6084                                 SendMessage(hComboEdit, WM_KEYDOWN, Msg.CharCode, Msg.KeyData);
6085                         Handled := True;
6086                 end;
6087 {       end else begin
6088                 //\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ð
6089                 KeyData := Msg.KeyData;
6090                 if (KeyData and $20000000) = 0 then begin
6091                         if Msg.CharCode in [Ord('F'), Ord('V'), Ord('B'), Ord('R'),
6092                                                                                                         Ord('A'), Ord('T'), Ord('H')] then begin
6093                                 if not ActionList.IsShortCut(Msg) then begin
6094                                         Handled := True;
6095                                 end;
6096                         end;
6097                 end;}
6098         end;
6099 end;
6100
6101 procedure TGikoForm.BrowserTabVisibleActionExecute(Sender: TObject);
6102 begin
6103         GikoSys.Setting.BrowserTabVisible := BrowserTabVisibleAction.Checked;
6104         SetBrowserTabState;
6105 end;
6106
6107 procedure TGikoForm.BrowserTabTopActionExecute(Sender: TObject);
6108 begin
6109         BrowserTabBottomAction.Checked := False;
6110         BrowserTabTopAction.Checked := True;
6111         GikoSys.Setting.BrowserTabPosition := gtpTop;
6112         SetBrowserTabState;
6113 end;
6114
6115 procedure TGikoForm.BrowserTabBottomActionExecute(Sender: TObject);
6116 begin
6117         BrowserTabTopAction.Checked := False;
6118         BrowserTabBottomAction.Checked := True;
6119         GikoSys.Setting.BrowserTabPosition := gtpBottom;
6120         SetBrowserTabState;
6121 end;
6122
6123 procedure TGikoForm.BrowserTabTabStyleActionExecute(Sender: TObject);
6124 begin
6125         BrowserTabButtonStyleAction.Checked := False;
6126         BrowserTabFlatStyleAction.Checked := False;
6127         BrowserTabTabStyleAction.Checked := True;
6128         GikoSys.Setting.BrowserTabStyle := gtsTab;
6129         SetBrowserTabState;
6130 end;
6131
6132 procedure TGikoForm.BrowserTabButtonStyleActionExecute(Sender: TObject);
6133 begin
6134         BrowserTabTabStyleAction.Checked := False;
6135         BrowserTabFlatStyleAction.Checked := False;
6136         BrowserTabButtonStyleAction.Checked := True;
6137         GikoSys.Setting.BrowserTabStyle := gtsButton;
6138         SetBrowserTabState;
6139 end;
6140
6141 procedure TGikoForm.BrowserTabFlatStyleActionExecute(Sender: TObject);
6142 begin
6143         BrowserTabFlatStyleAction.Checked := True;
6144         BrowserTabTabStyleAction.Checked := False;
6145         BrowserTabButtonStyleAction.Checked := False;
6146         GikoSys.Setting.BrowserTabStyle := gtsFlat;
6147         SetBrowserTabState;
6148 end;
6149
6150 procedure TGikoForm.PreviewTimerTimer(Sender: TObject);
6151 var
6152         p: TPoint;
6153         ARect: TRect;
6154         sl: TStringList;
6155         html: string;
6156         HtmlFileName: string;
6157
6158         NavURL: OleVariant;
6159         Flags: OleVariant;
6160         TargetFrameName: OleVariant;
6161         PostData: OleVariant;
6162         Headers: OleVariant;
6163         WindowHeight: Integer;
6164         WindowWidth: Integer;
6165
6166 //      Style: Longint;
6167         Referer: string;
6168         Protocol, Host, Path, Document, Port, Bookmark: string;
6169 begin
6170         PreviewTimer.Enabled := False;
6171
6172         GetCursorpos(p);
6173
6174         case GikoSys.Setting.PreviewSize of
6175                 gpsXSmall: begin
6176                         WindowWidth := 128;
6177                         WindowHeight := 96;
6178                 end;
6179                 gpsSmall: begin
6180                         WindowWidth := 256;
6181                         WindowHeight := 192;
6182                 end;
6183                 gpsLarge: begin
6184                         WindowWidth := 512;
6185                         WindowHeight := 384;
6186                 end;
6187                 gpsXLarge: begin
6188                         WindowWidth := 640;
6189                         WindowHeight := 480;
6190                 end;
6191                 else begin      //gpsMedium
6192                         WindowWidth := 384;
6193                         WindowHeight := 288;
6194                 end;
6195         end;
6196
6197         ARect := Rect(0, 0, WindowWidth, WindowHeight);
6198
6199         case GikoSys.Setting.PopupPosition of
6200                 gppRightTop:            OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - (ARect.Bottom - ARect.Top) -     15);
6201                 gppRight:                       OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
6202                 gppRightBottom: OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y + 15);
6203                 gppTop:                                 OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - (ARect.Bottom - ARect.Top) -  15);
6204                 gppCenter:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - ((ARect.Bottom - ARect.Top) div 2));
6205                 gppBottom:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y + 15);
6206                 gppLeftTop:                     OffsetRect(ARect, p.x + 15, p.y - (ARect.Bottom - ARect.Top) -  15);
6207                 gppLeft:                                OffsetRect(ARect, p.x + 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
6208                 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Ó
6209         end;
6210
6211         html := '<html><head>'#13#10
6212                                 + '<SCRIPT>'#13#10
6213                                 + 'function init() {'#13#10
6214                                 + '     if ((document.body.clientHeight >= Image1.height) && (document.body.clientWidth >= Image1.width)) {'#13#10
6215                                 + '     } else {'#13#10
6216                                 + '             var dh, ih;'#13#10
6217                                 + '             dh = document.body.clientWidth / document.body.clientHeight;'#13#10
6218                                 + '             ih = Image1.width / Image1.height;'#13#10
6219                                 + '             if (document.body.clientWidth < document.body.clientHeight) {'#13#10
6220                                 + '                     if (ih > dh)'#13#10
6221                                 + '                             Image1.width = document.body.clientWidth;'#13#10
6222                                 + '                     else'#13#10
6223                                 + '                             Image1.height = document.body.clientHeight;'#13#10
6224                                 + '             } else {'#13#10
6225                                 + '                     if (ih < dh)'#13#10
6226                                 + '                             Image1.height = document.body.clientHeight;'#13#10
6227                                 + '                     else'#13#10
6228                                 + '                             Image1.width = document.body.clientWidth;'#13#10
6229                                 + '             }'#13#10
6230                                 + '     }'#13#10
6231                                 + '     Message.style.display = "none";'#13#10
6232                                 + '}'#13#10
6233                                 + '</SCRIPT>'#13#10
6234                                 + '</head>'#13#10
6235                                 + '<body topmargin="0" leftmargin="0" style="border-width: 1px; overflow:hidden; border-style: solid;" onLoad="init()">'#13#10
6236                                 + '<div align="center" id="Message">\83v\83\8c\83r\83\85\81[\8dì\90¬\92\86</div>'#13#10
6237                                 + '<div align="center"><img name="Image1" border="0" src="%ImageURL%"></div>'#13#10
6238                                 + '</body></html>';
6239         sl := TStringList.Create;
6240         try
6241                 try
6242                         HtmlFileName := GikoSys.GetAppDir + HTML_FILE_NAME;
6243                         sl.Text := AnsiReplaceStr(html, '%ImageURL%', FPreviewURL);
6244                         sl.SaveToFile(HtmlFileName);
6245                 finally
6246                         sl.Free;
6247                 end;
6248         except
6249         end;
6250
6251         NavURL := HtmlFileName;
6252         Flags := 0;
6253         TargetFrameName := '';
6254         PostData := '';
6255
6256         GikoSys.ParseURI(FPreviewURL, Protocol, Host, Path, Document, Port, Bookmark);
6257         Referer := Protocol + '://' + Host;
6258         if Port <> '' then
6259                 Referer := Referer + ':' + Port;
6260         Referer := Referer + Path;
6261         Headers := 'Referer: ' + Referer;
6262
6263         FPreviewBrowser.Navigate(NavURL, Flags, TargetFrameName, PostData, Headers);
6264
6265         if ARect.Top + WindowHeight > Screen.DesktopHeight then
6266                 ARect.Top := Screen.DesktopHeight - WindowHeight;
6267         if ARect.Left + WindowWidth > Screen.DesktopWidth then
6268                 ARect.Left := Screen.DesktopWidth - WindowWidth;
6269         if ARect.Left < Screen.DesktopLeft then ARect.Left := Screen.DesktopLeft;
6270         if ARect.Bottom < Screen.DesktopTop then ARect.Bottom := Screen.DesktopTop;
6271
6272         SetWindowPos(FPreviewBrowser.Handle, HWND_TOPMOST, ARect.Left, ARect.Top, WindowWidth, WindowHeight, SWP_NOACTIVATE or SWP_HIDEWINDOW);
6273         ShowWindow(FPreviewBrowser.Handle, SW_SHOWNOACTIVATE);
6274
6275 //      Style := GetWindowLong(FPreviewBrowser.Handle, GWL_EXSTYLE);
6276 //      SetWindowLong(FPreviewBrowser.Handle, GWL_EXSTYLE, Style xor WS_EX_APPWINDOW);
6277
6278 end;
6279
6280 procedure TGikoForm.WMSetCursor(var Message: TWMSetCursor);
6281 begin
6282         if PreviewTimer.Enabled then
6283                 PreviewTimer.Enabled := False;
6284         if (FHint <> nil) and (IsWindowVisible(FHint.Handle)) then begin
6285                 FHint.ReleaseHandle;
6286                 FHint.ClearAllRes;
6287         end;
6288         if (FPreviewBrowser <> nil) and (IsWindowVisible(FPreviewBrowser.Handle)) then
6289                 ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
6290         Message.Result := 1;
6291         inherited;
6292 end;
6293
6294 procedure TGikoForm.MessageHideButtonClick(Sender: TObject);
6295 begin
6296         MsgBarCloseAction.Execute;
6297 end;
6298
6299 function TGikoForm.OnDocumentContextMenu(Sender: TObject): WordBool;
6300 var
6301         Doc: IHtmlDocument2;
6302         Range: IHTMLTxtRange;
6303         s: string;
6304         Num: Integer;
6305         ThreadItem: TThreadItem;
6306 begin
6307         Doc := Browser.Document as IHtmlDocument2;
6308         Range := Doc.selection.createRange as IHTMLTxtRange;
6309         s := StringReplace(Range.text, '\81@', ' ', [rfReplaceAll]);
6310         s := GikoSys.ZenToHan(Trim(s));
6311         if GikoSys.IsNumeric(s) then begin
6312
6313                 ThreadItem := GetActiveContent;
6314                 if ThreadItem <> nil then begin
6315                         Num := StrToInt(s);
6316                         FHint.PopupType := gptThread;
6317                         SetResPopupText(ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), Num, Num, False, False);
6318                         if FHint.ResCount <> 0 then
6319                                 ShowTextPopup;
6320                         Result := False;
6321                 end else
6322                         Result := True;
6323         end else begin
6324                 Result := True;
6325         end;
6326 end;
6327
6328 procedure TGikoForm.SetResPopupText(sBoard: string; sThread: string; StNum, ToNum: Integer; Title, First: Boolean);
6329 var
6330         i: Integer;
6331         tmp: string;
6332         FileName: string;
6333         Line: Integer;
6334
6335         wkInt: Integer;
6336
6337         Res: TResRec;
6338         Board: TBoard;
6339         ThreadItem: TThreadItem;
6340         Header: string;
6341         Body: string;
6342
6343                                 //Abonizer : TAbon;
6344 begin
6345         try
6346                 if StNum > ToNum then begin
6347                         wkInt := StNum;
6348                         StNum := ToNum;
6349                         ToNum := wkInt;
6350                 end;
6351
6352                 if (sBoard <> '') and (sThread <> '') then begin
6353                         //\8dÅ\91å10\83\8c\83X\82Ü\82Å\95\\8e¦
6354                         if StNum + 10 < ToNum then
6355                                 ToNum := StNum + 10;
6356
6357                         //\83^\83C\83g\83\8b\95\\8e¦
6358                         if Title then begin
6359                                 Board := BBS2ch.FindBBSID(sBoard);
6360                                 if Board <> nil then begin
6361                                         if not Board.IsThreadDatRead then
6362                                                 GikoSys.ReadSubjectFile(Board);
6363                                         ThreadItem := Board.Find(sThread + '.dat');
6364                                         if ThreadItem <> nil then
6365                                                 FHint.Title := ThreadItem.Title;
6366                                 end;
6367                         end;
6368
6369                         for i := StNum to ToNum do begin
6370                                 Line := i;
6371                                 FileName := IncludeTrailingPathDelimiter(BBS2ch.GetLogFolder + sBoard) + sThread + '.dat';
6372                                 tmp := GikoSys.ReadThreadFile(FileName, Line);
6373
6374                                 if (tmp <> '') And ( not GikoSys.FAbon.CheckAbonPopupRes(tmp) And( not GikoSys.FAbon.CheckIndividualAbonList(line))) then begin
6375                                         Res := GikoSys.DivideStrLine(tmp);
6376
6377                                         Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' \93\8a\8de\93ú\81F ' + Res.FDateTime;
6378
6379                                         Body := StringReplace(Res.FBody, '<br> ', #10, [rfIgnoreCase, rfReplaceAll]);
6380                                         Body := StringReplace(Body, '<br>', #10, [rfIgnoreCase, rfReplaceAll]);
6381                                         Body := StringReplace(Body, '</a>', '', [rfIgnoreCase, rfReplaceAll]);
6382                                         Body := GikoSys.DeleteLink(Body);
6383                                         Body := StringReplace(Body, '&lt;', '<', [rfReplaceAll]);
6384                                         Body := StringReplace(Body, '&gt;', '>', [rfReplaceAll]);
6385                                         Body := StringReplace(Body, '&quot;', '"', [rfReplaceAll]);
6386                                         Body := StringReplace(Body, '&amp;', '&', [rfReplaceAll]);
6387                                         FHint.Add(Header, Body);
6388 //                                                      s := StringReplace(s, '&amp', '&', [rfReplaceAll]);
6389 //                                                      s := StringReplace(s, '\81\97\81M', ',', [rfReplaceAll]);
6390                                 end;
6391                         end;
6392                 end;
6393         finally
6394         end;
6395 end;
6396
6397 {function TGikoForm.GetThreadText(sBoard: string; sThread: string; StNum, ToNum: Integer; Title, First: Boolean): string;
6398 var
6399         i: Integer;
6400         s: string;
6401         tmp: string;
6402         FileName: string;
6403         Line: Integer;
6404         SList: TStrings;
6405
6406         wkInt: Integer;
6407
6408         Res: TResRec;
6409         ActiveFileName: string;
6410         Board: TBoard;
6411         ThreadItem: TThreadItem;
6412         Header: string;
6413         Body: string;
6414 begin
6415         s := '';
6416         HintData := THintData.Create;
6417         SList := TStringList.Create;
6418         try
6419
6420                 if StNum > ToNum then begin
6421                         wkInt := StNum;
6422                         StNum := ToNum;
6423                         ToNum := wkInt;
6424                 end;
6425
6426                 if (sBoard <> '') and (sThread <> '') then begin
6427
6428                         //\8dÅ\91å10\83\8c\83X\82Ü\82Å\95\\8e¦
6429                         if StNum + 10 < ToNum then
6430                                 ToNum := StNum + 10;
6431
6432                         //\83^\83C\83g\83\8b\95\\8e¦
6433                         if Title then begin
6434                                 Board := BBS2ch.FindBBSID(sBoard);
6435                                 if Board <> nil then begin
6436                                         if not Board.IsThreadDatRead then
6437                                                 GikoSys.ReadSubjectFile(Board);
6438                                         ThreadItem := Board.Find(sThread + '.dat');
6439                                         //ThreadItem := BBS2ch.FindThreadItem(sBoard, sThread + '.dat');
6440                                         if ThreadItem <> nil then
6441                                                 HintData.Title := ThreadItem.Title;
6442                                                 //s := s + ThreadItem.Title;
6443                                 end;
6444                         end;
6445
6446                         for i := StNum to ToNum do begin
6447                                 Line := i;
6448                                 FileName := IncludeTrailingPathDelimiter(BBS2ch.GetLogFolder + sBoard) + sThread + '.dat';
6449                                 tmp := GikoSys.ReadThreadFile(FileName, Line);
6450                                 if tmp <> '' then begin
6451                                         Res := GikoSys.DivideStrLine(tmp);
6452
6453                                         //if s <> '' then
6454                                         //      s := s + #10#10;
6455                                         //s := s + IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' \93\8a\8de\93ú\81F ' + Res.FDateTime + #10 + #10;
6456                                         //s := s + ' ' + StringReplace(Res.FBody, '<br>', #10, [rfIgnoreCase, rfReplaceAll]);
6457                                         Header := IntToStr(Line) + ' \96¼\91O\81F ' + Res.FName + ' \93\8a\8de\93ú\81F ' + Res.FDateTime;
6458
6459                                         s := StringReplace(Res.FBody, '<br> ', #10, [rfIgnoreCase, rfReplaceAll]);
6460                                         s := StringReplace(s, '<br>', #10, [rfIgnoreCase, rfReplaceAll]);
6461                                         s := StringReplace(s, '</a>', '', [rfIgnoreCase, rfReplaceAll]);
6462                                         s := GikoSys.DeleteLink(s);
6463                                         s := StringReplace(s, '&lt;', '<', [rfReplaceAll]);
6464                                         s := StringReplace(s, '&gt;', '>', [rfReplaceAll]);
6465                                         s := StringReplace(s, '&quot;', '"', [rfReplaceAll]);
6466                                         s := StringReplace(s, '&amp;', '&', [rfReplaceAll]);
6467                                         Body := s;
6468                                         HintData.Add(Header, Body);
6469 //                                                      s := StringReplace(s, '&amp', '&', [rfReplaceAll]);
6470 //                                                      s := StringReplace(s, '\81\97\81M', ',', [rfReplaceAll]);
6471                                 end;
6472                         end;
6473                 end;
6474
6475         finally
6476                 SList.Free;
6477         end;
6478         Result := HintData;
6479 end;}
6480
6481 procedure TGikoForm.ShowTextPopup;
6482 var
6483         p: TPoint;
6484         ARect: TRect;
6485 begin
6486 //      if Trim(s) = '' then
6487 //              Exit;
6488         try
6489                 FHint.Font.Name := GikoSys.Setting.HintFontName;
6490                 FHint.Font.Size := GikoSys.Setting.HintFontSize;
6491                 FHint.Font.Color := GikoSys.Setting.HintFontColor;
6492                 FHint.Color := GikoSys.Setting.HintBackColor;
6493                 FHint.HeaderBold := GikoSys.Setting.ResPopupHeaderBold;
6494                 GetCursorpos(p);
6495                 if FHint.PopupType = gptRaw then
6496                         ARect := FHint.CalcHintRect(Screen.Width, FHint.Caption, nil)
6497                 else
6498                         ARect := FHint.CalcHintRect(Screen.Width, '', nil);
6499                 case GikoSys.Setting.PopupPosition of
6500                         gppRightTop:            OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - (ARect.Bottom - ARect.Top) -     15);
6501                         gppRight:                       OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
6502                         gppRightBottom: OffsetRect(ARect, p.x - (ARect.Right - ARect.Left) - 15, p.y + 15);
6503                         gppTop:                                 OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - (ARect.Bottom - ARect.Top) -  15);
6504                         gppCenter:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y - ((ARect.Bottom - ARect.Top) div 2));
6505                         gppBottom:                      OffsetRect(ARect, p.x - ((ARect.Right - ARect.Left) div 2), p.y + 15);
6506                         gppLeftTop:                     OffsetRect(ARect, p.x + 15, p.y - (ARect.Bottom - ARect.Top) -  15);
6507                         gppLeft:                                OffsetRect(ARect, p.x + 15, p.y - ((ARect.Bottom - ARect.Top) div 2));
6508                         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Ó
6509                 end;
6510                 //FHint.ActivateHint(ARect, s);
6511                 if FHint.PopupType = gptRaw then
6512                         FHint.ActivateHint(ARect, FHint.Caption)
6513                 else
6514                         FHint.ActivateHint(ARect, '');
6515         except
6516                 FHint.ReleaseHandle;
6517                 FHint.ClearAllRes;
6518         end;
6519 end;
6520
6521 procedure TGikoForm.GikoHelpActionExecute(Sender: TObject);
6522 var
6523         FileName: string;
6524 begin
6525         FileName := GikoSys.GetAppDir + 'batahlp.chm';
6526         if not FileExists(FileName) then begin
6527                 MsgBox(
6528                         Handle,
6529                         '\83w\83\8b\83v\82ª\8c©\82Â\82©\82è\82Ü\82¹\82ñ\82Å\82µ\82½' + #13#10 +
6530                         '\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 +
6531                         '\83w\83\8b\83v\82Í\83M\83R\83i\83r\82Ì\83T\83C\83g\82É\92u\82¢\82Ä\82 \82è\82Ü\82·',
6532                         '\83G\83\89\81[',
6533                         MB_ICONSTOP);
6534                 Exit;
6535         end;
6536         ShellExecute(Handle, 'open', PChar(FileName), '', PChar(GikoSys.GetAppDir), SW_SHOW);
6537 end;
6538
6539 procedure TGikoForm.ToolButton18Click(Sender: TObject);
6540 begin
6541         if FTreeType = gttHistory then begin
6542                 FHistoryList.Clear;
6543                 TreeView.Items.Clear;
6544         end;
6545 end;
6546
6547 procedure TGikoForm.KotehanActionExecute(Sender: TObject);
6548 var
6549         Dlg: TKotehanDialog;
6550 begin
6551         Dlg := TKotehanDialog.Create(Self);
6552         try
6553                 Dlg.ShowModal;
6554         finally
6555                 Dlg.Release;
6556         end;
6557 end;
6558
6559 procedure TGikoForm.SetLinkBar;
6560 var
6561         i: Integer;
6562         j: Integer;
6563         ToolButton: TLinkToolButton;
6564         MenuItem: TMenuItem;
6565 begin
6566         MainCoolBar.Bands.BeginUpdate;
6567         try
6568                 LinkBarPopupMenu.Items.Clear;
6569                 for i := LinkToolBar.ButtonCount - 1 downto 0 do
6570                         LinkToolBar.RemoveControl(LinkToolBar.Buttons[i]);
6571                 for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
6572                         if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
6573                                 for j := 0 to FavoriteTreeView.Items[i].Count - 1 do begin
6574                                         ToolButton := TLinkToolButton.Create(LinkToolBar);
6575                                         if TObject(FavoriteTreeView.Items[i].Item[j].Data) is TFavoriteFolder then begin
6576                                                 MenuItem := TMenuItem.Create(Self);
6577                                                 CreateFavMenu(FavoriteTreeView.Items[i].Item[j], MenuItem);
6578                                                 LinkBarPopupMenu.Items.Add(MenuItem);
6579                                                 ToolButton.MenuItem := MenuItem;
6580                                                 ToolButton.ImageIndex := TOOL_ICON_FAV_FOLDER;
6581                                         end else if TObject(FavoriteTreeView.Items[i].Item[j].Data) is TFavoriteBoardItem then begin
6582                                                 ToolButton.ImageIndex := TOOL_ICON_FAV_BOARD;
6583                                                 ToolButton.OnClick := FavoriteClick;
6584                                         end else if TObject(FavoriteTreeView.Items[i].Item[j].Data) is TFavoriteThreadItem then begin
6585                                                 ToolButton.ImageIndex := TOOL_ICON_FAV_THREAD;
6586                                                 ToolButton.OnClick := FavoriteClick;
6587                                         end;
6588                                         ToolButton.Caption := FavoriteTreeView.Items[i].Item[j].Text;
6589                                         ToolButton.Left := 10000;
6590                                         ToolButton.Data := FavoriteTreeView.Items[i].Item[j].Data;
6591                                         ToolButton.AutoSize := True;
6592                                         ToolButton.OnDragDrop := LinkToolButtonDragDrop;
6593                                         ToolButton.OnDragOver := FavoriteDragOver;
6594                                         ToolButton.OnMouseDown := LinkToolButtonOnMouseDown;
6595                                         ToolButton.OnMouseMove := LinkToolButtonOnMouseMove;
6596                                         ToolButton.OnMouseUp := LinkToolButtonOnMouseUp;
6597                                         ToolButton.OnStartDrag := LinkToolButtonStartDrag;
6598                                         //ToolButton.DragMode := dmAutomatic;
6599                                         ToolButton.DragMode := dmManual;
6600                                         ToolButton.PopupMenu := FavoriteTreePopupMenu;
6601
6602                                         LinkToolBar.InsertControl(ToolButton);
6603                                 end;
6604                                 break;
6605                         end;
6606                 end;
6607 {               if LinkToolBar.ButtonCount = 0 then begin
6608                         ToolButton := TLinkToolButton.Create(LinkToolBar);
6609                         ToolButton.Style := tbsButton;
6610                         ToolButton.ImageIndex := -1;
6611                         ToolButton.Caption := '';
6612                         LinkToolBar.InsertControl(ToolButton);
6613                 end;}
6614         finally
6615                 MainCoolBar.Bands.EndUpdate;
6616         end;
6617 end;
6618
6619 procedure TGikoForm.FavoriteDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
6620 var
6621         Node: TTreeNode;
6622         bound: TRect;
6623         height: Integer;
6624         Change: Boolean;
6625 begin
6626
6627         if Sender = FavoriteTreeView then begin
6628                 Node := FavoriteTreeView.GetNodeAt(X, Y);
6629
6630                 if Node = nil then
6631                         Exit;
6632
6633                 bound := Node.DisplayRect( False );
6634                 height := bound.Bottom - bound.Top;
6635                 if (bound.Top + height / 2) <= Y then
6636                         Node := FavoriteTreeView.GetNodeAt(X, Y + height);
6637
6638                 if Node = nil then
6639                         Exit;
6640
6641                 if Node.IsFirstNode then
6642                         Exit;
6643
6644                 Change := True;
6645
6646                 if FDropSpaceNode <> nil then
6647                         if FDropSpaceNode.AbsoluteIndex = Node.AbsoluteIndex then
6648                                 Change := False;
6649
6650                 if Change then begin
6651                         if FDropSpaceNode <> nil then
6652                                 FDropSpaceNode.Free;
6653
6654                         FDropSpaceNode := FavoriteDM.TreeView.Items.AddChildObject(Node.Parent, '', nil );
6655                         FDropSpaceNode.MoveTo( Node, naInsert );
6656                         FDropSpaceNode.ImageIndex := -1;
6657                         FDropSpaceNode.SelectedIndex := -1;
6658                 end;
6659         end;
6660
6661         if Source = FavoriteTreeView then begin
6662                 if FavoriteTreeView.Selected = FavoriteTreeView.Items.GetFirstNode then begin
6663                         Accept := False;
6664                         Exit;
6665                 end;
6666                 Accept := True;
6667         end else if Source = BrowserTab then
6668                 Accept := True
6669         else if Source = ListView then
6670                 Accept := True
6671         else if Source is TLinkToolButton then
6672                 Accept := True
6673         else if Source = TreeView then
6674                 Accept := True
6675         else
6676                 Accept := False;
6677 end;
6678
6679 procedure TGikoForm.FavoriteTreeViewDragOver(Sender, Source: TObject; X, Y: Integer; State: TDragState; var Accept: Boolean);
6680 begin
6681
6682         FavoriteDragOver( Sender, Source, X, Y, State, Accept );
6683
6684 end;
6685 procedure TGikoForm.LinkToolButtonStartDrag(Sender: TObject; var DragObject: TDragObject);
6686 begin
6687          //     FDragging := true;
6688 end;
6689
6690 procedure TGikoForm.LinkToolButtonDragDrop(Sender, Source: TObject; X, Y: Integer);
6691 var
6692         SenderNode: TTreeNode;
6693         LinkToolButton: TLinkToolButton;
6694 begin
6695
6696         LinkToolButton := TLinkToolButton( Sender );
6697         SenderNode := TreeNodeDataFind( FavoriteTreeView.TopItem, LinkToolButton.Data );
6698
6699         FavoriteDragDrop( SenderNode, Source );
6700
6701 end;
6702
6703 procedure TGikoForm.LinkToolButtonOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
6704 begin
6705 end;
6706
6707 procedure TGikoForm.LinkToolButtonOnMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
6708 var
6709         Now : Cardinal;
6710 begin
6711         TToolButton( Sender ).DragMode := dmManual;
6712         if ssLeft in Shift then begin
6713                 TToolButton( Sender ).Down := true;
6714                 if FDragTime = 0 then begin
6715                         FDragTime := GetTickCount();
6716                 end else begin
6717                         Now := GetTickCount();
6718                         if (Now - FDragTime) > 500 then begin
6719                                 if FDragButton <> TToolButton( Sender ) then begin
6720                                         try
6721                                                 FDragButton := TToolButton( Sender );
6722                                                 TToolButton(Sender).BeginDrag(false ,5);
6723                                                 FDragTime := 0;
6724                                         except
6725                                                 {$IF Defined(debug)}
6726                                                 ShowMessage('Error');
6727                                                 {$IFEND}
6728                                         end;
6729                                 end;
6730                         end;
6731                 end;
6732         end else begin
6733                 FDragTime := 0;
6734         end;
6735 end;
6736
6737 procedure TGikoForm.LinkToolButtonOnMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
6738 begin
6739         FDragTime := 0;
6740 end;
6741
6742 function TGikoForm.GetWidthAllToolButton(ToolBar: TToolBar): Integer;
6743 var
6744         i: Integer;
6745 begin
6746         Result := 0;
6747         for i := 0 to ToolBar.ButtonCount - 1 do
6748                 Result := Result + ToolBar.Buttons[i].Width;
6749 end;
6750
6751 procedure TGikoForm.MainCoolBarBandInfo(Sender: TObject; var BandInfo: PReBarBandInfoA);
6752 var
6753         Control: TWinControl;
6754 begin
6755         Control := FindControl(BandInfo^.hwndChild);
6756         if (Control = MenuToolBar) or (Control = StdToolBar) or (Control = LinkToolBar) then begin
6757                 BandInfo^.fMask := BandInfo.fMask or RBBIM_STYLE or RBBIM_IDEALSIZE;
6758                 BandInfo^.fStyle := BandInfo.fStyle or RBBS_USECHEVRON;
6759                 BandInfo^.cxIdeal := GetWidthAllToolButton(TToolBar(Control));
6760         end;
6761 end;
6762
6763 procedure TGikoForm.MainCoolBarChevronClick(Sender: TObject; RebarChevron: PNMRebarChevron);
6764 var
6765         i : Integer;
6766         Idx: Integer;
6767         p: TPoint;
6768 begin
6769         ChevronPopupMenu.Items.Clear;
6770         Idx := 0;
6771         for i := 0 to MainCoolBar.Bands.Count - 1 do begin
6772                 if MainCoolBar.Bands[ i ].Visible then begin
6773                         if Idx = Int64(RebarChevron^.uBand) then begin
6774                                 Idx := i;
6775                                 break;
6776                         end;
6777                         Inc( Idx );
6778                 end;
6779         end;
6780         if (Idx >= 0) and (MainCoolBar.Bands.Count > Idx) then begin
6781                 if MainCoolBar.Bands[Idx].Control = MenuToolbar then begin
6782                         MenuBarChevronMenu;
6783                 end else if MainCoolBar.Bands[Idx].Control = StdToolbar then begin
6784                         ToolBarChevronMenu(StdToolBar);
6785                 end else if MainCoolBar.Bands[Idx].Control = LinkToolbar then begin
6786                         LinkBarChevronMenu;
6787                 end else
6788                         Exit;
6789                 p := MainCoolBar.ClientToScreen(Point(RebarChevron^.rc.left, RebarChevron^.rc.bottom));
6790                 ChevronPopupMenu.Popup(p.x, p.y);
6791         end;
6792 end;
6793
6794 procedure TGikoForm.MenuBarChevronMenu;
6795         procedure SetSubMenu(MenuItem: TMenuItem; PopupItem: TMenuItem);
6796         var
6797                 i: Integer;
6798                 Item: TMenuItem;
6799         begin
6800                 MenuItem.Click;
6801                 for i := 0 to MenuItem.Count - 1 do begin
6802 //                      Item := nil;
6803                         if MenuItem[i] is TFavoriteMenuItem then begin
6804                                 Item := TFavoriteMenuItem.Create(Self);
6805                                 TFavoriteMenuItem(Item).Data := TFavoriteMenuItem(MenuItem[i]).Data;
6806                         end else
6807                                 Item := TMenuItem.Create(Self);
6808                         Item.Caption := MenuItem[i].Caption;
6809                         Item.Action := MenuItem[i].Action;
6810                         Item.ImageIndex := MenuItem[i].ImageIndex;
6811                         Item.OnClick := MenuItem[i].OnClick;
6812                         PopupItem.Add(Item);
6813                         if MenuItem[i].Count > 0 then
6814                                 SetSubMenu(MenuItem[i], Item);
6815                 end;
6816         end;
6817 var
6818         i: Integer;
6819         w: Integer;
6820         bw: Integer;
6821         Item: TMenuItem;
6822 begin
6823         ChevronPopupMenu.Items.Clear;
6824         ChevronPopupMenu.Images := MainMenu.Images;
6825         bw := GetWidthAllToolButton(MenuToolBar);
6826         if MenuToolBar.Width < bw then begin
6827                 w := 0;
6828                 for i := 0 to MenuToolBar.ButtonCount - 1 do begin
6829                         w := w + MenuToolBar.Buttons[i].Width;
6830                         if MenuToolBar.Width <= w then begin
6831                                 Item := TMenuItem.Create(Self);
6832                                 Item.Caption := MenuToolBar.Buttons[i].MenuItem.Caption;
6833                                 //Item.Action := MenuToolBar.Buttons[i].MenuItem.Action;
6834                                 ChevronPopupMenu.Items.Add(Item);
6835                                 SetSubMenu(MenuToolbar.Buttons[i].MenuItem, Item);
6836                         end;
6837                 end;
6838         end;
6839 end;
6840
6841 procedure TGikoForm.ToolBarChevronMenu(ToolBar: TToolBar);
6842         procedure SetSubMenu(PopupMenu: TPopupMenu; PopupItem: TMenuItem);
6843         var
6844                 i: Integer;
6845                 Item: TMenuItem;
6846         begin
6847                 if Assigned(PopupMenu.OnPopup) then
6848                         PopupMenu.OnPopup(nil);
6849                 for i := 0 to PopupMenu.Items.Count - 1 do begin
6850 //                      Item := nil;
6851                         if PopupMenu.Items[i] is TFavoriteMenuItem then begin
6852                                 Item := TFavoriteMenuItem.Create(Self);
6853                                 TFavoriteMenuItem(Item).Data := TFavoriteMenuItem(PopupMenu.Items[i]).Data;
6854                         end else
6855                         Item := TMenuItem.Create(Self);
6856                         Item.Caption := PopupMenu.Items[i].Caption;
6857                         Item.Action := PopupMenu.Items[i].Action;
6858                         Item.ImageIndex := PopupMenu.Items[i].ImageIndex;
6859                         Item.OnClick := PopupMenu.Items[i].OnClick;
6860                         PopupItem.Add(Item);
6861                 end;
6862         end;
6863 var
6864         i: Integer;
6865         w: Integer;
6866         bw: Integer;
6867         Item: TMenuItem;
6868 begin
6869         ChevronPopupMenu.Items.Clear;
6870         ChevronPopupMenu.Images := ToolBar.HotImages;
6871         bw := GetWidthAllToolButton(ToolBar);
6872         if ToolBar.Width < bw then begin
6873                 w := 0;
6874                 for i := 0 to ToolBar.ButtonCount - 1 do begin
6875                         w := w + ToolBar.Buttons[i].Width;
6876                         if ToolBar.Width <= w then begin
6877                                 Case ToolBar.Buttons[i].Tag of
6878                                 0:
6879                                         begin
6880                                                 Item := TMenuItem.Create(Self);
6881                                                 if ToolBar.Buttons[i].Style = tbsSeparator then
6882                                                         Item.Caption := '-'
6883                                                 else begin
6884                                                         Item.Caption := ToolBar.Buttons[i].Caption;
6885                                                         Item.Action := ToolBar.Buttons[i].Action;
6886                                                         //Item.Visible := True;
6887                                                 end;
6888                                                 ChevronPopupMenu.Items.Add(Item);
6889                                                 if ToolBar.Buttons[i].DropdownMenu <> nil then begin
6890                                                         Item.Action := nil;
6891                                                         Item.OnClick := nil;
6892                                                         SetSubMenu(ToolBar.Buttons[i].DropdownMenu, Item);
6893                                                 end;
6894                                         end;
6895                                 else
6896                                         // \8f«\97\88\82Ì\82½\82ß\82Ì\97\\96ñ
6897                                 end;
6898                         end;
6899                 end;
6900         end;
6901 end;
6902
6903 procedure TGikoForm.LinkBarChevronMenu;
6904 var
6905         i: Integer;
6906         j: Integer;
6907         w: Integer;
6908         Item: TFavoriteMenuItem;
6909         bw: Integer;
6910         Button: TLinkToolButton;
6911 begin
6912         ChevronPopupMenu.Items.Clear;
6913         ChevronPopupMenu.Images := LinkToolBar.Images;
6914         bw := GetWidthAllToolButton(LinkToolBar);
6915         if LinkToolBar.Width < bw then begin
6916                 w := 0;
6917                 for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
6918                         if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
6919                                 for j := 0 to FavoriteTreeView.Items[i].Count - 1 do begin
6920                                         w := w + LinkToolBar.Buttons[j].Width;
6921                                         if LinkToolBar.Width <= w then begin
6922                                                 if LinkToolBar.Buttons[j] is TLinkToolButton then begin
6923                                                         Button := TLinkToolButton(LinkToolBar.Buttons[j]);
6924                                                         Item := TFavoriteMenuItem.Create(Self);
6925                                                         if TObject(Button.Data) is TFavoriteFolder then begin
6926                                                                 CreateFavMenu(FavoriteTreeView.Items[i].Item[j], Item);
6927                                                         end else if TObject(Button.Data) is TFavoriteBoardItem then begin
6928                                                                 Item.OnClick := FavoriteClick;
6929                                                         end else if TObject(Button.Data) is TFavoriteThreadItem then begin
6930                                                                 Item.OnClick := FavoriteClick;
6931                                                         end;
6932                                                         Item.Data := Button.Data;
6933                                                         Item.Caption := LinkToolBar.Buttons[j].Caption;
6934                                                         Item.ImageIndex := LinkToolBar.Buttons[j].ImageIndex;
6935                                                         ChevronPopupMenu.Items.Add(Item);
6936                                                 end;
6937                                         end;
6938                                 end;
6939                                 break;
6940                         end;
6941                 end;
6942         end;
6943 end;
6944
6945 procedure TGikoForm.ListCoolBarBandInfo(Sender: TObject; var BandInfo: PReBarBandInfoA);
6946 var
6947         Control: TWinControl;
6948 begin
6949         Control := FindControl(BandInfo^.hwndChild);
6950         if Control = ListToolBar then begin
6951                 BandInfo^.fMask := BandInfo.fMask or RBBIM_STYLE or RBBIM_IDEALSIZE;
6952                 BandInfo^.fStyle := BandInfo.fStyle or RBBS_USECHEVRON;
6953                 BandInfo^.cxIdeal := GetWidthAllToolButton(TToolBar(Control));
6954         end;
6955 end;
6956
6957 procedure TGikoForm.ListCoolBarChevronClick(Sender: TObject; RebarChevron: PNMRebarChevron);
6958 var
6959         Idx: Integer;
6960         p: TPoint;
6961 begin
6962         ChevronPopupMenu.Items.Clear;
6963         Idx := RebarChevron^.uBand;
6964         if (Idx >= 0) and (ListCoolBar.Bands.Count > Idx) then begin
6965                 if ListCoolBar.Bands[Idx].Control = ListToolBar then begin
6966                         ToolBarChevronMenu(ListToolBar);
6967                 end else
6968                         Exit;
6969                 p := ListCoolBar.ClientToScreen(Point(RebarChevron^.rc.left, RebarChevron^.rc.bottom));
6970                 ChevronPopupMenu.Popup(p.x, p.y);
6971         end;
6972 end;
6973
6974 procedure TGikoForm.BrowserCoolBarBandInfo(Sender: TObject; var BandInfo: PReBarBandInfoA);
6975 var
6976         Control: TWinControl;
6977 begin
6978         Control := FindControl(BandInfo^.hwndChild);
6979         if Control = BrowserToolBar then begin
6980                 BandInfo^.fMask := BandInfo.fMask or RBBIM_STYLE or RBBIM_IDEALSIZE;
6981                 BandInfo^.fStyle := BandInfo.fStyle or RBBS_USECHEVRON;
6982                 BandInfo^.cxIdeal := GetWidthAllToolButton(TToolBar(Control));
6983         end;
6984 end;
6985
6986 procedure TGikoForm.BrowserCoolBarChevronClick(Sender: TObject; RebarChevron: PNMRebarChevron);
6987 var
6988         Idx: Integer;
6989         p: TPoint;
6990 begin
6991         ChevronPopupMenu.Items.Clear;
6992         Idx := RebarChevron^.uBand;
6993         if (Idx >= 0) and (BrowserCoolBar.Bands.Count > Idx) then begin
6994                 if BrowserCoolBar.Bands[Idx].Control = BrowserToolBar then
6995                         ToolBarChevronMenu(BrowserToolBar)
6996                 else
6997                         Exit;
6998                 p := BrowserCoolBar.ClientToScreen(Point(RebarChevron^.rc.left, RebarChevron^.rc.bottom));
6999                 ChevronPopupMenu.Popup(p.x, p.y);
7000         end;
7001 end;
7002
7003 procedure TGikoForm.ListViewColumnInfo(Sender: TObject; var Column: PLVColumnA);
7004 begin
7005         if Column^.iImage = -1 then begin
7006                 Column^.mask := Column^.mask or LVCF_FMT;
7007         end else begin
7008                 Column^.mask := Column^.mask or LVCF_FMT or LVCF_IMAGE;
7009                 Column^.fmt := Column^.fmt or LVCFMT_IMAGE or LVCFMT_BITMAP_ON_RIGHT;
7010         end;
7011 end;
7012
7013 procedure TGikoForm.ThreadEditorActionExecute(Sender: TObject);
7014 var
7015         Editor: TEditorForm;
7016 begin
7017         if not (GetActiveList is TBoard) then
7018                 Exit;
7019         Editor := TEditorForm.Create(Self);
7020         Editor.SetBoard(TBoard(GetActiveList));
7021         Editor.Show;
7022         Editor.BodyEdit.SetFocus;
7023 end;
7024
7025 procedure TGikoForm.ToolBarSettingActionExecute(Sender: TObject);
7026 var
7027         Dlg: TToolBarSettingDialog;
7028         i: Integer;
7029         //Component: TComponent;
7030 begin
7031         Dlg := TToolBarSettingDialog.Create(Self, ActionList);
7032         try
7033                 Dlg.AddToolBar(StdToolBar, gttStandard);
7034                 Dlg.AddToolBar(ListToolBar, gttList);
7035                 Dlg.AddToolBar(BrowserToolBar, gttBrowser);
7036                 {
7037                 if ToolBarSettingAction.ActionComponent.GetParentComponent is TPopupMenu then begin
7038                         Component := TPopupMenu( ToolBarSettingAction.ActionComponent.GetParentComponent ).PopupComponent;
7039
7040                         if Component = MainCoolBar then
7041                                 Dlg.ToolBarComboBox.ItemIndex := 0
7042                         else if Component = ListCoolBar then
7043                                 Dlg.ToolBarComboBox.ItemIndex := 1
7044                         else if Component = BrowserCoolBar then
7045                                 Dlg.ToolBarComboBox.ItemIndex := 2;
7046                 end;
7047                 }
7048                 if Dlg.ShowModal = mrOK then begin
7049                         SetToolBarPopup;
7050
7051                         //\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é
7052                         for i := 0 to MainCoolBar.Bands.Count - 1 do begin
7053                                 MainCoolBar.Bands[i].MinWidth := MainCoolBar.Bands[i].MinWidth + 1;
7054                                 MainCoolBar.Bands[i].MinWidth := MainCoolBar.Bands[i].MinWidth - 1;
7055                         end;
7056                         for i := 0 to ListCoolBar.Bands.Count - 1 do begin
7057                                 ListCoolBar.Bands[i].MinWidth := ListCoolBar.Bands[i].MinWidth + 1;
7058                                 ListCoolBar.Bands[i].MinWidth := ListCoolBar.Bands[i].MinWidth - 1;
7059                         end;
7060                         for i := 0 to BrowserCoolBar.Bands.Count - 1 do begin
7061                                 BrowserCoolBar.Bands[i].MinWidth := BrowserCoolBar.Bands[i].MinWidth + 1;
7062                                 BrowserCoolBar.Bands[i].MinWidth := BrowserCoolBar.Bands[i].MinWidth - 1;
7063                         end;
7064                         SaveToolBarSetting(StdToolBar);
7065                         SaveToolBarSetting(ListToolBar);
7066                         for i := ListToolBar.ControlCount - 1 downto 0 do
7067                         begin
7068                                 if ListToolBar.Controls[ i ].Action = SelectItemAction then
7069                                 begin
7070                                         // \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·
7071                                         if (i + 1) < ListToolBar.ControlCount then
7072                                                 if ListToolBar.Controls[ i + 1 ] is TToolButton then
7073                                                         if TToolButton( ListToolBar.Controls[ i + 1 ] ).Style = tbsSeparator then
7074                                                                 ListToolBar.Controls[ i + 1 ].Visible := False;
7075
7076                                         // \83X\83\8c\83b\83h\8di\8d\9e\83{\83^\83\93\82ð\89B\82·
7077                                         ListToolBar.Controls[ i ].Visible := False;
7078                                         // \83X\83\8c\83b\83h\8di\8d\9e\83t\83B\81[\83\8b\83h\82ð\91}\93ü
7079                                         SelectComboBox.Left := ListToolBar.Controls[ i ].Left;
7080                                         SelectComboBox.Width := GikoSys.Setting.SelectComboBoxWidth;
7081                                         SelectComboBox.Parent := ListToolBar;
7082                                         // \83X\83\8c\83b\83h\8di\8d\9e\97p\93Æ\8e©\83Z\83p\83\8c\81[\83^\82ð\91}\93ü
7083                                         SelectComboBoxSplitter.Left := SelectComboBox.Left + SelectComboBox.Width;
7084                                         SelectComboBoxSplitter.Parent := ListToolBar;
7085
7086                                         break;
7087                                 end;
7088                         end;
7089                         SaveToolBarSetting(BrowserToolBar);
7090                 end;
7091         finally
7092                 Dlg.Release;
7093         end;
7094 end;
7095
7096 procedure TGikoForm.SetToolBarPopup;
7097 var
7098         i: Integer;
7099 begin
7100         for i := 0 to StdToolBar.ButtonCount - 1 do begin
7101         end;
7102         for i := 0 to ListToolBar.ButtonCount - 1 do begin
7103                 if ListToolBar.Buttons[i].Action = IconStyle then
7104                         ListToolBar.Buttons[i].DropdownMenu := ListIconPopupMenu;
7105                 if ListToolBar.Buttons[i].Action = SelectReservAction then
7106                         ListToolBar.Buttons[i].DropdownMenu := RoundNamePopupMenu;
7107         end;
7108         for i := 0 to BrowserToolBar.ButtonCount - 1 do begin
7109                 if BrowserToolBar.Buttons[i].Action = IEAction then
7110                         BrowserToolBar.Buttons[i].DropdownMenu := BrowserPopupMenu;
7111         end;
7112 end;
7113
7114 procedure TGikoForm.FormMouseWheel(Sender: TObject; Shift: TShiftState;
7115         WheelDelta: Integer; MousePos: TPoint; var Handled: Boolean);
7116 var
7117         Wnd: THandle;
7118         delta: Integer;
7119 //      msg: TMessage;
7120 begin
7121         Handled := False;
7122         Wnd := WindowFromPoint(MousePos);
7123         Handled := True;
7124         if WheelDelta > 0 then
7125                 Delta := -1
7126         else
7127                 Delta := 1;
7128
7129         if (Wnd = BrowserTab.Handle) or
7130                  (Wnd = BrowserTab.Parent.Handle) then begin
7131                 BrowserTab.ScrollTabs(Delta);
7132         end else if Wnd = ListView.Handle then begin
7133                 if ListView.ViewStyle = vsList then
7134                         ListView.Scroll( Delta * Mouse.WheelScrollLines * Abs( ListView.Font.Height ), 0 )
7135                 else
7136                         ListView.Scroll( 0, Delta * Mouse.WheelScrollLines * Abs( ListView.Font.Height ) );
7137         end else begin
7138                 Handled := False;
7139         end;
7140 end;
7141
7142
7143 procedure TGikoForm.SelectComboBoxChange(Sender: TObject);
7144 begin
7145         if Length( SelectComboBox.Text ) = 0 then
7146         begin
7147                 AllItemAction.Checked := True;
7148                 LogItemAction.Checked := False;
7149                 NewItemAction.Checked := False;
7150         end else begin
7151                 // \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é
7152                 if AllItemAction.Checked then
7153                                                 AllItemAction.Checked := False;
7154                 if LogItemAction.Checked then
7155                                                 LogItemAction.Checked := False;
7156                 if NewItemAction.Checked then
7157                                                 NewItemaction.Checked := False;
7158         end;
7159
7160         if Length( SelectComboBox.Text ) = 0 then
7161                 SetListViewType( gvtAll )
7162         else
7163                 SetListViewType( gvtUser, SelectComboBox.Text, false);
7164 end;
7165
7166 procedure TGikoForm.SelectComboBoxKeyDown(Sender: TObject; var Key: Word;
7167         Shift: TShiftState);
7168 begin
7169
7170         if Key = VK_Return then
7171         begin
7172                 ModifySelectList;
7173         end else if Length( SelectComboBox.Text ) = 0 then
7174         begin
7175                 AllItemAction.Checked := True;
7176                 LogItemAction.Checked := False;
7177                 NewItemAction.Checked := False;
7178         end else begin
7179                 // \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é
7180                 if AllItemAction.Checked then
7181                         AllItemAction.Checked := False;
7182                 if LogItemAction.Checked then
7183                         LogItemAction.Checked := False;
7184                 if NewItemAction.Checked then
7185                         NewItemaction.Checked := False;
7186         end;
7187
7188 end;
7189
7190 procedure TGikoForm.SelectComboBoxExit(Sender: TObject);
7191 begin
7192
7193         ModifySelectList;
7194
7195         if Length( SelectComboBox.Text ) = 0 then
7196         begin
7197                 SelectComboBox.Text := SELECTCOMBOBOX_NAME;
7198                 SelectComboBox.Color := SELECTCOMBOBOX_COLOR;
7199         end;
7200
7201 end;
7202
7203 // \8di\82è\8d\9e\82Ý\8c\9f\8dõ\82Ì\97\9a\97ð\8dX\90V
7204 procedure TGikoForm.ModifySelectList;
7205 var
7206         idx : Integer;
7207         oldText : string;
7208 begin
7209
7210         try
7211                 if SelectComboBox.Parent = nil then
7212                         exit;
7213
7214                 if Length( SelectComboBox.Text ) > 0 then
7215                 begin
7216                         oldText := SelectComboBox.Text;
7217                         idx := GikoSys.Setting.SelectTextList.IndexOf( oldText );
7218                         if idx <> -1 then
7219                                 GikoSys.Setting.SelectTextList.Delete( idx );
7220                         idx := SelectComboBox.Items.IndexOf( oldText );
7221                         if idx <> -1 then
7222                                 SelectComboBox.Items.Delete( idx );
7223                         GikoSys.Setting.SelectTextList.Insert( 0, oldText );
7224                         SelectComboBox.Items.Insert( 0, oldText );
7225                         SelectComboBox.Text := oldText;
7226                 end;
7227         except
7228         end;
7229
7230 end;
7231
7232 //NG\83\8f\81[\83h\83t\83@\83C\83\8b\82ð\95Ò\8fW\82·\82é\82½\82ß\82É\8aJ\82­
7233 procedure TGikoForm.NG1Click(Sender: TObject);
7234 begin
7235         GikoSys.FAbon.EditNGwords;
7236 end;
7237 //NG\83\8f\81[\83h\83t\83@\83C\83\8b\82ð\8dÄ\93Ç\82Ý\8d\9e\82Ý\82·\82é
7238 procedure TGikoForm.SelectResActionExecute(Sender: TObject);
7239 var
7240         Dlg: TListSelectDialog;
7241         ThreadItem : TThreadItem;
7242         FilterList : TStringList;
7243         idx : Integer;
7244 begin
7245         Dlg := TListSelectDialog.Create(Self);
7246         try
7247                 Dlg.SelectComboBox.Items.Assign(GikoSys.Setting.SelectTextList);
7248                 Dlg.SelectComboBox.Text := '';
7249                 Dlg.ShowModal;
7250                 if (Dlg.ModalResult = mrCancel) or (Length( Dlg.SelectComboBox.Text ) = 0) then begin
7251                         // \83{\83^\83\93\82Ì\8dX\90V
7252                         AllResAction.Checked := True;
7253                         SelectResAction.Checked := False;
7254
7255                         // \83t\83B\83\8b\83^\95\8e\9a\97ñ\82ð\8bó\82É\82·\82é
7256                         FilterList := TStringList.Create;
7257                         try
7258                                 GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
7259                                 GikoSys.FSelectResFilter.Reverse := False;
7260                         finally
7261                                 FilterList.Destroy;
7262                         end;
7263                 end else begin
7264                         // \83{\83^\83\93\82Ì\8dX\90V
7265                         AllResAction.Checked := False;
7266                         SelectResAction.Checked := True;
7267
7268                         // \8c\9f\8dõ\97\9a\97ð\82Ì\8dX\90V
7269                         idx := GikoSys.Setting.SelectTextList.IndexOf(Dlg.SelectComboBox.Text);
7270                         if idx <> -1 then
7271                                 GikoSys.Setting.SelectTextList.Delete(idx);
7272                         GikoSys.Setting.SelectTextList.Insert(0, Dlg.SelectComboBox.Text);
7273                         while Dlg.SelectComboBox.Items.Count > 100 do begin
7274                                 Dlg.SelectComboBox.Items.Delete(Dlg.SelectComboBox.Items.Count - 1);
7275                         end;
7276
7277                         try
7278                                 if SelectComboBox.Parent <> nil then
7279                                         SelectComboBox.Items.Assign( GikoSys.Setting.SelectTextList );
7280                         except
7281                         end;
7282
7283                         // \83t\83B\83\8b\83^\82Ì\90Ý\92è
7284                         FilterList := TStringList.Create;
7285                         try
7286                                 GikoSys.FSelectResFilter.Reverse := True;
7287                                 FilterList.Delimiter := ' '; //\8bæ\90Ø\82è\8eq\82ð\94¼\8ap\83X\83y\81[\83X\82É\90Ý\92è
7288                                 FilterList.DelimitedText := Dlg.SelectComboBox.Text;
7289
7290                                 GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
7291                         finally
7292                                 FilterList.Destroy;
7293                         end;
7294                 end;
7295
7296                 // \83X\83\8c\83b\83h\82Ì\8dÄ\95`\89æ
7297                 ThreadItem := GetActiveContent;
7298                 if ThreadItem <> nil then
7299                         SetContent( ThreadItem );
7300         finally
7301                 Dlg.Release;
7302         end;
7303
7304 end;
7305
7306 procedure TGikoForm.SelectResActionUpdate(Sender: TObject);
7307 begin
7308         SelectResAction.Enabled := GetActiveContent <> nil;
7309 end;
7310
7311 procedure TGikoForm.FormKeyDown(Sender: TObject; var Key: Word;
7312         Shift: TShiftState);
7313
7314 var
7315
7316         Doc: IHtmlDocument2;
7317 //      Range: IHTMLTxtRange;
7318         s: string;
7319         Num: Integer;
7320         ThreadItem: TThreadItem;
7321
7322 begin
7323
7324         ThreadItem := GetActiveContent;
7325         if ThreadItem <> nil then begin
7326                 if ssCtrl in Shift then begin
7327                         if ssAlt in Shift then begin
7328                                 Doc := Browser.Document as IHtmlDocument2;
7329                                 s := IntToStr(Fkeynum);
7330                                 if GikoSys.IsNumeric(s) then begin
7331                                         ThreadItem := GetActiveContent;
7332                                         if ThreadItem <> nil then begin
7333                                                 Num := StrToInt(s);
7334                                                 FHint.PopupType := gptThread;
7335                                                 SetResPopupText(ThreadItem.ParentBoard.BBSID, ChangeFileExt(ThreadItem.FileName, ''), Num, Num, False, False);
7336                                                 if FHint.ResCount <> 0 then begin
7337                                                         ShowTextPopup;
7338                                                 end;
7339                                         end;
7340                                 end;
7341                                 Fkeynum := 0;
7342                         end else begin
7343                                 if Fkeynum = 0 then begin
7344                                         if (Key >= $60) and (Key <= $69) then begin
7345                                                         Fkeynum := Key - $60;
7346                                         end;
7347                                 end else begin
7348                                         if (Key >= $60) and (Key <= $69) then begin
7349                                                         Fkeynum := Fkeynum * 10 + Key - $60;
7350                                         end;
7351                                 end;
7352                         end;
7353                 end else begin
7354                         Fkeynum := 0;
7355                         if FHint <> nil then begin
7356                                 FHint.ReleaseHandle;
7357                                 FHint.ClearAllRes;
7358                         end;
7359                 end;
7360         end;
7361
7362 end;
7363
7364
7365 procedure TGikoForm.FormKeyUp(Sender: TObject; var Key: Word;
7366         Shift: TShiftState);
7367 begin
7368
7369         if Key = $11 then begin
7370                 Fkeynum := 0;
7371                 if FHint <> nil then begin
7372                         FHint.ReleaseHandle;
7373                         FHint.ClearAllRes;
7374                 end;
7375
7376         end;
7377
7378 end;
7379
7380 // \91S\82Ä\82Ì\83\8c\83X\82ð\95\\8e¦
7381 procedure TGikoForm.AllResActionExecute(Sender: TObject);
7382 var
7383         ThreadItem : TThreadItem;
7384         FilterList : TStringList;
7385 begin
7386         // \83{\83^\83\93\82Ì\8dX\90V
7387         AllResAction.Checked := True;
7388         SelectResAction.Checked := False;
7389
7390         // \83t\83B\83\8b\83^\95\8e\9a\97ñ\82ð\8bó\82É\82·\82é
7391         FilterList := TStringList.Create;
7392         try
7393                 GikoSys.FSelectResFilter.LoadFromStringList( FilterList );
7394                 GikoSys.FSelectResFilter.Reverse := False;
7395         finally
7396                 FilterList.Destroy;
7397         end;
7398
7399         // \83X\83\8c\83b\83h\82ð\8dÄ\95`\89æ
7400         ThreadItem := GetActiveContent;
7401         if ThreadItem <> nil then
7402                 SetContent( ThreadItem );
7403 end;
7404
7405 procedure TGikoForm.AllResActionUpdate(Sender: TObject);
7406 begin
7407         AllResAction.Enabled := GetActiveContent <> nil;
7408 end;
7409
7410 procedure TGikoForm.ReloadClick(Sender: TObject);
7411 var
7412         ThreadItem : TThreadItem;
7413 begin
7414         if GikoSys.FAbon.ReLoadFromNGwordFile =false then begin
7415                 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);
7416         end else begin
7417                 ThreadItem := GetActiveContent;
7418                 if ThreadItem <> nil then
7419                         SetContent( ThreadItem );
7420         end;
7421
7422 end;
7423
7424 procedure TGikoForm.GoBackClick(Sender: TObject);
7425 var
7426         ThreadItem : TThreadItem;
7427         s: string;
7428 begin
7429         if GikoSys.FAbon.GoForward =false then begin
7430                 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);
7431         end else begin
7432                 s := GikoSys.FAbon.NGwordname;
7433                 StatusBar.Panels.Items[2].Text := s;
7434                 StatusBar.Panels[2].Width := Max(StatusBar.Canvas.TextWidth(s), 100);
7435                 StatusBarResize(Sender);
7436                 ThreadItem := GetActiveContent;
7437                 if ThreadItem <> nil then
7438                         SetContent( ThreadItem );
7439         end;
7440
7441 end;
7442
7443 procedure TGikoForm.GoFowardClick(Sender: TObject);
7444 var
7445         ThreadItem : TThreadItem;
7446         s: string;
7447 begin
7448         if GikoSys.FAbon.GoBack =false then begin
7449                 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);
7450         end else begin
7451                 s := GikoSys.FAbon.NGwordname;
7452                 StatusBar.Panels.Items[2].Text := s;
7453                 StatusBar.Panels[2].Width := Max(StatusBar.Canvas.TextWidth(s), 100);
7454                 StatusBarResize(Sender);
7455                 ThreadItem := GetActiveContent;
7456                 if ThreadItem <> nil then
7457                         SetContent( ThreadItem );
7458         end;
7459
7460 end;
7461
7462 procedure TGikoForm.SelectComboBoxSplitterMouseMove(Sender: TObject;
7463         Shift: TShiftState; X, Y: Integer);
7464 var
7465         pos : TPoint;
7466         w : Integer;
7467 begin
7468         If (SelectComboBox.Parent <> nil) and (IsDraggingSelectComboBox) Then begin
7469                 pos.X := X;
7470                 pos.Y := Y;
7471                 pos := SelectComboBoxSplitter.ClientToScreen( pos );
7472                 w := SelectComboBox.Width + (pos.X - DraggingSelectComboBoxPosition.X);
7473
7474                 If w <= 50 Then Begin
7475                         // \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­
7476                         // \81u\8e~\82Ü\82Á\82½(50pixel)\88Ê\92u\81v\82É\82È\82é\82æ\82¤\82É
7477                         pos.X := pos.X + (50 - w);
7478
7479                         // \8f¬\82³\82­\82È\82è\82·\82¬\82È\82¢\82æ\82¤\82É
7480                         w := 50;
7481                 End;
7482
7483                 // \83`\83\89\82Â\82«\8cy\8c¸\82Ì\88×
7484                 If SelectComboBox.Width <> w Then Begin
7485                         SelectComboBox.Width := w;
7486                         GikoSys.Setting.SelectComboBoxWidth := w;
7487                         DraggingSelectComboBoxPosition := pos;
7488                 End;
7489         End;
7490 end;
7491
7492 procedure TGikoForm.SelectComboBoxSplitterMouseDown(Sender: TObject;
7493         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
7494 var
7495         pos : TPoint;
7496 begin
7497         IsDraggingSelectComboBox := True;
7498         pos.X := X;
7499         pos.Y := Y;
7500         DraggingSelectComboBoxPosition := SelectComboBoxSplitter.ClientToScreen( pos );
7501 end;
7502
7503 procedure TGikoForm.SelectComboBoxSplitterMouseUp(Sender: TObject;
7504         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
7505 begin
7506         IsDraggingSelectComboBox := False;
7507 end;
7508
7509 procedure TGikoForm.StatusBarResize(Sender: TObject);
7510 begin
7511         StatusBar.Panels[1].Width := StatusBar.Width -
7512                                                                                                                          StatusBar.Panels[0].Width -
7513                                                                                                                          StatusBar.Panels[2].Width;
7514 end;
7515 //\8cÂ\95Ê\82 \82Ú\81[\82ñ\81u\92Ê\8fí\81v
7516 procedure TGikoForm.IndividualAbon1Click(Sender: TObject);
7517 var
7518         ThreadItem : TThreadItem;
7519 begin
7520         GikoSys.FAbon.AddIndividualAbon(KokoPopupMenu.Tag,1);
7521         ThreadItem := GetActiveContent;
7522         if ThreadItem <> nil then
7523                 SetContent( ThreadItem );
7524 end;
7525 //\8cÂ\95Ê\82 \82Ú\81[\82ñ\81u\93§\96¾\81v
7526 procedure TGikoForm.IndividualAbon2Click(Sender: TObject);
7527 var
7528         ThreadItem : TThreadItem;
7529 begin
7530         GikoSys.FAbon.AddIndividualAbon(KokoPopupMenu.Tag,0);
7531         ThreadItem := GetActiveContent;
7532         if ThreadItem <> nil then
7533                 SetContent( ThreadItem );
7534 end;
7535 //\8cÂ\95Ê\82 \82Ú\81[\82ñ\89ð\8f\9c\81i\81j
7536 procedure TGikoForm.AntiIndividualAbonClick(Sender: TObject);
7537 var
7538         ThreadItem : TThreadItem;
7539         msg : String;
7540 begin
7541         if GikoSys.FAbon.GetAbonResCount <> 0 then begin
7542                 GikoSys.FAbon.DeleteIndividualAbon(KokoPopupMenu.Tag);
7543                 ThreadItem := GetActiveContent;
7544                 if ThreadItem <> nil then
7545                         SetContent( ThreadItem );
7546         end else begin
7547                 msg := '\82±\82Ì\83X\83\8c\83b\83h\82Å\82Í\8cÂ\95Ê\82 \82Ú\81`\82ñ\82ð\8ds\82Á\82Ä\82Ü\82¹\82ñ';
7548                 MsgBox(Handle, msg, '\83\81\83b\83Z\81[\83W', MB_OK);
7549         end;
7550 end;
7551 //\8cÂ\95Ê\82 \82Ú\81[\82ñ\89ð\8f\9c
7552 procedure TGikoForm.N42Click(Sender: TObject);
7553 var
7554         IndividualForm :TIndividualAbonForm;
7555         ThreadItem : TThreadItem;
7556         i : Integer;
7557         msg : String;
7558 begin
7559         IndividualForm := TIndividualAbonForm.Create(Self);
7560         try
7561                 if GikoSys.FAbon.GetAbonResCount <> 0 then begin
7562                         for i :=0 to GikoSys.FAbon.GetAbonResCount-1 do begin
7563                         IndividualForm.ComboBox1.Items.Add(GikoSys.FAbon.GetAbonResString(i));
7564                         end;
7565                         if IndividualForm.ShowModal = mrOK then begin
7566                                 GikoSys.FAbon.DeleteIndividualAbon(IndividualForm.ResNumber);
7567                 end;
7568                 ThreadItem := GetActiveContent;
7569                 if ThreadItem <> nil then
7570                         SetContent( ThreadItem );
7571                 end else begin
7572                         msg := '\82±\82Ì\83X\83\8c\83b\83h\82Å\82Í\8cÂ\95Ê\82 \82Ú\81`\82ñ\82ð\8ds\82Á\82Ä\82Ü\82¹\82ñ';
7573                         MsgBox(Handle, msg, '\83\81\83b\83Z\81[\83W', MB_OK);
7574                 end;
7575         finally
7576                 IndividualForm.Free;
7577         end;
7578 end;
7579
7580 procedure TGikoForm.SelectComboBoxEnter(Sender: TObject);
7581 begin
7582
7583         if (Length( SelectComboBox.Text ) = 0) or
7584                 (SelectComboBox.Text = SELECTCOMBOBOX_NAME) then
7585         begin
7586                 SelectComboBox.Text := '';
7587                 SelectComboBox.Color := clWindow;
7588         end;
7589
7590 end;
7591
7592 procedure TGikoForm.N51Click(Sender: TObject);
7593 begin
7594         N42Click(Sender);
7595 end;
7596 //\94Â\96¼\8c\9f\8dõ
7597 procedure TGikoForm.TreeSelectSearchBoardNameExecute(Sender: TObject);
7598 var
7599         s : String;
7600         msg : String;
7601         CurItem : TTreeNode;
7602         next : boolean;
7603 begin
7604         if InputQuery('\94Â\96¼\8c\9f\8dõ','\94Â\96¼\82Ì\93ü\97Í',s) then begin
7605                 next := true;
7606                 while next do begin
7607                         if TreeView.Selected = nil then
7608                                 CurItem := TreeView.Items.GetFirstNode
7609                         else begin
7610                                 CurItem := TreeView.Selected.GetNext;
7611                                 if CurItem = nil then
7612                                         CurItem := TreeView.Items.GetFirstNode;
7613                         end;
7614                         while CurItem <> nil do begin
7615                                 if (CurItem.ImageIndex <> 2) and (AnsiPos(s,CurItem.Text) <> 0) then begin
7616                                         break;
7617                                 end;
7618                                 CurItem := CurItem.GetNext;
7619                         end;
7620                         try
7621                                 if CurItem = nil then begin
7622                                         msg := '\90æ\93ª\82É\96ß\82è\82Ü\82·\82©\81H';
7623                                         if MsgBox(Handle, msg, '', MB_YESNO or MB_ICONEXCLAMATION) = mrYes      then begin
7624                                                 CurItem := TreeView.Items.GetFirstNode;
7625                                         end else begin
7626                                                 Exit;
7627                                         end;
7628                                         TreeView.Select(CurItem);
7629                                         TreeView.SetFocus;
7630                                 end else begin
7631                                         TreeView.Select(CurItem);
7632                                         TreeView.SetFocus;
7633                                         msg := '\8e\9f\82É\8ds\82«\82Ü\82·\82©\81H';
7634                                         if MsgBox(Handle, msg, '', MB_YESNO or MB_ICONEXCLAMATION) = mrYes      then begin
7635                                                 next := true;
7636                                         end else begin
7637                                                 next := false;
7638                                         end;
7639                                 end;
7640
7641                         except
7642                                 Exit;
7643                         end;
7644                 end;
7645         end;
7646 end;
7647
7648 procedure TGikoForm.CabinetFavoriteActionExecute(Sender: TObject);
7649 begin
7650
7651         GikoSys.Setting.CabinetIndex := 2;
7652
7653         // \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Ö
7654         HistoryToolBar.Hide;
7655         FavoriteToolBar.Show;
7656         TreeView.Visible := False;
7657         FavoriteTreeView.Visible := True;
7658
7659         CabinetSelectToolButton.Caption := '\82¨\8bC\82É\93ü\82è';
7660
7661         // \83\81\83j\83\85\81[\8by\82Ñ\83{\83^\83\93\82Ì\83`\83F\83b\83N\82ð\90Ý\92è
7662         Cabinet2chAction.Checked := False;
7663         CabinetHistoryAction.Checked := False;
7664         CabinetFavoriteAction.Checked := True;
7665
7666         // \82¨\8bC\82É\93ü\82è\82Ì\83c\83\8a\81[\82ð\93W\8aJ
7667         FavoriteTreeView.TopItem.Expanded := True;
7668
7669 end;
7670
7671 procedure TGikoForm.FavoriteMoveTo( SenderNode, SourceNode: TTreeNode );
7672 begin
7673
7674         if (SenderNode = nil) or (SourceNode = nil) or (SenderNode = SourceNode) then
7675                 Exit;
7676
7677         if TObject(SenderNode.Data) is TFavoriteFolder then
7678                 SourceNode.MoveTo(SenderNode, naAddChild)
7679         else
7680                 SourceNode.MoveTo(SenderNode, naInsert);
7681
7682 end;
7683
7684 procedure TGikoForm.FavoriteAddTo( SenderNode: TTreeNode; Source: TObject );
7685 var
7686         Node: TTreeNode;
7687         FavNode: TTreeNode;
7688         FavoBoardItem: TFavoriteBoardItem;
7689         FavoThreadItem: TFavoriteThreadItem;
7690         Board: TBoard;
7691         ThreadItem: TThreadItem;
7692 begin
7693
7694         if (SenderNode = nil) or (Source = nil) then
7695                 Exit;
7696
7697         if not (TObject(SenderNode.Data) is TFavoriteFolder) then
7698                 FavNode := SenderNode.Parent
7699         else
7700                 FavNode := SenderNode;
7701
7702         if Source is TBoard then begin
7703                 Board := TBoard( Source );
7704                 FavoBoardItem := TFavoriteBoardItem.Create;
7705                 FavoBoardItem.BBSID := Board.BBSID;
7706                 FavoBoardItem.BoardName := Board.Title;
7707                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, Board.Title, FavoBoardItem);
7708                 Node.ImageIndex := 15;
7709                 Node.SelectedIndex := 15;
7710         end else if Source is TFavoriteBoardItem then begin
7711                 FavoBoardItem := TFavoriteBoardItem( Source );
7712                 Board := BBS2ch.FindBBSID( FavoBoardItem.BBSID );
7713                 if Board <> nil then
7714                         if not Board.IsThreadDatRead then
7715                                 GikoSys.ReadSubjectFile(Board);
7716                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, Board.Title, Source);
7717                 Node.ImageIndex := 15;
7718                 Node.SelectedIndex := 15;
7719         end else if Source is TThreadItem then begin
7720                 ThreadItem := TThreadItem( Source );
7721                 FavoThreadItem := TFavoriteThreadItem.Create;
7722                 FavoThreadItem.BBSID := ThreadItem.ParentBoard.BBSID;
7723                 FavoThreadItem.ThreadID := ThreadItem.FileName;
7724                 FavoThreadItem.ThreadName := ThreadItem.Title;
7725                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, ThreadItem.Title, FavoThreadItem);
7726                 Node.ImageIndex := 16;
7727                 Node.SelectedIndex := 16;
7728         end else if Source is TFavoriteThreadItem then begin
7729                 FavoThreadItem := TFavoriteThreadItem( Source );
7730                 Board := BBS2ch.FindBBSID( FavoThreadItem.BBSID );
7731                 if Board <> nil then
7732                         if not Board.IsThreadDatRead then
7733                                 GikoSys.ReadSubjectFile(Board);
7734                 ThreadItem := BBS2ch.FindThreadItem( FavoThreadItem.BBSID, FavoThreadItem.ThreadID );
7735                 Node := FavoriteDM.TreeView.Items.AddChildObject(FavNode, ThreadItem.Title, Source);
7736                 Node.ImageIndex := 16;
7737                 Node.SelectedIndex := 16;
7738         end;
7739
7740 end;
7741
7742 procedure TGikoForm.FavoriteDragDrop( SenderNode: TTreeNode; Source: TObject );
7743 var
7744         idx: Integer;
7745         SourceNode: TTreeNode;
7746         LinkToolButton: TLinkToolButton;
7747 begin
7748
7749         if SenderNode = nil then
7750                 Exit;
7751
7752         if not (TObject( SenderNode.Data ) is TFavoriteFolder) then
7753                 if FDropSpaceNode <> nil then
7754                         SenderNode := FDropSpaceNode;
7755
7756         if Source = FavoriteTreeView then begin
7757
7758                 SourceNode := FavoriteTreeView.Selected;
7759                 FavoriteMoveTo( SenderNode, SourceNode );
7760
7761         end else if Source is TLinkToolButton then begin
7762
7763                 LinkToolButton := TLinkToolButton( Source );
7764                 //ShowMessage(LinkToolButton.Text);
7765                 SourceNode := TreeNodeDataFind( FavoriteTreeView.TopItem, LinkToolButton.Data );
7766                 FavoriteMoveTo( SenderNode, SourceNode );
7767
7768         end else if Source = BrowserTab then begin
7769
7770                 idx := BrowserTab.TabIndex;
7771                 FavoriteAddTo( SenderNode, BrowserTab.Tabs.Objects[idx] );
7772
7773         end else if Source = ListView then begin
7774
7775                 FavoriteAddTo( SenderNode, ListView.Selected.Data );
7776
7777         end else if Source = TreeView then begin
7778
7779                 FavoriteAddTo( SenderNode, TreeView.Selected.Data );
7780
7781         end;
7782
7783         SetLinkBar;
7784
7785 end;
7786
7787 procedure TGikoForm.FavoriteTreeViewDragDrop(Sender, Source: TObject; X,
7788         Y: Integer);
7789 var
7790         SenderNode: TTreeNode;
7791 begin
7792
7793         SenderNode := FavoriteTreeView.GetNodeAt(X, Y);
7794         if SenderNode <> nil then begin
7795                 FavoriteDragDrop( SenderNode, Source );
7796         end;
7797
7798 end;
7799
7800 procedure TGikoForm.FavoriteTreeViewEdited(Sender: TObject;
7801         Node: TTreeNode; var S: String);
7802 begin
7803
7804         FavoriteTreeView.ReadOnly := True;
7805         SetLinkBar;
7806
7807 end;
7808
7809 procedure TGikoForm.FavoriteTreeViewKeyDown(Sender: TObject; var Key: Word;
7810         Shift: TShiftState);
7811 begin
7812
7813         Case Key of
7814         VK_F2:
7815                 begin
7816                         FClickNode := FavoriteTreeView.Selected;
7817                         FavoriteTreeViewRenameActionExecute( Sender );
7818                 end;
7819         VK_DELETE:
7820                 begin
7821                         FClickNode := FavoriteTreeView.Selected;
7822                         FavoriteTreeViewDeleteActionExecute( Sender );
7823                 end;
7824         end;
7825
7826 end;
7827
7828 procedure TGikoForm.FavoriteTreePopupMenuPopup(Sender: TObject);
7829 var
7830         i: Integer;
7831         LinkToolButton: TLinkToolButton;
7832 begin
7833
7834         if FavoriteTreePopupMenu.PopupComponent = FavoriteTreeView then begin
7835         
7836                 FClickNode := FavoriteTreeView.Selected;
7837
7838         end else if FavoriteTreePopupMenu.PopupComponent is TLinkToolButton then begin
7839
7840                 LinkToolButton := TLinkToolButton( FavoriteTreePopupMenu.PopupComponent );
7841                 for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
7842                         if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
7843                                 FClickNode := FavoriteTreeView.Items[i];
7844                                 Break;
7845                         end;
7846                 end;
7847                 for i := 0 to FClickNode.Count - 1 do begin
7848                         if FClickNode.Item[i].Data = LinkToolButton.Data then begin
7849                                 FClickNode := FClickNode.Item[i];
7850                                 Break;
7851                         end;
7852                 end;
7853
7854         end;
7855
7856         if FClickNode = nil then begin
7857                 FavoriteTreeBrowseFolderPopupMenu.Enabled := False;
7858                 FavoriteTreeDeletePopupMenu.Enabled := False;
7859                 FavoriteTreeRenamePopupMenu.Enabled := False;
7860                 FavoriteTreeNewFolderPopupMenu.Enabled := False;
7861                 FavoriteTreeReloadPopupMenu.Enabled := False;
7862                 FavoriteTreeURLCopyPopupMenu.Enabled := False;
7863                 FavoriteTreeNameCopyPopupMenu.Enabled := False;
7864                 FavoriteTreeNameURLCopyPopupMenu.Enabled := False;
7865                 FavoriteTreeLogDeletePopupMenu.Enabled := False;
7866         end else if FClickNode.IsFirstNode then begin
7867                 FavoriteTreeBrowseFolderPopupMenu.Enabled := True;
7868                 FavoriteTreeDeletePopupMenu.Enabled := False;
7869                 FavoriteTreeRenamePopupMenu.Enabled := False;
7870                 FavoriteTreeNewFolderPopupMenu.Enabled := True;
7871                 FavoriteTreeReloadPopupMenu.Enabled := False;
7872                 FavoriteTreeURLCopyPopupMenu.Enabled := False;
7873                 FavoriteTreeNameCopyPopupMenu.Enabled := False;
7874                 FavoriteTreeNameURLCopyPopupMenu.Enabled := False;
7875                 FavoriteTreeLogDeletePopupMenu.Enabled := False;
7876         end else if FClickNode.Text = Favorite.FAVORITE_LINK_NAME then begin
7877                 FavoriteTreeBrowseFolderPopupMenu.Enabled := True;
7878                 FavoriteTreeDeletePopupMenu.Enabled := True;
7879                 FavoriteTreeRenamePopupMenu.Enabled := False;
7880                 FavoriteTreeNewFolderPopupMenu.Enabled := True;
7881                 FavoriteTreeReloadPopupMenu.Enabled := False;
7882                 FavoriteTreeURLCopyPopupMenu.Enabled := False;
7883                 FavoriteTreeNameCopyPopupMenu.Enabled := False;
7884                 FavoriteTreeNameURLCopyPopupMenu.Enabled := False;
7885                 FavoriteTreeLogDeletePopupMenu.Enabled := False;
7886         end else if TObject(FClickNode.Data) is TFavoriteFolder then begin
7887                 FavoriteTreeBrowseFolderPopupMenu.Enabled := True;
7888                 FavoriteTreeDeletePopupMenu.Enabled := True;
7889                 FavoriteTreeRenamePopupMenu.Enabled := True;
7890                 FavoriteTreeNewFolderPopupMenu.Enabled := True;
7891                 FavoriteTreeReloadPopupMenu.Enabled := False;
7892                 FavoriteTreeURLCopyPopupMenu.Enabled := False;
7893                 FavoriteTreeNameCopyPopupMenu.Enabled := False;
7894                 FavoriteTreeNameURLCopyPopupMenu.Enabled := False;
7895                 FavoriteTreeLogDeletePopupMenu.Enabled := False;
7896         end else if TObject(FClickNode.Data) is TFavoriteThreadItem then begin
7897                 FavoriteTreeBrowseFolderPopupMenu.Enabled := False;
7898                 FavoriteTreeDeletePopupMenu.Enabled := True;
7899                 FavoriteTreeRenamePopupMenu.Enabled := True;
7900                 FavoriteTreeNewFolderPopupMenu.Enabled := True;
7901                 FavoriteTreeReloadPopupMenu.Enabled := True;
7902                 FavoriteTreeURLCopyPopupMenu.Enabled := True;
7903                 FavoriteTreeNameCopyPopupMenu.Enabled := True;
7904                 FavoriteTreeNameURLCopyPopupMenu.Enabled := True;
7905                 FavoriteTreeLogDeletePopupMenu.Enabled := True;
7906         end else if TObject(FClickNode.Data) is TFavoriteBoardItem then begin
7907                 FavoriteTreeBrowseFolderPopupMenu.Enabled := False;
7908                 FavoriteTreeDeletePopupMenu.Enabled := True;
7909                 FavoriteTreeRenamePopupMenu.Enabled := True;
7910                 FavoriteTreeNewFolderPopupMenu.Enabled := True;
7911                 FavoriteTreeReloadPopupMenu.Enabled := True;
7912                 FavoriteTreeURLCopyPopupMenu.Enabled := True;
7913                 FavoriteTreeNameCopyPopupMenu.Enabled := True;
7914                 FavoriteTreeNameURLCopyPopupMenu.Enabled := True;
7915                 FavoriteTreeLogDeletePopupMenu.Enabled := False;
7916         end else begin
7917                 FavoriteTreeBrowseFolderPopupMenu.Enabled := False;
7918                 FavoriteTreeDeletePopupMenu.Enabled := False;
7919                 FavoriteTreeRenamePopupMenu.Enabled := False;
7920                 FavoriteTreeNewFolderPopupMenu.Enabled := False;
7921                 FavoriteTreeReloadPopupMenu.Enabled := False;
7922                 FavoriteTreeURLCopyPopupMenu.Enabled := False;
7923                 FavoriteTreeNameCopyPopupMenu.Enabled := False;
7924                 FavoriteTreeNameURLCopyPopupMenu.Enabled := False;
7925                 FavoriteTreeLogDeletePopupMenu.Enabled := False;
7926         end;
7927
7928 end;
7929
7930 procedure TGikoForm.FavoriteTreeViewDeleteActionExecute(Sender: TObject);
7931 begin
7932
7933         if FClickNode = nil then
7934                 Exit;
7935         if FClickNode.IsFirstNode then
7936                 Exit;
7937         if FClickNode.Text = Favorite.FAVORITE_LINK_NAME then begin
7938                 if MsgBox(Handle, '\81u\83\8a\83\93\83N\81v\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', '\8am\94F', MB_YESNO or MB_ICONQUESTION) <> ID_YES then
7939                         Exit;
7940         end;
7941
7942         //FDeleteList.Add(FClickNode.Data);
7943         //SetDeleteItemList(FClickNode);
7944
7945         FClickNode.Delete;
7946
7947         SetLinkBar;
7948
7949 end;
7950
7951 procedure TGikoForm.FavoriteTreeViewRenameActionExecute(Sender: TObject);
7952 begin
7953
7954         if FClickNode = nil then
7955                 Exit;
7956         if FClickNode.IsFirstNode then
7957                 Exit;
7958         if FClickNode.Text = Favorite.FAVORITE_LINK_NAME then
7959                 Exit;
7960         FavoriteTreeView.ReadOnly := False;
7961         FClickNode.EditText;
7962
7963         SetLinkBar;
7964
7965 end;
7966
7967 procedure TGikoForm.FavoriteTreeViewNewFolderActionExecute(
7968         Sender: TObject);
7969 var
7970         NewFavFolder: TFavoriteFolder;
7971         Node: TTreeNode;
7972 begin
7973
7974         if FClickNode = nil then
7975                 Exit;
7976
7977         try
7978                 if not (TObject(FClickNode.Data) is TFavoriteFolder) then begin
7979                         FavoriteTreeView.Selected := FClickNode.Parent;
7980                         FClickNode := FClickNode.Parent;
7981                 end;
7982
7983                 NewFavFolder := TFavoriteFolder.Create;
7984                 Node := FavoriteTreeView.Items.AddChildObject(FClickNode, '\90V\82µ\82¢\83t\83H\83\8b\83_', NewFavFolder);
7985                 Node.ImageIndex := 14;
7986                 Node.SelectedIndex := 14;
7987         //                      FClickNode.Selected.Expanded := True;
7988                 FavoriteTreeView.Selected := Node;
7989                 FClickNode := Node;
7990                 FavoriteTreeViewRenameAction.Execute;
7991         finally
7992         end;
7993
7994 end;
7995
7996 procedure TGikoForm.ToolButton19Click(Sender: TObject);
7997 begin
7998
7999         FavoriteArrangeActionExecute( nil );
8000         
8001 end;
8002
8003 procedure TGikoForm.FavoriteBrowseFolder( node: TTreeNode );
8004 var
8005         i: Integer;
8006 begin
8007
8008         if not (TObject(node.Data) is TFavoriteFolder) then
8009                 exit;
8010
8011         for i := 0 to node.Count - 1 do
8012         begin
8013                 if TObject(node.Item[i].Data) is TFavoriteFolder then
8014                         FavoriteBrowseFolder( node.Item[i] )
8015                 else if TObject(node.Item[i].Data) is TFavoriteThreadItem then
8016                         FavoriteClick( node.Item[i], False );
8017         end;
8018
8019 end;
8020
8021 procedure TGikoForm.FavoriteTreeViewBrowseFolderActionExecute(
8022         Sender: TObject);
8023 begin
8024
8025         FavoriteBrowseFolder( FClickNode );
8026         BrowserTab.OnChange(nil);
8027
8028 end;
8029
8030 procedure TGikoForm.FavoriteTreeViewChange(Sender: TObject;
8031         Node: TTreeNode);
8032 begin
8033
8034         if not Mouse.IsDragging then
8035                 FavoriteClick( Node );
8036         
8037 end;
8038
8039 procedure TGikoForm.FavoriteTreeViewDblClick(Sender: TObject);
8040 begin
8041
8042         FClickNode := FavoriteTreeView.Selected;
8043         FavoriteTreeViewReloadActionExecute( Sender );
8044
8045 end;
8046
8047 procedure TGikoForm.FavoriteTreeViewLogDeleteActionExecute(
8048         Sender: TObject);
8049 const
8050         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';
8051         DEL_TITLE = '\8dí\8f\9c\8am\94F';
8052 var
8053         ThreadItem: TThreadItem;
8054         FavThread: TFavoriteThreadItem;
8055         Board: TBoard;
8056 begin
8057
8058         if FClickNode = nil then Exit;
8059         if not (TObject(FClickNode.Data) is TFavoriteThreadItem) then Exit;
8060
8061         FavThread := TFavoriteThreadItem( FClickNode.Data );
8062         Board := BBS2ch.FindBBSID(FavThread.BBSID);
8063         if Board <> nil then
8064                 if not Board.IsThreadDatRead then
8065                         GikoSys.ReadSubjectFile(Board);
8066         ThreadItem := BBS2ch.FindThreadItem(FavThread.BBSID, FavThread.ThreadID);
8067
8068         try
8069                 if GikoSys.Setting.DeleteMsg then begin
8070                         if MsgBox(Handle, DEL_MSG, DEL_TITLE, MB_YESNO or MB_ICONQUESTION or MB_DEFBUTTON2) <> IDYES then
8071                                 Exit;
8072                 end;
8073
8074                 DeleteHistory(ThreadItem);
8075                 DeleteTab(ThreadItem);
8076                 ThreadItem.DeleteLogFile;
8077
8078                 ListView.Refresh;
8079         finally
8080         end;
8081
8082 end;
8083
8084 procedure TGikoForm.FavoriteTreeViewReloadActionExecute(Sender: TObject);
8085 var
8086         ThreadItem: TThreadItem;
8087         FavThread: TFavoriteThreadItem;
8088         Board: TBoard;
8089         FavBoard: TFavoriteBoardItem;
8090 begin
8091
8092         if FClickNode = nil then Exit;
8093
8094         if TObject( FClickNode.Data ) is TFavoriteThreadItem then begin
8095                 FavThread := TFavoriteThreadItem( FClickNode.Data );
8096                 Board := BBS2ch.FindBBSID(FavThread.BBSID);
8097                 if Board <> nil then
8098                         if not Board.IsThreadDatRead then
8099                                 GikoSys.ReadSubjectFile(Board);
8100                 ThreadItem := BBS2ch.FindThreadItem(FavThread.BBSID, FavThread.ThreadID);
8101                 if ThreadItem <> nil then
8102                         DownloadContent(ThreadItem);
8103         end else if TObject( FClickNode.Data ) is TFavoriteBoardItem then begin
8104                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
8105                 Board := BBS2ch.GetBoardFromBBSID( FavBoard.BBSID );
8106                 DownloadList(Board);
8107         end;
8108
8109 end;
8110
8111 procedure TGikoForm.FavoriteTreeViewURLCopyActionExecute(Sender: TObject);
8112 var
8113         ThreadItem: TThreadItem;
8114         FavThread: TFavoriteThreadItem;
8115         Board: TBoard;
8116         FavBoard: TFavoriteBoardItem;
8117         s: string;
8118 begin
8119
8120         if FClickNode = nil then Exit;
8121
8122         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
8123
8124                 FavThread := TFavoriteThreadItem( FClickNode.Data );
8125                 Board := BBS2ch.FindBBSID(FavThread.BBSID);
8126                 if Board <> nil then
8127                         if not Board.IsThreadDatRead then
8128                                 GikoSys.ReadSubjectFile(Board);
8129                 ThreadItem := BBS2ch.FindThreadItem(FavThread.BBSID, FavThread.ThreadID);
8130
8131                 try
8132                         s := ThreadItem.URL + #13#10;
8133                         if s <> '' then
8134                                 Clipboard.AsText := s;
8135                 finally
8136                 end;
8137
8138         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
8139
8140                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
8141                 Board := BBS2ch.FindBBSID(FavBoard.BBSID);
8142                 if Board <> nil then
8143                         if not Board.IsThreadDatRead then
8144                                 GikoSys.ReadSubjectFile(Board);
8145
8146                 try
8147                         s := Board.URL + #13#10;
8148                         if s <> '' then
8149                                 Clipboard.AsText := s;
8150                 finally
8151                 end;
8152
8153         end;
8154
8155 end;
8156
8157 procedure TGikoForm.FavoriteTreeViewNameCopyActionExecute(Sender: TObject);
8158 var
8159         ThreadItem: TThreadItem;
8160         FavThread: TFavoriteThreadItem;
8161         Board: TBoard;
8162         FavBoard: TFavoriteBoardItem;
8163         s: string;
8164 begin
8165
8166         if FClickNode = nil then Exit;
8167
8168         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
8169
8170                 FavThread := TFavoriteThreadItem( FClickNode.Data );
8171                 Board := BBS2ch.FindBBSID(FavThread.BBSID);
8172                 if Board <> nil then
8173                         if not Board.IsThreadDatRead then
8174                                 GikoSys.ReadSubjectFile(Board);
8175                 ThreadItem := BBS2ch.FindThreadItem(FavThread.BBSID, FavThread.ThreadID);
8176
8177                 try
8178                         s := ThreadItem.Title + #13#10;
8179                         if s <> '' then
8180                                 Clipboard.AsText := s;
8181                 finally
8182                 end;
8183
8184         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
8185
8186                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
8187                 Board := BBS2ch.FindBBSID(FavBoard.BBSID);
8188                 if Board <> nil then
8189                         if not Board.IsThreadDatRead then
8190                                 GikoSys.ReadSubjectFile(Board);
8191
8192                 try
8193                         s := Board.Title + #13#10;
8194                         if s <> '' then
8195                                 Clipboard.AsText := s;
8196                 finally
8197                 end;
8198
8199         end;
8200
8201 end;
8202
8203 procedure TGikoForm.FavoriteTreeViewNameURLCopyActionExecute(
8204         Sender: TObject);
8205 var
8206         ThreadItem: TThreadItem;
8207         FavThread: TFavoriteThreadItem;
8208         Board: TBoard;
8209         FavBoard: TFavoriteBoardItem;
8210         s: string;
8211 begin
8212
8213         if FClickNode = nil then Exit;
8214
8215         if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
8216
8217                 FavThread := TFavoriteThreadItem( FClickNode.Data );
8218                 Board := BBS2ch.FindBBSID(FavThread.BBSID);
8219                 if Board <> nil then
8220                         if not Board.IsThreadDatRead then
8221                                 GikoSys.ReadSubjectFile(Board);
8222                 ThreadItem := BBS2ch.FindThreadItem(FavThread.BBSID, FavThread.ThreadID);
8223
8224                 try
8225                         s := ThreadItem.URL + #13#10 + ThreadItem.Title + #13#10;
8226                         if s <> '' then
8227                                 Clipboard.AsText := s;
8228                 finally
8229                 end;
8230
8231         end else if (TObject(FClickNode.Data) is TFavoriteBoardItem) then begin
8232
8233                 FavBoard := TFavoriteBoardItem( FClickNode.Data );
8234                 Board := BBS2ch.FindBBSID(FavBoard.BBSID);
8235                 if Board <> nil then
8236                         if not Board.IsThreadDatRead then
8237                                 GikoSys.ReadSubjectFile(Board);
8238
8239                 try
8240                         s := Board.URL + #13#10 + Board.Title + #13#10;
8241                         if s <> '' then
8242                                 Clipboard.AsText := s;
8243                 finally
8244                 end;
8245
8246         end;
8247
8248 end;
8249
8250 function TGikoForm.TreeNodeDataFind(Node: TTreeNode; FindPointer: Pointer): TTreeNode;
8251 var
8252         Found: TTreeNode;
8253         i: Integer;
8254 begin
8255
8256         for i := 0 to Node.Count - 1 do begin
8257                 if Node.Item[i].Data = FindPointer then begin
8258                         Result := Node.Item[i];
8259                         Exit;
8260                 end else if Node.Item[i].Count > 0 then begin
8261                         Found := TreeNodeDataFind( Node.Item[i], FindPointer );
8262                         if Found <> nil then begin
8263                                 Result := Found;
8264                                 Exit;
8265                         end;
8266                 end;
8267         end;
8268
8269         Result := nil;
8270
8271 end;
8272
8273 procedure TGikoForm.LinkToolBarDragDrop(Sender, Source: TObject; X,
8274         Y: Integer);
8275 var
8276         i: Integer;
8277         SenderNode: TTreeNode;
8278 begin
8279
8280         SenderNode := nil;
8281         for i := 0 to FavoriteTreeView.Items.Count - 1 do begin
8282                 if FavoriteTreeView.Items[i].Text = Favorite.FAVORITE_LINK_NAME then begin
8283                         SenderNode := FavoriteTreeView.Items[i];
8284                         Break;
8285                 end;
8286         end;
8287
8288         FavoriteDragDrop( SenderNode, Source );
8289
8290 end;
8291
8292 procedure TGikoForm.BrowserTabMouseUp(Sender: TObject;
8293         Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
8294 begin
8295         if FDragWFirst <> true then begin
8296                 FDragWFirst := false;
8297         end;
8298 end;
8299
8300 procedure TGikoForm.LinkToolBarDragOver(Sender, Source: TObject; X,
8301         Y: Integer; State: TDragState; var Accept: Boolean);
8302 begin
8303
8304         FavoriteDragOver( Sender, Source, X, Y, State, Accept );
8305
8306 end;
8307
8308 procedure TGikoForm.OnlyAHundredResExecute(Sender: TObject);
8309 var
8310         ThreadItem : TThreadItem;
8311 begin
8312         GikoSys.OnlyAHundredRes := OnlyAHundredRes.Checked;
8313         ThreadItem := GetActiveContent;
8314         if ThreadItem <> nil then
8315                 SetContent( ThreadItem );
8316 end;
8317
8318 procedure TGikoForm.FavoriteTreeViewEndDrag(Sender, Target: TObject; X,
8319         Y: Integer);
8320 begin
8321
8322         if FDropSpaceNode <> nil then begin
8323                 FDropSpaceNode.Free;
8324                 FDropSpaceNode := nil;
8325                 SetLinkBar;
8326         end;
8327
8328 end;
8329
8330 procedure TGikoForm.ListCoolBarContextPopup(Sender: TObject;
8331         MousePos: TPoint; var Handled: Boolean);
8332 begin
8333
8334         MousePos := ListCoolBar.ClientToScreen( MousePos );
8335         MainCoolBarPopupMenu.Popup( MousePos.X, MousePos.Y );
8336
8337 end;
8338
8339 procedure TGikoForm.MainCoolBarContextPopup(Sender: TObject;
8340         MousePos: TPoint; var Handled: Boolean);
8341 begin
8342
8343         MousePos := MainCoolBar.ClientToScreen( MousePos );
8344         MainCoolBarPopupMenu.Popup( MousePos.X, MousePos.Y );
8345
8346 end;
8347
8348 procedure TGikoForm.BrowserCoolBarContextPopup(Sender: TObject;
8349         MousePos: TPoint; var Handled: Boolean);
8350 begin
8351
8352         MousePos := BrowserCoolBar.ClientToScreen( MousePos );
8353         MainCoolBarPopupMenu.Popup( MousePos.X, MousePos.Y );
8354
8355 end;
8356 procedure TGikoForm.ExportFavoriteFileAccept(Sender: TObject);
8357 begin
8358         if FavoriteDM.SaveFavoriteFile( ExportFavoriteFile.Dialog.FileName ) Then begin
8359                 ShowMessage('\83t\83@\83C\83\8b\82ð\8fo\97Í\82µ\82Ü\82µ\82½');
8360         end else begin
8361                 ShowMessage('\83t\83@\83C\83\8b\82Ì\8fo\97Í\82É\8e¸\94s\82µ\82Ü\82µ\82½');
8362         end;
8363 end;
8364 procedure TGikoForm.SetListViewBackGroundColor(value: TColor);
8365 begin
8366         if FListViewBackGroundColor <> value then begin
8367         FListViewBackGroundColor := value;
8368         ListView.Color := FListViewBackGroundColor;
8369     end;
8370 end;
8371 procedure TGikoForm.ExportFavoriteFileBeforeExecute(Sender: TObject);
8372 begin
8373         ExportFavoriteFile.Dialog.FileName := FavoriteDM.GetFavoriteFilePath;
8374 end;
8375
8376 initialization
8377                                 OleInitialize(nil);
8378 finalization
8379                                 OleUninitialize;
8380 end.