OSDN Git Service

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