OSDN Git Service

ローカルルール関係の基礎作り
[gikonavigoeson/gikonavi.git] / Giko.pas
index b4f0684..54c6a40 100644 (file)
--- a/Giko.pas
+++ b/Giko.pas
@@ -1105,8 +1105,11 @@ type
                { Public \90é\8c¾ }
 //             FDownload: TDownload;
                FControlThread: TThreadControl;
-               procedure MoveToURL(URL: string);
-               procedure InsertBrowserTab(ThreadItem: TThreadItem; ActiveTab: Boolean = True);
+               procedure MoveToURL(const inURL: string);
+               function InsertBrowserTab(
+                       ThreadItem      : TThreadItem;
+                       ActiveTab               : Boolean = True
+               ) : TBrowserRecord;
                procedure ReloadBBS;
                function GetHttpState: Boolean;
                procedure SetEnabledCloseButton(Enabled: Boolean);
@@ -1191,18 +1194,18 @@ type
        TBrowserRecord = class( TObject )
        private
                FBrowser        : TWebBrowser;
-               FEvent: THTMLDocumentEventSink;//\83u\83\89\83E\83U\83h\83L\83\85\83\81\83\93\83g\83C\83x\83\93\83g
+               FEvent: THTMLDocumentEventSink; //!< \83u\83\89\83E\83U\83h\83L\83\85\83\81\83\93\83g\83C\83x\83\93\83g
                FThread         : TThreadItem;
                FLastSize       : Integer;
                FRepaint        : Boolean;
- //            FOnlyHundred: Boolean;
+               FMovement       : string;                                                       //!< \83X\83N\83\8d\81[\83\8b\90æ\83A\83\93\83J\81[
        public
                destructor      Destroy; override;
                property        Browser : TWebBrowser   read FBrowser   write FBrowser;
                property        Thread  : TThreadItem   read FThread    write FThread;
                property        LastSize        : Integer               read FLastSize  write FLastSize;
                property        Repaint         : Boolean               read FRepaint   write FRepaint;
-//             property        OnlyHundred : Boolean           read FOnlyHundred write FOnlyHundred;
+               property        Movement        : string                read FMovement  write FMovement;
        end;
 
 var
@@ -2874,45 +2877,32 @@ begin
                end else begin
                        threadItem := GetActiveContent;
                        if Pos('about:blank..', Text) = 1 then begin
-                                 if(AnsiPos('http://jbbs.livedoor.jp/', threadItem.URL) <> 0) or
-                                       (AnsiPos('http://jbbs.livedoor.com/', threadItem.URL) <> 0) or
-                                       (AnsiPos('http://jbbs.shitaraba.com/', threadItem.URL) <> 0) then begin
-                                       URL := Copy(threadItem.URL, 1,  LastDelimiter('/',threadItem.URL));
-                                       Gikosys.GetPopupResNumber(Text,PathRec.FSt,PathRec.FTo);
-                                       if ( PathRec.FSt <> 0 ) and ( PathRec.FTo <> 0 ) then
-                                               buf := IntToStr(PathRec.FSt) + '-' + IntToStr(PathRec.FTo)
-                                       else if( PathRec.FSt <> 0 ) then
-                                               buf := IntToStr(PathRec.FSt);
-                               end else if AnsiPos('machi.to/bbs/', threadItem.URL) <> 0 then begin
-                                       URL := threaditem.URL;
-                                       buf := Copy(Text,AnsiPos('&st=',Text),Length(Text)-AnsiPos('&st=',Text) + 1);
+                               wkInt := LastDelimiter( '/', threadItem.URL );
+                               if Pos( '?', Copy( threadItem.URL, wkInt, MaxInt ) ) = 0 then begin
+                                       // Thread.URL \82Í PATH_INFO \93n\82µ
+                                       URL := Copy( threadItem.URL, 1,  LastDelimiter( '/', threadItem.URL ) );
+                                       wkInt := LastDelimiter( '/', Text );
+                                       if Pos( '?', Copy( Text, wkInt, MaxInt ) ) = 0 then
+                                               // Text \82à PATH_INFO \93n\82µ
+                                               URL := URL + Copy( Text, LastDelimiter( '/', Text ) + 1, MaxInt )
+                                       else
+                                               // Text \82Í QUERY_STRING \93n\82µ
+                                               URL := URL + Copy( Text, LastDelimiter( '?', Text ) + 1, MaxInt );
                                end else begin
