OSDN Git Service

スレ一覧に勢いカラム追加。
authorh677 <h677>
Sun, 22 Jan 2006 16:40:48 +0000 (16:40 +0000)
committerh677 <h677>
Sun, 22 Jan 2006 16:40:48 +0000 (16:40 +0000)
(重いので今後の修正が必要かも…)

Giko.pas
ListViewUtils.pas
Setting.pas
Sort.pas

index 0cdfa8a..759673a 100644 (file)
--- a/Giko.pas
+++ b/Giko.pas
@@ -543,6 +543,7 @@ type
     procedure GikoApplicationEventsException(Sender: TObject; E: Exception);
     procedure TreeViewMouseDown(Sender: TObject; Button: TMouseButton;
       Shift: TShiftState; X, Y: Integer);
+    procedure GetResURLMenuClick(Sender: TObject);
        private
                { Private \90é\8c¾ }
                FEnabledCloseButton: Boolean;
@@ -592,6 +593,7 @@ type
                FOrigenCaption: String;                         //\82¨\8bC\82É\93ü\82è\83c\83\8a\81[\82Ì\83A\83C\83e\83\80\95Ò\8fW\8e\9e\82Ì\95Ò\8fW\91O\82Ì\95\8e\9a\97ñ
                FPreviewBrowserRect: TRect;                     ///< \83v\83\8c\83r\83\85\81[\82Ì\95\\8e¦\88Ê\92u\82ð\8bL\89¯\82·\82é
                FActionListGroupIndexes: array of Integer;      ///<GikoDM\8fã\82Ì\83A\83N\83V\83\87\83\93\83\8a\83X\83g\82Ì\8ae\83A\83N\83V\83\87\83\93\82É\90Ý\92è\82³\82ê\82½GroupIndex\82ð\95Û\91\82·\82é\94z\97ñ
+               FListDrawTime: TDateTime;  ///< ListView\82ð\95`\89æ\82µ\82æ\82¤\82Æ\82µ\82½\8e\9e\8d\8f(\90¨\82¢\82Ì\8cv\8eZ\97p)
                procedure DownloadEnd(Sender: TObject; Item: TDownloadItem);
                procedure DownloadMsg(Sender: TObject; Item: TDownloadItem; Msg: string; Icon: TGikoMessageIcon);
                procedure WorkBegin(Sender: TObject; AWorkMode: TWorkMode; const AWorkCountMax: Integer; Number: Integer; const AWorkTitle: string);
@@ -659,6 +661,8 @@ type
                procedure GetGroupIndex(ActionList: TActionList);
                //! ActionList\82ÌGroupIndex\82Ì\90Ý\92è
                procedure SetGroupIndex(ActionList: TActionList);
+               //! \8ew\92è\82³\82ê\82½\83X\83\8c\83b\83h\82ð\8aJ\82­(\83\8d\83O\82ª\96³\82¢\82Æ\82« or \8ew\92èJUMP\82Ü\82Å\91«\82è\82È\82¢\82Æ\82«\82ÍDL\82·\82é)
+               procedure OpenThreadItem(Thread: TThreadItem; URL: String);
        protected
                procedure CreateParams(var Params: TCreateParams); override;
                procedure WndProc(var Message: TMessage); override;
@@ -696,6 +700,7 @@ type
                property ScreenCursor : TCursor read GetScreenCursor write SetScreenCursor;
                property ActiveBBS : TBBS read FActiveBBS write FActiveBBS;
                property WorkCount: Integer read FWorkCount write FWorkCount;
+               property ListDrawTime: TDateTime read FListDrawTime;
                procedure SetContent(inThread: TBrowserRecord);
                function GetActiveContent: TThreadItem;
                function GetActiveList: TObject;
@@ -788,6 +793,7 @@ type
                function WebBrowserClick(Sender: TObject): WordBool;
                //! \83c\81[\83\8b\83o\81[\82É\83X\83\8c\8di\8d\9e\82Ý\83R\83\93\83{\83{\83b\83N\83X\82ð\90Ý\92è\82·\82é
                procedure SetSelectComboBox();
+
        published
                property EnabledCloseButton: Boolean read FEnabledCloseButton write SetEnabledCloseButton;
        end;
@@ -2899,6 +2905,7 @@ begin
                                                         (ListView.ClientHeight div 2) - (ListView.Canvas.TextHeight(s) div 2));
                ListView.Canvas.TextOut(p.X, p.Y, s);
        end else begin
+               FListDrawTime := Now();
                DefaultDraw := True;
        end;
 end;
