OSDN Git Service

ダウンロード中の終了で、クラッシュする不具合対応(eggcakeさんありがとう)
[gikonavigoeson/gikonavi.git] / Giko.pas
index 9573136..12e89c3 100644 (file)
--- a/Giko.pas
+++ b/Giko.pas
@@ -24,7 +24,8 @@ uses
 const
        NGWORDNAME_PANEL = 3;
        THREADSIZE_PANEL = 2;
-       
+    USER_RESPOPUPCLEAR         = WM_USER + 2005;       ///< wParam : TWebBrowser
+       
 type
 
        TToolBarSettingSenderType = (tssNone, tssMain, tssList, tssBrowser);
@@ -419,6 +420,10 @@ type
     N80: TMenuItem;
     SameBoardThreadItem: TMenuItem;
     N81: TMenuItem;
+    N82: TMenuItem;
+    IDNG1: TMenuItem;
+    IDNG2: TMenuItem;
+    ResPopupClearTimer: TTimer;
                                procedure FormCreate(Sender: TObject);
                procedure FormDestroy(Sender: TObject);
                procedure BrowserStatusTextChange(Sender: TObject;
@@ -555,6 +560,7 @@ type
     procedure GetResURLMenuClick(Sender: TObject);
     procedure MainCoolBarContextPopup(Sender: TObject; MousePos: TPoint;
       var Handled: Boolean);
+    procedure ResPopupClearTimerTimer(Sender: TObject);
        private
                { Private \90é\8c¾ }
                FEnabledCloseButton: Boolean;
@@ -686,13 +692,16 @@ type
         procedure SameBoardThreadSubItemOnClick(Sender: TObject);
         //! \83|\83b\83v\83A\83b\83v\83u\83\89\83E\83U\8dì\90¬
         procedure CreateResPopupBrowser;
+        //! \83t\83@\83C\83\8b\83`\83F\83b\83N
+        function isValidFile(FileName: String) : boolean;
+        //! ListView\82ÌD&D\8eó\82¯\8eæ\82è
+        procedure AcceptDropFiles(var Msg: TMsg);
        protected
                procedure CreateParams(var Params: TCreateParams); override;
                procedure WndProc(var Message: TMessage); override;
                procedure WMSetCursor(var Message: TWMSetCursor); message WM_SETCURSOR;
                procedure WMSettingChange(var Message: TWMWinIniChange); message WM_SETTINGCHANGE;
                procedure WMCopyData(var Message: TWMCopyData); message WM_COPYDATA;
-
        public
                { Public \90é\8c¾ }
                LastRoundTime: TDateTime;
@@ -756,6 +765,8 @@ type
                procedure IndividualAbonID(Atype : Integer);
                //\82±\82Ì\83\8c\83X\82 \82Ú\81`\82ñ
                procedure IndividualAbon(Atag, Atype : Integer);
+        //\93¯\88êID\82ðNG\83\8f\81[\83h\82É\93o\98^
+        procedure AddIDtoNGWord(invisible : boolean);
                //\83u\83\89\83E\83U\82Ì\8dÄ\95`\89æ true:\91S\82Ä\82Ì\83^\83u false:\83A\83N\83e\83B\83u\82È\83^\83u\82Ì\82Ý
                procedure RepaintAllTabsBrowser();
                //\83\8a\83\93\83N\83o\81[\90Ý\92è
@@ -1041,6 +1052,7 @@ begin
                BrowserTab.Font.Style := [fsBold];
        if GikoSys.Setting.BrowserTabFontItalic then
                BrowserTab.Font.Style := GikoForm.BrowserTab.Font.Style + [fsItalic];
+
        BrowserTab.DoubleBuffered := True;
        FDragWFirst := false;
        SetContent(BrowserNullTab);                                                                                                     //\83u\83\89\83E\83U\82ð\8bó\94\92\95\\8e¦
@@ -1278,22 +1290,14 @@ begin
        dummy1.Caption  := ItemReservPMenu.Caption;
        dummy1.Hint     := ItemReservPMenu.Hint;
 
+    // \83}\83E\83X\83W\83F\83X\83`\83\83\81[
+    MouseGesture := TMouseGesture.Create;
+
 {$IFDEF SPAM_FILTER_ENABLED}
        // \83X\83p\83\80\83t\83B\83\8b\83^\8aw\8fK\97\9a\97ð
        GikoSys.Bayesian.LoadFromFile( GikoSys.Setting.GetSpamFilterFileName );
 {$ENDIF}
 
-       // \83}\83E\83X\83W\83F\83X\83`\83\83\81[
-       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 );
-
        //2ch\8c¾\8cê\93Ç\82Ý\8fo\82µ
        GikoSys.SetGikoMessage;
 
