OSDN Git Service

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