Develop and Download Open Source Software

Browse CVS Repository

Diff of /gikonavigoeson/gikonavi/Giko.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.638.2.2 by h677, Mon Aug 6 16:02:15 2007 UTC revision 1.702 by h677, Sun Oct 30 02:48:07 2011 UTC
# Line 19  uses Line 19  uses
19          {HintWindow,} GikoCoolBar, GikoListView, Search, ExternalBoardManager,          {HintWindow,} GikoCoolBar, GikoListView, Search, ExternalBoardManager,
20          ExternalBoardPlugInMain, StdActns, Variants, ExtActns,IdTCPConnection,          ExternalBoardPlugInMain, StdActns, Variants, ExtActns,IdTCPConnection,
21          IdBaseComponent, IdTCPClient, AppEvnts, BrowserRecord, MoveHistoryItem,          IdBaseComponent, IdTCPClient, AppEvnts, BrowserRecord, MoveHistoryItem,
22      ShellAPI,Preview, HistoryList, ResPopupBrowser;      ShellAPI,Preview, HistoryList, ResPopupBrowser, ExtPreviewDatamodule;
23    
24  const  const
25          NGWORDNAME_PANEL = 3;          NGWORDNAME_PANEL = 3;
26          THREADSIZE_PANEL = 2;          THREADSIZE_PANEL = 2;
27                USER_POPUPCLEAR             = WM_USER + 2005;       ///< wParam : TWebBrowser
28  type  type
29    
30          TToolBarSettingSenderType = (tssNone, tssMain, tssList, tssBrowser);          TToolBarSettingSenderType = (tssNone, tssMain, tssList, tssBrowser);
# Line 192  type Line 192  type
192                  ListToolBar: TToolBar;                  ListToolBar: TToolBar;
193                  BrowserCoolBar: TGikoCoolBar;                  BrowserCoolBar: TGikoCoolBar;
194                  BrowserToolBar: TToolBar;                  BrowserToolBar: TToolBar;
                 ToolButton3: TToolButton;  
                 ToolButton9: TToolButton;  
                 ToolButton11: TToolButton;  
                 ToolButton5: TToolButton;  
195                  ListNameToolBar: TToolBar;                  ListNameToolBar: TToolBar;
196                  ListNameLabel: TLabel;                  ListNameLabel: TLabel;
197                  FolderImage: TImage;                  FolderImage: TImage;
# Line 310  type Line 306  type
306                  F4: TMenuItem;                  F4: TMenuItem;
307                  N48: TMenuItem;                  N48: TMenuItem;
308                  T14: TMenuItem;                  T14: TMenuItem;
                 ToolButton16: TToolButton;  
309                  N50: TMenuItem;                  N50: TMenuItem;
310                  A11: TMenuItem;                  A11: TMenuItem;
311                  S5: TMenuItem;                  S5: TMenuItem;
# Line 346  type Line 341  type
341                  FavoriteTreeLogDeletePopupMenu: TMenuItem;                  FavoriteTreeLogDeletePopupMenu: TMenuItem;
342                  N59: TMenuItem;                  N59: TMenuItem;
343                  FavoriteTreeNameURLCopyPopupMenu: TMenuItem;                  FavoriteTreeNameURLCopyPopupMenu: TMenuItem;
                 ToolButton20: TToolButton;  
344                  N60: TMenuItem;                  N60: TMenuItem;
345                  ExportFavoriteFileAction1: TMenuItem;                  ExportFavoriteFileAction1: TMenuItem;
346                  N6: TMenuItem;                  N6: TMenuItem;
# Line 399  type Line 393  type
393      N73: TMenuItem;      N73: TMenuItem;
394      SelectComboBoxPanel: TPanel;      SelectComboBoxPanel: TPanel;
395      SelectComboBoxSplitter: TImage;      SelectComboBoxSplitter: TImage;
         ToolButton1: TToolButton;  
396      N74: TMenuItem;      N74: TMenuItem;
397      WikiFAQ: TMenuItem;      WikiFAQ: TMenuItem;
398      GikoApplicationEvents: TApplicationEvents;      GikoApplicationEvents: TApplicationEvents;
# Line 419  type Line 412  type
412      N80: TMenuItem;      N80: TMenuItem;
413      SameBoardThreadItem: TMenuItem;      SameBoardThreadItem: TMenuItem;
414      N81: TMenuItem;      N81: TMenuItem;
415        N82: TMenuItem;
416        IDNG1: TMenuItem;
417        IDNG2: TMenuItem;
418        ResPopupClearTimer: TTimer;
419        TaskTrayPopupMenu: TPopupMenu;
420        Exit1: TMenuItem;
421        N83: TMenuItem;
422        UpdateGikonaviAction1: TMenuItem;
423        N84: TMenuItem;
424        N85: TMenuItem;
425        URL2: TMenuItem;
426        URLPATHINFO1: TMenuItem;
427        URLQUERYSTRING1: TMenuItem;
428        N86: TMenuItem;
429                                  procedure FormCreate(Sender: TObject);                                  procedure FormCreate(Sender: TObject);
430                  procedure FormDestroy(Sender: TObject);                  procedure FormDestroy(Sender: TObject);
431            procedure SaveSettingAll();
432                  procedure BrowserStatusTextChange(Sender: TObject;                  procedure BrowserStatusTextChange(Sender: TObject;
433                          const Text: WideString);                          const Text: WideString);
434                  procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);                  procedure FormCloseQuery(Sender: TObject; var CanClose: Boolean);
# Line 555  type Line 563  type
563      procedure GetResURLMenuClick(Sender: TObject);      procedure GetResURLMenuClick(Sender: TObject);
564      procedure MainCoolBarContextPopup(Sender: TObject; MousePos: TPoint;      procedure MainCoolBarContextPopup(Sender: TObject; MousePos: TPoint;
565        var Handled: Boolean);        var Handled: Boolean);
566        procedure ResPopupClearTimerTimer(Sender: TObject);
567          private          private
568                  { Private 宣言 }                  { Private 宣言 }
569                  FEnabledCloseButton: Boolean;                  FEnabledCloseButton: Boolean;
# Line 604  type Line 613  type
613                  FPreviewBrowserRect: TRect;                     ///< プレビューの表示位置を記憶する                  FPreviewBrowserRect: TRect;                     ///< プレビューの表示位置を記憶する
614                  FActionListGroupIndexes: array of Integer;      ///<GikoDM上のアクションリストの各アクションに設定されたGroupIndexを保存する配列                  FActionListGroupIndexes: array of Integer;      ///<GikoDM上のアクションリストの各アクションに設定されたGroupIndexを保存する配列
615          FResPopupBrowser: TResPopupBrowser;          FResPopupBrowser: TResPopupBrowser;
616            FUpdateExePath: string;    ///ギコナビ更新インストーラパス
617            FUpdateExeArgs: string;    ///ギコナビ更新インストーラ引数
618            FKokoPopupThreadItem: TThreadItem;
619            FCwSave: Word;  // 8087CW値保存
620                  procedure DownloadEnd(Sender: TObject; Item: TDownloadItem);                  procedure DownloadEnd(Sender: TObject; Item: TDownloadItem);
621                  procedure DownloadMsg(Sender: TObject; Item: TDownloadItem; Msg: string; Icon: TGikoMessageIcon);                  procedure DownloadMsg(Sender: TObject; Item: TDownloadItem; Msg: string; Icon: TGikoMessageIcon);
622                  procedure WorkBegin(Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer; Number: Integer; const AWorkTitle: string);                  procedure WorkBegin(Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer; Number: Integer; const AWorkTitle: string);
# Line 681  type Line 694  type
694          //! もっとも古いBrowserの開放          //! もっとも古いBrowserの開放
695          procedure ReleaseOldestBrowser;          procedure ReleaseOldestBrowser;
696          //! アクティブなタブと同じ板の開いているスレッドをメニューアイテムに追加          //! アクティブなタブと同じ板の開いているスレッドをメニューアイテムに追加
697          procedure AddMenuSameBoardThread;          procedure AddMenuSameBoardThread(MenuItem: TMenuItem);
698          //!  アクティブなタブと同じ板の開いているスレッドクリックイベント          //!  アクティブなタブと同じ板の開いているスレッドクリックイベント
699          procedure SameBoardThreadSubItemOnClick(Sender: TObject);          procedure SameBoardThreadSubItemOnClick(Sender: TObject);
700          //! ポップアップブラウザ作成          //! ポップアップブラウザ作成
701          procedure CreateResPopupBrowser;          procedure CreateResPopupBrowser;
702            //! ファイルチェック
703            function isValidFile(FileName: String) : boolean;
704            //! ListViewのD&D受け取り
705            procedure AcceptDropFiles(var Msg: TMsg);
706            //! スレッド一覧更新処理
707            procedure UpdateListView();
708            //! アイコン読み込み
709            procedure LoadIcon();
710            //! ポップアップメニュー読み込み
711            procedure LoadPopupMenu();
712          protected          protected
713                  procedure CreateParams(var Params: TCreateParams); override;                  procedure CreateParams(var Params: TCreateParams); override;
714                  procedure WndProc(var Message: TMessage); override;                  procedure WndProc(var Message: TMessage); override;
715                  procedure WMSetCursor(var Message: TWMSetCursor); message WM_SETCURSOR;                  procedure WMSetCursor(var Message: TWMSetCursor); message WM_SETCURSOR;
716                  procedure WMSettingChange(var Message: TWMWinIniChange); message WM_SETTINGCHANGE;                  procedure WMSettingChange(var Message: TWMWinIniChange); message WM_SETTINGCHANGE;
717                  procedure WMCopyData(var Message: TWMCopyData); message WM_COPYDATA;                  procedure WMCopyData(var Message: TWMCopyData); message WM_COPYDATA;
   
718          public          public
719                  { Public 宣言 }                  { Public 宣言 }
720                  LastRoundTime: TDateTime;                  LastRoundTime: TDateTime;
721                  BrowserNullTab: TBrowserRecord;                  BrowserNullTab: TBrowserRecord;
722                  FControlThread: TThreadControl;                  FControlThread: TThreadControl;
723          FIconData : TNotifyIconData;          FIconData : TNotifyIconData;
724                  procedure MoveToURL(const inURL: string);                  procedure MoveToURL(const inURL: string; KeyMask: Boolean = False);
725                  function InsertBrowserTab(ThreadItem: TThreadItem; ActiveTab: Boolean = True) : TBrowserRecord;                  function InsertBrowserTab(ThreadItem: TThreadItem; ActiveTab: Boolean = True) : TBrowserRecord;
726                  procedure ReloadBBS;                  procedure ReloadBBS;
727                  function GetHttpState: Boolean;                  function GetHttpState: Boolean;
# Line 724  type Line 746  type
746                  property ScreenCursor : TCursor read GetScreenCursor write SetScreenCursor;                  property ScreenCursor : TCursor read GetScreenCursor write SetScreenCursor;
747                  property ActiveBBS : TBBS read FActiveBBS write FActiveBBS;                  property ActiveBBS : TBBS read FActiveBBS write FActiveBBS;
748                  property WorkCount: Integer read FWorkCount write FWorkCount;                  property WorkCount: Integer read FWorkCount write FWorkCount;
749            property UpdateExePath: string read FUpdateExePath write FUpdateExePath;
750            property UpdateExeArgs: string read FUpdateExeArgs write FUpdateExeArgs;
751    
752                  procedure SetContent(inThread: TBrowserRecord);                  procedure SetContent(inThread: TBrowserRecord);
753                  function GetActiveContent(popup :Boolean = false): TThreadItem;                  function GetActiveContent(popup :Boolean = false): TThreadItem;
754                  function GetActiveList: TObject;                  function GetActiveList: TObject;
# Line 743  type Line 768  type
768                  property ListViewBackGroundColor: TColor read FListViewBackGroundColor write SetListViewBackGroundColor;                  property ListViewBackGroundColor: TColor read FListViewBackGroundColor write SetListViewBackGroundColor;
769                  property UseOddResOddColor : Boolean read FUseOddResOddColor write FUseOddResOddColor;                  property UseOddResOddColor : Boolean read FUseOddResOddColor write FUseOddResOddColor;
770                  property OddColor : TColor read FOddColor write FOddColor;                  property OddColor : TColor read FOddColor write FOddColor;
771            //! レスメニューアクティブスレッドアイテム
772            property KokoPopupThreadItem : TThreadItem read FKokoPopupThreadItem;
773    
774                  function FindToolBarButton( bar : TToolBar; action : TAction ) : TToolButton;                  function FindToolBarButton( bar : TToolBar; action : TAction ) : TToolButton;
775                  procedure OnPlugInMenuItem( Sender : TObject );                  procedure OnPlugInMenuItem( Sender : TObject );
776                  procedure TabFileURLReplace(oldURLs: TStringList; newURLs: TStringList);                  procedure TabFileURLReplace(oldURLs: TStringList; newURLs: TStringList);
# Line 756  type Line 784  type
784                  procedure IndividualAbonID(Atype : Integer);                  procedure IndividualAbonID(Atype : Integer);
785                  //このレスあぼ〜ん                  //このレスあぼ〜ん
786                  procedure IndividualAbon(Atag, Atype : Integer);                  procedure IndividualAbon(Atag, Atype : Integer);
787            //同一IDをNGワードに登録
788            procedure AddIDtoNGWord(invisible : boolean);
789                  //ブラウザの再描画 true:全てのタブ false:アクティブなタブのみ                  //ブラウザの再描画 true:全てのタブ false:アクティブなタブのみ
790                  procedure RepaintAllTabsBrowser();                  procedure RepaintAllTabsBrowser();
791                  //リンクバー設定                  //リンクバー設定
# Line 811  type Line 841  type
841          procedure TaskTrayIconMessage(var Msg : TMsg); message WM_USER + 2010;          procedure TaskTrayIconMessage(var Msg : TMsg); message WM_USER + 2010;
842          //! タスクトレイにアイコン登録&フォーム隠し          //! タスクトレイにアイコン登録&フォーム隠し
843          procedure StoredTaskTray;          procedure StoredTaskTray;
844            //! 同IDレスアンカー表示
845            procedure ShowSameIDAncher(const AID: String);
846          published          published
847                  property EnabledCloseButton: Boolean read FEnabledCloseButton write SetEnabledCloseButton;                  property EnabledCloseButton: Boolean read FEnabledCloseButton write SetEnabledCloseButton;
848          end;          end;
# Line 849  uses Line 881  uses
881          About, Option, Round, Splash, Sort, ListSelect, Imm,          About, Option, Round, Splash, Sort, ListSelect, Imm,
882          NewBoard, MojuUtils, Clipbrd, GikoBayesian,Y_TextConverter,          NewBoard, MojuUtils, Clipbrd, GikoBayesian,Y_TextConverter,
883          HTMLCreate, ListViewUtils, GikoDataModule, GikoMessage,          HTMLCreate, ListViewUtils, GikoDataModule, GikoMessage,
884    InputAssistDataModule, Types, ReplaceDataModule;    InputAssistDataModule, Types, ReplaceDataModule, PopupMenuUtil;
885    
886  const  const
887          BLANK_HTML: string = 'about:blank';          BLANK_HTML: string = 'about:blank';
# Line 898  begin Line 930  begin
930          Writeln('============================================================');          Writeln('============================================================');
931  {$ENDIF}  {$ENDIF}
932  //try  //try
933        // ゼロ割例外の現在の設定を保存する
934        FCwSave := Get8087CW;
935        if ( AnsiPos('9.0', GikoSys.GetIEVersion()) = 1 ) then begin
936            // IE 9の場合だけ、無効ビットを立てる
937            Set8087CW(FCwSave or $0004);
938        end;
939          Sort.SetSortDate(Now());          Sort.SetSortDate(Now());
940            
941          FTreeType := gttNone;          FTreeType := gttNone;
942          // 起動時に保存されてしまう対策          // 起動時に保存されてしまう対策
943          FStartUp := true;          FStartUp := true;
# Line 913  begin Line 951  begin
951      FResPopupBrowser := nil;      FResPopupBrowser := nil;
952          CreateBrowsers(BROWSER_COUNT);          CreateBrowsers(BROWSER_COUNT);
953      FIconData.uID := 0;      FIconData.uID := 0;
954        FUpdateExePath := '';
955        FUpdateExeArgs := '';
956    
957          //メニューフォント          //メニューフォント
958          SetMenuFont;          SetMenuFont;
# Line 920  begin Line 960  begin
960          //手のカーソル          //手のカーソル
961          Screen.Cursors[5] := LoadCursor(HInstance, 'GIKOHAND');          Screen.Cursors[5] := LoadCursor(HInstance, 'GIKOHAND');
962    
963        // アイコンの読み取り
964        LoadIcon;
965    
966          //アドレス履歴読み込み          //アドレス履歴読み込み
967          AddressHistoryDM.ReadHistory(AddressComboBox.Items, GikoSys.Setting.MaxRecordCount);          AddressHistoryDM.ReadHistory(AddressComboBox.Items, GikoSys.Setting.MaxRecordCount);
968    
# Line 999  begin Line 1042  begin
1042                  case FResRangeMenuSelect of                  case FResRangeMenuSelect of
1043                  Ord( grrKoko ): GikoDM.OnlyKokoResAction.Checked        := True;                  Ord( grrKoko ): GikoDM.OnlyKokoResAction.Checked        := True;
1044                  Ord( grrNew ):  GikoDM.OnlyNewResAction.Checked := True;                  Ord( grrNew ):  GikoDM.OnlyNewResAction.Checked := True;
1045                  100:                    GikoDM.OnlyAHundredResAction.Checked            := True;                  10..65535:
1046                begin
1047                    GikoDM.OnlyAHundredResAction.Checked            := True;
1048                    GikoSys.ResRange := GikoSys.Setting.ResRangeExCount;
1049                end;
1050                  end;                  end;
1051          end;          end;
1052    
# Line 1041  begin Line 1088  begin
1088                  BrowserTab.Font.Style := [fsBold];                  BrowserTab.Font.Style := [fsBold];
1089          if GikoSys.Setting.BrowserTabFontItalic then          if GikoSys.Setting.BrowserTabFontItalic then
1090                  BrowserTab.Font.Style := GikoForm.BrowserTab.Font.Style + [fsItalic];                  BrowserTab.Font.Style := GikoForm.BrowserTab.Font.Style + [fsItalic];
1091    
1092          BrowserTab.DoubleBuffered := True;          BrowserTab.DoubleBuffered := True;
1093          FDragWFirst := false;          FDragWFirst := false;
1094          SetContent(BrowserNullTab);                                                                                                     //ブラウザを空白表示          SetContent(BrowserNullTab);                                                                                                     //ブラウザを空白表示
# Line 1275  begin Line 1323  begin
1323          GikoDM.RepaintStatusBar;          GikoDM.RepaintStatusBar;
1324          StatusBarResize(Sender);          StatusBarResize(Sender);
1325    
1326          dummy1.Caption  := ItemReservPMenu.Caption;  //      dummy1.Caption  := ItemReservPMenu.Caption;
1327          dummy1.Hint     := ItemReservPMenu.Hint;  //      dummy1.Hint     := ItemReservPMenu.Hint;
1328        // ブラウザポップアップメニューの初期化
1329        PopupMenuUtil.ReadSetting(GikoDM.GikoFormActionList, BrowserTabPopupMenu);
1330        // マウスジェスチャー
1331        MouseGesture := TMouseGesture.Create;
1332    
1333  {$IFDEF SPAM_FILTER_ENABLED}  {$IFDEF SPAM_FILTER_ENABLED}
1334          // スパムフィルタ学習履歴          // スパムフィルタ学習履歴
1335          GikoSys.Bayesian.LoadFromFile( GikoSys.Setting.GetSpamFilterFileName );          GikoSys.Bayesian.LoadFromFile( GikoSys.Setting.GetSpamFilterFileName );
1336  {$ENDIF}  {$ENDIF}
1337    
         // マウスジェスチャー  
         MouseGesture := TMouseGesture.Create;  
         GikoSys.Setting.Gestures.LoadGesture(  
                 GikoSys.Setting.GetGestureFileName, GikoDM.GikoFormActionList );  
         MouseGesture.Margin := GikoSys.Setting.Gestures.Margin;  
         MouseGesture.OnGestureStart := OnGestureStart;  
         MouseGesture.OnGestureMove := OnGestureMove;  
         MouseGesture.OnGestureEnd := OnGestureEnd;  
         if GikoSys.Setting.GestureEnabled then  
                 MouseGesture.SetHook( Handle );  
   
