OSDN Git Service

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