@@ -4563,6 +4570,45 @@ begin
        TopPanel.Height := Max(MainCoolBar.Height, AnimePanel.Height);
 
 end;
+//! \8ew\92è\82³\82ê\82½\83X\83\8c\83b\83h\82ð\8aJ\82­(\83\8d\83O\82ª\96³\82¢\82Æ\82« or \8ew\92èJUMP\82Ü\82Å\91«\82è\82È\82¢\82Æ\82«\82ÍDL\82·\82é)
+procedure TGikoForm.OpenThreadItem(Thread: TThreadItem; URL: String);
+var
+       stRes, edRes : Int64;
+       browserRec : TBrowserRecord;
+       threadNumber : String;
+begin
+       stRes := 0;
+       edRes := 0;
+       // \83^\83u\82ð\90\90¬
+       browserRec := InsertBrowserTab(Thread);
+       if (browserRec <> nil) then begin
+               // JUMP\82·\82×\82«\83\8c\83X\94Ô\8d\86\82ª\82 \82é\82©\83`\83F\83b\83N\82·\82é
+               threadNumber := ChangeFileExt(Thread.FileName, '');
+               GikoSys.GetPopupResNumber( URL, stRes, edRes );
+               // \83X\83\8c\82Ì\94Ô\8d\86\82ð\83\8c\83X\94Ô\82Æ\8cë\82Á\82Ä\94F\8e¯\82µ\82Ä\82¢\82é\82Ì\82ð\83N\83\8a\83A
+               if (StrToInt(threadNumber) = stRes) then begin
+                       if not (AnsiEndsText(threadNumber + '/' + threadNumber, URL))
+                               and (Pos('&st=' + threadNumber , URL) = 0) then begin
+                               stRes := 0;
+                       end;
+               end;
+               if ( stRes > 0 ) then begin
+                       browserRec.Movement := IntToStr( stRes );
+               end;
+               // \83\8d\83O\82ð\8e\9d\82Á\82Ä\82¢\82È\82¢\82© JUMP\82·\82×\82«\83\8c\83X\94Ô\8d\86\82Ü\82Å\8eæ\93¾\82µ\82Ä\82¢\82È\82¢\82Æ\82«\82ÍDL\82·\82é
+               if (not Thread.IsLogFile) or (stRes > Thread.Count) then begin
+                       DownloadContent(Thread);
+               end else if (not browserRec.Repaint) then begin
+                       try
+                               if (browserRec.Movement <> '') then begin
+                                       browserRec.Move(browserRec.Movement);
+                                       browserRec.Movement := '';
+                               end;
+                       except
+                       end;
+               end;
+       end;
+end;
 
 procedure TGikoForm.MoveToURL(const inURL: string);
 var
@@ -4575,13 +4621,8 @@ var
        i, bi                                   : Integer;
        boardURL                        : string;
        tmpThread                       : TThreadItem;
-//     category                        : TCategory;
-//     categoryNode    : TTreeNode;
-//     boardNode                       : TTreeNode;
        shiftDown                       : Boolean;
        ctrlDown                        : Boolean;
-       stRes, edRes    : Int64;
-       browserRec              : TBrowserRecord;
 begin
 
        GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark );
@@ -4637,36 +4678,11 @@ 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 begin
-                                                                               browserRec.Movement := IntToStr( stRes );
-                                                                               if (stRes > ThreadItem.Count) then begin
-                                                                                       DownloadContent( ThreadItem );
-                                                                               end else begin
-                                                                                       try
-                                                                                               browserRec.Move(browserRec.Movement);
-                                                                                       except
-                                                                                       end;
-                                                                                       browserRec.Movement := '';
-                                                                               end;
-                                                                       end;
-                                                               end else begin
-                                                                       if (browserRec <> nil) and (stRes > 0) then
-                                                                               browserRec.Movement := IntToStr( stRes );
-                                                                       DownloadContent( ThreadItem );
-                                                               end;
-                                                               Exit;
                                                        end;
+                                                       OpenThreadItem(ThreadItem, inURL);
+                                                       Exit;
                                                end;
                                        end;
 
@@ -4693,15 +4709,6 @@ begin
        if (Length( Trim(BBSKey) ) > 0) and (Length( Trim(BBSID) ) > 0) then begin
                boardURL := GikoSys.Get2chThreadURL2BoardURL( inURL );
                Board := BBSsFindBoardFromURL( boardURL );