@@ -1312,6 +1316,20 @@ begin
 
     //\92u\8a·\90Ý\92è\83t\83@\83C\83\8b\82Ì\93Ç\82Ý\8d\9e\82Ý
     ReplaceDM.LoadFromFile(GikoSys.GetReplaceFileName);
+
+    //\83\8c\83X\83|\83b\83v\83A\83b\83v\8fÁ\8b\8e\83^\83C\83}\81[
+    ResPopupClearTimer.Interval := GikoSys.Setting.RespopupWait;
+
+    // D&D\82ð\8eó\82¯\8eæ\82é
+    DragAcceptFiles(ListView.Handle, True);
+
+    // \8f\89\8aú\89»\82É\8e¸\94s\82µ\82½\83\82\83W\83\85\81[\83\8b\83`\83F\83b\83N
+    if (FavoriteDM.AbEnd) then begin
+        GikoUtil.MsgBox(Self.Handle, '\82¨\8bC\82É\93ü\82è\82Ì\8f\89\8aú\89»\82É\8e¸\94s\82µ\82Ü\82µ\82½\81B\83M\83R\83i\83r\82ð\8fI\97¹\82µ\82Ü\82·\81B',
+            '\8f\89\8aú\89»\88Ù\8fí');
+        Self.Close;
+    end;
+
 end;
 
 // CoolBar \82Ì\90Ý\92è\82ð\95Ï\90\94\82É\95Û\91
@@ -1431,6 +1449,8 @@ begin
 end;
 //
 procedure TGikoForm.FormShow(Sender: TObject);
+var
+       item        : TThreadItem;
 begin
        if FStartUp then begin
                ShowWindow(Application.Handle, SW_HIDE);
@@ -1464,6 +1484,20 @@ begin
             GikoDM.TabsOpenAction.Tag := 1;
                        GikoDM.TabsOpenAction.Execute;
             GikoDM.TabsOpenAction.Tag := 0;