1338          //2ch言語読み出し          //2ch言語読み出し
1339          GikoSys.SetGikoMessage;          GikoSys.SetGikoMessage;
1340    
# Line 1301  begin Line 1342  begin
1342          if GikoSys.Setting.AutoLogin then          if GikoSys.Setting.AutoLogin then
1343                  GikoDM.LoginAction.Execute;                  GikoDM.LoginAction.Execute;
1344    
1345          GikoSys.Setting.BeLogin := GikoSys.Setting.BeAutoLogin;      if GikoSys.Setting.BeAutoLogin then
1346            GikoDM.BeLogInOutAction.Execute;
1347    
1348          //キャプションが上書きされてしまうので、ここで再設定          //キャプションが上書きされてしまうので、ここで再設定
1349          FavoriteAddToolButton.Caption := '追加...';          FavoriteAddToolButton.Caption := '追加...';
# Line 1312  begin Line 1354  begin
1354    
1355      //置換設定ファイルの読み込み      //置換設定ファイルの読み込み
1356      ReplaceDM.LoadFromFile(GikoSys.GetReplaceFileName);      ReplaceDM.LoadFromFile(GikoSys.GetReplaceFileName);
1357    
1358        //レスポップアップ消去タイマー
1359        ResPopupClearTimer.Interval := GikoSys.Setting.RespopupWait;
1360    
1361        // D&Dを受け取る
1362        DragAcceptFiles(ListView.Handle, True);
1363    
1364    
1365        // 初期化に失敗したモジュールチェック
1366        if (FavoriteDM.AbEnd) then begin
1367            GikoUtil.MsgBox(Self.Handle,
1368                'お気に入りの初期化に失敗しました。ギコナビを終了します。'#13#10 +
1369                'ギコナビフォルダを開きます、config/' + Favorite.FAVORITE_FILE_NAME +
1370                ' を config/~' + Favorite.FAVORITE_FILE_NAME + '(前回起動時のお気に入り)で'#13#10 +
1371                 '置き換える事で直る可能性があります。',
1372                '初期化異常');
1373            GikoDM.GikoFolderOpenAction.Execute;
1374            Self.Close;
1375        end;
1376    
1377  end;  end;
1378    
1379  // CoolBar の設定を変数に保存  // CoolBar の設定を変数に保存
# Line 1435  var Line 1497  var
1497          item        : TThreadItem;          item        : TThreadItem;
1498  begin  begin
1499          if FStartUp then begin          if FStartUp then begin
1500            FStartUp := false;
1501                  ShowWindow(Application.Handle, SW_HIDE);                  ShowWindow(Application.Handle, SW_HIDE);
   
