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