-               //if Board = nil then
-               //      Board := BBSsFindBoardFromBBSID( BBSID );
-               { \82±\82Ì\95\94\95ª\82àBBS\82\93FindBoardFromURL\82É\8e\9d\82½\82¹\82½\81@20050523
-               if Board = nil then begin
-                       // \81¦\8dì\82Á\82Ä\82à\92Ç\89Á\82·\82é\82Æ\82±\82ë\82ª\96³\82¢\82Ì\82Å\8c\83\82µ\82­\95Û\97¯
-                       //\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)
-                       Board := BBSs[ 0 ].FindBBSID( BBSID );
-               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(inURL, gbtUserApp);
@@ -4726,61 +4733,26 @@ begin
                if ThreadItem = nil then begin
                        ThreadItem := Board.FindThreadFromFileName( BBSKey + '.dat' );
                end;
-               if ThreadItem = nil then begin
-                       //shift -> \90Ý\92è\83u\83\89\83E\83U\81i\96³\82¯\82ê\82ÎIE\81j
-                       //ctrl  -> IE
-                       {shiftDown      := GetAsyncKeyState(VK_SHIFT) = Smallint($8001);
-                       ctrlDown        := GetAsyncKeyState(VK_CONTROL) = Smallint($8001);
-                       if shiftDown then
-                               GikoSys.OpenBrowser(URL1, gbtUserApp)
-                       else if ctrlDown then
-                               GikoSys.OpenBrowser(URL1, gbtIE)
-                       else begin
-                       }
-                       ThreadItem := TThreadItem.Create( nil, Board, URL );
-                       ThreadItem.FileName := ChangeFileExt(BBSKey, '.dat');
-                       if AnsiPos(Host, Board.URL) = 0 then
-                               ThreadItem.DownloadHost := Host
-                       else
-                               ThreadItem.DownloadHost := '';
-                       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);
-                       {end;}
-               end else begin
-                       if ThreadItem.IsLogFile then begin
-                               GikoSys.GetPopupResNumber( inURL, stRes, edRes );
-                               browserRec := InsertBrowserTab(ThreadItem);
-                               if (browserRec <> nil) and (stRes > 0) then begin
-                                       browserRec.Movement := IntToStr( stRes );
-                                       if (stRes > ThreadItem.Count) then begin
-                       DownloadContent(ThreadItem);
-                                       end else begin
-                                               try
-                                                       browserRec.Move(browserRec.Movement);
-                                               except
-                                               end;
-                                               browserRec.Movement := '';
-                                       end;
+               try
+                       // \83X\83\8c\83b\83h\83A\83C\83e\83\80\82ª\82È\82¢\82È\82ç\90\90¬\82·\82é\81B
+                       if ThreadItem = nil then begin
+                               ThreadItem := TThreadItem.Create( nil, Board, URL );
+                               ThreadItem.FileName := ChangeFileExt(BBSKey, '.dat');
+                               Board.Insert(0, ThreadItem);
+                               if ActiveList is TBoard then begin
+                                       if TBoard(ActiveList) = Board then
+                                               ListView.Items.Count := ListView.Items.Count + 1;
                                end;
-                       end else begin
+                       end;
+                       // \83\8d\83O\82È\82µ\83X\83\8c\83b\83h\82Ì\82Æ\82«\82Í\81A\83z\83X\83g\96¼\82Ì\83`\83F\83b\83N\82ð\82·\82é
+                       if not ThreadItem.IsLogFile then begin
                                if AnsiPos(Host, Board.URL) = 0 then
                                        ThreadItem.DownloadHost := Host
                                else
                                        ThreadItem.DownloadHost := '';
-                               GikoSys.GetPopupResNumber( inURL, stRes, edRes );
-                               browserRec := InsertBrowserTab(ThreadItem);
-                               if (browserRec <> nil) and (stRes > 0) then
-                                       browserRec.Movement := IntToStr( stRes );
-                               DownloadContent(ThreadItem);
                        end;
+                       OpenThreadItem(ThreadItem, inURL);
+               except
                end;
        end else begin
                Board := BBSsFindBoardFromURL( inURL );
@@ -4790,7 +4762,7 @@ begin
                        if FActiveBBS <> Board.ParentCategory.ParenTBBS then
                                ShowBBSTree( Board.ParentCategory.ParenTBBS );
                        SelectTreeNode( Board, True );
-       end;
+               end;
        end;
 end;
 
@@ -7832,6 +7804,11 @@ begin
                end;
        end;
 end;