1502                  //FormCreateでやると可視設定が反映されない場合があるのでFormShowでやることにした                  //FormCreateでやると可視設定が反映されない場合があるのでFormShowでやることにした
1503                  //ツールバー表示                  //ツールバー表示
1504                  GikoDM.StdToolBarVisibleAction.Checked := GikoSys.Setting.StdToolBarVisible;                  GikoDM.StdToolBarVisibleAction.Checked := GikoSys.Setting.StdToolBarVisible;
# Line 1461  begin Line 1523  begin
1523  //              ResetBandInfo( ListCoolBar, ListToolBar );  //              ResetBandInfo( ListCoolBar, ListToolBar );
1524                  FIsIgnoreResize := rtNone;                  FIsIgnoreResize := rtNone;
1525    
1526            //ActionListのGroupIndexを元に戻す
1527                    SetGroupIndex(GikoDM.GikoFormActionList);
1528    
1529                  //FormCreteから移動。                  //FormCreteから移動。
1530                  if GikoSys.Setting.TabAutoLoadSave then begin                  if GikoSys.Setting.TabAutoLoadSave then begin
1531              GikoDM.TabsOpenAction.Tag := 1;              GikoDM.TabsOpenAction.Tag := 1;
1532                          GikoDM.TabsOpenAction.Execute;                          GikoDM.TabsOpenAction.Execute;
1533              GikoDM.TabsOpenAction.Tag := 0;              GikoDM.TabsOpenAction.Tag := 0;
1534              if (GikoSys.Setting.LastCloseTabURL <> '') then begin              if (GikoSys.Setting.LastCloseTabURL <> '') then begin
1535                    if ( FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
1536                            while (FActiveContent.Browser.ReadyState <> READYSTATE_COMPLETE) and
1537                                    (FActiveContent.Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin
1538                            // メッセージを受け取らないようにスリープに変更
1539                            Sleep(1);
1540                        end;
1541                            end;
1542                  item := BBSsFindThreadFromURL( GikoSys.Setting.LastCloseTabURL );                  item := BBSsFindThreadFromURL( GikoSys.Setting.LastCloseTabURL );
1543                    GikoSys.Setting.LastCloseTabURL := '';
1544                  if (item <> nil) and (item.IsLogFile) then begin                  if (item <> nil) and (item.IsLogFile) then begin
1545                      OpenThreadItem(item, item.URL);                      OpenThreadItem(item, item.URL);
1546                  end;                  end;
1547                  GikoSys.Setting.LastCloseTabURL := '';                  //ShowWindow(Self.Handle, SW_SHOW);
1548              end;              end;
1549                  end;                  end;
   
         //ActionListのGroupIndexを元に戻す  
                 SetGroupIndex(GikoDM.GikoFormActionList);  
   
                 FStartUp := false;  
1550          end;          end;
1551  end;  end;
1552    
# Line 1505  begin Line 1573  begin
1573          if (SearchDialog <> nil) then begin          if (SearchDialog <> nil) then begin
1574                  if (SearchDialog.Visible) then begin                  if (SearchDialog.Visible) then begin
1575                          SearchDialog.Close;                          SearchDialog.Close;
                         try  
                                 SearchDialog.Release;  
                         except  
                         end;  
                         SearchDialog := nil;  
1576                  end;                  end;
1577            try
1578                SearchDialog.Release;
1579            except
1580            end;
1581            SearchDialog := nil;
1582          end;          end;
1583    
1584          //スクリーン上の全てのフォームから、EditorFormを閉じる          //スクリーン上の全てのフォームから、EditorFormを閉じる
1585      GikoDM.CloseAllEditorAction.Execute;      GikoDM.CloseAllEditorAction.Execute;
1586    
1587          Application.UnhookMainWindow(Hook);          Application.UnhookMainWindow(Hook);
1588        //アプリケーション終了の前にダウンロードスレッドに正常終了を促す
1589        FControlThread.DownloadAbort;
1590        FControlThread.Terminate;
1591    
1592        //OnDestoryだと再起動をかけたときなどに保存されないのでOnCloseQueryで設定保存
1593        SaveSettingAll();
1594        
1595          Application.Terminate;          Application.Terminate;
1596  end;  end;
1597    
1598  procedure TGikoForm.FormDestroy(Sender: TObject);  procedure TGikoForm.SaveSettingAll();
1599  var  var
         i                               : Integer;  
 //      CoolSet: TCoolSet;  
1600          wp                      : TWindowPlacement;          wp                      : TWindowPlacement;
1601          tmpBool : Boolean;      WindowPlacement: TWindowPlacement;
1602  begin  begin
         // マウスジェスチャー開放  
         try  
                 MouseGesture.UnHook;  
         except  
         end;  
1603          try          try
1604                  ActiveListColumnSave;                  ActiveListColumnSave;
1605          except          except
1606          end;          end;
1607    
1608          try          try
1609            WindowPlacement.length := SizeOf(TWindowPlacement);
1610            GetWindowPlacement(Self.Handle, @WindowPlacement);
1611    
1612                  //最大化・ウィンドウ位置保存                  //最大化・ウィンドウ位置保存
1613                  wp.length := sizeof(wp);                  wp.length := sizeof(wp);
1614                  GetWindowPlacement(Handle, @wp);                  GetWindowPlacement(Handle, @wp);
# Line 1544  begin Line 1616  begin
1616                  GikoSys.Setting.WindowLeft := wp.rcNormalPosition.Left;                  GikoSys.Setting.WindowLeft := wp.rcNormalPosition.Left;
1617                  GikoSys.Setting.WindowHeight := wp.rcNormalPosition.Bottom - wp.rcNormalPosition.Top;                  GikoSys.Setting.WindowHeight := wp.rcNormalPosition.Bottom - wp.rcNormalPosition.Top;
1618                  GikoSys.Setting.WindowWidth := wp.rcNormalPosition.Right - wp.rcNormalPosition.Left;                  GikoSys.Setting.WindowWidth := wp.rcNormalPosition.Right - wp.rcNormalPosition.Left;
1619                  GikoSys.Setting.WindowMax := WindowState = wsMaximized;                  GikoSys.Setting.WindowMax := (WindowState = wsMaximized) or
1620                                            (WindowPlacement.flags = WPF_RESTORETOMAXIMIZED);
1621                  GikoSys.Setting.ListStyle := ListView.ViewStyle;                  GikoSys.Setting.ListStyle := ListView.ViewStyle;
1622                  GikoSys.Setting.CabinetVisible := GikoDM.CabinetVisibleAction.Checked;                  GikoSys.Setting.CabinetVisible := GikoDM.CabinetVisibleAction.Checked;
1623                  GikoSys.Setting.CabinetWidth := CabinetPanel.Width;                  GikoSys.Setting.CabinetWidth := CabinetPanel.Width;
# Line 1565  begin Line 1637  begin
1637                          GikoSys.Setting.ResRange := FResRangeMenuSelect;                          GikoSys.Setting.ResRange := FResRangeMenuSelect;
1638          except          except
1639          end;          end;
1640          if WindowState <> wsNormal then      //今のwinodwのスタイルでCoolBarの位置、ウィンドウの位置を保存
1641                  WindowState := wsNormal;      SaveCoolBarSettings;
1642          SaveCoolBarSettings;      GikoSys.Setting.WriteWindowSettingFile;
1643        // 名前とメールの保存なのでエディタが閉じた後ならいつでもいい
1644        GikoSys.Setting.WriteNameMailSettingFile;
1645        // 冒険の書の保存
1646        GikoSys.Setting.WriteBoukenSettingFile;
1647            //入力アシスト機構の設定の保存
1648            InputAssistDM.SaveToFile(GikoSys.GetInputAssistFileName);
1649    
1650            //お気に入り保存
1651            try
1652                    //FavoriteDMは自動生成フォームなので、解放は自動的にされる
1653            // 初期化異常時からの終了では保存しない
1654            if not (FavoriteDM.AbEnd) then begin
1655                    FavoriteDM.WriteFavorite;
1656            end;
1657            except
1658            end;
1659    
1660            //アドレス履歴保存
1661          try          try
1662                  GikoSys.Setting.WriteWindowSettingFile;                  //AddressHistoryDMは自動生成フォームなので、解放は自動的にされる。
1663                  GikoSys.Setting.WriteNameMailSettingFile;                  AddressHistoryDM.WriteHistory(AddressComboBox.Items, GikoSys.Setting.MaxRecordCount);
1664          except          except
1665          end;          end;
         // リアルタイムに保存されるので、また、ウィンドウサイズが CoolBar より  
         // 小さくなっているときに保存すると値が上書きされてしまうのでここでは保存しない  
1666    
1667                  // ↑FormDestroy中に移動したので、ここで保存しないといけないと思う。(もじゅ 2004/04/09)          //ヒストリリスト保存
1668          // CoolBar 保存          try
1669          //if (GikoForm.WindowState <> wsMinimized) and (GikoForm.WindowState <> wsMaximized) then                  FHistoryList.SaveToFile(GikoSys.GetConfigDir + 'History.xml');
1670            except
1671            end;
1672    
1673          //入力アシスト機構の設定の保存          //巡回リスト保存
1674          InputAssistDM.SaveToFile(GikoSys.GetInputAssistFileName);          try
1675                    RoundList.SaveRoundFile;
1676            except
1677            end;
1678    
1679          //お気に入り保存      // タスクトレイのアイコン削除
1680        if (FIconData.uID <> 0) then begin
1681            Shell_NotifyIcon(NIM_DELETE, @FIconData);
1682        end;
1683    
1684    end;
1685    
1686    procedure TGikoForm.FormDestroy(Sender: TObject);
1687    var
1688            i                               : Integer;
1689            tmpBool : Boolean;
1690    begin
1691        //一時的に通常スタイルに戻してCoolBarの位置、ウィンドウの位置を保存
1692        //※注意:OnDestroyで使うことしか考慮されていない
1693        //        他でやると再描画が発生する
1694            if WindowState <> wsNormal then begin
1695                    WindowState := wsNormal;
1696            try
1697                    SaveCoolBarSettings;
1698                        GikoSys.Setting.WriteWindowSettingFile;
1699            except
1700                end;
1701        end;
1702    
1703            // マウスジェスチャー開放
1704            try
1705            if GikoSys.Setting.GestureEnabled then begin
1706                    MouseGesture.OnGestureStart := nil;
1707                        MouseGesture.OnGestureMove := nil;
1708                        MouseGesture.OnGestureEnd := nil;
1709            end;
1710            MouseGesture.Clear;
1711                    MouseGesture.UnHook;
1712            MouseGesture.Free;
1713            except
1714            end;
1715    
1716            //お気に入り破棄
1717          try          try
                 //FavoriteDMは自動生成フォームなので、解放は自動的にされる  
                 FavoriteDM.WriteFavorite;  
1718                  FavoriteDM.Clear;                  FavoriteDM.Clear;
1719          except          except
1720          end;          end;
1721          LockWindowUpdate(Self.Handle);  
1722          try          try
1723                  //タブクローズ                  //タブクローズ
1724                  tmpBool := GikoSys.Setting.ShowDialogForAllTabClose;                  tmpBool := GikoSys.Setting.ShowDialogForAllTabClose;
# Line 1599  begin Line 1727  begin
1727                  GikoSys.Setting.ShowDialogForAllTabClose := tmpBool;                  GikoSys.Setting.ShowDialogForAllTabClose := tmpBool;
1728          except          except
1729          end;          end;
1730    
1731          try          try
1732                  for i := FBrowsers.Count - 1 downto 0 do begin                  for i := FBrowsers.Count - 1 downto 0 do begin
1733                GikoSys.ShowRefCount('browser' + IntToStr(i), TWebBrowser(FBrowsers[i]).ControlInterface);
1734                GikoSys.ShowRefCount('document' + IntToStr(i), TWebBrowser(FBrowsers[i]).ControlInterface.Document);
1735                    end;
1736    
1737                    for i := FBrowsers.Count - 1 downto 0 do begin
1738                          TWebBrowser(FBrowsers[i]).Free;                          TWebBrowser(FBrowsers[i]).Free;
1739                  end;                  end;
1740                  FBrowsers.Clear;                  FBrowsers.Clear;
# Line 1608  begin Line 1742  begin
1742          finally          finally
1743                  FBrowsers.Free;                  FBrowsers.Free;
1744          end;          end;
1745    
1746          try          try
1747                  if BrowserNullTab <> nil then begin                  if BrowserNullTab <> nil then begin
1748                          BrowserNullTab.Browser := nil;  {*BrowserNullTabのBrowserは設計時に貼り付けてる奴                          BrowserNullTab.Browser := nil;  {*BrowserNullTabのBrowserは設計時に貼り付けてる奴
# Line 1626  begin Line 1761  begin
1761          except          except
1762          end;          end;
1763    
         //アドレス履歴保存  
         try  
                 //AddressHistoryDMは自動生成フォームなので、解放は自動的にされる。  
                 AddressHistoryDM.WriteHistory(AddressComboBox.Items, GikoSys.Setting.MaxRecordCount);  
         except  
         end;  
   
         //ヒストリリスト保存  
         try  
                 FHistoryList.SaveToFile(GikoSys.GetConfigDir + 'History.xml');  
         except  
         end;  
1764          try          try
1765                  try                  try
1766                          FHistoryList.Clear;                          FHistoryList.Clear;
# Line 1647  begin Line 1770  begin
1770                  FHistoryList.Free;                  FHistoryList.Free;
1771          end;          end;
1772    
1773          //巡回リスト保存&破棄  
         try  
                 RoundList.SaveRoundFile;  
         except  
         end;  
1774          try          try
1775                  try                  try
1776                          RoundList.Clear;                          RoundList.Clear;
# Line 1662  begin Line 1781  begin
1781           end;           end;
1782    
1783          try          try
1784                  try          try
1785                          FControlThread.Terminate;              //FControlThread.DownloadAbort;
1786                          FControlThread.WaitFor;              FControlThread.Terminate;
1787                  except              FControlThread.WaitFor;
1788                  end;          except
1789          finally          end;
1790                  FControlThread.Free;      finally
1791            FControlThread.Free;
1792          end;          end;
1793      // プラグインによって追加されたメニューを開放する      // プラグインによって追加されたメニューを開放する
1794      for i := GikoForm.PlugInMenu.Count - 1 downto 0 do begin      for i := GikoForm.PlugInMenu.Count - 1 downto 0 do begin
# Line 1691  begin Line 1811  begin
1811                                  BBSs[ i ].Free;                                  BBSs[ i ].Free;
1812                          BBSs[ i ] := nil;                          BBSs[ i ] := nil;
1813                  end;                  end;
1814            DestorySpecialBBS(BoardGroup.SpecialBBS);
1815          except          except
1816          end;          end;
1817    
# Line 1698  begin Line 1819  begin
1819                  if FEvent <> nil then                  if FEvent <> nil then
1820                          FEvent.Free;                          FEvent.Free;
1821    
         // TODO レスポップアップの破棄  
1822          try          try
1823              if FResPopupBrowser <> nil then  begin              if FResPopupBrowser <> nil then  begin
1824                  TOleControl(FResPopupBrowser).Parent := nil;                  TOleControl(FResPopupBrowser).Parent := nil;
# Line 1714  begin Line 1834  begin
1834                  end;                  end;
1835          except          except
1836          end;          end;
1837          LockWindowUpdate(0);  
1838        // Updateがいれば実行する
1839        if FileExists(FUpdateExePath) then begin
1840            // アップデート実行
1841            GikoSys.CreateProcess(FUpdateExePath, FUpdateExeArgs);
1842        end;
1843        // ゼロ割例外を元に戻す
1844        Set8087CW(FCwSave);
1845  end;  end;
1846    
1847  // 各所にあるキャビネット・ BBS メニューをセット/更新  // 各所にあるキャビネット・ BBS メニューをセット/更新
# Line 1880  var Line 2007  var
2007          e: IHTMLElement;          e: IHTMLElement;
2008          Ext: string;          Ext: string;
2009          PathRec: TPathRec;          PathRec: TPathRec;
2010    Text2: string;      Text2: string;
2011      cResPopup: TResPopupBrowser;      cResPopup: TResPopupBrowser;
2012        senderBrowser :TWebBrowser;
2013        doc: IHTMLDocument2;
2014  begin  begin
2015          // ギコナビはレスアンカーが about:blank.. で始まることを期待しているが      // ギコナビはレスアンカーが about:blank.. で始まることを期待しているが
2016    // IE 7 では about:blank.. ではなく about:.. になるので、置換する(投げやり)      // IE 7 では about:blank.. ではなく about:.. になるので、置換する(投げやり)
2017          if Pos('about:..', Text) = 1 then      if Pos('about:..', Text) = 1 then
2018          Text2 := 'about:blank..' + Copy( Text, Length('about:..')+1, Length(Text) )          Text2 := 'about:blank..' + Copy( Text, Length('about:..')+1, Length(Text) )
2019    else      else
2020          Text2 := Text;          Text2 := Text;
2021    
2022          if not( TObject(Sender) is TWebBrowser )then          if not( TObject(Sender) is TWebBrowser )then
2023                  Exit;                  Exit;
2024    
2025        senderBrowser := TWebBrowser(Sender);
2026        doc := senderBrowser.ControlInterface.Document as IHTMLDocument2;
2027    
2028          try          try
2029                  try                  try
2030                          if (TWebBrowser(Sender) <> nil) and (not TWebBrowser(Sender).Busy) and (Assigned(TWebBrowser(Sender).Document)) then begin                          if ((not senderBrowser.Busy) and Assigned(doc)) then begin
2031                                  if LowerCase(OleVariant(IHTMLDocument2(TWebBrowser(Sender).Document)).charset) <> 'shift_jis' then begin                                  if LowerCase(doc.charset) <> 'shift_jis' then begin
2032                                          OleVariant(IHTMLDocument2(TWebBrowser(Sender).Document)).charset := 'shift_jis';                                          doc.charset := 'shift_jis';
2033                                  end;                                  end;
2034                          end;                          end;
2035                  except                  except
2036                  end;                  end;
2037          finally          finally
2038          end;          end;
2039    
2040          if PreviewTimer.Enabled then          if PreviewTimer.Enabled then
2041                  PreviewTimer.Enabled := False;                  PreviewTimer.Enabled := False;
2042    
2043          Application.CancelHint;          Application.CancelHint;
2044    
2045          try          try
2046                  if GetActiveContent <> nil then                  if GetActiveContent <> nil then
2047                          ActiveFileName := ChangeFileExt(ExtractFileName(GetActiveContent.FileName), '')                          ActiveFileName := ChangeFileExt(ExtractFileName(GetActiveContent.FileName), '')
# Line 1914  begin Line 2051  begin
2051                  FActiveContent := nil;                  FActiveContent := nil;
2052                  Exit;                  Exit;
2053          end;          end;
2054    
2055      // 前回と同じ場合終了      // 前回と同じ場合終了
2056      if (StatusBar.Panels[1].Text = Text2) then begin      if (StatusBar.Panels[1].Text = Text2) then begin
2057          if Text2 = '' then begin          if Text2 = '' then begin
# Line 1935  begin Line 2073  begin
2073    
2074      if FResPopupBrowser <> nil then begin      if FResPopupBrowser <> nil then begin
2075          if not(Sender is TResPopupBrowser) then begin          if not(Sender is TResPopupBrowser) then begin
2076              if (FResPopupBrowser.Visible) then begin              if ((doc <> nil) and (FResPopupBrowser.Visible)) then begin
2077                  FResPopupBrowser.Clear;                  if ResPopupClearTimer.Interval > 0 then begin
2078                        ResPopupClearTimer.Enabled := True;
2079                        ResPopupClearTimer.Tag := 0;
2080                    end else begin
2081                        FResPopupBrowser.Clear;
2082                    end;
2083              end;              end;
2084          end else begin          end else begin
2085              TResPopupBrowser(Sender).ChildClear;              if ResPopupClearTimer.Interval > 0 then begin
2086                    ResPopupClearTimer.Enabled := True;
2087                    ResPopupClearTimer.Tag := 1;
2088                end else begin
2089                    TResPopupBrowser(Sender).ChildClear;
2090                end;
2091          end;          end;
2092      end;      end;
2093      cResPopup := nil;      cResPopup := nil;
# Line 1953  begin Line 2101  begin
2101    
2102  //file:///C:/Borland/Projects/gikoNavi/test/read.cgi/qa/990576336/10  //file:///C:/Borland/Projects/gikoNavi/test/read.cgi/qa/990576336/10
2103  //file:///C:/Borland/Projects/gikoNavi/test/read.cgi/qa/990576336/10-15  //file:///C:/Borland/Projects/gikoNavi/test/read.cgi/qa/990576336/10-15
2104        // 他のアプリで処理するURLか確認
2105        if (ExtPreviewDM.PreviewURL(Text2)) then begin
2106            Exit;
2107        end;
2108          s := '';          s := '';
2109          Ext := AnsiLowerCase(ExtractFileExt(Text2));          Ext := AnsiLowerCase(ExtractFileExt(Text2));
2110          if (Pos('http://', Text2) = 1) and (GikoSys.Setting.PreviewVisible) and          if (Pos('http://', Text2) = 1) and (GikoSys.Setting.PreviewVisible) and
2111                          ((Ext = '.jpg') or (Ext = '.jpeg') or (Ext = '.gif') or (Ext = '.png')) then begin                          ((Ext = '.jpg') or (Ext = '.jpeg') or (Ext = '.gif') or (Ext = '.png')) or
2112            (Pos('http://www.nicovideo.jp/watch/', Text2) = 1)  then begin
2113                  if FPreviewBrowser = nil then begin                  if FPreviewBrowser = nil then begin
2114                          FPreviewBrowser := TPreviewBrowser.Create(Self);                          FPreviewBrowser := TPreviewBrowser.Create(Self);
2115                          ShowWindow(FPreviewBrowser.Handle, SW_HIDE);                          ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
# Line 1968  begin Line 2120  begin
2120                  PreviewTimer.Interval := GikoSys.Setting.PreviewWait;                  PreviewTimer.Interval := GikoSys.Setting.PreviewWait;
2121                  PreviewTimer.Enabled := True;                  PreviewTimer.Enabled := True;
2122          end else if (Pos('about:blank', Text2) = 1) or (Pos('http://', Text2) = 1) or (Pos('mailto:', Text2) = 1) then begin          end else if (Pos('about:blank', Text2) = 1) or (Pos('http://', Text2) = 1) or (Pos('mailto:', Text2) = 1) then begin
2123                  if Pos('mailto:', Text2) = 1 then begin                  if (Pos('mailto:', Text2) = 1) and (GikoSys.Setting.RespopupMailTo) then begin
2124                          s := StringReplace(Text2, 'mailto:', '', [rfIgnoreCase]);                          s := StringReplace(Text2, 'mailto:', '', [rfIgnoreCase]);
2125                          //ギコナビスレ パート3の466氏に感謝                          //ギコナビスレ パート3の466氏に感謝
2126                          GetCursorPos(p);                          GetCursorPos(p);
2127                          p.x := p.x - TWebBrowser(Sender).ClientOrigin.x;                          p.x := p.x - senderBrowser.ClientOrigin.x;
2128                          p.y := p.y - TWebBrowser(Sender).ClientOrigin.y;                          p.y := p.y - senderBrowser.ClientOrigin.y;
2129                          e := IHTMLDocument2(TWebBrowser(Sender).Document).elementFromPoint(p.x, p.y);                          e := doc.elementFromPoint(p.x, p.y);
2130                          if (Assigned(e)) then begin                          if (Assigned(e)) then begin
2131                  CreateResPopupBrowser;                  CreateResPopupBrowser;
2132    
2133                    if not(Sender is TResPopupBrowser) then begin
2134                        if (FResPopupBrowser.Visible) then begin
2135                            FResPopupBrowser.Clear;
2136                        end;
2137                    end else begin
2138                        TResPopupBrowser(Sender).ChildClear;
2139                    end;
2140    
2141                  cResPopup := FResPopupBrowser.CreateNewBrowser;                  cResPopup := FResPopupBrowser.CreateNewBrowser;
2142                                  tmp2 := ZenToHan(e.Get_outerText);                                  tmp2 := Trim(ZenToHan(e.Get_outerText));
2143                                  if (GikoSys.IsNumeric(tmp2)) then begin                                  if (GikoSys.IsNumeric(tmp2)) then begin
2144                                          //sはレス番号っぽいっす。                                          //sはレス番号っぽいっす。
2145                                          wkIntSt := StrToInt64(tmp2);                                          wkIntSt := StrToInt64(tmp2);
# Line 1991  begin Line 2152  begin
2152                                  end;                                  end;
2153                          end;                          end;
2154                  end else begin                  end else begin
2155                CreateResPopupBrowser;
2156    
2157                if not(Sender is TResPopupBrowser) then begin
2158                    if (FResPopupBrowser.Visible) then begin
2159                        FResPopupBrowser.Clear;
2160                    end;
2161                end else begin
2162                    TResPopupBrowser(Sender).ChildClear;
2163                end;
2164    
2165                          threadItem := GetActiveContent(true);                          threadItem := GetActiveContent(true);
2166                          URL := THTMLCreate.GetRespopupURL(Text2, threadItem.URL);                          URL := THTMLCreate.GetRespopupURL(Text2, threadItem.URL);
2167                          PathRec := Gikosys.Parse2chURL2(URL);                          PathRec := Gikosys.Parse2chURL2(URL);
# Line 2043  begin Line 2214  begin
2214                                                  wkIntSt := 1;                                                  wkIntSt := 1;
2215                                                  wkIntTo := 1;                                                  wkIntTo := 1;
2216                                          end;                                          end;
                     CreateResPopupBrowser;  
2217                      cResPopup := FResPopupBrowser.CreateNewBrowser;                      cResPopup := FResPopupBrowser.CreateNewBrowser;
2218                      cResPopup.PopupType := gptThread;                      cResPopup.PopupType := gptThread;
2219                                          HTMLCreater.SetResPopupText(cResPopup, threadItem, wkIntSt, wkIntTo, ATitle, PathRec.FFirst );                                          HTMLCreater.SetResPopupText(cResPopup, threadItem, wkIntSt, wkIntTo, ATitle, PathRec.FFirst );
# Line 2051  begin Line 2221  begin
2221                          end;                          end;
2222                  end;                  end;
2223          if (cResPopup <> nil) then begin          if (cResPopup <> nil) then begin
2224                ResPopupClearTimer.Enabled := False;
2225    
2226              if cResPopup.PopupType = gptRaw then begin              if cResPopup.PopupType = gptRaw then begin
2227                  if cResPopup.Title <> '' then begin                  if cResPopup.Title <> '' then begin
2228                      cResPopup.TitlePopup;                      cResPopup.TitlePopup;
# Line 2181  var Line 2353  var
2353          ARect: TRect;          ARect: TRect;
2354  begin  begin
2355          DefaultDraw := True;          DefaultDraw := True;
2356    // なぜか無条件でExitしている
2357          Exit;          Exit;
2358          DefaultDraw := False;          DefaultDraw := False;
2359          if (cdsSelected in State) or (cdsHot in State) then begin          if (cdsSelected in State) or (cdsHot in State) then begin
# Line 2223  begin Line 2396  begin
2396  {$IFDEF DEBUG}  {$IFDEF DEBUG}
2397          Writeln(URL);          Writeln(URL);
2398  {$ENDIF}  {$ENDIF}
2399        FKokoPopupThreadItem := nil;
2400          if Pos(kMenuName, URL) <> 0 then begin          if Pos(kMenuName, URL) <> 0 then begin
2401                  sNo := Copy( URL, Pos( kMenuName, URL ) + Length( kMenuName ), Length( URL ) );                  sNo := Copy( URL, Pos( kMenuName, URL ) + Length( kMenuName ), Length( URL ) );
2402                    
2403                  if not GikoSys.IsNumeric(sNo) then Exit;                  if not GikoSys.IsNumeric(sNo) then Exit;
2404    
2405                  Cancel := True;                  Cancel := True;
# Line 2233  begin Line 2407  begin
2407          KokoPopupMenu.PopupComponent := nil;          KokoPopupMenu.PopupComponent := nil;
2408          if (Sender is TComponent) then          if (Sender is TComponent) then
2409              KokoPopupMenu.PopupComponent := TComponent(Sender);              KokoPopupMenu.PopupComponent := TComponent(Sender);
2410            // 誤爆対策 クリックしたブラウザと異なるときに消す処理を追加
2411            if not (Sender is TResPopupBrowser) then begin
2412                if (FResPopupBrowser <> nil) and (FResPopupBrowser.CurrentBrowser.Visible = True) then begin
2413                    FResPopupBrowser.Clear;
2414                end;
2415            end else begin
2416                if (Sender <> FResPopupBrowser.CurrentBrowser) then begin
2417                    TResPopupBrowser(Sender).ChildClear;
2418                end;
2419            end;
2420            FKokoPopupThreadItem := GetActiveContent(true);
2421                  KokoPopupMenu.Tag := StrToInt(sNo);                  KokoPopupMenu.Tag := StrToInt(sNo);
2422                  KokoPopupMenu.Popup(p.x, p.y);                  KokoPopupMenu.Popup(p.x, p.y);
2423          end else if Pos('mailto', LowerCase(URL)) <> 0 then begin          end else if Pos('mailto', LowerCase(URL)) <> 0 then begin
2424                  Cancel := not GikoSys.Setting.OpenMailer;                  Cancel := not GikoSys.Setting.OpenMailer;
2425    
2426            //@と.を含まないURLはメールアドレスとみなさない
2427            //主にage、sage対策
2428            if (Pos('@', URL) = 0) or (Pos('.', URL) = 0) then begin
2429                Cancel := True;
2430            end;
2431          end;          end;
2432    
2433  end;  end;
# Line 2378  begin Line 2569  begin
2569  end;  end;
2570  procedure TGikoForm.DownloadMsg(Sender: TObject; Item: TDownloadItem; Msg: string; Icon: TGikoMessageIcon);  procedure TGikoForm.DownloadMsg(Sender: TObject; Item: TDownloadItem; Msg: string; Icon: TGikoMessageIcon);
2571  begin  begin
2572        if csDestroying in Self.ComponentState then
2573            Exit;
2574          AddMessageList(Msg, nil, Icon);          AddMessageList(Msg, nil, Icon);
2575  end;  end;
2576  // *************************************************************************  // *************************************************************************
# Line 2392  var Line 2585  var
2585          Res : TResRec;          Res : TResRec;
2586  begin  begin
2587          try          try
2588            if csDestroying in Self.ComponentState then
2589                    Exit;
2590                  if Item.DownType = gdtBoard then                  if Item.DownType = gdtBoard then
2591                          ATitle := Item.Board.Title                          ATitle := Item.Board.Title
2592                  else                  else
# Line 2469  begin Line 2664  begin
2664    
2665                                  //巡回ありの場合&1000超は巡回削除                                  //巡回ありの場合&1000超は巡回削除
2666                                  if (Item.ThreadItem.Round) and (Item.ThreadItem.Count > 1000) then begin                                  if (Item.ThreadItem.Round) and (Item.ThreadItem.Count > 1000) then begin
2667                                          Item.ThreadItem.Round := False;                      // 2ch以外は、1000が最高か不明なので、2ch限定にする
2668                                          //Item.ThreadItem.RoundName := '';                      if (Item.ThreadItem.ParentBoard.Is2ch) then begin
2669                                          AddMessageList('★1000発言を超えたので巡回を削除しました - [' + Item.ThreadItem.Title + ']', nil, gmiOK);                                          Item.ThreadItem.Round := False;
2670                                            AddMessageList('★1000発言を超えたので巡回を削除しました - [' + Item.ThreadItem.Title + ']', nil, gmiOK);
2671                        end;
2672                                  end;                                  end;
2673                                  TreeView.Refresh;                                  TreeView.Refresh;
2674                                  //ListViewでこのスレが含まれる板を表示しているときの更新処理                                  //ListViewでこのスレが含まれる板を表示しているときの更新処理
2675                                  if (ActiveList <> nil) and (ActiveList is TBoard) then begin                  UpdateListView();
                                         TBoard(ActiveList).LogThreadCount := TBoard(ActiveList).GetLogThreadCount;  
                                         TBoard(ActiveList).NewThreadCount := TBoard(ActiveList).GetNewThreadCount;  
                                         TBoard(ActiveList).UserThreadCount:= TBoard(ActiveList).GetUserThreadCount;  
                     //ListViewのアイテムの個数も更新  
                                         case GikoForm.ViewType of  
                                                 gvtAll: ListView.Items.Count := TBoard(ActiveList).Count;  
                                                 gvtLog: ListView.Items.Count := TBoard(ActiveList).LogThreadCount;  
                                                 gvtNew: ListView.Items.Count := TBoard(ActiveList).NewThreadCount;  
                                                 gvtArch: ListView.Items.Count := TBoard(ActiveList).ArchiveThreadCount;  
                                                 gvtLive: ListView.Items.Count := TBoard(ActiveList).LiveThreadCount;  
                                                 gvtUser: ListView.Items.Count := TBoard(ActiveList).UserThreadCount;  
                                         end;  
                                 end;  
2676                                  RefreshListView(Item.ThreadItem);                                  RefreshListView(Item.ThreadItem);
2677                          end;                          end;
2678    
# Line 2533  procedure TGikoForm.WorkBegin(Sender: TO Line 2717  procedure TGikoForm.WorkBegin(Sender: TO
2717  begin  begin
2718  //      SetProgressValue(Number, 0, AWorkCountMax);  //      SetProgressValue(Number, 0, AWorkCountMax);
2719  //      ProgressBar.Visible := True;  //      ProgressBar.Visible := True;
2720        if csDestroying in Self.ComponentState then
2721            Exit;
2722    
2723          ProgressBar.Position := 0;          ProgressBar.Position := 0;
2724          ProgressBar.Max := AWorkCountMax;          ProgressBar.Max := AWorkCountMax;
2725          FDownloadTitle := AWorkTitle;          FDownloadTitle := AWorkTitle;
# Line 2542  end; Line 2729  end;
2729    
2730  procedure TGikoForm.WorkEnd(Sender: TObject; AWorkMode: TWorkMode; Number: Integer);  procedure TGikoForm.WorkEnd(Sender: TObject; AWorkMode: TWorkMode; Number: Integer);
2731  begin  begin
2732        if csDestroying in Self.ComponentState then
2733            Exit;
2734          ProgressBar.Position := 0;          ProgressBar.Position := 0;
2735          if FDownloadMax <> 0 then          if FDownloadMax <> 0 then
2736                  StatusBar.Panels[1].Text := FDownloadTitle + ' - ダウンロードが完了しました';                  StatusBar.Panels[1].Text := FDownloadTitle + ' - ダウンロードが完了しました';
# Line 2549  end; Line 2738  end;
2738    
2739  procedure TGikoForm.Work(Sender: TObject; AWorkMode: TWorkMode; const AWorkCount: Integer; Number: Integer);  procedure TGikoForm.Work(Sender: TObject; AWorkMode: TWorkMode; const AWorkCount: Integer; Number: Integer);
2740  begin  begin
2741        if csDestroying in Self.ComponentState then
2742            Exit;
2743          ProgressBar.Position := AWorkCount;          ProgressBar.Position := AWorkCount;
2744  //      SetProgressValue(Number, AWorkCount);  //      SetProgressValue(Number, AWorkCount);
2745          StatusBar.Panels[1].Text := FDownloadTitle + ' - ダウンロード中 (' + IntToStr(AWorkCount) + '/' + IntToStr(FDownloadMax) + ')';          StatusBar.Panels[1].Text := FDownloadTitle + ' - ダウンロード中 (' + IntToStr(AWorkCount) + '/' + IntToStr(FDownloadMax) + ')';
# Line 2730  var Line 2921  var
2921          BBSID: string;          BBSID: string;
2922          FileName: string;          FileName: string;
2923          sTitle: string;          sTitle: string;
2924          doc: Variant;          doc: OleVariant;
2925          s: string;          s: string;
2926          idx: Integer;          idx: Integer;
2927          ThreadItem: TThreadItem;          ThreadItem: TThreadItem;
# Line 2744  begin Line 2935  begin
2935          (FActiveContent <> nil) and          (FActiveContent <> nil) and
2936                  (FActiveContent.Thread <> Thread.Thread) and                  (FActiveContent.Thread <> Thread.Thread) and
2937                  (FActiveContent.Browser <> nil) and                  (FActiveContent.Browser <> nil) and
2938                  (Assigned(FActiveContent.Browser.Document)) then begin                  (Assigned(FActiveContent.Browser.ControlInterface.Document)) then begin
2939                  try          try
2940                  try              try
2941                          FActiveContent.Thread.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document).Body).ScrollTop;                  FActiveContent.Thread.ScrollTop := FActiveContent.Browser.OleObject.Document.Body.ScrollTop;
2942                  except              except
2943                          on E: Exception do              on E: Exception do
2944                                  MsgBox(Handle, E.Message, 'SetContent[<-ScrollTop]', 0);                  MsgBox(Handle, E.Message, 'SetContent[<-ScrollTop]', 0);
2945                  end;          end;
2946                  finally                  finally
2947                  end;                  end;
2948          end;          end;
# Line 2778  begin Line 2969  begin
2969          ThreadTitle := Thread.Thread.Title;          ThreadTitle := Thread.Thread.Title;
2970          ThreadPTitle := Thread.Thread.ParentBoard.Title;          ThreadPTitle := Thread.Thread.ParentBoard.Title;
2971          //ThreadScrollTop := Thread.Thread.ScrollTop;          //ThreadScrollTop := Thread.Thread.ScrollTop;
2972        if Thread.Thread.IsLogFile then  begin
2973            if not FileExists(Thread.Thread.GetThreadFileName) then begin
2974                Thread.Thread.DeleteLogFile;
2975            end;
2976        end;
2977    
2978          ThreadIsLog := Thread.Thread.IsLogFile;          ThreadIsLog := Thread.Thread.IsLogFile;
2979          ThreadItem := Thread.Thread;          ThreadItem := Thread.Thread;
2980          ThreadNewArraical :=  Thread.Thread.NewArrival;          ThreadNewArraical :=  Thread.Thread.NewArrival;
# Line 2797  begin Line 2994  begin
2994                                  ShowWindow(FActiveContent.Browser.Handle, SW_HIDE);                                  ShowWindow(FActiveContent.Browser.Handle, SW_HIDE);
2995                  end;                  end;
2996                  ShowWindow(Thread.Browser.Handle, SW_SHOW);                  ShowWindow(Thread.Browser.Handle, SW_SHOW);
2997                  if (not Assigned(Thread.Browser.Document)) then begin                  if (not Assigned(Thread.Browser.ControlInterface.Document)) then begin
2998                          Thread.Browser.Navigate('about:blank');                          Thread.Browser.Navigate('about:blank');
2999                  end;                  end;
3000                  while (Thread.Browser.ReadyState <> READYSTATE_COMPLETE) and                  while (Thread.Browser.ReadyState <> READYSTATE_COMPLETE) and
# Line 2835  begin Line 3032  begin
3032                          try                          try
3033                                  Thread.Browser.BringToFront;                                  Thread.Browser.BringToFront;
3034                                  s := '<HTML><BODY><CENTER>このスレッドは取得していません</CENTER></BODY></HTML>';                                  s := '<HTML><BODY><CENTER>このスレッドは取得していません</CENTER></BODY></HTML>';
3035                                  doc := Idispatch( olevariant(Thread.Browser.ControlInterface).Document) as IHTMLDocument2;                                  doc := Thread.Browser.OleObject.Document;
3036                                  doc.open;                                  doc.open;
3037                                  doc.charset := 'Shift_JIS';                                  doc.charset := 'Shift_JIS';
3038                                  doc.Write(s);                                  doc.Write(s);
# Line 2967  begin Line 3164  begin
3164                  BBSs[i].SelectText := SelectText;                  BBSs[i].SelectText := SelectText;
3165                  BBSs[i].KubetsuChk := KubetsuChk;                  BBSs[i].KubetsuChk := KubetsuChk;
3166          end;          end;
3167        BoardGroup.SpecialBBS.SelectText := SelectText;
3168        BoardGroup.SpecialBBS.KubetsuChk := KubetsuChk;
3169        
3170          ViewType := AViewType;          ViewType := AViewType;
3171          if ActiveList is TBoard then begin          if ActiveList is TBoard then begin
3172                  Board := TBoard(ActiveList);                  Board := TBoard(ActiveList);
# Line 3566  begin Line 3766  begin
3766  end;  end;
3767  procedure TGikoForm.DeleteTab(index, selectIndex: Integer);  procedure TGikoForm.DeleteTab(index, selectIndex: Integer);
3768  var  var
3769      doc: Variant;      browserRec : TBrowserRecord;
3770        doc: OleVariant;
3771      j: Integer;      j: Integer;
3772  begin  begin
3773        browserRec := TBrowserRecord(BrowserTab.Tabs.Objects[index]);
3774      try      try
3775          if TBrowserRecord(BrowserTab.Tabs.Objects[index]).Browser <> nil then begin          if browserRec.Browser <> nil then begin
3776              doc := TBrowserRecord(BrowserTab.Tabs.Objects[index]).Browser.Document;              doc := browserRec.Browser.OleObject.Document;
3777              TBrowserRecord(BrowserTab.Tabs.Objects[index]).Thread.ScrollTop := doc.Body.ScrollTop;              browserRec.Thread.ScrollTop := doc.Body.ScrollTop;
3778          end;          end;
3779      except      except
3780          TBrowserRecord(BrowserTab.Tabs.Objects[index]).Thread.ScrollTop := 0;          browserRec.Thread.ScrollTop := 0;
3781      end;      end;
3782      if(FActiveContent = TBrowserRecord(BrowserTab.Tabs.Objects[index])) then  
3783        if(FActiveContent = browserRec) then
3784          FActiveContent := nil;          FActiveContent := nil;
3785      if TBrowserRecord(BrowserTab.Tabs.Objects[index]).Browser <> nil then begin      if browserRec.Browser <> nil then begin
3786          j := FBrowsers.IndexOf(TBrowserRecord(BrowserTab.Tabs.Objects[index]).Browser);          j := FBrowsers.IndexOf(browserRec.Browser);
3787          if j <> -1 then          if j <> -1 then
3788              FBrowsers.Move(j, BROWSER_COUNT - 1);              FBrowsers.Move(j, BROWSER_COUNT - 1);
3789      end;      end;
3790    
3791      BrowserTab.Tabs.BeginUpdate;      BrowserTab.Tabs.BeginUpdate;
3792      try      try
3793          GikoSys.Setting.LastCloseTabURL :=          GikoSys.Setting.LastCloseTabURL := browserRec.Thread.URL;
3794              TBrowserRecord(BrowserTab.Tabs.Objects[index]).Thread.URL;          browserRec.Free;
         TBrowserRecord(BrowserTab.Tabs.Objects[index]).Free;  
3795          if ( BrowserTab.Tabs.Count - 1 = index ) and          if ( BrowserTab.Tabs.Count - 1 = index ) and
3796              ( BrowserTab.TabRect(index).Left              ( BrowserTab.TabRect(index).Left
3797                  <= BrowserTab.DisplayRect.Left ) then begin                  <= BrowserTab.DisplayRect.Left ) then begin
# Line 3609  begin Line 3812  begin
3812      if BrowserTab.Tabs.Count = 0 then begin      if BrowserTab.Tabs.Count = 0 then begin
3813          BrowserNullTab.Thread := nil;          BrowserNullTab.Thread := nil;
3814      end;      end;
3815    
3816      if(BrowserTab.TabIndex <> -1) and      if(BrowserTab.TabIndex <> -1) and
3817          ( TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Browser = nil) then begin          ( TBrowserRecord(BrowserTab.Tabs.Objects[BrowserTab.TabIndex]).Browser = nil) then begin
3818          // 一番古いブラウザを開放する          // 一番古いブラウザを開放する
# Line 3676  begin Line 3880  begin
3880                  TreeSelectFavoriteAddPupupMenu.Visible := False;                  TreeSelectFavoriteAddPupupMenu.Visible := False;
3881                  TreeSelectLogDeleteSeparator.Visible := False;                  TreeSelectLogDeleteSeparator.Visible := False;
3882                  TreeSelectLogDeletePopupMenu.Visible := False;                  TreeSelectLogDeletePopupMenu.Visible := False;
3883            SearchBoardName.Visible := False;
3884          end else if TObject(FClickNode.Data) is TBoard then begin          end else if TObject(FClickNode.Data) is TBoard then begin
3885                  TreeSelectThreadPupupMenu.Visible := False;                  TreeSelectThreadPupupMenu.Visible := False;
3886                  TreeSelectBoardPupupMenu.Visible := True;                  TreeSelectBoardPupupMenu.Visible := True;
# Line 3686  begin Line 3891  begin
3891                  TreeSelectFavoriteAddPupupMenu.Visible := True;                  TreeSelectFavoriteAddPupupMenu.Visible := True;
3892                  TreeSelectLogDeleteSeparator.Visible := False;                  TreeSelectLogDeleteSeparator.Visible := False;
3893                  TreeSelectLogDeletePopupMenu.Visible := False;                  TreeSelectLogDeletePopupMenu.Visible := False;
3894            SearchBoardName.Visible := True;
3895          end else if TObject(FClickNode.Data) is TFavoriteBoardItem then begin          end else if TObject(FClickNode.Data) is TFavoriteBoardItem then begin
3896                  TreeSelectThreadPupupMenu.Visible := False;                  TreeSelectThreadPupupMenu.Visible := False;
3897                  TreeSelectBoardPupupMenu.Visible := True;                  TreeSelectBoardPupupMenu.Visible := True;
# Line 3696  begin Line 3902  begin
3902                  TreeSelectFavoriteAddPupupMenu.Visible := True;                  TreeSelectFavoriteAddPupupMenu.Visible := True;
3903                  TreeSelectLogDeleteSeparator.Visible := False;                  TreeSelectLogDeleteSeparator.Visible := False;
3904                  TreeSelectLogDeletePopupMenu.Visible := False;                  TreeSelectLogDeletePopupMenu.Visible := False;
3905            SearchBoardName.Visible := False;
3906          end else if (TObject(FClickNode.Data) is TThreadItem) then begin          end else if (TObject(FClickNode.Data) is TThreadItem) then begin
3907                  TreeSelectThreadPupupMenu.Visible := True;                  TreeSelectThreadPupupMenu.Visible := True;
3908                  TreeSelectBoardPupupMenu.Visible := False;                  TreeSelectBoardPupupMenu.Visible := False;
# Line 3706  begin Line 3913  begin
3913                  TreeSelectFavoriteAddPupupMenu.Visible := True;                  TreeSelectFavoriteAddPupupMenu.Visible := True;
3914                  TreeSelectLogDeleteSeparator.Visible := True;                  TreeSelectLogDeleteSeparator.Visible := True;
3915                  TreeSelectLogDeletePopupMenu.Visible := True;                  TreeSelectLogDeletePopupMenu.Visible := True;
3916            SearchBoardName.Visible := False;
3917          end else if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin          end else if (TObject(FClickNode.Data) is TFavoriteThreadItem) then begin
3918                  TreeSelectThreadPupupMenu.Visible := True;                  TreeSelectThreadPupupMenu.Visible := True;
3919                  TreeSelectBoardPupupMenu.Visible := False;                  TreeSelectBoardPupupMenu.Visible := False;
# Line 3716  begin Line 3924  begin
3924                  TreeSelectFavoriteAddPupupMenu.Visible := True;                  TreeSelectFavoriteAddPupupMenu.Visible := True;
3925                  TreeSelectLogDeleteSeparator.Visible := True;                  TreeSelectLogDeleteSeparator.Visible := True;
3926                  TreeSelectLogDeletePopupMenu.Visible := True;                  TreeSelectLogDeletePopupMenu.Visible := True;
3927            SearchBoardName.Visible := False;
3928          end else if (TObject(FClickNode.Data) is TCategory) then begin          end else if (TObject(FClickNode.Data) is TCategory) then begin
3929                  TreeSelectThreadPupupMenu.Visible := False;                  TreeSelectThreadPupupMenu.Visible := False;
3930                  TreeSelectBoardPupupMenu.Visible := False;                  TreeSelectBoardPupupMenu.Visible := False;
# Line 3726  begin Line 3935  begin
3935                  TreeSelectFavoriteAddPupupMenu.Visible := False;                  TreeSelectFavoriteAddPupupMenu.Visible := False;
3936                  TreeSelectLogDeleteSeparator.Visible := False;                  TreeSelectLogDeleteSeparator.Visible := False;
3937                  TreeSelectLogDeletePopupMenu.Visible := False;                  TreeSelectLogDeletePopupMenu.Visible := False;
3938            SearchBoardName.Visible := True;
3939          end else if FClickNode.IsFirstNode then begin          end else if FClickNode.IsFirstNode then begin
3940                  TreeSelectThreadPupupMenu.Visible := False;                  TreeSelectThreadPupupMenu.Visible := False;
3941                  TreeSelectBoardPupupMenu.Visible := False;                  TreeSelectBoardPupupMenu.Visible := False;
# Line 3736  begin Line 3946  begin
3946                  TreeSelectFavoriteAddPupupMenu.Visible := False;                  TreeSelectFavoriteAddPupupMenu.Visible := False;
3947                  TreeSelectLogDeleteSeparator.Visible := False;                  TreeSelectLogDeleteSeparator.Visible := False;
3948                  TreeSelectLogDeletePopupMenu.Visible := False;                  TreeSelectLogDeletePopupMenu.Visible := False;
3949            SearchBoardName.Visible := True;
3950          end else begin          end else begin
3951                  TreeSelectThreadPupupMenu.Visible := False;                  TreeSelectThreadPupupMenu.Visible := False;
3952                  TreeSelectBoardPupupMenu.Visible := False;                  TreeSelectBoardPupupMenu.Visible := False;
# Line 3746  begin Line 3957  begin
3957                  TreeSelectFavoriteAddPupupMenu.Visible := False;                  TreeSelectFavoriteAddPupupMenu.Visible := False;
3958                  TreeSelectLogDeleteSeparator.Visible := False;                  TreeSelectLogDeleteSeparator.Visible := False;
3959                  TreeSelectLogDeletePopupMenu.Visible := False;                  TreeSelectLogDeletePopupMenu.Visible := False;
3960            SearchBoardName.Visible := False;
3961          end;          end;
3962  end;  end;
3963    
# Line 3761  var Line 3973  var
3973      BNum, BRes: string;      BNum, BRes: string;
3974      threadItem: TThreadItem;      threadItem: TThreadItem;
3975      aElement : IHTMLElement;      aElement : IHTMLElement;
3976        senderBrowser : TWebBrowser;
3977        doc : IHTMLDocument2;
3978  begin  begin
3979  {$IFDEF DEBUG}  {$IFDEF DEBUG}
3980          Writeln(IntToStr(Integer(ppDisp)));          Writeln(IntToStr(Integer(ppDisp)));
3981  {$ENDIF}  {$ENDIF}
3982          Cancel := True;          Cancel := True;
     aElement := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement;  
         if ( aElement <> nil) then begin  
                 Text := aElement.Get_outerText;  
                 Html := aElement.Get_outerHTML;  
                 if(AnsiPos('>>', Text) = 1) or (AnsiPos('>', Text) = 1)  
                         or (AnsiPos('>>', Text) = 1) or (AnsiPos('>', Text) = 1) then begin  
                         if GikoSys.Setting.ResAnchorJamp then begin  
   
                                 Text := ZenToHan(Trim(Text));  
   
                                 if(AnsiPos('>>', Text) = 1) then begin  
                                         //Text := Copy(Text, 3, Length(Text) - 2);  
                                         Delete(Text, 1, 2);  
                                 end else begin  
                                         //Text := Copy(Text, 2, Length(Text) - 1);  
                                         Delete(Text, 1, 1);  
                                 end;  
3983    
3984                                  if AnsiPos('-', Text) <> 0 then begin          if not( TObject(Sender) is TWebBrowser )then
3985                                          wkIntSt := StrToIntDef(Copy(Text, 1, AnsiPos('-', Text) - 1), 0);                  Exit;
                                         Text := Copy(Text, AnsiPos('-', Text) + 1, Length(Text));  
                                         wkIntTo := StrToIntDef(Text, 0);  
                                         if wkIntTo < wkIntSt then  
                                                 wkIntSt := wkIntTo;  
                                 end else begin  
                                         wkIntSt := StrToIntDef(Text, 0);  
                                 end;  
3986    
3987                                  if wkIntSt <> 0 then begin      senderBrowser := TWebBrowser(Sender);
3988                          FActiveContent.IDAnchorPopup('');      doc := senderBrowser.ControlInterface.Document as IHTMLDocument2;
3989                      MoveHisotryManager.pushItem(FActiveContent);          if not Assigned(doc) then
3990                      if (Sender is TResPopupBrowser) then begin                  Exit;
3991                          TResPopupBrowser(Sender).ChildClear;  
3992                          OpenThreadItem(          aElement := doc.activeElement;
3993                              GetActiveContent(true),          if not Assigned(aElement) then
3994                              GetActiveContent(true).URL + '&st=' +                  Exit;
3995                                   IntToStr(wkIntSt) + '&to=' + IntToStr(wkIntSt));  
3996                      end else begin          Text := aElement.Get_outerText;
3997                                          BrowserMovement(IntToStr(wkIntSt));          Html := aElement.Get_outerHTML;
3998                      end;  
3999                  end;          if(AnsiPos('>>', Text) = 1) or (AnsiPos('>', Text) = 1)
4000                    or (AnsiPos('>>', Text) = 1) or (AnsiPos('>', Text) = 1) then begin
4001                    if GikoSys.Setting.ResAnchorJamp then begin
4002    
4003                            Text := ZenToHan(Trim(Text));
4004    
4005                            if(AnsiPos('>>', Text) = 1) then begin
4006                                    //Text := Copy(Text, 3, Length(Text) - 2);
4007                                    Delete(Text, 1, 2);
4008                            end else begin
4009                                    //Text := Copy(Text, 2, Length(Text) - 1);
4010                                    Delete(Text, 1, 1);
4011                          end;                          end;
                 end else begin  
             ////'http://be.2ch.net/test/p.php?i='+id+'&u=d:'+bas+num  
4012    
4013                          URL := GikoSys.GetHRefText(Html);                          if AnsiPos('-', Text) <> 0 then begin
4014                          URL := GikoSys.HTMLDecode(URL);                                  wkIntSt := StrToIntDef(Copy(Text, 1, AnsiPos('-', Text) - 1), 0);
4015              if AnsiPos('BE:', URL) = 1 then begin                                  Text := Copy(Text, AnsiPos('-', Text) + 1, Length(Text));
4016                                  BNum := Copy(URL, 4, AnsiPos('/', URL) - 4);                                  wkIntTo := StrToIntDef(Text, 0);
4017                                  BRes := Copy(URL, AnsiPos('/', URL) + 1,  Length(URL));                                  if wkIntTo < wkIntSt then
4018                  threadItem := FActiveContent.Thread;                                          wkIntSt := wkIntTo;
4019                  if threadItem = nil then Exit;                          end else begin
4020                  URL := BE_PHP_URL + BNum + '&u=d'                                  wkIntSt := StrToIntDef(Text, 0);
4021                          + CustomStringReplace(threadItem.URL, 'l50', '') + BRes;                          end;
             end;  
4022    
4023                          if( AnsiPos('http://', URL) = 1) or (AnsiPos('https://', URL) = 1) or                          if wkIntSt <> 0 then begin
4024                                  ( AnsiPos('ftp://', URL) = 1) then begin                  FActiveContent.IDAnchorPopup('');
4025                                  //アドレスバーの履歴                  MoveHisotryManager.pushItem(FActiveContent);
                                 if GikoSys.Setting.LinkAddAddressBar then begin  
                                         idx := AddressComboBox.Items.IndexOf(URL);  
                                         if idx = -1 then begin  
                                                 AddressComboBox.Items.Insert(0, URL);  
                                                 if AddressComboBox.Items.Count > GikoSys.Setting.AddressHistoryCount then  
                                                         AddressComboBox.Items.Delete(AddressComboBox.Items.Count - 1);  
                                         end else begin  
                                                 AddressComboBox.Items.Delete(idx);  
                                                 AddressComboBox.Items.Insert(0, URL);  
                                         end;  
                                 end;  
4026                  if (Sender is TResPopupBrowser) then begin                  if (Sender is TResPopupBrowser) then begin
4027                      TResPopupBrowser(Sender).ChildClear                      TResPopupBrowser(Sender).ChildClear;
4028                        OpenThreadItem(
4029                            GetActiveContent(true),
4030                            GetActiveContent(true).URL + '&st=' +
4031                                 IntToStr(wkIntSt) + '&to=' + IntToStr(wkIntSt));
4032                    end else begin
4033                                            BrowserMovement(IntToStr(wkIntSt));
4034                  end;                  end;
4035                end;
4036                    end;
4037            end else begin
4038            ////'http://be.2ch.net/test/p.php?i='+id+'&u=d:'+bas+num
4039    
4040                  MoveHisotryManager.pushItem(FActiveContent);                  URL := GikoSys.GetHRefText(Html);
4041                                  MoveToURL( URL );                  URL := GikoSys.HTMLDecode(URL);
4042            if AnsiPos('BE:', URL) = 1 then begin
4043                            BNum := Copy(URL, 4, AnsiPos('/', URL) - 4);
4044                            BRes := Copy(URL, AnsiPos('/', URL) + 1,  Length(URL));
4045                threadItem := FActiveContent.Thread;
4046                if threadItem = nil then Exit;
4047                URL := BE_PHP_URL + BNum + '&u=d'
4048                    + CustomStringReplace(threadItem.URL, 'l50', '') + BRes;
4049            end;
4050    
4051                    if( AnsiPos('http://', URL) = 1) or (AnsiPos('https://', URL) = 1) or
4052                            ( AnsiPos('ftp://', URL) = 1) then begin
4053                            //アドレスバーの履歴
4054                            if GikoSys.Setting.LinkAddAddressBar then begin
4055                                    idx := AddressComboBox.Items.IndexOf(URL);
4056                                    if idx = -1 then begin
4057                                            AddressComboBox.Items.Insert(0, URL);
4058                                            if AddressComboBox.Items.Count > GikoSys.Setting.AddressHistoryCount then
4059                                                    AddressComboBox.Items.Delete(AddressComboBox.Items.Count - 1);
4060                                    end else begin
4061                                            AddressComboBox.Items.Delete(idx);
4062                                            AddressComboBox.Items.Insert(0, URL);
4063                                    end;
4064                          end;                          end;
4065                if (Sender is TResPopupBrowser) then begin
4066                    TResPopupBrowser(Sender).ChildClear
4067                end;
4068    
4069                MoveHisotryManager.pushItem(FActiveContent);
4070                            MoveToURL( URL );
4071                  end;                  end;
4072      end;          end;
4073    
4074  end;  end;
4075    
# Line 4079  end; Line 4304  end;
4304  procedure TGikoForm.BrowserDocumentComplete(Sender: TObject;  procedure TGikoForm.BrowserDocumentComplete(Sender: TObject;
4305          const pDisp: IDispatch; var URL: OleVariant);          const pDisp: IDispatch; var URL: OleVariant);
4306  var  var
         FDispHtmlDocument: DispHTMLDocument;  
4307          BrowserRecord :TBrowserRecord;          BrowserRecord :TBrowserRecord;
4308          i :Integer;          i :Integer;
4309          doc                                     : Variant;          doc     : IHTMLDocument2;
4310          threadItem      : TThreadItem;          threadItem      : TThreadItem;
4311  begin  begin
4312          if TObject(Sender) is TWebBrowser then begin          if TObject(Sender) is TWebBrowser then begin
# Line 4097  begin Line 4321  begin
4321                          if BrowserRecord <> nil then begin                          if BrowserRecord <> nil then begin
4322                                  if BrowserRecord.Event <> nil then                                  if BrowserRecord.Event <> nil then
4323                                          BrowserRecord.Event.Free;                                          BrowserRecord.Event.Free;
4324                                  FDispHtmlDocument := Idispatch(OleVariant(BrowserRecord.Browser.ControlInterface).Document) as DispHTMLDocument;                                  BrowserRecord.Event := THTMLDocumentEventSink.Create(Self, BrowserRecord.Browser.ControlInterface.Document, HTMLDocumentEvents2);
                                 BrowserRecord.Event := THTMLDocumentEventSink.Create(Self, FDispHtmlDocument, HTMLDocumentEvents2);  
4325                                  BrowserRecord.Event.OnContextMenu := OnDocumentContextMenu;                                  BrowserRecord.Event.OnContextMenu := OnDocumentContextMenu;
4326                                  BrowserRecord.Event.OnClick := WebBrowserClick;  //追加したOnClickイベント                                  BrowserRecord.Event.OnClick := WebBrowserClick;  //追加したOnClickイベント
4327                          end;                          end;
4328                  end else begin                  end else begin
4329                          if GetActiveContent <> nil then begin                          if GetActiveContent <> nil then begin
                                 FDispHtmlDocument := Idispatch(OleVariant(Browser.ControlInterface).Document) as DispHTMLDocument;  
4330                                  if FEvent <> nil then                                  if FEvent <> nil then
4331                                          FEvent.Free;                                          FEvent.Free;
4332                                  FEvent := THTMLDocumentEventSink.Create(Self, FDispHtmlDocument, HTMLDocumentEvents2);                                  FEvent := THTMLDocumentEventSink.Create(Self, Browser.ControlInterface.Document, HTMLDocumentEvents2);
4333                                  FEvent.OnContextMenu := OnDocumentContextMenu;                                  FEvent.OnContextMenu := OnDocumentContextMenu;
4334                                  FEvent.OnClick := WebBrowserClick;  //追加したOnClickイベント                                  FEvent.OnClick := WebBrowserClick;  //追加したOnClickイベント
4335                          end else begin                          end else begin
# Line 4145  begin Line 4367  begin
4367                                  RefreshListView(threadItem);                                  RefreshListView(threadItem);
4368                          end else if threadItem.ScrollTop <> 0 then begin                          end else if threadItem.ScrollTop <> 0 then begin
4369                                  try                                  try
4370                                          doc := Idispatch( OleVariant( BrowserRecord.Browser.ControlInterface ).Document ) as IHTMLDocument2;                                          doc := BrowserRecord.Browser.ControlInterface.Document as IHTMLDocument2;
4371                                          doc.Body.ScrollTop := threadItem.ScrollTop;                                          (doc.body as IHTMLElement2).ScrollTop := threadItem.ScrollTop;
4372                                  except                                  except
4373                                          on E: Exception do                                          on E: Exception do
4374                                                  MsgBox(Handle, E.Message, 'SetContent[ScrollTop<-]', 0);                                                  MsgBox(Handle, E.Message, 'SetContent[ScrollTop<-]', 0);
# Line 4191  procedure TGikoForm.SetSelectItemRound(R Line 4413  procedure TGikoForm.SetSelectItemRound(R
4413  var  var
4414          threadItem : TThreadItem;          threadItem : TThreadItem;
4415  begin  begin
4416          if ParentName <> 'dummy1' then begin          if ParentName <> 'RoundItem' then begin
4417                  SetSelectItemRound(RoundFlag, RoundName);                  SetSelectItemRound(RoundFlag, RoundName);
4418          end else begin          end else begin
4419                  threadItem := GetActiveContent;                  threadItem := GetActiveContent;
# Line 4280  begin Line 4502  begin
4502          MenuToolBar.Buttons[0].AutoSize := True;          MenuToolBar.Buttons[0].AutoSize := True;
4503          MainCoolBar.AutoSize := False;          MainCoolBar.AutoSize := False;
4504          MainCoolBar.AutoSize := True;          MainCoolBar.AutoSize := True;
   
4505          GikoSys.MenuFont(ListCoolBar.Font);          GikoSys.MenuFont(ListCoolBar.Font);
4506          GikoSys.MenuFont(BrowserCoolBar.Font);          GikoSys.MenuFont(BrowserCoolBar.Font);
4507  //      MenuToolBar.Font.Color := clMenuText;  //      MenuToolBar.Font.Color := clMenuText;
# Line 4472  var Line 4693  var
4693          stRes, edRes : Int64;          stRes, edRes : Int64;
4694          browserRec : TBrowserRecord;          browserRec : TBrowserRecord;
4695          threadNumber : String;          threadNumber : String;
4696          doc : Variant;          doc : IHTMLDocument2;
4697  begin  begin
4698          stRes := 0;          stRes := 0;
4699          edRes := 0;          edRes := 0;
# Line 4500  begin Line 4721  begin
4721                          browserRec.Move(IntToStr(stRes));                          browserRec.Move(IntToStr(stRes));
4722                          Thread.JumpAddress := 0;                          Thread.JumpAddress := 0;
4723                          try                          try
4724                                  doc := Idispatch( OleVariant( browserRec.Browser.ControlInterface ).Document ) as IHTMLDocument2;                  doc := browserRec.Browser.ControlInterface.Document as IHTMLDocument2;
4725                                  Thread.ScrollTop := doc.Body.ScrollTop;                  if Assigned(doc) then
4726                                    Thread.ScrollTop := (doc.body as IHTMLElement2).ScrollTop;
4727                          except                          except
4728                          end;                          end;
4729                  end;                  end;
4730          end;          end;
4731  end;  end;
4732    
4733  procedure TGikoForm.MoveToURL(const inURL: string);  procedure TGikoForm.MoveToURL(const inURL: string; KeyMask: Boolean = False);
4734  var  var
4735          protocol, host, path, document, port, bookmark : string;          protocol, host, path, document, port, bookmark : string;
4736          URL, protocol2, host2, path2, document2, port2, bookmark2 : string;          URL, protocol2, host2, path2, document2, port2, bookmark2 : string;
# Line 4525  begin Line 4747  begin
4747    
4748          GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );          GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
4749          GikoSys.Parse2chURL( inURL, path, document, BBSID, BBSKey );          GikoSys.Parse2chURL( inURL, path, document, BBSID, BBSKey );
4750        // アクションから呼ばれるとshift/ctrlはおしっぱの場合がほとんどなのでマスクする
4751        if not KeyMask then begin
4752          shiftDown       := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);          shiftDown       := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
4753          ctrlDown        := GetAsyncKeyState(VK_CONTROL) = Smallint($8001);          ctrlDown        := GetAsyncKeyState(VK_CONTROL) = Smallint($8001);
4754          if shiftDown then begin          if shiftDown then begin
4755                  GikoSys.OpenBrowser(inURL, gbtUserApp);              GikoSys.OpenBrowser(inURL, gbtUserApp);
4756                  Exit;              Exit;
4757          end else if ctrlDown then begin          end else if ctrlDown then begin
4758                  GikoSys.OpenBrowser(inURL, gbtIE);              GikoSys.OpenBrowser(inURL, gbtIE);
4759                  Exit;              Exit;
4760          end;          end;
4761        end;
4762    
4763          //===== プラグイン          //===== プラグイン
4764          try          try
# Line 4702  end; Line 4925  end;
4925    
4926  procedure TGikoForm.WndProc(var Message: TMessage);  procedure TGikoForm.WndProc(var Message: TMessage);
4927  var  var
4928          senderBrowser   : TWebBrowser;          senderBrowser : TWebBrowser;
4929          url                                             : OleVariant;          url : OleVariant;
4930  begin  begin
4931          try          try
4932                  case Message.Msg of                  case Message.Msg of
# Line 4734  begin Line 4957  begin
4957                                  senderBrowser := TWebBrowser( Message.WParam );                                  senderBrowser := TWebBrowser( Message.WParam );
4958                                  BrowserDocumentComplete( senderBrowser, senderBrowser.Parent, url );                                  BrowserDocumentComplete( senderBrowser, senderBrowser.Parent, url );
4959                          end;                          end;
4960            USER_POPUPCLEAR:
4961                if (TObject(Message.WParam) is TResPopupBrowser) then begin
4962                    try
4963                                    TResPopupBrowser( Message.WParam ).Clear;
4964                    except
4965                    end;
4966                            end else if (TObject(Message.WParam) is TPreviewBrowser) then begin
4967                    if FPreviewBrowser <> nil then begin
4968                            ShowWindow(FPreviewBrowser.Handle, SW_HIDE);
4969                    end;
4970                            end;
4971                  end;                  end;
4972    
4973                  inherited;                  inherited;
# Line 4827  begin Line 5061  begin
5061          if PreviewTimer.Enabled then          if PreviewTimer.Enabled then
5062                  PreviewTimer.Enabled := False;                  PreviewTimer.Enabled := False;
5063    
5064          if (FResPopupBrowser <> nil) and (IsWindowVisible(FResPopupBrowser.Handle)) then begin      //Window外に移動したときは消えるようにするため復活
5065          FResPopupBrowser.Clear;      if (FResPopupBrowser <> nil) and (IsWindowVisible(FResPopupBrowser.Handle)) then begin
5066          end;          // 右クリックの時は消さないように条件追加
5067            if (Message.MouseMsg <> WM_RBUTTONUP) then begin
5068                FResPopupBrowser.Clear;
5069            end;
5070        end;
5071    
5072          if (FPreviewBrowser <> nil)          if (FPreviewBrowser <> nil)
5073                  and (IsWindowVisible(FPreviewBrowser.Handle)) then begin                  and (IsWindowVisible(FPreviewBrowser.Handle)) then begin
# Line 4856  end; Line 5094  end;
5094    
5095  function TGikoForm.OnDocumentContextMenu(Sender: TObject): WordBool;  function TGikoForm.OnDocumentContextMenu(Sender: TObject): WordBool;
5096  var  var
5097          Doc: IHtmlDocument2;          doc: IHtmlDocument2;
5098          Range: IHTMLTxtRange;          Range: IHTMLTxtRange;
5099          s: string;          s: string;
5100          Num: Integer;          Num: Integer;
# Line 4864  var Line 5102  var
5102  begin  begin
5103          Result := False;          Result := False;
5104          FactiveContent.IDAnchorPopup('');          FactiveContent.IDAnchorPopup('');
5105          Doc := FactiveContent.Browser.Document as IHtmlDocument2;  
5106          if Assigned(Doc) then begin          doc := FactiveContent.Browser.ControlInterface.Document as IHtmlDocument2;
5107                  Range := Doc.selection.createRange as IHTMLTxtRange;          if not Assigned(doc) then
5108                  s := CustomStringReplace(Range.text, ' ', ' ');//全角空白を半角空白に          Exit;
5109                  s := ZenToHan(Trim(s));  
5110                  if GikoSys.IsNumeric(s) then begin          Range := doc.selection.createRange as IHTMLTxtRange;
5111                          Num := StrToInt64(s);          if not Assigned(Range) then
5112                          ThreadItem := GetActiveContent(true);          Exit;
5113                          if (ThreadItem <> nil) and (Num <= ThreadItem.Count)  
5114                  and (Num > 0)then begin          s := CustomStringReplace(Range.text, ' ', ' ');//全角空白を半角空白に
5115                  CreateResPopupBrowser;          s := ZenToHan(Trim(s));
5116                  FResPopupBrowser.CreateNewBrowser.PopupType := gptThread;          if GikoSys.IsNumeric(s) then begin
5117                                  HTMLCreater.SetResPopupText(FResPopupBrowser.CreateNewBrowser, ThreadItem, Num, Num, False, False);                  Num := StrToInt64Def(s, -1);
5118                  FResPopupBrowser.Popup;                  ThreadItem := GetActiveContent(true);
5119                                  Result := False;                  if (ThreadItem <> nil) and (Num <= ThreadItem.Count)
5120                          end else             and (Num > 0)then begin
5121                                  Result := True;             CreateResPopupBrowser;
5122                  end else begin             FResPopupBrowser.CreateNewBrowser.PopupType := gptThread;
5123                            HTMLCreater.SetResPopupText(FResPopupBrowser.CreateNewBrowser, ThreadItem, Num, Num, False, False);
5124                FResPopupBrowser.Popup;
5125                    Result := False;
5126                    end else
5127                          Result := True;                          Result := True;
5128                  end;      end else begin
5129                    Result := True;
5130          end;          end;
5131  end;  end;
5132    
# Line 5050  begin Line 5293  begin
5293          SenderNode.Selected := False;          SenderNode.Selected := False;
5294          FavoriteDragDrop( SenderNode, Source );          FavoriteDragDrop( SenderNode, Source );
5295    
5296          SetLinkBar;          PostMessage( Handle, USER_SETLINKBAR, 0, 0 );
   