-                                       if (AnsiPos('&', threadItem.URL) <> 0) and (AnsiPos('&', Text) = 0)then begin
-                                               URL := threadItem.URL;
-                                               buf := Copy(Text,LastDelimiter('/',Text)+1,Length(Text)-LastDelimiter('/',Text));
-                                               if AnsiPos('-', buf) <> 0 then begin
-                                                       buf2 := Copy(buf, AnsiPos('-', buf) + 1, Length(buf));
-                                                       Delete(buf, AnsiPos('-', buf), Length(buf));
-                                                       if (IsNumeric(buf)) and (IsNumeric(buf2)) then
-                                                               buf := Format('&st=%s&to=%s', [buf, buf2])
-                                                       else if (IsNumeric(buf)) then
-                                                               buf := Format('&st=%s&to=%s', [buf, buf])
-                                                       else if (IsNumeric(buf)) then
-                                                               buf := Format('&st=%s&to=%s', [buf2, buf2])
-                                                       else
-                                                               buf := '';
-                                               end else begin
-                                                       if IsNumeric(buf) then
-                                                               buf := Format('&st=%s&to=%s', [buf, buf])
-                                                       else
-                                                               buf := '';
-                                               end;
+                                       // Thread.URL \82Í QUERY_STRING \93n\82µ
+                                       URL := Copy( threadItem.URL, 1,  LastDelimiter( '?', threadItem.URL ) );
+                                       wkInt := LastDelimiter( '/', Text );
+                                       if Pos( '?', Copy( Text, wkInt, MaxInt ) ) = 0 then begin
+                                               // Text \82Í PATH_INFO \93n\82µ
+                                               // URL \82É\94Â\82Æ\83L\81[\82ª\91«\82ç\82È\82¢\82Ì\82Å Text \82©\82ç\92¸\91Õ\82·\82é
+                                               wkInt := LastDelimiter( '/', Copy( Text, 1, wkInt - 1 ) );
+                                               wkInt := LastDelimiter( '/', Copy( Text, 1, wkInt - 1 ) );
+                                               URL := Copy( URL, 1, Length( URL ) - 1 ) + Copy( Text, wkInt, MaxInt );
                                        end else begin
-                                               URL := Copy(threadItem.URL, 1,  LastDelimiter('/',threadItem.URL));
-                                               buf := Copy(Text,LastDelimiter('/',Text)+1,Length(Text)-LastDelimiter('/',Text));
+                                               // Text \82à QUERY_STRING \93n\82µ
+                                               URL := URL + Copy( Text, LastDelimiter( '?', Text ) + 1, MaxInt )
                                        end;
                                end;
-                               URL := URL + buf;
                        end else begin
                                URL := Text;
                        end;
@@ -2921,8 +2911,9 @@ begin
                        if (PathRec.FNoParam) then begin
                                PathRec.FSt := 1;
                                PathRec.FTo := 1;
-                       end else
+                       end else begin
                                Gikosys.GetPopupResNumber(URL,PathRec.FSt,PathRec.FTo);
+                       end;
                        GikoSys.ParseURI( URL, Protocol, Host, Path, Document, Port, Bookmark );
 
                        if PathRec.FDone or (not GikoSys.Is2chHost( Host )) then begin
@@ -2949,10 +2940,10 @@ begin
                                //      wkIntTo := 1;
                                //if PathRec.FFirst then
                                //      wkIntSt := 1;
-                               if PathRec.FStBegin then
-                                       wkIntSt := 1;
-                               if PathRec.FToEnd then
-                                       wkIntTo := 9999;
+                               //if PathRec.FStBegin then //http://\81`\81`\81`\81`/-50\82Æ\82¢\82¤\82Æ\82«
+                               //      wkIntSt := 1;          //
+                               //if PathRec.FToEnd then   //http://\81`\81`\81`\81`/50-\82Æ\82¢\82¤\82Æ\82«
+                               //      wkIntTo := 9999;       // \82Ç\82¿\82ç\82Ì\8fê\8d\87\82à\81AGetPopupResNumber\82Å\82¤\82Ü\82­\94Ô\8d\86\82ð\92²\90®\82·\82é\82Ì\82Å\82Ó\82æ\82¤\81B
 
                                //ATitle := ActiveFileName <> PathRec.FKey;
                                if (FActiveContent <> nil) and (FActiveContent.Thread.URL = URL) then
