OSDN Git Service

ローカルルール関係の基礎作り
[gikonavigoeson/gikonavi.git] / Giko.pas
index c7e5bc9..54c6a40 100644 (file)
--- a/Giko.pas
+++ b/Giko.pas
@@ -578,6 +578,7 @@ type
     TabAutoLoadAction: TAction;
     ListColumnPopupMenu: TPopupMenu;
     JumpToNumOfResAction: TAction;
+    FavoriteTreeViewCollapseAction: TAction;
                                procedure FormCreate(Sender: TObject);
                procedure FormDestroy(Sender: TObject);
                procedure CabinetPanelHide(Sender: TObject);
@@ -929,6 +930,7 @@ type
       Column: TListColumn; Point: TPoint);
     procedure JumpToNumOfResActionExecute(Sender: TObject);
     procedure JumpToNumOfResActionUpdate(Sender: TObject);
+    procedure FavoriteTreeViewCollapseActionExecute(Sender: TObject);
        private
                { Private \90é\8c¾ }
         //RoundList : TRoundList;
@@ -1006,7 +1008,7 @@ type
                procedure WorkEnd(Sender: TObject; AWorkMode: TWorkMode; Number: Integer);
                procedure Work(Sender: TObject; AWorkMode: TWorkMode; const AWorkCount: Integer; Number: Integer);
 
-               procedure SetActiveList(Obj: TObject);
+
                procedure ListClick;
                procedure ListDoubleClick(Shift: TShiftState);
                procedure BrowserMovement(const AName: string); overload;
@@ -1088,8 +1090,6 @@ type
                function LoadTabURLs : Boolean;
                /// \83o\83\93\83h\95\9d\82ð\8dÄ\8cv\8eZ\81E\8dÄ\90Ý\92è\82·\82é
                procedure ResetBandInfo( bar : TGikoCoolBar; band : TToolBar );
-               /// ListView \82Ì\83J\83\89\83\80\95\9d\82¨\82æ\82Ñ\88Ê\92u\82Ì\95Û\91
-               procedure ActiveListColumnSave;
                /// ListView \82Ì Column \82ð\90^\82Ì\83J\83\89\83\80\82É\95Ï\8a·
                function        ActiveListTrueColumn( column : TListColumn ) : TListColumn;
                /// ListColumnPopupMenu \83A\83C\83e\83\80\82Ì\83N\83\8a\83b\83N\83C\83x\83\93\83g
@@ -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);
@@ -1126,7 +1129,7 @@ type
                function GetActiveContent: TThreadItem;
                function GetActiveList: TObject;
 
-               property ActiveList: TObject read GetActiveList write SetActiveList;
+
 //             property LastRoundTime: TDateTime read FLastRoundTime write FLastRoundTime;
 
                procedure SetListViewType(AViewType: TGikoViewType); overload;
@@ -1150,16 +1153,19 @@ type
 //             property Favorite: TFavorite read FFavorite write FFavorite;
                procedure SetToolBarPopup;
                procedure ShowFavoriteAddDialog( Item : TObject );
-        procedure FavoritesURLReplace(oldURLs: TStringList; newURLs: TStringList);
-        procedure RoundListURLReplace(oldURLs: TStringList; newURLs: TStringList);
+               procedure FavoritesURLReplace(oldURLs: TStringList; newURLs: TStringList);
+               procedure RoundListURLReplace(oldURLs: TStringList; newURLs: TStringList);
                property ListViewBackGroundColor: TColor read FListViewBackGroundColor write SetListViewBackGroundColor;
                property UseOddResOddColor : Boolean read FUseOddResOddColor write FUseOddResOddColor;
                property OddColor : TColor read FOddColor write FOddColor;
 
                function FindToolBarButton( bar : TToolBar; action : TAction ) : TToolButton;
                procedure OnPlugInMenuItem( Sender : TObject );