5297  end;  end;
5298    
5299  procedure TGikoForm.LinkToolButtonOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);  procedure TGikoForm.LinkToolButtonOnMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
# Line 5580  procedure TGikoForm.SelectComboBoxKeyDow Line 5822  procedure TGikoForm.SelectComboBoxKeyDow
5822          Shift: TShiftState);          Shift: TShiftState);
5823  var  var
5824    IMC: HIMC;    IMC: HIMC;
5825    Len: integer;    Len, idx: integer;
5826    Str: string;    Str: string;
5827    tmp: string;    tmp: string;
5828  begin  begin
# Line 5606  begin Line 5848  begin
5848                                  SetSelectWord(Str);                                  SetSelectWord(Str);
5849                          end;                          end;
5850                  end;                  end;
5851        end else if (Key = Windows.VK_DELETE) and (ssCtrl in Shift) then begin
5852            // Ctrl + DEL で削除する
5853            Str := SelectComboBox.Text;
5854            idx := GikoSys.Setting.SelectTextList.IndexOf( Str );
5855            if idx <> -1 then begin
5856                GikoSys.Setting.SelectTextList.Delete( idx );
5857            end;
5858            idx := SelectComboBox.Items.IndexOf( Str );
5859                    if idx <> -1 then begin
5860                SelectComboBox.Items.Delete( idx );
5861            end;
5862            SelectComboBox.Text := '';
5863            // 絞込みを解除するために変更イベントを呼び出す
5864            SelectComboBox.OnChange(Sender);
5865          end else if Length( SelectComboBox.Text ) = 0 then          end else if Length( SelectComboBox.Text ) = 0 then
5866          begin          begin
5867                  {* SelectComboBox.Textが空でも、入力途中でEscしたとか                  {* SelectComboBox.Textが空でも、入力途中でEscしたとか
# Line 6109  begin Line 6365  begin
6365          if FDragWFirst = true then          if FDragWFirst = true then
6366                  FDragWFirst := false;                  FDragWFirst := false;
6367    
6368      if GikoSys.Setting.ListOrientation = gloHorizontal then begin      // マウスの中ボタンで閉じたときに最大化してしまうのを防ぐ 
6369          if GikoSys.Setting.ListWidthState = glsMin then begin      if Button <> mbMiddle then begin
6370              GikoDM.BrowserMaxAndFocusAction.Execute;          if GikoSys.Setting.ListOrientation = gloHorizontal then begin
6371          end;              if GikoSys.Setting.ListWidthState = glsMin then begin
6372      end else begin                  GikoDM.BrowserMaxAndFocusAction.Execute;
6373          if GikoSys.Setting.ListHeightState = glsMin then begin              end;
6374              GikoDM.BrowserMaxAndFocusAction.Execute;          end else begin
6375                if GikoSys.Setting.ListHeightState = glsMin then begin
6376                    GikoDM.BrowserMaxAndFocusAction.Execute;
6377                end;
6378          end;          end;
6379      end;      end;
6380  end;  end;
# Line 6259  end; Line 6518  end;
6518    
6519    
6520  procedure TGikoForm.BrowserTabPopupMenuPopup(Sender: TObject);  procedure TGikoForm.BrowserTabPopupMenuPopup(Sender: TObject);
6521    var
6522        i:Integer;
6523  begin  begin
6524          AddRoundNameMenu(dummy1);      for i := 0  to BrowserTabPopupMenu.Items.Count - 1 do begin
6525      AddMenuSameBoardThread;          if (BrowserTabPopupMenu.Items[i].Name='RoundItem') then begin
6526                AddRoundNameMenu(BrowserTabPopupMenu.Items[i]);
6527            end else if (BrowserTabPopupMenu.Items[i].Name='BoardThreadItem') then begin
6528                AddMenuSameBoardThread(BrowserTabPopupMenu.Items[i])
6529            end;
6530        end;
6531  end;  end;
6532  //! アクティブなタブと同じ板の開いているスレッドをメニューアイテムに追加  //! アクティブなタブと同じ板の開いているスレッドをメニューアイテムに追加
6533  procedure TGikoForm.AddMenuSameBoardThread;  procedure TGikoForm.AddMenuSameBoardThread(MenuItem: TMenuItem);
6534  var  var
6535          i: Integer;          i: Integer;
6536          Item: TMenuItem;          Item: TMenuItem;
6537  begin  begin
6538      SameBoardThreadItem.Clear;      MenuItem.Clear;
6539      for i := 0 to BrowserTab.Tabs.Count - 1 do begin      for i := 0 to BrowserTab.Tabs.Count - 1 do begin
6540          // 同じ板かどうか          // 同じ板かどうか
6541          if (FActiveContent.Thread.ParentBoard =          if (FActiveContent.Thread.ParentBoard =
# Line 6279  begin Line 6545  begin
6545                  TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread then begin                  TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread then begin
6546                  Item := TMenuItem.Create(Self);                  Item := TMenuItem.Create(Self);
6547                  Item.Caption := TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread.Title;                  Item.Caption := TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread.Title;
6548                    Item.Hint    := TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread.URL;
6549                  Item.OnClick := SameBoardThreadSubItemOnClick;                  Item.OnClick := SameBoardThreadSubItemOnClick;
6550                  SameBoardThreadItem.Add(Item);                  MenuItem.Add(Item);
6551              end;              end;
6552          end;          end;
6553      end;      end;
6554      // 何も無いなら使用できないようにする      // 何も無いなら使用できないようにする
6555      SameBoardThreadItem.Enabled := SameBoardThreadItem.Count > 0;      MenuItem.Enabled := MenuItem.Count > 0;
6556  end;  end;
6557  //!  アクティブなタブと同じ板の開いているスレッドクリックイベント  //!  アクティブなタブと同じ板の開いているスレッドクリックイベント
6558  procedure TGikoForm.SameBoardThreadSubItemOnClick(Sender: TObject);  procedure TGikoForm.SameBoardThreadSubItemOnClick(Sender: TObject);
6559  var  var
6560          i, j: Integer;          i: Integer;
6561          MenuItem: TMenuItem;          MenuItem: TMenuItem;
6562  begin  begin
6563          if Sender is TMenuItem then begin          if Sender is TMenuItem then begin
6564          try          try
             j := 0;  
6565              MenuItem := TMenuItem(Sender);              MenuItem := TMenuItem(Sender);
6566              for i := 0 to BrowserTab.Tabs.Count - 1 do begin              for i := 0 to BrowserTab.Tabs.Count - 1 do begin
6567                  // 同じ板かどうか                  // 同じ板かどうか
# Line 6303  begin Line 6569  begin
6569                      TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread.ParentBoard) then begin                      TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread.ParentBoard) then begin
6570                      if FActiveContent.Thread <>                      if FActiveContent.Thread <>
6571                          TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread then begin                          TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread then begin
6572                          if (SameBoardThreadItem.Items[j] = MenuItem) then begin                          if (MenuItem.Hint = TBrowserRecord(BrowserTab.Tabs.Objects[i])
6573                              MoveToURL( TBrowserRecord(BrowserTab.Tabs.Objects[i])                                  .Thread.URL) then begin
6574                                  .Thread.URL);                              MoveToURL( MenuItem.Hint);
6575                              Exit;                              Exit;
6576                          end;                          end;
                         Inc(j);  
6577                      end;                      end;
6578                  end;                  end;
6579              end;              end;
# Line 6387  end; Line 6652  end;
6652    
6653  /// 最小化される  /// 最小化される
6654  procedure TGikoForm.OnMinimize;  procedure TGikoForm.OnMinimize;
6655    var
6656        doc: IHTMLDocument2;
6657  begin  begin
6658          if FActiveContent <> nil then begin          if FActiveContent <> nil then begin
6659                  FIsMinimize := mtMinimizing;                  FIsMinimize := mtMinimizing;
6660                  FActiveContent.Thread.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;          doc := FActiveContent.Browser.ControlInterface.Document as IHTMLDocument2;
6661            if Assigned(doc) then begin
6662                    FActiveContent.Thread.ScrollTop := (doc.body as IHTMLElement2).ScrollTop;
6663            end;
6664          end;          end;
6665  end;  end;
6666    
# Line 6586  end; Line 6856  end;
6856    
6857  procedure TGikoForm.OnResized;  procedure TGikoForm.OnResized;
6858  var  var
6859          doc                                             : Variant;          doc : IHTMLDocument2;
6860  begin  begin
   
6861          FOldFormWidth := Width;          FOldFormWidth := Width;
6862          FIsIgnoreResize := rtNone;          FIsIgnoreResize := rtNone;
6863    
# Line 6603  begin Line 6872  begin
6872                  begin                  begin
6873                          // 最小化は既に完了している (つまりタスクバーからウィンドウを復元中)                          // 最小化は既に完了している (つまりタスクバーからウィンドウを復元中)
6874                          if FActiveContent <> nil then begin                          if FActiveContent <> nil then begin
6875                                  doc := Idispatch( olevariant(FActiveContent.Browser.ControlInterface).Document) as IHTMLDocument2;                                  doc := FActiveContent.Browser.ControlInterface.Document as IHTMLDocument2;
6876                                  doc.Body.ScrollTop := FActiveContent.Thread.ScrollTop;                                  (doc.body as IHTMLElement2).ScrollTop := FActiveContent.Thread.ScrollTop;
6877                          end;                          end;
6878                          FIsMinimize := mtNone;                          FIsMinimize := mtNone;
6879                  end;                  end;
# Line 6612  begin Line 6881  begin
6881    
6882  end;  end;
6883  // *************************************************************************  // *************************************************************************
6884  //! お気に入りツリーのマウスアップイベント  //! スレッドブラウザクリックイベント
6885  // *************************************************************************  // *************************************************************************
6886  function TGikoForm.WebBrowserClick(Sender: TObject): WordBool;  function TGikoForm.WebBrowserClick(Sender: TObject): WordBool;
 const  
     LIMIT = 20;  
6887  var  var
         p : TPoint;  
6888          e: IHTMLElement;          e: IHTMLElement;
6889          AID: string;      doc : IHTMLDocument2;
         stlist : TStringList;  
         i, count: Integer;  
         body : String;  
     limited : Integer;  
6890      FOleInPlaceActiveObject: IOleInPlaceActiveObject;      FOleInPlaceActiveObject: IOleInPlaceActiveObject;
6891            p : TPoint;
6892            AID: string;
6893  begin  begin
6894    result := true;          result := true;
6895    try      if not Assigned(FActiveContent) then
6896          if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then          Exit;
6897          FOleInPlaceActiveObject := FActiveContent.Browser.ControlInterface as IOleInPlaceActiveObject;      if not Assigned(FActiveContent.Browser) then
6898          FOleInPlaceActiveObject.OnFrameWindowActivate(True);          Exit;
6899                  try  
6900                          GetCursorPos(p);          try
6901                          p.x := p.x - FActiveContent.Browser.ClientOrigin.x;                  FOleInPlaceActiveObject := FActiveContent.Browser.ControlInterface as IOleInPlaceActiveObject;
6902                          p.y := p.y - FActiveContent.Browser.ClientOrigin.y;                  FOleInPlaceActiveObject.OnFrameWindowActivate(True);
6903                          e := IHTMLDocument2(FActiveContent.Browser.Document).elementFromPoint(p.x, p.y);                  GetCursorPos(p);
6904                          if (Assigned(e)) then begin  
6905                                  if (e.className = 'date') or (e.id = 'date') then begin                  p.x := p.x - FActiveContent.Browser.ClientOrigin.x;
6906                                          AID := e.innerText;                  p.y := p.y - FActiveContent.Browser.ClientOrigin.y;
6907                                          if AnsiPos('id', AnsiLowerCase(AID)) > 0 then begin  
6908                                                  AID := Copy(AID, AnsiPos('id', AnsiLowerCase(AID)) - 1, 11);                  doc := FActiveContent.Browser.ControlInterface.Document as IHTMLDocument2;
6909                          if AnsiPos(' be:', AnsiLowerCase(AID)) > 0 then begin                  if not Assigned(doc) then
6910                                  AID := Copy(AID, 1, AnsiPos(' BE:', AnsiLowerCase(AID)) - 1)                          Exit;
6911                          end;  
6912                                          end else begin                  e := doc.elementFromPoint(p.x, p.y);
6913                                                  stlist := TStringList.Create;                  if not Assigned(e) then
6914                                                  try                          Exit;
6915                                                          stList.DelimitedText := AID;  
6916                                                          AID := '';                  if (e.className = 'date') or (e.id = 'date') then begin
6917                                                          for i := 0 to stList.Count - 1 do                          AID := GikoSys.ExtructResID(e.innerText);
6918                                                                  if Length(WideString(stList[i])) = 8 then begin              ShowSameIDAncher(AID);
                                                                         if GikoSys.NotDateorTimeString(stList[i]) then begin  
                                                                                 AID := stList[i];  
                                                                                 break;  
                                                                         end;  
                                                                 end;  
                                                 finally  
                                                         stList.Free;  
                                                 end;  
                                         end;  
                     count := GikoSys.GetSameIDResCount(AID, FActiveContent.Thread);  
                     limited := LIMIT;  
                     if count > LIMIT then begin  
                         if (GikoUtil.MsgBox(Handle,  
                                 IntToStr(LIMIT) + '個以上ありますが、すべて表示しますか?',  
                                 'IDポップアップ警告',  
                                                                 MB_YESNO or MB_ICONQUESTION) = ID_YES) then begin  
                             limited := -1;  
                         end  
                     end;  
                                         body := GikoSys.GetSameIDResAnchor(AID, FActiveContent.Thread, limited);  
                                         FActiveContent.IDAnchorPopup(body);  
                                 end;  
                         end;  
                 except  
6919                  end;                  end;
6920    except          except
6921    end;          end;
6922  end;  end;
6923    procedure TGikoForm.ShowSameIDAncher(const AID: String);
6924    const
6925        LIMIT = 20;
6926    var
6927            numbers : TStringList;
6928        limited : Integer;
6929    begin
6930        numbers := TStringList.Create;
6931        try
6932    
6933            GikoSys.GetSameIDRes(AID, FActiveContent.Thread, numbers);
6934            limited := LIMIT;
6935            if not (GikoSys.Setting.LimitResCountMessage) then begin
6936                limited := -1;
6937            end else if (numbers.Count > LIMIT) then begin
6938                if (GikoUtil.MsgBox(Handle,
6939                        IntToStr(LIMIT) + '個以上ありますが、すべて表示しますか?',
6940                        'IDポップアップ警告',
6941                        MB_YESNO or MB_ICONQUESTION) = ID_YES) then begin
6942                    limited := -1;
6943                end
6944            end;
6945            FActiveContent.IDAnchorPopup(
6946                GikoSys.CreateResAnchor(numbers, FActiveContent.Thread, limited));
6947        finally
6948            numbers.Free;
6949        end;
6950    end;
6951  //スレッド一覧を最大化してフォーカスを当てる  //スレッド一覧を最大化してフォーカスを当てる
6952  procedure TGikoForm.SelectTimerTimer(Sender: TObject);  procedure TGikoForm.SelectTimerTimer(Sender: TObject);
6953  begin  begin
# Line 7067  end; Line 7334  end;
7334  //このレスあぼ〜ん  //このレスあぼ〜ん
7335  procedure TGikoForm.IndividualAbon(Atag, Atype : Integer);  procedure TGikoForm.IndividualAbon(Atag, Atype : Integer);
7336  var  var
7337          ThreadItem      : TThreadItem;      doc : IHTMLDocument2;
7338          ReadList                : TStringList;          ThreadItem : TThreadItem;
7339          wordCount               : TWordCount;          ReadList : TStringList;
7340            wordCount : TWordCount;
7341  begin  begin
7342          ThreadItem      := GetActiveContent(True);      if not Assigned(FActiveContent) then
7343          ReadList                := TStringList.Create;          Exit;
7344          wordCount               := TWordCount.Create;      doc := FActiveContent.Browser.ControlInterface.Document as IHTMLDocument2;
7345        if not Assigned(doc) then
7346            Exit;
7347    
7348            ThreadItem := GetActiveContent(True);
7349            ReadList := TStringList.Create;
7350            wordCount := TWordCount.Create;
7351          try          try
7352                  ThreadItem.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;                  ThreadItem.ScrollTop := (doc.body as IHTMLElement2).ScrollTop;
7353  {$IFDEF SPAM_FILTER_ENABLED}  {$IFDEF SPAM_FILTER_ENABLED}
7354                  // スパムに設定                  // スパムに設定
7355                  ReadList.LoadFromFile( ThreadItem.GetThreadFileName );                  ReadList.LoadFromFile( ThreadItem.GetThreadFileName );
# Line 7093  begin Line 7367  begin
7367          if ThreadItem <> nil then          if ThreadItem <> nil then
7368                  InsertBrowserTab( ThreadItem, True );                  InsertBrowserTab( ThreadItem, True );
7369  end;  end;
7370    //同一IDをNGワードに登録
7371    procedure TGikoForm.AddIDtoNGWord(invisible : boolean);
7372    var
7373        doc : IHTMLDocument2;
7374            ThreadItem : TThreadItem;
7375            No : Integer;
7376    {$IFDEF SPAM_FILTER_ENABLED}
7377            body : TStringList;
7378            ReadList                : TStringList;
7379            wordCount               : TWordCount;
7380    {$ENDIF}
7381        id, dateStr: String;
7382    begin
7383            No := KokoPopupMenu.Tag;
7384            if No = 0 then Exit;
7385            ThreadItem := GikoForm.KokoPopupThreadItem;
7386            if ThreadItem = nil then Exit;
7387    
7388        id := GikoSys.GetResID(No, ThreadItem);
7389        if (id <> '') and (not IsNoValidID(id)) then begin
7390            // コメントとして、スレッド名と今日の日付を追加
7391            DateTimeToString(dateStr, 'yyyymmdd', Now);
7392            id := id + #9'>>add ' + dateStr + ',' + ThreadItem.Title;
7393            if (GikoSys.FAbon.AddToken(id, invisible)) then begin
7394                GikoSys.FAbon.ReLoadFromNGwordFile;
7395                FActiveContent.Repaint := True;
7396            end;
7397        end else begin
7398            ShowMessage('IDを取得できませんでした。');
7399        end;
7400    {$IFDEF SPAM_FILTER_ENABLED}
7401        body := TStringList.Create;
7402        try
7403            GikoSys.GetSameIDRes(id, ThreadItem, body);
7404            ReadList                := TStringList.Create;
7405            wordCount               := TWordCount.Create;
7406            try
7407                // スパムに設定
7408                ReadList.LoadFromFile( ThreadItem.GetThreadFileName );
7409                for i := 0 to body.Count - 1 do begin
7410                    GikoSys.SpamCountWord( ReadList[ i ], wordCount );
7411                    GikoSys.SpamForget( wordCount, False ); // ハムを解除
7412                    GikoSys.SpamLearn( wordCount, True );           // スパムに設定
7413                end;
7414            finally
7415                wordCount.Free;
7416                ReadList.Free;
7417            end;
7418        finally
7419            body.Free;
7420        end;
7421    {$ENDIF}
7422        if (FActiveContent.Repaint) then begin
7423            doc := FActiveContent.Browser.ControlInterface.Document as IHTMLDocument2;
7424    
7425            if not Assigned(doc) then
7426                Exit;
7427            ThreadItem.ScrollTop := (doc.body as IHTMLElement2).ScrollTop;
7428            if ThreadItem <> nil then
7429                InsertBrowserTab( ThreadItem, True );
7430        end;
7431    end;
7432    
7433  //同一IDのあぼ〜ん  //同一IDのあぼ〜ん
7434  procedure TGikoForm.IndividualAbonID(Atype : Integer);  procedure TGikoForm.IndividualAbonID(Atype : Integer);
# Line 7105  var Line 7441  var
7441  begin  begin
7442          No := KokoPopupMenu.Tag;          No := KokoPopupMenu.Tag;
7443          if No = 0 then Exit;          if No = 0 then Exit;
7444          ThreadItem := GetActiveContent(True);          ThreadItem := GikoForm.KokoPopupThreadItem;
7445          if ThreadItem = nil then Exit;          if ThreadItem = nil then Exit;
7446          body := TStringList.Create;          body := TStringList.Create;
7447          try          try
# Line 7114  begin Line 7450  begin
7450                  ReadList                := TStringList.Create;                  ReadList                := TStringList.Create;
7451                  wordCount               := TWordCount.Create;                  wordCount               := TWordCount.Create;
7452                  try                  try
7453                          ThreadItem.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;                          ThreadItem.ScrollTop := FActiveContent.Browser.OleObject.Document.Body.ScrollTop;
7454  {$IFDEF SPAM_FILTER_ENABLED}  {$IFDEF SPAM_FILTER_ENABLED}
7455                          // スパムに設定                          // スパムに設定
7456                          ReadList.LoadFromFile( ThreadItem.GetThreadFileName );                          ReadList.LoadFromFile( ThreadItem.GetThreadFileName );
# Line 7144  end; Line 7480  end;
7480  procedure TGikoForm.KokoPopupMenuPopup(Sender: TObject);  procedure TGikoForm.KokoPopupMenuPopup(Sender: TObject);
7481  var  var
7482          firstElement: IHTMLElement;          firstElement: IHTMLElement;
7483          document: IHTMLDocument2;          doc: IHTMLDocument2;
7484  begin  begin
7485          document := FActiveContent.Browser.Document as IHTMLDocument2;      try
7486          if Assigned(document) then          doc := FActiveContent.Browser.ControlInterface.Document as IHTMLDocument2;
7487                  firstElement := document.all.item('idSearch', 0) as IHTMLElement;              if Assigned(doc) then
7488                  if Assigned(firstElement) then                      firstElement := doc.all.item('idSearch', 0) as IHTMLElement;
7489                          if firstElement.style.visibility <> 'hidden' then                  if Assigned(firstElement) then
7490                                  firstElement.style.visibility := 'hidden';                          if firstElement.style.visibility <> 'hidden' then
7491                                    firstElement.style.visibility := 'hidden';
7492        except
7493        end;
7494  end;  end;
7495    
7496  procedure TGikoForm.RepaintAllTabsBrowser();  procedure TGikoForm.RepaintAllTabsBrowser();
# Line 7263  begin Line 7602  begin
7602                                  end;                                  end;
7603                          end;                          end;
7604                  end;                  end;
7605          end;          end else begin
7606            // ExplorerのD&Dを受けるとの非アクティブ
7607            if Msg.message = WM_DROPFILES then begin
7608                AcceptDropFiles(Msg);
7609                Handled := True;
7610            end;
7611        end;
7612  end;  end;
7613  // *************************************************************************  // *************************************************************************
7614  //! アプリケーションがアクティブでなくなったときのイベント  //! アプリケーションがアクティブでなくなったときのイベント
# Line 7328  begin Line 7673  begin
7673          BrowserNullTab.Browser.Navigate(BLANK_HTML);          BrowserNullTab.Browser.Navigate(BLANK_HTML);
7674    
7675          FBrowsers := TList.Create;          FBrowsers := TList.Create;
7676    
7677          for i := 0 to count -1 do begin          for i := 0 to count -1 do begin
7678                  FBrowsers.Add(TWebBrowser.Create(BrowserPanel));                  FBrowsers.Add(TWebBrowser.Create(BrowserPanel));
7679                  newBrowser := FBrowsers[FBrowsers.Count - 1];                  newBrowser := FBrowsers[FBrowsers.Count - 1];
# Line 7343  begin Line 7689  begin
7689                  newBrowser.OnStatusTextChange   := BrowserStatusTextChange;                  newBrowser.OnStatusTextChange   := BrowserStatusTextChange;
7690                  newBrowser.Navigate(BLANK_HTML);                  newBrowser.Navigate(BLANK_HTML);
7691                  ShowWindow(newBrowser.Handle, SW_HIDE);                  ShowWindow(newBrowser.Handle, SW_HIDE);
7692            GikoSys.ShowRefCount('Browser' + IntToStr(i), newBrowser.ControlInterface);
7693            GikoSys.ShowRefCount('Document' + IntToStr(i), newBrowser.ControlInterface.Document);
7694          end;          end;
7695          BrowserNullTab.Browser.BringToFront;          BrowserNullTab.Browser.BringToFront;
7696          ShowWindow(BrowserNullTab.Browser.Handle, SW_SHOW);          ShowWindow(BrowserNullTab.Browser.Handle, SW_SHOW);
# Line 7516  begin Line 7864  begin
7864  end;  end;
7865    
7866  procedure TGikoForm.TaskTrayIconMessage(var Msg: TMsg);  procedure TGikoForm.TaskTrayIconMessage(var Msg: TMsg);
7867    var
7868        p: TPoint;
7869  begin  begin
7870      //  左クリックなら復元する      //  左クリックなら復元する
7871      if  (Msg.wParam = WM_LBUTTONUP) then  begin      if  (Msg.wParam = WM_LBUTTONUP) then  begin
7872          UnStoredTaskTray;          UnStoredTaskTray;
7873        end else if (Msg.wParam=WM_RBUTTONUP) then begin
7874            // 右クリックなら終了する
7875            GetCursorPos ( p );
7876            SetForegroundWindow ( Self.Handle );
7877            TaskTrayPopupMenu.Popup ( p.X, p.Y );
7878      end;      end;
7879  end;  end;
7880  //! タスクトレイにアイコン登録&フォーム隠し  //! タスクトレイにアイコン登録&フォーム隠し
# Line 7584  begin Line 7939  begin
7939          FResPopupBrowser := TResPopupBrowser.Create(BrowserPanel);          FResPopupBrowser := TResPopupBrowser.Create(BrowserPanel);
7940      end;      end;
7941  end;  end;
7942    //! ListViewのD&D受け取り
7943    procedure TGikoForm.AcceptDropFiles(var Msg: TMsg);
7944    var
7945        FileName: Array[0..MAX_PATH] of Char;
7946        Cnt, K: Integer;
7947        Board: TBoard;
7948        LogFolder: String;
7949        datList: TStringList;
7950    begin
7951        // 表示しているの板のとき以外は拒否
7952        if GetActiveList is TBoard then begin
7953            Board := TBoard(GetActiveList);
7954            if MsgBox(Handle, Board.Title
7955                + ' 板に入れていいですか?', 'ギコナビ', MB_YESNO or MB_ICONQUESTION) = IDYES       then begin
7956                // 板の時は、ログフォルダにコピーしてはぐれログ対応と同じ処理?
7957                datList := TStringList.Create;
7958                try
7959                    Cnt := DragQueryFile(Msg.WParam, $FFFFFFFF, FileName, SizeOf(FileName));
7960                    for K := 0 to Cnt - 1 do begin
7961                        DragQueryFile(Msg.WParam, K, FileName, SizeOf(FileName));
7962                        // FileNameにdropされたファイル名が入っているので、ここで何らかの処理をする。たとえば次の行
7963                        // ファイルのチェック
7964                        if (isValidFile(FileName)) then begin
7965                            LogFolder := ExtractFilePath(Board.FilePath);
7966                            if (FileExists( LogFolder + ExtractFileName(FileName))) then begin
7967                                GikoUtil.MsgBox(Handle, LogFolder + 'に' + ExtractFileName(FileName) + 'が既に存在します。', 'エラー', MB_ICONSTOP or MB_OK);
7968                            end else begin
7969                                if (not DirectoryExists(LogFolder)) then begin
7970                                    if (not GikoSys.ForceDirectoriesEx(LogFolder) ) then begin
7971                                        GikoUtil.MsgBox(Handle, LogFolder + 'の生成に失敗しました。', 'エラー', MB_ICONSTOP or MB_OK);
7972                                    end;
7973                                end;
7974                                if (not Windows.CopyFile(FileName,  PChar(LogFolder + ExtractFileName(FileName)), true)) then begin
7975                                    GikoUtil.MsgBox(Handle, FileName + 'のコピーに失敗しました。', 'エラー', MB_ICONSTOP or MB_OK);
7976                                end else begin
7977                                    datList.Add(ExtractFileName(FileName));
7978                                end;
7979                            end;
7980                        end;
7981                    end;
7982                    DragFinish(Msg.WParam);
7983                    if (datList.Count > 0) then begin
7984                        GikoSys.AddOutofIndexDat(Board, datList, False);
7985                        ShowMessage(IntToStr(datList.Count) + '個のdatファイルがコピーされました。' );
7986                            if GikoForm.TreeView.Visible then begin
7987                                    GikoForm.TreeView.Refresh;
7988                        end;
7989                                if GikoForm.ListView.Visible then begin
7990                                    UpdateListView();
7991                        end;
7992                    end else begin
7993                        ShowMessage('一つもコピーされませんでした。' );
7994                    end;
7995                finally
7996                    datList.Free;
7997                end;
7998    
7999            end;
8000        end else begin
8001            ShowMessage('板を表示してください。');
8002        end;
8003    end;
8004    procedure TGikoForm.UpdateListView();
8005    begin
8006        //ListViewでこのスレが含まれる板を表示しているときの更新処理
8007        if (ActiveList <> nil) and (ActiveList is TBoard) then begin
8008            TBoard(ActiveList).LogThreadCount := TBoard(ActiveList).GetLogThreadCount;
8009            TBoard(ActiveList).NewThreadCount := TBoard(ActiveList).GetNewThreadCount;
8010            TBoard(ActiveList).UserThreadCount:= TBoard(ActiveList).GetUserThreadCount;
8011            //ListViewのアイテムの個数も更新
8012            case GikoForm.ViewType of
8013                gvtAll: ListView.Items.Count := TBoard(ActiveList).Count;
8014                gvtLog: ListView.Items.Count := TBoard(ActiveList).LogThreadCount;
8015                gvtNew: ListView.Items.Count := TBoard(ActiveList).NewThreadCount;
8016                gvtArch: ListView.Items.Count := TBoard(ActiveList).ArchiveThreadCount;
8017                gvtLive: ListView.Items.Count := TBoard(ActiveList).LiveThreadCount;
8018                gvtUser: ListView.Items.Count := TBoard(ActiveList).UserThreadCount;
8019            end;
8020        end;
8021        ListView.Refresh;
8022    end;
8023    //! ファイルチェック
8024    function TGikoForm.isValidFile(FileName: String) : boolean;
8025    var
8026        dt: TDateTime;
8027    begin
8028        Result := True;
8029        // 存在するか、拡張子dat、ファイル名
8030        if ( not FileExists(FileName) ) then begin
8031            Result := False;
8032            GikoUtil.MsgBox(Handle, FileName + 'は存在しません。', 'エラー', MB_ICONSTOP or MB_OK);
8033        end else if (ExtractFileExt(ExtractFileName(FileName)) <> '.dat' ) then begin
8034            Result := False;
8035            GikoUtil.MsgBox(Handle, ExtractFileName(FileName) + 'の拡張子が".dat"でありません。', 'エラー', MB_ICONSTOP or MB_OK);
8036        end else begin
8037            // ログファイルの拡張子をはずしたものがスレ作成日時
8038            try
8039                dt := GikoSys.GetCreateDateFromName(ExtractFileName(FileName));
8040                if ((UnixToDateTime(ZERO_DATE) + OffsetFromUTC) = dt) then begin
8041                    Result := False;
8042                    GikoUtil.MsgBox(Handle, ExtractFileName(FileName) + 'のファイル名が不正です。', 'エラー', MB_ICONSTOP or MB_OK);
8043                end;
8044            except
8045                Result := False;
8046                GikoUtil.MsgBox(Handle, ExtractFileName(FileName) + 'のファイル名が不正です。', 'エラー', MB_ICONSTOP or MB_OK);
8047            end;
8048        end;
8049    end;
8050    
8051    procedure TGikoForm.ResPopupClearTimerTimer(Sender: TObject);
8052    begin
8053        ResPopupClearTimer.Enabled := False;
8054        if ResPopupClearTimer.Tag = 0 then begin
8055            FResPopupBrowser.Clear;
8056        end else begin
8057            FResPopupBrowser.CurrentBrowser.ChildClear;
8058        end;
8059    end;
8060    //! アイコン読み込み
8061    procedure TGikoForm.LoadIcon();
8062    const
8063        ICONI6 = 'icon16.bmp';
8064        ICON32 = 'icon32.bmp';
8065        ICONSTAT  = 'state_icon.bmp';
8066        ICONMES = 'message_icon.bmp';
8067        ICONADD = 'address_icon.bmp';
8068        ICONITEM = 'item_icon.bmp';
8069        ICONTOOL = 'hottoolbar_icon.bmp';
8070    begin
8071        if FileExists(GikoSys.Setting.GetAppDir + ICONI6) then begin
8072            ItemIcon16.Clear;
8073            ItemIcon16.FileLoad(rtBitmap,
8074                GikoSys.Setting.GetAppDir + ICONI6, clPurple);
8075        end;
8076        if FileExists(GikoSys.Setting.GetAppDir + ICON32) then begin
8077            ItemIcon32.Clear;
8078            ItemIcon32.FileLoad(rtBitmap,
8079                GikoSys.Setting.GetAppDir + ICON32, clPurple);
8080        end;
8081        if FileExists(GikoSys.Setting.GetAppDir + ICONSTAT) then begin
8082            StateIconImageList.Clear;
8083            StateIconImageList.FileLoad(rtBitmap,
8084                GikoSys.Setting.GetAppDir + ICONSTAT, clPurple);
8085        end;
8086        if FileExists(GikoSys.Setting.GetAppDir + ICONMES) then begin
8087            MessageImageList.Clear;
8088            MessageImageList.FileLoad(rtBitmap,
8089                GikoSys.Setting.GetAppDir + ICONMES, clPurple);
8090        end;
8091        if FileExists(GikoSys.Setting.GetAppDir + ICONADD) then begin
8092            AddressImageList.Clear;
8093            AddressImageList.FileLoad(rtBitmap,
8094                GikoSys.Setting.GetAppDir + ICONADD, clPurple);
8095        end;
8096        if FileExists(GikoSys.Setting.GetAppDir + ICONITEM) then begin
8097            ItemImageList.Clear;
8098            ItemImageList.FileLoad(rtBitmap,
8099                GikoSys.Setting.GetAppDir + ICONITEM, clPurple);
8100        end;
8101        if FileExists(GikoSys.Setting.GetAppDir + ICONTOOL) then begin
8102            HotToobarImageList.Clear;
8103            HotToobarImageList.FileLoad(rtBitmap,
8104                GikoSys.Setting.GetAppDir + ICONTOOL, clPurple);
8105        end;
8106    end;
8107    //! ポップアップメニュー読み込み
8108    procedure TGikoForm.LoadPopupMenu();
8109    begin
8110    
8111    
8112    end;
8113    
8114  initialization  initialization
8115                                  OleInitialize(nil);                                  OleInitialize(nil);
8116  finalization  finalization
8117                                  OleUninitialize;                                  OleUninitialize;
8118    
8119    
8120  end.  end.

Legend:
Removed from v.1.638.2.2  
changed lines
  Added in v.1.702

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26