@@ -3468,6 +3459,7 @@ var
        s: string;
        boardPlugIn : TBoardPlugIn;
        i: Integer;
+       browserRec      : TBrowserRecord;
 begin
        try
                if Item.DownType = gdtBoard then
@@ -3509,11 +3501,15 @@ begin
                                end;
                                if GikoSys.Setting.BrowserTabVisible then begin
                                        if GetActiveContent = Item.ThreadItem then
-                                               InsertBrowserTab(Item.ThreadItem)
+                                               browserRec := InsertBrowserTab(Item.ThreadItem)
                                        else if (ListView.Selected <> nil ) and ( TObject(ListView.Selected.Data) is TThreadItem ) and ( Item.ThreadItem = TThreadItem(ListView.Selected.Data)) then
-                                               InsertBrowserTab(Item.ThreadItem, True)
+                                               browserRec := InsertBrowserTab(Item.ThreadItem, True)
                                        else
-                                               InsertBrowserTab(Item.ThreadItem, False);
+                                               browserRec := InsertBrowserTab(Item.ThreadItem, False);
+                                       if browserRec.Thread = BrowserNullTab.Thread then begin
+                                               browserRec.Movement := BrowserNullTab.Movement;
+                                               BrowserNullTab.Movement := '';
+                                       end;
                                end else begin
                                        if (GetActiveContent = Item.ThreadItem) or (FActiveContent = nil) or(FActiveContent.Browser = BrowserNullTab.Browser) then
                        InsertBrowserTab(Item.ThreadItem);
@@ -3646,14 +3642,17 @@ begin
        end;
 end;}
 
-procedure TGikoForm.InsertBrowserTab(ThreadItem: TThreadItem; ActiveTab: Boolean = True);
-
+function TGikoForm.InsertBrowserTab(
+       ThreadItem      : TThreadItem;
+       ActiveTab               : Boolean = True
+) : TBrowserRecord;
 var
-       i, j, idx: Integer;
-       favItem : TFavoriteThreadItem;
+       i, j, idx               : Integer;
+       favItem                 : TFavoriteThreadItem;
        newBrowser      : TBrowserRecord;
 begin
 
+       Result := nil;
        if Threaditem = nil then Exit;
 
        if ThreadItem.IsLogFile then begin
@@ -3672,6 +3671,7 @@ begin
                for i := 0 to BrowserTab.Tabs.Count - 1 do begin
                        if TObject(BrowserTab.Tabs.Objects[i]) is TBrowserRecord then begin
                                if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread = ThreadItem then begin
+                                       Result := TBrowserRecord( BrowserTab.Tabs.Objects[i] );
                                        if TBrowserRecord(BrowserTab.Tabs.Objects[i]).FBrowser = nil then begin
                                                for j := BrowserTab.Tabs.Count - 1 downto 0 do begin
                                                        if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FBrowser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin
@@ -3758,6 +3758,7 @@ begin
                                        BrowserTab.TabIndex := i;
                        end;
                end;
+               Result := newBrowser;
                if(ActiveTab) or (idx = -1) then begin
                        BrowserTab.OnChange(nil);
                end;
@@ -3767,6 +3768,7 @@ begin
                        BrowserNullTab.Browser := Browser;
                end;
                BrowserNullTab.thread := ThreadItem;
+               Result := BrowserNullTab;
                BrowserTab.TabIndex := -1;
                SetContent(BrowserNullTab);
        end;
@@ -3857,11 +3859,13 @@ begin
 
 
        try
+               {
                if ThreadItem.UnRead then begin
                        ThreadItem.ParentBoard.UnRead := ThreadItem.ParentBoard.UnRead - 1;
                        if ThreadItem.ParentBoard.UnRead < 0 then ThreadItem.ParentBoard.UnRead := 0;
                        TreeView.Refresh;
                end;
+        }
                if(FActiveContent <> nil) and (FActiveContent <> Thread) then begin
                        if (FActiveContent.Browser <> BrowserNullTab.Browser) then
                                ShowWindow(FActiveContent.Browser.Handle, SW_HIDE);