-                procedure TabFileURLReplace(oldURLs: TStringList; newURLs: TStringList);
-
+               procedure TabFileURLReplace(oldURLs: TStringList; newURLs: TStringList);
+               /// ListView \82Ì\83J\83\89\83\80\95\9d\82¨\82æ\82Ñ\88Ê\92u\82Ì\95Û\91¶ KuroutSetting\82©\82ç\82æ\82Ñ\82¾\82µ\82½\82¢\82Ì\82Å
+               procedure ActiveListColumnSave;
+               procedure SetActiveList(Obj: TObject);
+               property ActiveList: TObject read GetActiveList write SetActiveList;
        published
                property EnabledCloseButton: Boolean read FEnabledCloseButton write SetEnabledCloseButton;
        end;
@@ -1188,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
@@ -1260,6 +1266,7 @@ const
        USER_RESIZED            = WM_USER + 2001;
        USER_MINIMIZED                                  = WM_USER + 2002;
        USER_SETLINKBAR                                 = WM_USER + 2003;
+       USER_DOCUMENTCOMPLETE           = WM_USER + 2004;       ///< wParam : TWebBrowser
        SELECTTIME_INTERBAL                             = 110;
 
        BROWSER_COUNT           = 5;    //\83u\83\89\83E\83U\82Ì\90\94
@@ -1714,7 +1721,7 @@ begin
        //Samba24\82Ì\83t\83@\83C\83\8b\83`\83F\83b\83N
        GikoSys.SambaFileExists();
 
-        //\83^\83u\8e©\93®\93Ç\82Ý\8d\9e\82Ý (AV\94­\90\82Ì\82½\82ß\88ê\8e\9e\95\95\88ó)
+        //\82É\82¿\82á\82ñ\8cê\83t\83@\83C\83\8b\93Ç\82Ý\8fo\82µ
 end;
 
 // CoolBar \82Ì\90Ý\92è\82ð\95Ï\90\94\82É\95Û\91
@@ -1878,6 +1885,12 @@ begin
                if GikoSys.Setting.TabAutoLoadSave then begin
                        TabAutoLoadAction.Execute;
                end;
+                //\82É\82¿\82á\82ñ\8cê\88Ä\93à\83T\83|\81[\83g\8b@\94\
+                if GikoSys.Setting.GengoSupport then begin
+                //\97\\92è\92n
+                //Test\8cü\82¯
+                end;
+
                FStartUp := true;
        end;
 end;
@@ -2674,17 +2687,25 @@ begin
                                        else
                                                Item.SubItems[ idx ] := '';
 
-                               gbcLastModified:
-                                       if (ThreadItem.LastModified = ZERO_DATE)  then begin
+                               gbcRoundDate://gbcLastModified:
+                                       if (ThreadItem.RoundDate = ZERO_DATE)  then begin
                                                Item.SubItems[ idx ] := '';
                                        end else
-                                               Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', ThreadItem.LastModified);
+                                               Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', ThreadItem.RoundDate);
 
                                gbcCreated:
                                        if ThreadItem.CreateDate = ZERO_DATE then begin
                                                Item.SubItems[ idx ] := '';
                                        end else
                                                Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', ThreadItem.CreateDate);
+
+                               gbcLastModified:
+                                       if (ThreadItem.LastModified = ZERO_DATE)  then begin
+                                               Item.SubItems[ idx ] := '';
+                                       end else
+                                               Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', ThreadItem.LastModified);
+
+
                                end;
                                Inc( idx );
                        end;
@@ -2705,7 +2726,7 @@ begin
                                gbcAllCount:
                                        Item.SubItems[ idx ] := IntToStr(ThreadItem.AllResCount);
 
-                               gbcLastModified:
+                               gbcRoundDate://gbcLastModified:
                                        Item.SubItems[ idx ] := '';
 
                                gbcCreated:
@@ -2713,6 +2734,10 @@ begin
                                                Item.SubItems[ idx ] := '';
                                        end else
                                                Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', ThreadItem.CreateDate);
+
+                               gbcLastModified:
+                                       Item.SubItems[ idx ] := '';
+
                                else
                                        Item.SubItems[ idx ] := '';
                                end;
@@ -2769,7 +2794,7 @@ var
        ActiveFileName: string;
        e: IHTMLElement;
        Ext: string;
