OSDN Git Service

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