@@ -4004,12 +4008,16 @@ end;
 procedure TGikoForm.SetListViewType(AViewType: TGikoViewType; SelectText: string; KubetsuChk: Boolean);
 var
        Board: TBoard;
+       i: Integer;
 begin
        if ActiveList is TBoard then begin
+               for i := Length( BBSs ) - 1 downto 0 do begin
+                       BBSs[i].SelectText := SelectText;
+                       BBSs[i].KubetsuChk := KubetsuChk;
+               end;
                Board := TBoard(ActiveList);
-
-               Board.ParentCategory.ParenTBBS.SelectText := SelectText;
-               Board.ParentCategory.ParenTBBS.KubetsuChk := KubetsuChk;
+//             Board.ParentCategory.ParenTBBS.SelectText := SelectText;
+//             Board.ParentCategory.ParenTBBS.KubetsuChk := KubetsuChk;
 //             Board.SelectText := SelectText;
 //             Board.KubetsuChk := KubetsuChk;
                ViewType := AViewType;
@@ -6686,8 +6694,21 @@ begin
                         Assigned( BrowserRecord.Thread ) then begin
                        threadItem := BrowserRecord.Thread;
 
-                       if threadItem.UnRead then begin
+                       if (BrowserRecord <> nil) and (Length( BrowserRecord.Movement ) > 0) then begin
+                               if threadItem.UnRead then begin
+                                       threadItem.UnRead := False;
+                                       threadItem.ParentBoard.UnRead := ThreadItem.ParentBoard.UnRead - 1;
+                                       if threadItem.ParentBoard.UnRead < 0 then threadItem.ParentBoard.UnRead := 0;
+                                       TreeView.Refresh;
+                                       ListView.Refresh;
+                               end;
+                               BrowserMovement( BrowserRecord.Movement, BrowserRecord );
+                               BrowserRecord.Movement := '';
+                       end else if threadItem.UnRead then begin
                                threadItem.UnRead := False;
+                               threadItem.ParentBoard.UnRead := ThreadItem.ParentBoard.UnRead - 1;
+                               if threadItem.ParentBoard.UnRead < 0 then threadItem.ParentBoard.UnRead := 0;
+                               TreeView.Refresh;
                                BrowserMovement( 'new', BrowserRecord );
                                ListView.Refresh;
                        end else if threadItem.ScrollTop <> 0 then begin
@@ -7473,11 +7494,10 @@ begin
        end;
 end;
 
-procedure TGikoForm.MoveToURL(URL: string);
-
+procedure TGikoForm.MoveToURL(const inURL: string);
 var
        protocol, host, path, document, port, bookmark : string;
-       URL2, protocol2, host2, path2, document2, port2, bookmark2 : string;
+       URL, protocol2, host2, path2, document2, port2, bookmark2 : string;
        tmp1, tmp2: string;
        BBSID, BBSKey: string;
        tmpBoard, Board: TBoard;
@@ -7490,19 +7510,21 @@ var
 //     boardNode                       : TTreeNode;
        shiftDown                       : Boolean;
        ctrlDown                        : Boolean;
+       stRes, edRes    : Int64;
+       browserRec              : TBrowserRecord;
 begin
 
-       GikoSys.ParseURI( URL, protocol, host, path, document, port, bookmark );
-       GikoSys.Parse2chURL( URL, path, document, BBSID, BBSKey );
+       GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
+       GikoSys.Parse2chURL( inURL, path, document, BBSID, BBSKey );
 
 
        shiftDown       := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
        ctrlDown        := GetAsyncKeyState(VK_CONTROL) = Smallint($8001);
        if shiftDown then begin
-               GikoSys.OpenBrowser(URL, gbtUserApp);
+               GikoSys.OpenBrowser(inURL, gbtUserApp);
                Exit;
        end else if ctrlDown then begin
-               GikoSys.OpenBrowser(URL, gbtIE);
+               GikoSys.OpenBrowser(inURL, gbtIE);
                Exit;
        end;
 
@@ -7512,15 +7534,16 @@ begin
                bi := High( BoardPlugIns );
                for i := Low( BoardPlugIns ) to bi do begin
                        if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin
-                               case BoardPlugIns[ i ].AcceptURL( URL ) of
+                               case BoardPlugIns[ i ].AcceptURL( inURL ) of
                                atThread:
                                        begin