-       buf: string;
+       buf, buf2: string;
        PathRec: TPathRec;
 begin
        if not( TObject(Sender) is TWebBrowser )then
@@ -2852,30 +2877,43 @@ begin
                end else begin
                        threadItem := GetActiveContent;
                        if Pos('about:blank..', Text) = 1 then begin
-                                 if (AnsiPos('http://jbbs.livedoor.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
-                                       URL := Copy(threadItem.URL, 1,  LastDelimiter('/',threadItem.URL));
-                                       buf := Copy(Text,LastDelimiter('/',Text)+1,Length(Text)-LastDelimiter('/',Text));
+                                       // 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
+                                               // 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;
+
                        PathRec := Gikosys.Parse2chURL2(URL);
                        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
@@ -2902,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
@@ -2977,7 +3015,6 @@ procedure TGikoForm.ListViewKeyDown(Sender: TObject; var Key: Word;
        Shift: TShiftState);
 var
        pos     : TPoint;
-       rect    : TRect;
 begin
        if GetActiveList is TBoard then begin
                case Key of
@@ -3030,9 +3067,11 @@ Delphi 6 Personal 
 \90³\82µ\82¢\83J\83\89\83\80\82ª\93n\82³\82ê\82È\82¢\82½\82ß\81A\90³\82µ\82¢\83J\83\89\83\80\82É\95Ï\8a·\82µ\82Ü\82·\81B
 *}
 function       TGikoForm.ActiveListTrueColumn( column : TListColumn ) : TListColumn;
+{*
 var
        i, idx          : Integer;
        orderList       : TList;
+*}
 begin
 
        // \90³\82µ\82­\95Ï\8a·\82·\82é\95û\96@\82ª\95ª\82©\82ç\82È\82¢\82Ì\82Å\95Û\97¯
@@ -3146,6 +3185,8 @@ begin
                GikoSys.Setting.BoardSortIndex := id;
                GikoSys.Setting.BoardSortOrder := FSortOrder;
                wkBoard.CustomSort(ThreadItemSortProc);
+       end else begin
+               id := 0;
        end;
 
        ListView.Refresh;
@@ -3418,6 +3459,7 @@ var
        s: string;
        boardPlugIn : TBoardPlugIn;
        i: Integer;
+       browserRec      : TBrowserRecord;
 begin
        try
                if Item.DownType = gdtBoard then
@@ -3452,21 +3494,27 @@ begin
                                        ATitle := GikoSys.DivideStrLine(GikoSys.ReadThreadFile(Item.ThreadItem.GetThreadFileName, 1)).FTitle;
                                end;
                                for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
-                                       if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread = Item.ThreadItem then
+                                       if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread = Item.ThreadItem then begin
                                                TBrowserRecord(BrowserTab.Tabs.Objects[i]).Repaint := true;
+                                               break;
+                                       end;
                                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);
                                end;
-
+                Application.ProcessMessages;
                                if Item.State = gdsComplete then begin
                                        PlaySound('New');
                                        AddMessageList(ATitle + ' [\83X\83\8c\8eæ\93¾\8a®\97¹]', nil, gmiOK);
@@ -3594,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
@@ -3620,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
@@ -3706,6 +3758,7 @@ begin
                                        BrowserTab.TabIndex := i;
                        end;
                end;
+               Result := newBrowser;
                if(ActiveTab) or (idx = -1) then begin
                        BrowserTab.OnChange(nil);
                end;
@@ -3715,6 +3768,7 @@ begin
                        BrowserNullTab.Browser := Browser;
                end;
                BrowserNullTab.thread := ThreadItem;
+               Result := BrowserNullTab;
                BrowserTab.TabIndex := -1;
                SetContent(BrowserNullTab);
        end;
@@ -3734,7 +3788,6 @@ var
        s: string;
 //     OldCursor: TCursor;
        i: Integer;
-       url: OleVariant;
        idx: Integer;
        ThreadItem: TThreadItem;
        Thread: TBrowserRecord;
@@ -3742,6 +3795,7 @@ var
        ThreadScrollTop: Integer;
        ThreadIsLog, ThreadUnRead, ThreadNewArraical: boolean;
 begin