+//! \82±\82Ì\83\8c\83X\82ÌURL\8eæ\93¾
+procedure TGikoForm.GetResURLMenuClick(Sender: TObject);
+begin
+;
+end;
 
 initialization
                                OleInitialize(nil);
index f9e2a43..5f018bd 100644 (file)
@@ -10,6 +10,7 @@ type
        TListViewUtils = class(TObject)
        private
                {Private \90é\8c¾}
+
                class procedure DrawCategoryItem(BBS: TBBS; Item: TListItem; ListView: TListView);
                class procedure DrawBoardItem(Category: TCategory; Item: TListItem; ListView: TListView);
                class procedure DrawThreadItem(Board: TBoard; Item: TListItem; ListView: TListView);
@@ -30,11 +31,10 @@ type
                class procedure ListViewData(Sender: TObject; Item: TListItem);
        end;
 
-
 implementation
 
 uses
-       GikoSystem, Sort, Setting, Giko, MojuUtils, GikoDataModule;
+       GikoSystem, Sort, Setting, Giko, MojuUtils, GikoDataModule, DateUtils, Math;
 
 const
        //\83c\83\8a\81[\81E\83\8a\83X\83g\83A\83C\83R\83\93
@@ -612,6 +612,7 @@ end;
 class procedure TListViewUtils.DrawItemLogThread(Thread: TThreadItem; Item: TListItem; ColumnCount: Integer);
 var
        i, idx : Integer;
+       spanday: Double;
 begin
        idx := 0;
        for i := 0 to ColumnCount - 1 do begin
@@ -655,6 +656,16 @@ begin
                                Item.SubItems[ idx ] := '';
                        end else
                                Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', Thread.LastModified);
+               gbcVigor:
+                       begin
+                               spanday := DaySpan(GikoForm.ListDrawTime, Thread.CreateDate);
+                               if (spanday > 0) then begin
+                                       Item.SubItems[ idx ] := Format('%5.2f', [Thread.AllResCount / spanday]);
+                               end else begin
+                                       Item.SubItems[ idx ] := '';
+                               end;
+
+                       end;
                end;
                Inc( idx );
        end;
@@ -668,6 +679,7 @@ end;
 class procedure TListViewUtils.DrawItemNoLogThread(Thread: TThreadItem; Item: TListItem; ColumnCount: Integer);
 var
        i, idx: Integer;
+       spanday: Double;
 begin
        idx := 0;
        for i := 0 to ColumnCount - 1do begin
@@ -686,9 +698,20 @@ begin
                                Item.SubItems[ idx ] := FormatDateTime('yyyy/mm/dd hh:mm:ss', Thread.CreateDate);
                gbcLastModified:
                        Item.SubItems[ idx ] := '';
+               gbcVigor:
+                       begin
+                               spanday := DaySpan(GikoForm.ListDrawTime, Thread.CreateDate);
+                               if (spanday > 0) then begin
+                                       Item.SubItems[ idx ] := Format('%5.2f', [Thread.AllResCount / spanday]);
+                               end else begin
+                                       Item.SubItems[ idx ] := '';
+                               end;
+
+                       end;
                else
                        Item.SubItems[ idx ] := '';
                end;
+
                Inc( idx );
        end;
        if Thread.NewArrival then
index 4012fd3..1f8be7e 100644 (file)
@@ -73,15 +73,15 @@ type
        end;
        /// \83X\83\8c\83\8a\83X\83g\82Ì\83J\83\89\83\80 ID
        type    TGikoBoardColumnID = (gbcTitle, gbcAllCount, gbcLocalCount, gbcNonAcqCount,
-               gbcNewCount, gbcUnReadCount, gbcRoundName, gbcRoundDate, gbcCreated, gbcLastModified );{gbcLastModified,}
+               gbcNewCount, gbcUnReadCount, gbcRoundName, gbcRoundDate, gbcCreated, gbcLastModified, gbcVigor );{gbcLastModified,}
        /// \83X\83\8c\83\8a\83X\83g\82Ì\83J\83\89\83\80\96¼