+            if (GikoSys.Setting.LastCloseTabURL <> '') then begin
+                PostMessage( Handle, USER_DOCUMENTCOMPLETE, Integer( FActiveContent.Browser ), 0 );
+                if ( FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
+                       while (FActiveContent.Browser.ReadyState <> READYSTATE_COMPLETE) and
+                               (FActiveContent.Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin
+                               Application.ProcessMessages;
+                    end;
+                       end;
+                item := BBSsFindThreadFromURL( GikoSys.Setting.LastCloseTabURL );
+                if (item <> nil) and (item.IsLogFile) then begin
+                    OpenThreadItem(item, item.URL);
+                end;
+                GikoSys.Setting.LastCloseTabURL := '';
+            end;
                end;
 
         //ActionList\82ÌGroupIndex\82ð\8c³\82É\96ß\82·
@@ -1484,38 +1518,51 @@ begin
                        Exit;
        end;
 
+    GikoSys.Setting.LastCloseTabURL := '';
        if GikoSys.Setting.TabAutoLoadSave then begin
                GikoDM.TabsSaveAction.Execute;
+        if (GetActiveContent <> nil) and
+            (GetActiveContent.IsLogFile) then begin
+            GikoSys.Setting.LastCloseTabURL := GetActiveContent.URL;
+        end;
        end;
 
        if (SearchDialog <> nil) then begin
                if (SearchDialog.Visible) then begin
                        SearchDialog.Close;
-                       try
-                               SearchDialog.Release;
-                       except
-                       end;
-                       SearchDialog := nil;
                end;
+        try
+            SearchDialog.Release;
+        except
+        end;
+        SearchDialog := nil;
        end;
 
        //\83X\83N\83\8a\81[\83\93\8fã\82Ì\91S\82Ä\82Ì\83t\83H\81[\83\80\82©\82ç\81AEditorForm\82ð\95Â\82\82é
     GikoDM.CloseAllEditorAction.Execute;
 
        Application.UnhookMainWindow(Hook);
+    //\83A\83v\83\8a\83P\81[\83V\83\87\83\93\8fI\97¹\82Ì\91O\82É\83_\83E\83\93\83\8d\81[\83h\83X\83\8c\83b\83h\82É\90³\8fí\8fI\97¹\82ð\91£\82·
+    FControlThread.Terminate;
        Application.Terminate;
 end;
 
 procedure TGikoForm.FormDestroy(Sender: TObject);
 var
        i                               : Integer;
-//     CoolSet: TCoolSet;
        wp                      : TWindowPlacement;
        tmpBool : Boolean;
 begin
        // \83}\83E\83X\83W\83F\83X\83`\83\83\81[\8aJ\95ú
        try
+        if GikoSys.Setting.GestureEnabled then begin
+               MouseGesture.OnGestureStart := nil;
+                   MouseGesture.OnGestureMove := nil;
+                   MouseGesture.OnGestureEnd := nil;
+        end;
+        MouseGesture.Clear;
                MouseGesture.UnHook;
+        MouseGesture.Free;
        except
        end;
        try
@@ -1572,11 +1619,14 @@ begin
        //\82¨\8bC\82É\93ü\82è\95Û\91
        try
                //FavoriteDM\82Í\8e©\93®\90\90¬\83t\83H\81[\83\80\82È\82Ì\82Å\81A\89ð\95ú\82Í\8e©\93®\93I\82É\82³\82ê\82é
-               FavoriteDM.WriteFavorite;
+        // \8f\89\8aú\89»\88Ù\8fí\8e\9e\82©\82ç\82Ì\8fI\97¹\82Å\82Í\95Û\91\82µ\82È\82¢
+        if not (FavoriteDM.AbEnd) then begin
+               FavoriteDM.WriteFavorite;
+        end;
                FavoriteDM.Clear;
        except
        end;
-       LockWindowUpdate(Self.Handle);
+       //LockWindowUpdate(Self.Handle);
        try
                //\83^\83u\83N\83\8d\81[\83Y
                tmpBool := GikoSys.Setting.ShowDialogForAllTabClose;
@@ -1648,13 +1698,14 @@ begin
         end;
 
        try
-               try
-                       FControlThread.Terminate;
-                       FControlThread.WaitFor;
-               except
-               end;
-       finally
-               FControlThread.Free;
+        try
+            FControlThread.DownloadAbort;
+            FControlThread.Terminate;
+            FControlThread.WaitFor;
+        except
+        end;
+    finally
+        FControlThread.Free;
        end;
     // \83v\83\89\83O\83C\83\93\82É\82æ\82Á\82Ä\92Ç\89Á\82³\82ê\82½\83\81\83j\83\85\81[\82ð\8aJ\95ú\82·\82é
     for i := GikoForm.PlugInMenu.Count - 1 downto 0 do begin
@@ -1684,7 +1735,6 @@ begin
                if FEvent <> nil then
                        FEvent.Free;
 
-        // TODO \83\8c\83X\83|\83b\83v\83A\83b\83v\82Ì\94j\8aü
         try
             if FResPopupBrowser <> nil then  begin
                 TOleControl(FResPopupBrowser).Parent := nil;
@@ -1700,7 +1750,7 @@ begin
                end;
        except
        end;
-       LockWindowUpdate(0);
+       //LockWindowUpdate(0);
 end;
 
 // \8ae\8f\8a\82É\82 \82é\83L\83\83\83r\83l\83b\83g\81E BBS \83\81\83j\83\85\81[\82ð\83Z\83b\83g\81^\8dX\90V
@@ -1922,10 +1972,20 @@ begin
     if FResPopupBrowser <> nil then begin
         if not(Sender is TResPopupBrowser) then begin
             if (FResPopupBrowser.Visible) then begin
-                FResPopupBrowser.Clear;
+                if ResPopupClearTimer.Interval > 0 then begin
+                    ResPopupClearTimer.Enabled := True;
+                    ResPopupClearTimer.Tag := 0;
+                end else begin
+                    FResPopupBrowser.Clear;
+                end;
             end;
         end else begin
-            TResPopupBrowser(Sender).ChildClear;
+            if ResPopupClearTimer.Interval > 0 then begin
+                ResPopupClearTimer.Enabled := True;
+                ResPopupClearTimer.Tag := 1;
+            end else begin
+                TResPopupBrowser(Sender).ChildClear;
+            end;
         end;
     end;
     cResPopup := nil;
@@ -1954,7 +2014,7 @@ begin
                PreviewTimer.Interval := GikoSys.Setting.PreviewWait;
                PreviewTimer.Enabled := True;
        end else if (Pos('about:blank', Text2) = 1) or (Pos('http://', Text2) = 1) or (Pos('mailto:', Text2) = 1) then begin
-               if Pos('mailto:', Text2) = 1 then begin
+               if (Pos('mailto:', Text2) = 1) and (GikoSys.Setting.RespopupMailTo) then begin
                        s := StringReplace(Text2, 'mailto:', '', [rfIgnoreCase]);
                        //\83M\83R\83i\83r\83X\83\8c \83p\81[\83g3\82Ì466\8e\81\82É\8a´\8eÓ
                        GetCursorPos(p);
@@ -1963,6 +2023,15 @@ begin
                        e := IHTMLDocument2(TWebBrowser(Sender).Document).elementFromPoint(p.x, p.y);
                        if (Assigned(e)) then begin
                 CreateResPopupBrowser;
+
+                if not(Sender is TResPopupBrowser) then begin
+                    if (FResPopupBrowser.Visible) then begin
+                        FResPopupBrowser.Clear;
+                    end;
+                end else begin
+                    TResPopupBrowser(Sender).ChildClear;
+                end;
+
                 cResPopup := FResPopupBrowser.CreateNewBrowser;
                                tmp2 := ZenToHan(e.Get_outerText);
                                if (GikoSys.IsNumeric(tmp2)) then begin
@@ -1970,14 +2039,24 @@ begin
                                        wkIntSt := StrToInt64(tmp2);
                                        wkIntTo := StrToInt64(tmp2);
                     cResPopup.PopupType := gptThread;
-                                       HTMLCreater.SetResPopupText(cResPopup, GetActiveContent, wkIntSt, wkIntTo, False, False);
+                                       HTMLCreater.SetResPopupText(cResPopup, GetActiveContent(true), wkIntSt, wkIntTo, False, False);
                                end else begin
                     cResPopup.PopupType := gptRaw;
                     cResPopup.Title := s;
                                end;
                        end;
                end else begin
-                       threadItem := GetActiveContent;
+            CreateResPopupBrowser;
+
+            if not(Sender is TResPopupBrowser) then begin
+                if (FResPopupBrowser.Visible) then begin
+                    FResPopupBrowser.Clear;
+                end;
+            end else begin
+                TResPopupBrowser(Sender).ChildClear;
+            end;
+
+                       threadItem := GetActiveContent(true);
                        URL := THTMLCreate.GetRespopupURL(Text2, threadItem.URL);
                        PathRec := Gikosys.Parse2chURL2(URL);
                        if (PathRec.FNoParam) then begin
@@ -2029,7 +2108,6 @@ begin
                                                wkIntSt := 1;
                                                wkIntTo := 1;
                                        end;
-                    CreateResPopupBrowser;
                     cResPopup := FResPopupBrowser.CreateNewBrowser;
                     cResPopup.PopupType := gptThread;
                                        HTMLCreater.SetResPopupText(cResPopup, threadItem, wkIntSt, wkIntTo, ATitle, PathRec.FFirst );
@@ -2037,6 +2115,8 @@ begin
                        end;
                end;
         if (cResPopup <> nil) then begin
+            ResPopupClearTimer.Enabled := False;
+
             if cResPopup.PopupType = gptRaw then begin
                 if cResPopup.Title <> '' then begin
                     cResPopup.TitlePopup;
@@ -2167,6 +2247,7 @@ var
        ARect: TRect;
 begin
        DefaultDraw := True;
+// \82È\82º\82©\96³\8fð\8c\8f\82ÅExit\82µ\82Ä\82¢\82é
        Exit;
        DefaultDraw := False;
        if (cdsSelected in State) or (cdsHot in State) then begin
@@ -2364,6 +2445,8 @@ begin
 end;
 procedure TGikoForm.DownloadMsg(Sender: TObject; Item: TDownloadItem; Msg: string; Icon: TGikoMessageIcon);
 begin
+    if csDestroying in Self.ComponentState then
+        Exit;
        AddMessageList(Msg, nil, Icon);
 end;
 // *************************************************************************
@@ -2378,6 +2461,8 @@ var
        Res : TResRec;
 begin
        try
+        if csDestroying in Self.ComponentState then
+               Exit;
                if Item.DownType = gdtBoard then
                        ATitle := Item.Board.Title
                else
@@ -2519,6 +2604,9 @@ procedure TGikoForm.WorkBegin(Sender: TObject; AWorkMode: TWorkMode; const AWork
 begin
 //     SetProgressValue(Number, 0, AWorkCountMax);
 //     ProgressBar.Visible := True;
+    if csDestroying in Self.ComponentState then
+        Exit;
+
        ProgressBar.Position := 0;
        ProgressBar.Max := AWorkCountMax;
        FDownloadTitle := AWorkTitle;
@@ -2528,6 +2616,8 @@ end;
 
 procedure TGikoForm.WorkEnd(Sender: TObject; AWorkMode: TWorkMode; Number: Integer);
 begin
+    if csDestroying in Self.ComponentState then
+        Exit;
        ProgressBar.Position := 0;
        if FDownloadMax <> 0 then
                StatusBar.Panels[1].Text := FDownloadTitle + ' - \83_\83E\83\93\83\8d\81[\83h\82ª\8a®\97¹\82µ\82Ü\82µ\82½';
@@ -2535,6 +2625,8 @@ end;
 
 procedure TGikoForm.Work(Sender: TObject; AWorkMode: TWorkMode; const AWorkCount: Integer; Number: Integer);
 begin
+    if csDestroying in Self.ComponentState then
+        Exit;
        ProgressBar.Position := AWorkCount;
 //     SetProgressValue(Number, AWorkCount);
        StatusBar.Panels[1].Text := FDownloadTitle + ' - \83_\83E\83\93\83\8d\81[\83h\92\86 (' + IntToStr(AWorkCount) + '/' + IntToStr(FDownloadMax) + ')';
@@ -2726,7 +2818,8 @@ var
 begin
        Thread := inThread;
        idx := BrowserTab.TabIndex;
-       if (FActiveContent <> nil) and
+       if  (not FStartUp) and
+        (FActiveContent <> nil) and
                (FActiveContent.Thread <> Thread.Thread) and
                (FActiveContent.Browser <> nil) and
                (Assigned(FActiveContent.Browser.Document)) then begin
@@ -2763,6 +2856,12 @@ begin
        ThreadTitle := Thread.Thread.Title;
        ThreadPTitle := Thread.Thread.ParentBoard.Title;
        //ThreadScrollTop := Thread.Thread.ScrollTop;
+    if Thread.Thread.IsLogFile then  begin
+        if not FileExists(Thread.Thread.GetThreadFileName) then begin
+            Thread.Thread.DeleteLogFile;
+        end;
+    end;
+
        ThreadIsLog := Thread.Thread.IsLogFile;
        ThreadItem := Thread.Thread;
        ThreadNewArraical :=  Thread.Thread.NewArrival;
@@ -3571,6 +3670,8 @@ begin
     end;
     BrowserTab.Tabs.BeginUpdate;
     try
+        GikoSys.Setting.LastCloseTabURL :=
+            TBrowserRecord(BrowserTab.Tabs.Objects[index]).Thread.URL;
         TBrowserRecord(BrowserTab.Tabs.Objects[index]).Free;
         if ( BrowserTab.Tabs.Count - 1 = index ) and
             ( BrowserTab.TabRect(index).Left
@@ -3778,12 +3879,17 @@ begin
                                end;
 
                                if wkIntSt <> 0 then begin
-                    if (Sender is TResPopupBrowser) then begin
-                        TResPopupBrowser(Sender).ChildClear
-                    end;
                        FActiveContent.IDAnchorPopup('');
                     MoveHisotryManager.pushItem(FActiveContent);
-                                       BrowserMovement(IntToStr(wkIntSt));
+                    if (Sender is TResPopupBrowser) then begin
+                        TResPopupBrowser(Sender).ChildClear;
+                        OpenThreadItem(
+                            GetActiveContent(true),
+                            GetActiveContent(true).URL + '&st=' +
+                                 IntToStr(wkIntSt) + '&to=' + IntToStr(wkIntSt));
+                    end else begin
+                                       BrowserMovement(IntToStr(wkIntSt));
+                    end;
                 end;
                        end;
                end else begin
@@ -4258,7 +4364,6 @@ begin
        MenuToolBar.Buttons[0].AutoSize := True;
        MainCoolBar.AutoSize := False;
        MainCoolBar.AutoSize := True;
-
        GikoSys.MenuFont(ListCoolBar.Font);
        GikoSys.MenuFont(BrowserCoolBar.Font);
 //     MenuToolBar.Font.Color := clMenuText;
@@ -4712,6 +4817,13 @@ begin
                                senderBrowser := TWebBrowser( Message.WParam );
                                BrowserDocumentComplete( senderBrowser, senderBrowser.Parent, url );
                        end;
+        USER_RESPOPUPCLEAR:
+            if (TObject(Message.WParam) is TResPopupBrowser) then begin
+                try
+                               TResPopupBrowser( Message.WParam ).Clear;
+                except
+                end;
+                       end;
                end;
 
                inherited;
@@ -4848,8 +4960,8 @@ begin
                s := CustomStringReplace(Range.text, '\81@', ' ');//\91S\8ap\8bó\94\92\82ð\94¼\8ap\8bó\94\92\82É
                s := ZenToHan(Trim(s));
                if GikoSys.IsNumeric(s) then begin
-                       Num := StrToInt64(s);
-                       ThreadItem := GetActiveContent;
+                       Num := StrToInt64Def(s, -1);
+                       ThreadItem := GetActiveContent(true);
                        if (ThreadItem <> nil) and (Num <= ThreadItem.Count)
                 and (Num > 0)then begin
                 CreateResPopupBrowser;
@@ -6087,13 +6199,16 @@ begin
        if FDragWFirst = true then
                FDragWFirst := false;
 
-    if GikoSys.Setting.ListOrientation = gloHorizontal then begin
-        if GikoSys.Setting.ListWidthState = glsMin then begin
-            GikoDM.BrowserMaxAndFocusAction.Execute;
-        end;
-    end else begin
-        if GikoSys.Setting.ListHeightState = glsMin then begin
-            GikoDM.BrowserMaxAndFocusAction.Execute;
+    // \83}\83E\83X\82Ì\92\86\83{\83^\83\93\82Å\95Â\82\82½\82Æ\82«\82É\8dÅ\91å\89»\82µ\82Ä\82µ\82Ü\82¤\82Ì\82ð\96h\82®\81@
+    if Button <> mbMiddle then begin
+        if GikoSys.Setting.ListOrientation = gloHorizontal then begin
+            if GikoSys.Setting.ListWidthState = glsMin then begin
+                GikoDM.BrowserMaxAndFocusAction.Execute;
+            end;
+        end else begin
+            if GikoSys.Setting.ListHeightState = glsMin then begin
+                GikoDM.BrowserMaxAndFocusAction.Execute;
+            end;
         end;
     end;
 end;
@@ -6590,7 +6705,7 @@ begin
 
 end;
 // *************************************************************************
-//! \82¨\8bC\82É\93ü\82è\83c\83\8a\81[\82Ì\83}\83E\83X\83A\83b\83v\83C\83x\83\93\83g
+//! \83X\83\8c\83b\83h\83u\83\89\83E\83U\83N\83\8a\83b\83N\83C\83x\83\93\83g
 // *************************************************************************
 function TGikoForm.WebBrowserClick(Sender: TObject): WordBool;
 const
@@ -6641,7 +6756,9 @@ begin
                                        end;
                     count := GikoSys.GetSameIDResCount(AID, FActiveContent.Thread);
                     limited := LIMIT;
-                    if count > LIMIT then begin
+                    if not (GikoSys.Setting.LimitResCountMessage) then begin
+                        limited := -1;
+                    end else if (count > LIMIT) then begin
                         if (GikoUtil.MsgBox(Handle,
                                 IntToStr(LIMIT) + '\8cÂ\88È\8fã\82 \82è\82Ü\82·\82ª\81A\82·\82×\82Ä\95\\8e¦\82µ\82Ü\82·\82©\81H',
                                 'ID\83|\83b\83v\83A\83b\83v\8cx\8d\90',
@@ -6934,10 +7051,11 @@ end;
 
 procedure TGikoForm.BrowserPanelResize(Sender: TObject);
 begin
-       if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
-               MoveWindow(FActiveContent.Browser.Handle, 0, 0, BrowserPanel.ClientWidth, BrowserPanel.ClientHeight, false);
-       end;
-
+    if (FIsMinimize <> mtMinimizing) then begin
+       if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
+               MoveWindow(FActiveContent.Browser.Handle, 0, 0, BrowserPanel.ClientWidth, BrowserPanel.ClientHeight, false);
+       end;
+    end;
 end;
 procedure TGikoForm.CoolBarResized(Sender: TObject; CoolBar: TCoolBar);
 var
@@ -7070,6 +7188,63 @@ begin
        if ThreadItem <> nil then
                InsertBrowserTab( ThreadItem, True );
 end;
+//\93¯\88êID\82ðNG\83\8f\81[\83h\82É\93o\98^
+procedure TGikoForm.AddIDtoNGWord(invisible : boolean);
+var
+       ThreadItem : TThreadItem;
+       No : Integer;
+{$IFDEF SPAM_FILTER_ENABLED}
+       body : TStringList;
+       ReadList                : TStringList;
+       wordCount               : TWordCount;
+{$ENDIF}
+    id, dateStr: String;
+begin
+       No := KokoPopupMenu.Tag;
+       if No = 0 then Exit;
+       ThreadItem := GetActiveContent(True);
+       if ThreadItem = nil then Exit;
+
+    id := GikoSys.GetResID(No, ThreadItem);
+    if (id <> '') and (not IsNoValidID(id)) then begin
+        // \83R\83\81\83\93\83g\82Æ\82µ\82Ä\81A\83X\83\8c\83b\83h\96¼\82Æ\8d¡\93ú\82Ì\93ú\95t\82ð\92Ç\89Á
+        DateTimeToString(dateStr, 'yyyymmdd', Now);
+        id := id + #9'>>add ' + dateStr + ',' + ThreadItem.Title;
+        if (GikoSys.FAbon.AddToken(id, invisible)) then begin
+            GikoSys.FAbon.ReLoadFromNGwordFile;
+            FActiveContent.Repaint := True;
+        end;
+    end else begin
+        ShowMessage('ID\82ð\8eæ\93¾\82Å\82«\82Ü\82¹\82ñ\82Å\82µ\82½\81B');
+    end;
+{$IFDEF SPAM_FILTER_ENABLED}
+    body := TStringList.Create;
+    try
+        GikoSys.GetSameIDRes(id, ThreadItem, body);
+        ReadList               := TStringList.Create;
+        wordCount              := TWordCount.Create;
+        try
+            // \83X\83p\83\80\82É\90Ý\92è
+            ReadList.LoadFromFile( ThreadItem.GetThreadFileName );
+            for i := 0 to body.Count - 1 do begin
+                GikoSys.SpamCountWord( ReadList[ i ], wordCount );
+                GikoSys.SpamForget( wordCount, False );        // \83n\83\80\82ð\89ð\8f\9c
+                GikoSys.SpamLearn( wordCount, True );          // \83X\83p\83\80\82É\90Ý\92è
+            end;
+        finally
+            wordCount.Free;
+            ReadList.Free;
+        end;
+    finally
+        body.Free;
+    end;
+{$ENDIF}
+    if (FActiveContent.Repaint) then begin
+        ThreadItem.ScrollTop := OleVariant(IHTMLDocument2(FActiveContent.Browser.Document)).Body.ScrollTop;
+        if ThreadItem <> nil then
+            InsertBrowserTab( ThreadItem, True );
+    end;
+end;
 
 //\93¯\88êID\82Ì\82 \82Ú\81`\82ñ
 procedure TGikoForm.IndividualAbonID(Atype : Integer);
@@ -7240,7 +7415,13 @@ begin
                                end;
                        end;
                end;
-       end;
+       end else begin
+        // Explorer\82ÌD&D\82ð\8eó\82¯\82é\82Æ\82Ì\94ñ\83A\83N\83e\83B\83u
+        if Msg.message = WM_DROPFILES then begin
+            AcceptDropFiles(Msg);
+            Handled := True;
+        end;
+    end;
 end;
 // *************************************************************************
 //! \83A\83v\83\8a\83P\81[\83V\83\87\83\93\82ª\83A\83N\83e\83B\83u\82Å\82È\82­\82È\82Á\82½\82Æ\82«\82Ì\83C\83x\83\93\83g
@@ -7561,10 +7742,110 @@ begin
         FResPopupBrowser := TResPopupBrowser.Create(BrowserPanel);
     end;
 end;
+//! ListView\82ÌD&D\8eó\82¯\8eæ\82è
+procedure TGikoForm.AcceptDropFiles(var Msg: TMsg);
+var
+    FileName: Array[0..MAX_PATH] of Char;
+    Cnt, K: Integer;
+    Board: TBoard;
+    LogFolder: String;
+    datList: TStringList;
+    p: TPoint;
+begin
+    // \95\\8e¦\82µ\82Ä\82¢\82é\82Ì\94Â\82Ì\82Æ\82«\88È\8aO\82Í\8b\91\94Û
+    if GetActiveList is TBoard then begin
+        Board := TBoard(GetActiveList);
+        if MsgBox(Handle, Board.Title
+            + ' \94Â\82É\93ü\82ê\82Ä\82¢\82¢\82Å\82·\82©\81H', '\83M\83R\83i\83r', MB_YESNO or MB_ICONQUESTION) = IDYES      then begin
+            // \94Â\82Ì\8e\9e\82Í\81A\83\8d\83O\83t\83H\83\8b\83_\82É\83R\83s\81[\82µ\82Ä\82Í\82®\82ê\83\8d\83O\91Î\89\9e\82Æ\93¯\82\8f\88\97\9d\81H
+            datList := TStringList.Create;
+            try
+                Cnt := DragQueryFile(Msg.WParam, $FFFFFFFF, FileName, SizeOf(FileName));
+                for K := 0 to Cnt - 1 do begin
+                    DragQueryFile(Msg.WParam, K, FileName, SizeOf(FileName));
+                    // FileName\82Édrop\82³\82ê\82½\83t\83@\83C\83\8b\96¼\82ª\93ü\82Á\82Ä\82¢\82é\82Ì\82Å\81A\82±\82±\82Å\89½\82ç\82©\82Ì\8f\88\97\9d\82ð\82·\82é\81B\82½\82Æ\82¦\82Î\8e\9f\82Ì\8ds
+                    // \83t\83@\83C\83\8b\82Ì\83`\83F\83b\83N
+                    if (isValidFile(FileName)) then begin
+                        LogFolder := ExtractFilePath(Board.FilePath);
+                        if (FileExists( LogFolder + ExtractFileName(FileName))) then begin
+                            GikoUtil.MsgBox(Handle, LogFolder + '\82É' + ExtractFileName(FileName) + '\82ª\8aù\82É\91\8dÝ\82µ\82Ü\82·\81B', '\83G\83\89\81[', MB_ICONSTOP or MB_OK);
+                        end else begin
+                            if (not DirectoryExists(LogFolder)) then begin
+                                if (not GikoSys.ForceDirectoriesEx(LogFolder) ) then begin
+                                    GikoUtil.MsgBox(Handle, LogFolder + '\82Ì\90\90¬\82É\8e¸\94s\82µ\82Ü\82µ\82½\81B', '\83G\83\89\81[', MB_ICONSTOP or MB_OK);
+                                end;
+                            end;
+                            if (not Windows.CopyFile(FileName,  PChar(LogFolder + ExtractFileName(FileName)), true)) then begin
+                                GikoUtil.MsgBox(Handle, FileName + '\82Ì\83R\83s\81[\82É\8e¸\94s\82µ\82Ü\82µ\82½\81B', '\83G\83\89\81[', MB_ICONSTOP or MB_OK);
+                            end else begin
+                                datList.Add(ExtractFileName(FileName));
+                            end;
+                        end;
+                    end;
+                end;
+                DragFinish(Msg.WParam);
+                if (datList.Count > 0) then begin
+                    GikoSys.AddOutofIndexDat(Board, datList, False);
+                    ShowMessage(IntToStr(datList.Count) + '\8cÂ\82Ìdat\83t\83@\83C\83\8b\82ª\83R\83s\81[\82³\82ê\82Ü\82µ\82½\81B' );
+                       if GikoForm.TreeView.Visible then
+                               GikoForm.TreeView.Refresh;
+                           if GikoForm.ListView.Visible then
+                               GikoForm.ListView.Refresh;
+                end else begin
+                    ShowMessage('\88ê\82Â\82à\83R\83s\81[\82³\82ê\82Ü\82¹\82ñ\82Å\82µ\82½\81B' );
+                end;
+            finally
+                datList.Free;
+            end;
+
+        end;
+    end else begin
+        ShowMessage('\94Â\82ð\95\\8e¦\82µ\82Ä\82­\82¾\82³\82¢\81B');
+    end;
+end;
+
+//! \83t\83@\83C\83\8b\83`\83F\83b\83N
+function TGikoForm.isValidFile(FileName: String) : boolean;
+var
+    dt: TDateTime;
+begin
+    Result := True;
+    // \91\8dÝ\82·\82é\82©\81A\8ag\92£\8eqdat\81A\83t\83@\83C\83\8b\96¼
+    if ( not FileExists(FileName) ) then begin
+        Result := False;
+        GikoUtil.MsgBox(Handle, FileName + '\82Í\91\8dÝ\82µ\82Ü\82¹\82ñ\81B', '\83G\83\89\81[', MB_ICONSTOP or MB_OK);
+    end else if (ExtractFileExt(ExtractFileName(FileName)) <> '.dat' ) then begin
+        Result := False;
+        GikoUtil.MsgBox(Handle, ExtractFileName(FileName) + '\82Ì\8ag\92£\8eq\82ª".dat"\82Å\82 \82è\82Ü\82¹\82ñ\81B', '\83G\83\89\81[', MB_ICONSTOP or MB_OK);
+    end else begin
+        // \83\8d\83O\83t\83@\83C\83\8b\82Ì\8ag\92£\8eq\82ð\82Í\82¸\82µ\82½\82à\82Ì\82ª\83X\83\8c\8dì\90¬\93ú\8e\9e
+        try
+            dt := GikoSys.GetCreateDateFromName(FileName);
+            if ((UnixToDateTime(ZERO_DATE) + OffsetFromUTC) = dt) then begin
+                Result := False;
+                GikoUtil.MsgBox(Handle, ExtractFileName(FileName) + '\82Ì\83t\83@\83C\83\8b\96¼\82ª\95s\90³\82Å\82·\81B', '\83G\83\89\81[', MB_ICONSTOP or MB_OK);
+            end;
+        except
+            Result := False;
+            GikoUtil.MsgBox(Handle, ExtractFileName(FileName) + '\82Ì\83t\83@\83C\83\8b\96¼\82ª\95s\90³\82Å\82·\81B', '\83G\83\89\81[', MB_ICONSTOP or MB_OK);
+        end;
+    end;
+end;
+
+procedure TGikoForm.ResPopupClearTimerTimer(Sender: TObject);
+begin
+    ResPopupClearTimer.Enabled := False;
+    if ResPopupClearTimer.Tag = 0 then begin
+        FResPopupBrowser.Clear;
+    end else begin
+        FResPopupBrowser.CurrentBrowser.ChildClear;
+    end;
+end;
 
 initialization
                                OleInitialize(nil);
 finalization
                                OleUninitialize;
 
+
 end.