+//     AddMessageList('SetContent', nil, gmiWhat);
        Thread := inThread;
        idx := BrowserTab.TabIndex;
        if (FActiveContent <> nil) and
@@ -3805,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);
@@ -3842,55 +3898,21 @@ begin
                        Self.Caption := CAPTION_NAME + ' - [' + ThreadTitle + ']';
                        //Thread.Repaint\82Í\81A\83X\83L\83\93\93\99\82Ì\90Ý\92è\82ð\95Ï\8dX\82µ\82½\82Æ\82«\81AThread\82ð\83_\83E\83\93\83\8d\81[\83h\82µ\82½\82Æ\82«
                        //\90V\8bK\82ÉThread\82ð\8aJ\82¢\82½\82Æ\82«\82É\90^\82É\82È\82Á\82Ä\82¢\82é\81B
-//                     if(Thread.Repaint) or (Thread.OnlyHundred <> GikoSys.OnlyAHundredRes)then begin
                        if Thread.Repaint then begin
                                //Thread.LastSize := ThreadItem.Size;
                                Thread.Repaint := false;
-                               try
-                                       Thread.Browser.OnStatusTextChange := nil;
-                                       doc := Idispatch( olevariant(Thread.Browser.ControlInterface).Document) as IHTMLDocument2;
-                                       GikoSys.CreateHTML2(doc, ThreadItem, sTitle);
-
-                       //              if (Assigned(Thread.Browser)) and (Thread.Browser <> nil) then
-                                       Thread.Browser.OnStatusTextChange := BrowserStatusTextChange;
-                                       //\82È\82º\82©\82±\82±\82Å\96¾\8e¦\93I\82ÉDocumentComplete\82ð\8cÄ\82Î\82È\82¢\82Æ\82¤\82Ü\82­\82¢\82©\82È\82¢
-                                       //\92Ç\8bL\81@200406/19
-                                       //Visible\82Ì\82Æ\82«\82µ\82©DocumentComplete\82Í\8cÄ\82Î\82ê\82È\82¢\82ç\82µ\82¢
-                                       Thread.FBrowser.OnDocumentComplete(Thread.FBrowser, Thread.FBrowser.Parent, url);
-//                                     Thread.OnlyHundred := GikoSys.OnlyAHundredRes;
-                                       Application.ProcessMessages;
-                                       //\82±\82±\82ÅApplication.ProcessMessages\82ð\8cÄ\82Ô\82±\82Æ\82É\82æ\82Á\82ÄWebBrowser\82ð\8dX\90V\82³\82¹\82é\81B
-                                       //\91\8a\82µ\82È\82¢\82Æ\88ê\89æ\96Ê\95ª\82µ\82©\95`\89æ\82Å\82«\82Ä\82È\82¢\82Ì\82Å\82»\82ê\88È\8fã\82Ì\83X\83N\83\8d\81[\83\8b\97Ê\82ð\8ew\92è\82µ\82Ä\82à\96³\8cø\82É\82È\82é
-                                       //\81@by\82à\82\82ã(2004/01/20)
-                                       try
-                                               //if (Assigned(Thread)) and (Assigned(ThreadItem))then begin
-                                                       if(Thread <> nil) and (ThreadItem <>nil) then begin
-                                                               if ThreadUnRead then
-                                                                       BrowserMovement('new', Thread)
-                                                               else if ThreadScrollTop <> 0 then begin
-                                                                       try
-                                                                               doc.Body.ScrollTop := ThreadScrollTop;
-                                                                       except
-                                                                               on E: Exception do
-                                                                                       MsgBox(Handle, E.Message, 'SetContent[ScrollTop<-]', 0);
-                                                                       end;
-                                                               end;
-                                               //      end;
-                                               end else begin
-                                                       FActiveContent := nil;
-                                                       BrowserTab.Repaint;
-                                                       Exit;
-                                               end;
-                                       except
-                                               FActiveContent := nil;
-                                               BrowserTab.Repaint;
-                                               Exit;
-                                       end;
-                               finally
-                                        //     Application.ProcessMessages;
+
+                               Thread.Browser.OnStatusTextChange := nil;
+                               doc := Idispatch( olevariant(Thread.Browser.ControlInterface).Document) as IHTMLDocument2;
+                               GikoSys.CreateHTML2(doc, ThreadItem, sTitle);
+                               Thread.Browser.OnStatusTextChange := BrowserStatusTextChange;
+                               PostMessage( Handle, USER_DOCUMENTCOMPLETE, Integer( Thread.Browser ), 0 );
+                               if ThreadItem = nil then begin
+                                       FActiveContent := nil;
+                                       BrowserTab.Repaint;
+                                       Exit;
                                end;
                        end;