-       const   GikoBoardColumnCaption : array[0..9] of string =
+       const   GikoBoardColumnCaption : array[0..10] of string =
                ( '\83X\83\8c\83b\83h\96¼', '\83J\83E\83\93\83g', '\8eæ\93¾', '\96¢\8eæ\93¾', '\90V\92\85',
-               '\96¢\93Ç', '\8f\84\89ñ\97\\96ñ', '\8eæ\93¾\93ú\8e\9e', '\83X\83\8c\8dì\90¬\93ú\8e\9e', '\8dÅ\8fI\8dX\90V\93ú\8e\9e' );
-       const GikoBoardColumnAlignment : array[0..9] of TAlignment = (
+               '\96¢\93Ç', '\8f\84\89ñ\97\\96ñ', '\8eæ\93¾\93ú\8e\9e', '\83X\83\8c\8dì\90¬\93ú\8e\9e', '\8dÅ\8fI\8dX\90V\93ú\8e\9e', '\90¨\82¢' );
+       const GikoBoardColumnAlignment : array[0..10] of TAlignment = (
                taLeftJustify, taRightJustify, taRightJustify, taRightJustify,
                taRightJustify, taRightJustify, taLeftJustify, taLeftJustify,
-               taLeftJustify, taLeftJustify);
+               taLeftJustify, taLeftJustify, taRightJustify);
        /// \83X\83\8c\83\8a\83X\83g\83J\83\89\83\80\94z\97ñ
        type    TGikoBoardColumnList = class( TList )
        private
@@ -259,7 +259,7 @@ type
                //\83\8a\83X\83g\83J\83\89\83\80\83w\83b\83_\81[\83T\83C\83Y
                FBBSColumnWidth: array[0..0] of Integer;
                FCategoryColumnWidth: array[0..2] of Integer;
-               FBoardColumnWidth: array[0..9] of Integer;
+               FBoardColumnWidth: array[0..10] of Integer;
 
                /// \83J\83e\83S\83\8a\83\8a\83X\83g\83J\83\89\83\80\8f\87\8f\98
                FBBSColumnOrder : TGikoBBSColumnList;
@@ -936,7 +936,7 @@ procedure TSetting.ReadSettingFile();
 const
        DEFAULT_BBS_WIDTH: array[0..0] of Integer = (140);
        DEFAULT_CATEGORY_WIDTH: array[0..2] of Integer = (150, 80, 130);
-       DEFAULT_BOARD_WIDTH: array[0..9] of Integer = (350, 60, 60, 60, 60, 60, 80, 130, 130, 130);
+       DEFAULT_BOARD_WIDTH: array[0..10] of Integer = (350, 60, 60, 60, 60, 60, 80, 130, 130, 130, 60);
        MAX_WIDTH: Integer = 2000;
 var
        ini: TMemIniFile;
index 25d752e..a319a80 100644 (file)
--- a/Sort.pas
+++ b/Sort.pas
@@ -4,7 +4,7 @@ interface
 uses
        Windows, Messages, SysUtils, Classes, Controls, Forms,
        BoardGroup,DateUtils,
-       Setting;
+       Setting, Math;
 
        function CategorySortProc(Item1, Item2: Pointer): integer;
        function BoardSortProc(List: TStringList; Item1, Item2: Integer): integer;
@@ -73,6 +73,8 @@ function ThreadItemSortProc(List: TStringList; Item1, Item2: Integer): integer;
 var
        ThreadItem1: TThreadItem;
        ThreadItem2: TThreadItem;
+       SpanDay1, SpanDay2: Double;
+       NowDateTime: TDateTime;
 begin
        ThreadItem1 := TThreadItem(List.Objects[ Item1 ]);
        ThreadItem2 := TThreadItem(List.Objects[ Item2 ]);
@@ -105,6 +107,23 @@ begin
                gbcRoundDate:   Result := CompareDateTime(ThreadItem1.RoundDate, ThreadItem2.RoundDate); {gbcLastModified:}
                gbcCreated:                             Result := CompareDateTime(ThreadItem1.CreateDate, ThreadItem2.CreateDate);
                gbcLastModified:        Result := CompareDateTime(ThreadItem1.LastModified, ThreadItem2.LastModified); {gbcLastModified:}
+               gbcVigor:
+                       begin
+                               NowDateTime := Now();
+                               SpanDay1 := DaySpan(NowDateTime, ThreadItem1.CreateDate);
+                               SpanDay2 := DaySpan(NowDateTime, ThreadItem2.CreateDate);
+                               if (SpanDay1 > 0) and (SpanDay2 > 0) then begin
+                                       Result := CompareValue(
+                                                               ThreadItem1.AllResCount / SpanDay1,
+                                                               ThreadItem2.AllResCount / SpanDay2);
+                               end else if (SpanDay1 > 0) then begin
+                                       Result := 1;
+                               end else if (SpanDay2 > 0) then begin
+                                       Result := -1;
+                               end else begin
+                                       Result := 0;
+                               end;
+                       end;
        else
                Result := 0;
        end;