-                                               tmpThread               := TThreadItem.Create( BoardPlugIns[ i ], URL );
+                                               tmpThread               := TThreadItem.Create( BoardPlugIns[ i ], inURL );
                                                boardURL                := tmpThread.BoardPlugIn.GetBoardURL( DWORD( tmpThread ) );
                                                Board                           := BBSsFindBoardFromURL( boardURL );
                                                if Board = nil then begin
+                            //break;
                                                        // \81¦\8dì\82Á\82Ä\82à\92Ç\89Á\82·\82é\82Æ\82±\82ë\82ª\96³\82¢\82Ì\82Å\8c\83\82µ\82­\95Û\97¯
-                                                       //GikoSys.OpenBrowser(URL, gbtUserApp);
+                                                       //GikoSys.OpenBrowser(inURL, gbtUserApp);
                                                        //Exit;
                                                        {
                                                        Board := GikoSys.GetUnknownBoard( tmpThread.BoardPlugIn, boardURL );
@@ -7532,34 +7555,40 @@ begin
                                                                GikoSys.ReadSubjectFile( Board );
                                                                Exit;
                                                        end;
-                                               end;
-
-                                               ThreadItem := Board.FindThreadFromFileName( tmpThread.FileName );
-                                               if ThreadItem = nil then begin
-                                                       ThreadItem := tmpThread;
-                                                       Board.Insert( 0, ThreadItem );
-                                                       if ActiveList is TBoard then begin
-                                                               if TBoard(ActiveList) = Board then
-                                                                       ListView.Items.Count := ListView.Items.Count + 1;
-                                                       end;
-                                                       InsertBrowserTab( ThreadItem );
-                                                       DownloadContent( ThreadItem );
-                                                       Exit;
-                                               end else begin
-                                                       tmpThread.Free;
-                                                       InsertBrowserTab( ThreadItem );
-                                                       if not ThreadItem.IsLogFile then begin
+                                                       ThreadItem := Board.FindThreadFromFileName( tmpThread.FileName );
+                                                       if ThreadItem = nil then begin
+                                                               ThreadItem := tmpThread;
+                                                               Board.Insert( 0, ThreadItem );
+                                                               if ActiveList is TBoard then begin
+                                                                       if TBoard(ActiveList) = Board then
+                                                                               ListView.Items.Count := ListView.Items.Count + 1;
+                                                               end;
+                                                               GikoSys.GetPopupResNumber( inURL, stRes, edRes );
+                                                               browserRec := InsertBrowserTab( ThreadItem );
+                                                               if (browserRec <> nil) and (stRes > 0) then
+                                                                       browserRec.Movement := IntToStr( stRes );
                                                                DownloadContent( ThreadItem );
+                                                               Exit;
+                                                       end else begin
+                                                               tmpThread.Free;
+                                                               GikoSys.GetPopupResNumber( inURL, stRes, edRes );
+                                                               browserRec := InsertBrowserTab( ThreadItem );
+                                                               if ThreadItem.IsLogFile then begin
+                                                                       if (browserRec <> nil) and (stRes > 0) then
+                                                                               BrowserMovement( IntToStr( stRes ), browserRec );
+                                                               end else begin
+                                                                       if (browserRec <> nil) and (stRes > 0) then
+                                                                               browserRec.Movement := IntToStr( stRes );
+                                                                       DownloadContent( ThreadItem );
+                                                               end;
+                                                               Exit;
                                                        end;
-                                                       Exit;
                                                end;
-
-                                               //Exit;
                                        end;
 
                                atBoard:
                                        begin
-                                               tmpBoard := TBoard.Create(BoardPlugIns[ i ], URL);
+                                               tmpBoard := TBoard.Create(BoardPlugIns[ i ], inURL);
                                                Board := BBSsFindBoardFromURL( tmpBoard.URL );
                                                tmpBoard.Free;
                                                if Board <> nil then begin
@@ -7578,7 +7607,7 @@ begin
 
 
        if (Length( Trim(BBSKey) ) > 0) and (Length( Trim(BBSID) ) > 0) then begin
-               boardURL := GikoSys.Get2chThreadURL2BoardURL( URL );
+               boardURL := GikoSys.Get2chThreadURL2BoardURL( inURL );
                Board := BBSsFindBoardFromURL( boardURL );
                if Board = nil then
                        Board := BBSsFindBoardFromBBSID( BBSID );
@@ -7590,23 +7619,23 @@ begin
                end;
                if Board = nil then begin
                         // \93ü\82é\82×\82«\94Â\82ª\8c©\82Â\82©\82ç\82È\82©\82Á\82½\82Ì\82Å\81A\95\81\92Ê\82Ì\83u\83\89\83E\83U\82Å\8aJ\82­
-                        GikoSys.OpenBrowser(URL, gbtUserApp);
+                        GikoSys.OpenBrowser(inURL, gbtUserApp);
                         Exit;
                end else begin
                        // \8aO\95\94\82Ì\94Â\82È\82Ì\82É2ch\82ÌURL\82É\82³\82ê\82Ä\82µ\82Ü\82Á\82½\93z\82ð\82±\82±\82Å\8am\94F\82·\82é
-                       URL2 :=  Board.URL;
-                       GikoSys.ParseURI(URL2 , protocol2, host2, path2, document2, port2, bookmark2 );
+                       URL :=  Board.URL;
+                       GikoSys.ParseURI(URL , protocol2, host2, path2, document2, port2, bookmark2 );
                        tmp1 := Copy(host, AnsiPos('.', host) + 1, Length(host));
                        tmp2 := Copy(host2, AnsiPos('.', host2) + 1, Length(host2));
                        if ( not GikoSys.Is2chHost(tmp1)) and (tmp1 <> tmp2) then begin
-                               GikoSys.OpenBrowser(URL, gbtUserApp);
+                               GikoSys.OpenBrowser(inURL, gbtUserApp);
                                Exit;
                        end;
                end;
 
                if not Board.IsThreadDatRead then
                        GikoSys.ReadSubjectFile(Board);
-               URL := GikoSys.Get2chBrowsableThreadURL( URL );
+               URL := GikoSys.Get2chBrowsableThreadURL( inURL );
                ThreadItem := Board.FindThreadFromURL( URL );
                //\81@\89ß\8b\8e\83\8d\83O\91q\8cÉ\82©\82ç\81A\83_\83E\83\\82µ\82½\83X\83\8c\82ª\94­\8c©\82Å\82«\82È\82¢\82Ì\82Å\82±\82±\82Å\92T\82·\82æ\82¤\82É\82·\82é (2004/01/22)
                if ThreadItem = nil then begin
@@ -7619,9 +7648,9 @@ begin
                        {shiftDown      := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
                        ctrlDown        := GetAsyncKeyState(VK_CONTROL) = Smallint($8001);
                        if shiftDown then
-                               GikoSys.OpenBrowser(URL, gbtUserApp)
+                               GikoSys.OpenBrowser(URL1, gbtUserApp)
                        else if ctrlDown then
-                               GikoSys.OpenBrowser(URL, gbtIE)
+                               GikoSys.OpenBrowser(URL1, gbtIE)
                        else begin
                        }
                        ThreadItem := TThreadItem.Create( nil, URL );
@@ -7635,25 +7664,34 @@ begin
                                if TBoard(ActiveList) = Board then
                                        ListView.Items.Count := ListView.Items.Count + 1;
                        end;
-                       InsertBrowserTab(ThreadItem);
+                       GikoSys.GetPopupResNumber( inURL, stRes, edRes );
+                       browserRec := InsertBrowserTab(ThreadItem);
+                       if (browserRec <> nil) and (stRes > 0) then
+                               browserRec.Movement := IntToStr( stRes );
                        DownloadContent(ThreadItem);
                        {end;}
                end else begin
-                       if ThreadItem.IsLogFile then
-                               InsertBrowserTab(ThreadItem)
-                       else begin
+                       if ThreadItem.IsLogFile then begin
+                               GikoSys.GetPopupResNumber( inURL, stRes, edRes );
+                               browserRec := InsertBrowserTab(ThreadItem);
+                               if (browserRec <> nil) and (stRes > 0) then
+                                       browserRec.Movement := IntToStr( stRes );
+                       end else begin
                                if AnsiPos(Host, Board.URL) = 0 then
                                        ThreadItem.DownloadHost := Host
                                else
                                        ThreadItem.DownloadHost := '';
-                               InsertBrowserTab(ThreadItem);
+                               GikoSys.GetPopupResNumber( inURL, stRes, edRes );
+                               browserRec := InsertBrowserTab(ThreadItem);
+                               if (browserRec <> nil) and (stRes > 0) then
+                                       browserRec.Movement := IntToStr( stRes );
                                DownloadContent(ThreadItem);
                        end;
                end;
        end else begin
-    Board := BBSsFindBoardFromURL( URL );
+               Board := BBSsFindBoardFromURL( inURL );
     if Board = nil then begin
-                       GikoSys.OpenBrowser(URL, gbtAuto);
+                       GikoSys.OpenBrowser(inURL, gbtAuto);
     end else begin
          if FActiveBBS <> Board.ParentCategory.ParenTBBS then
         ShowBBSTree( Board.ParentCategory.ParenTBBS );
@@ -8972,9 +9010,10 @@ begin
                ModifySelectList;
        end else if Length( SelectComboBox.Text ) = 0 then
        begin
-               AllItemAction.Checked := True;
-               LogItemAction.Checked := False;
-               NewItemAction.Checked := False;
+               {* SelectComboBox.Text\82ª\8bó\82Å\82à\81A\93ü\97Í\93r\92\86\82ÅEsc\82µ\82½\82Æ\82©
+                * \8bó\82Ì\82Æ\82«\82ÉDel\83L\81[\82ð\89\9f\82µ\82½\82Æ\82©\82È\82Ì\82Å\81A\83X\83\8c\82Ì\8di\8d\9e\82Ý\82ð\88Û\8e\9d\82·\82é\81B
+                * \81i\82±\82±\82Å\82Í\89½\82à\82µ\82È\82¢\81j
+                *}
        end else begin
                // \83`\83\89\82Â\82­\82Æ\8c\99\82¾\82©\82ç\81A\88ê\89\9e\89\9f\82µ\82Ä\82 \82é\82Æ\82«\82¾\82¯\8f\88\97\9d\82·\82é
                if AllItemAction.Checked then
@@ -10095,7 +10134,12 @@ procedure TGikoForm.BrowserTabMouseUp(Sender: TObject;
 begin
        if FDragWFirst <> true then begin
                FDragWFirst := false;
-       end else if (X = FMouseDownPos.X) and (Y = FMouseDownPos.Y) then begin
+{
+       end else if (abs( X - FMouseDownPos.X ) < Mouse.DragThreshold)
+       and (abs( Y - FMouseDownPos.Y ) < Mouse.DragThreshold) then begin
+(*}
+       end else begin
+//*)
                if GikoSys.Setting.ListOrientation = gloHorizontal then begin
                        if GikoSys.Setting.ListWidthState = glsMin then begin
                                BrowserMaxAndFocusAction.Execute;
@@ -11121,12 +11165,16 @@ begin
                SelectListItem(List);
                for i := 0 to List.Count - 1 do begin
                        if TObject(List[i]) is TThreadItem then begin
-                               TThreadItem(List[i]).UnRead := false;
-                               TThreadItem(List[i]).ParentBoard.UnRead := TThreadItem(List[i]).ParentBoard.UnRead - 1;
+                               if (TThreadItem(List[i]).UnRead) then begin
+                                       TThreadItem(List[i]).UnRead := false;
+                                       TThreadItem(List[i]).ParentBoard.UnRead := TThreadItem(List[i]).ParentBoard.UnRead - 1;
+                               end;
                        end;
                end;
                if TreeView.Visible then
                        TreeView.Refresh;
+               if ListView.Visible then
+               ListView.Refresh;
        finally
                List.Free;
        end;
@@ -11142,12 +11190,16 @@ begin
                SelectListItem(List);
                for i := 0 to List.Count - 1 do begin
                        if TObject(List[i]) is TThreadItem then begin
-                               TThreadItem(List[i]).UnRead := true;
-                               TThreadItem(List[i]).ParentBoard.UnRead := TThreadItem(List[i]).ParentBoard.UnRead + 1;
+                               if (TThreadItem(List[i]).IsLogFile) and (not TThreadItem(List[i]).UnRead) then begin
+                                       TThreadItem(List[i]).UnRead := true;
+                                       TThreadItem(List[i]).ParentBoard.UnRead := TThreadItem(List[i]).ParentBoard.UnRead + 1;
+                               end;
                        end;
                end;
                if TreeView.Visible then
                        TreeView.Refresh;
+               if ListView.Visible then
+               ListView.Refresh;
        finally
                List.Free;
        end;