-                       ThreadItem.UnRead := False;
                        ListView.Refresh;
                end;
                if (Assigned(Thread)) and (Assigned(Thread.Thread)) and (Thread <> nil) and (ThreadItem <>nil) then begin
@@ -3986,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;
@@ -6632,11 +6658,13 @@ var
        FDispHtmlDocument: DispHTMLDocument;
        BrowserRecord :TBrowserRecord;
        i :Integer;
+       doc                                     : Variant;
+       threadItem      : TThreadItem;
 begin
-//     AddMessageList('DocumentComplete', nil);
+//     AddMessageList('DocumentComplete', nil, gmiWhat);
        if TObject(Sender) is TWebBrowser then begin
+               BrowserRecord := nil;
                if TWebBrowser(Sender) <> Browser then begin
-                       BrowserRecord := nil;
                        for i := BrowserTab.Tabs.Count - 1 downto 0 do begin
                                if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Browser = TWebBrowser(Sender) then begin
                                                BrowserRecord := TBrowserRecord(BrowserTab.Tabs.Objects[i]);
@@ -6652,7 +6680,7 @@ begin
                                BrowserRecord.FEvent.OnClick := WebBrowserClick;  //\92Ç\89Á\82µ\82½OnClick\83C\83x\83\93\83g
                        end;
                end else begin
-               if GetActiveContent <> nil then begin
+                       if GetActiveContent <> nil then begin
                                FDispHtmlDocument := Idispatch(OleVariant(Browser.ControlInterface).Document) as DispHTMLDocument;
                                if FEvent <> nil then
                                        FEvent.Free;
@@ -6661,6 +6689,38 @@ begin
                                FEvent.OnClick := WebBrowserClick;  //\92Ç\89Á\82µ\82½OnClick\83C\83x\83\93\83g
                        end;
                end;
+
+               if (BrowserRecord <> nil) and
+                        Assigned( BrowserRecord.Thread ) then begin
+                       threadItem := BrowserRecord.Thread;
+
+                       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
+                               try
+                                       doc := Idispatch( OleVariant( BrowserRecord.Browser.ControlInterface ).Document ) as IHTMLDocument2;
+                                       doc.Body.ScrollTop := threadItem.ScrollTop;
+                               except
+                                       on E: Exception do
+                                               MsgBox(Handle, E.Message, 'SetContent[ScrollTop<-]', 0);
+                               end;
+                       end;
+               end;
        end;
 end;
 
@@ -7434,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;
@@ -7451,20 +7510,22 @@ 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);
-        Exit;
-    end else if ctrlDown then begin
-       GikoSys.OpenBrowser(URL, gbtIE);
-        Exit;
+       ctrlDown        := GetAsyncKeyState(VK_CONTROL) = Smallint($8001);
+       if shiftDown then begin
+               GikoSys.OpenBrowser(inURL, gbtUserApp);
+               Exit;
+       end else if ctrlDown then begin
+               GikoSys.OpenBrowser(inURL, gbtIE);
+               Exit;
        end;
 
        //===== \83v\83\89\83O\83C\83\93
@@ -7473,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 );
@@ -7493,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
@@ -7539,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 );
@@ -7551,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
@@ -7580,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 );
@@ -7596,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 );
@@ -7660,6 +7737,9 @@ begin
 end;
 
 procedure TGikoForm.WndProc(var Message: TMessage);
+var
+       senderBrowser   : TWebBrowser;
+       url                                             : OleVariant;
 begin
        try
                case Message.Msg of
@@ -7677,6 +7757,12 @@ begin
                        OnMinimized;
                USER_SETLINKBAR:
                        SetLinkBar;
+               USER_DOCUMENTCOMPLETE:
+                       if (Message.WParam <> 0) and
+                                (TObject(Message.WParam) is TWebBrowser) then begin
+                               senderBrowser := TWebBrowser( Message.WParam );
+                               BrowserDocumentComplete( senderBrowser, senderBrowser.Parent, url );
+                       end;
                end;
 
                inherited;
@@ -8593,7 +8679,7 @@ begin
                end;
        end;
        // \90Ý\92è
-       lResult := SendMessage( bar.Handle, RB_SETBANDINFO, i, Integer( pBandInfo ) );
+       lResult := SendMessage( bar.Handle, RB_SETBANDINFO, idx, Integer( pBandInfo ) );
 
 end;
 
@@ -8838,7 +8924,7 @@ procedure TGikoForm.FormMouseWheel(Sender: TObject; Shift: TShiftState;
 var
        Wnd: THandle;
        delta: Integer;
-       browserPos : TPoint;
+//     browserPos : TPoint;
 const
        ICON_SIZE = 16;
 begin
@@ -8852,31 +8938,43 @@ begin
        if (Wnd = BrowserTab.Handle) or
                 (Wnd = BrowserTab.Parent.Handle) then begin
                BrowserTab.ScrollTabs(Delta);
-       end;
-       { else begin
+       end else begin
                if FIsHandledWheel then begin
                        FIsHandledWheel := False;
                        Handled := False;
                end else begin
                        FIsHandledWheel := True;
+                       if (Wnd = TreeView.Handle) or  (Wnd = FavoriteTreeView.Handle)
+                       or (Wnd = ListView.Handle) or (Wnd = MessageListView.Handle)
+                       then
+                               SendMessage( Wnd, WM_MOUSEWHEEL, WheelDelta shl 16, (Mouse.CursorPos.X shl 16) or Mouse.CursorPos.Y )
+                       else
+                               Handled := False;
+
+{
 //                     if (FActiveContent <> nil) and (FActiveContent.Browser <> nil) then begin
                                // TWebBrowser \82Ì Handle \82Æ\94ä\8ar\82µ\82Ä\82à\88ê\92v\82µ\82È\82¢\82Ì\82Å\8dÀ\95W\82Å TWebBrowser \82©\82Ç\82¤\82©\94»\92è
                                browserPos.X := 0;
                                browserPos.Y := 0;
                                Windows.ClientToScreen( Browser.Handle, browserPos );
-                               //if (Longword(Mouse.CursorPos.X - browserPos.X) >= Browser.Width)
-                               //or (Longword(Mouse.CursorPos.Y - browserPos.Y) >= Browser.Height) then begin
+                               if (Longword(Mouse.CursorPos.X - browserPos.X) >= Browser.Width)
+                               or (Longword(Mouse.CursorPos.Y - browserPos.Y) >= Browser.Height)
+                               or (Longword(Mouse.CursorPos.Y - browserPos.Y) < 0)
+                               or (Longword(Mouse.CursorPos.Y - browserPos.Y) < 0) then begin
 //                             or not FActiveContent.Browser.Focused then
                                        // TWebBrowser \82Í\96³\8cÀ\83\8b\81[\83v\82·\82é\82Ì\82Å\82»\82ê\88È\8aO\82È\82ç\83R\83\93\83g\83\8d\81[\83\8b\82É\91\97\90M
-                               //      SendMessage( Wnd, WM_MOUSEWHEEL, WheelDelta shl 16, (MousePos.X shl 16) or MousePos.Y );
-                               //end else begin
+                                       if (Wnd <> BrowserToolBar.Handle) and (Wnd <> BrowserNameToolBar.Handle) then
+                                               SendMessage( Wnd, WM_MOUSEWHEEL, WheelDelta shl 16, (Mouse.CursorPos.X shl 16) or Mouse.CursorPos.Y )
+                                       else
+                                               Handled := False;
+                               end else begin
                                        Handled := False;
-                               //end;
+                               end;
 //                     end else begin
 //                             SendMessage( Wnd, WM_MOUSEWHEEL, WheelDelta shl 16, (MousePos.X shl 16) or MousePos.Y );
 //                     end;
-               end;
-       end;}
+}              end;
+       end;
 end;
 
 
@@ -8912,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
@@ -9549,25 +9648,26 @@ end;
 procedure TGikoForm.FavoriteTreeViewKeyDown(Sender: TObject; var Key: Word;
        Shift: TShiftState);
 begin
-
-       Case Key of
-       VK_F2:
-               begin
-                       FClickNode := FavoriteTreeView.Selected;
-                       FavoriteTreeViewRenameActionExecute( Sender );
-               end;
-       VK_DELETE:
-               begin
-                       FClickNode := FavoriteTreeView.Selected;
-                       FavoriteTreeViewDeleteActionExecute( Sender );
-               end;
-       VK_RETURN:
-               begin
-               FavoriteClick( FavoriteTreeView.Selected );
-               FavoriteTreeView.Selected.Expanded := not FavoriteTreeView.Selected.Expanded;
+       if not TTreeView(Sender).IsEditing then begin
+               Case Key of
+               VK_F2:
+                       begin
+                               FClickNode := FavoriteTreeView.Selected;
+                               FavoriteTreeViewRenameActionExecute( Sender );
+                       end;
+               VK_DELETE:
+                       begin
+                               FClickNode := FavoriteTreeView.Selected;
+                               FavoriteTreeViewDeleteActionExecute( Sender );
+                       end;
+               VK_RETURN:
+                       begin
+                       FavoriteClick( FavoriteTreeView.Selected );
+                       FavoriteTreeView.Selected.Expanded := not FavoriteTreeView.Selected.Expanded;
+                       end;
+               VK_SPACE:
+                       FavoriteTreeViewDblClick( Sender );
                end;
-       VK_SPACE:
-               FavoriteTreeViewDblClick( Sender );
        end;
 
 end;
@@ -9962,7 +10062,7 @@ begin
                ThreadItem := FavThread.Item;
 
                try
-                       s := ThreadItem.URL + #13#10 + ThreadItem.Title + #13#10;
+                       s := ThreadItem.Title + #13#10 + ThreadItem.URL + #13#10;
                        if s <> '' then
                                Clipboard.AsText := s;
                finally
@@ -9977,7 +10077,7 @@ begin
                                GikoSys.ReadSubjectFile(Board);
 
                try
-                       s := Board.URL + #13#10 + Board.Title + #13#10;
+                       s := Board.Title + #13#10 + Board.URL + #13#10;
                        if s <> '' then
                                Clipboard.AsText := s;
                finally
@@ -10034,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;
@@ -10515,8 +10620,6 @@ begin
 end;
 // TreeView \82ª\83N\83\8a\83b\83N\82³\82ê\82½
 procedure TGikoForm.TreeClick( Node : TTreeNode );
-var
-       i: Integer;
 begin
 
        if Node = nil then
@@ -11062,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;
@@ -11083,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;
@@ -11239,7 +11350,7 @@ end;
 procedure TGikoForm.TabsSaveToFileActionExecute(Sender: TObject);
 var
        SaveTabList: TStringList;
-        Result: Boolean;
+       Result: Boolean;
 begin
        SaveTabList := TStringList.Create;
        try
@@ -11665,6 +11776,20 @@ begin
        JumpToNumOfResAction.Enabled := (GetActiveContent <> nil) and (GetActiveContent.IsLogFile);
 end;
 
+procedure TGikoForm.FavoriteTreeViewCollapseActionExecute(Sender: TObject);
+var
+       node    : TTreeNode;
+begin
+
+       node := FavoriteTreeView.Items.GetFirstNode;
+       while node <> nil do begin
+               if node.HasChildren then
+                       node.Expanded := False;
+               node := node.GetNext;
+       end;
+
+end;
+
 initialization
                                OleInitialize(nil);
 finalization