OSDN Git Service

スレタイの[転載禁止]と「©2ch.net」を非表示にする機能を追加
[gikonavigoeson/gikonavi.git] / ListViewUtils.pas
index 5f018bd..1aa9301 100644 (file)
@@ -80,9 +80,9 @@ begin
 
                // \83L\83\83\83r\83l\83b\83g\95\\8e¦\91O\82É\8dÄ\83\\81[\83g
                if ( GikoSys.Setting.BBSSortIndex <> 0 ) or ( GikoSys.Setting.BBSSortOrder <> true ) then begin
-                       Sort.SortOrder := true;
-                       Sort.SortIndex := 0;
-                       Sort.SortNoFlag := true;
+                       Sort.SetSortOrder(true);
+                       Sort.SetSortIndex(0);
+                       Sort.SetSortNoFlag(true);
                        inBBS.Sort(CategorySortProc);
                end;
 
@@ -99,9 +99,9 @@ begin
 
                        // \83L\83\83\83r\83l\83b\83g\95\\8e¦\91O\82É\8dÄ\83\\81[\83g
                        if ( GikoSys.Setting.CategorySortIndex <> 0 ) or ( GikoSys.Setting.CategorySortOrder <> true ) then begin
-                               Sort.SortOrder := true;
-                               Sort.SortIndex := 0;
-                               Sort.SortNoFlag := true;
+                               Sort.SetSortOrder(true);
+                               Sort.SetSortIndex(0);
+                               Sort.SetSortNoFlag(true);
                                Category.CustomSort(BoardSortProc);
                        end;
 
@@ -221,31 +221,31 @@ begin
                ListView.Column[ idx ].ImageIndex := ITEM_ICON_SORT2;
 
 
-       Sort.SortNoFlag := NumberVisible;
+       Sort.SetSortNoFlag(NumberVisible);
 
        if TObject( GikoForm.ActiveList ) is TBBS then begin
                wkBBS := TBBS( GikoForm.ActiveList );
                orderList := GikoSys.Setting.BBSColumnOrder;
-               Sort.SortOrder := vSortOrder;
-               Sort.SortIndex := Integer( orderList[ idx ] );
-               GikoSys.Setting.BBSSortIndex := Sort.SortIndex;
-               GikoSys.Setting.BBSSortOrder := Sort.SortOrder;
+               Sort.SetSortOrder(vSortOrder);
+               Sort.SetSortIndex(Integer( orderList[ idx ] ));
+               GikoSys.Setting.BBSSortIndex := Sort.GetSortIndex;
+               GikoSys.Setting.BBSSortOrder := Sort.GetSortOrder;
                wkBBS.Sort(Sort.CategorySortProc);
        end else if TObject( GikoForm.ActiveList ) is TCategory then begin
                wkCategory := TCategory( GikoForm.ActiveList );
                orderList := GikoSys.Setting.CategoryColumnOrder;
-               Sort.SortOrder := vSortOrder;
-               Sort.SortIndex := Integer( orderList[ idx ] );
-               GikoSys.Setting.CategorySortIndex := Sort.SortIndex;
-               GikoSys.Setting.CategorySortOrder := Sort.SortOrder;
+               Sort.SetSortOrder(vSortOrder);
+               Sort.SetSortIndex(Integer( orderList[ idx ] ));
+               GikoSys.Setting.CategorySortIndex := Sort.GetSortIndex;
+               GikoSys.Setting.CategorySortOrder := Sort.GetSortOrder;
                wkCategory.CustomSort(BoardSortProc);
        end else if TObject( GikoForm.ActiveList ) is TBoard then begin
                wkBoard := TBoard( GikoForm.ActiveList );
                orderList := GikoSys.Setting.BoardColumnOrder;
-               Sort.SortOrder := vSortOrder;
-               Sort.SortIndex := Integer( orderList[ idx ] );
-               GikoSys.Setting.BoardSortIndex := Sort.SortIndex;
-               GikoSys.Setting.BoardSortOrder := Sort.SortOrder;
+               Sort.SetSortOrder(vSortOrder);
+               Sort.SetSortIndex(Integer( orderList[ idx ] ));
+               GikoSys.Setting.BoardSortIndex := Sort.GetSortIndex;
+               GikoSys.Setting.BoardSortOrder := Sort.GetSortOrder;
                wkBoard.CustomSort(ThreadItemSortProc);
        end;
 
@@ -405,6 +405,16 @@ begin
                                Board.NewThreadCount := Board.GetNewThreadCount;
                                ListView.Items.Count := Board.NewThreadCount;
                        end;
+                       gvtArch:
+                       begin
+                               Board.ArchiveThreadCount := Board.GetArchiveThreadCount;
+                               ListView.Items.Count := Board.ArchiveThreadCount;
+                       end;
+                       gvtLive:
+                       begin
+                               Board.LiveThreadCount := Board.GetLiveThreadCount;
+                               ListView.Items.Count := Board.LiveThreadCount;
+                       end;
                        gvtUser:
                        begin
                                Board.UserThreadCount:= Board.GetUserThreadCount;
@@ -543,6 +553,7 @@ var
        BoardCnt: Integer;
        RepStr: String;
        i: Integer;
+    Idx: Integer;
 begin
        //===== \83X\83\8c\83\8a\83X\83g =====
        if GikoSys.Setting.ListIconVisible then
@@ -555,12 +566,14 @@ begin
                gvtAll: BoardCnt := Board.Count;
                gvtLog: BoardCnt := Board.LogThreadCount;
                gvtNew: BoardCnt := Board.NewThreadCount;
+               gvtArch: BoardCnt := Board.ArchiveThreadCount;
+               gvtLive: BoardCnt := Board.LiveThreadCount;
                gvtUser: BoardCnt := Board.UserThreadCount;
                else
                        BoardCnt := 0;
        end;
 
-       if (BoardCnt <= 0) or (Item = nil) or (Item.Index > BoardCnt)
+       if (BoardCnt <= 0) or (Item = nil) or (Item.Index >= BoardCnt)
                or (ListView.Items.Count = 0) or (not (Board.Items[Item.Index] is TThreadItem)) then Exit;
 
        //\89ü\91P\82·\82×\82«\83u\83\8d\83b\83N/////////////////////////////////////////////////////
@@ -570,6 +583,8 @@ begin
                                                        ThreadItem := TThreadItem(Board.Items[Item.Index]);
                gvtLog:         ThreadItem := Board.GetLogThread(Item.Index);
                gvtNew:         ThreadItem := Board.GetNewThread(Item.Index);
+               gvtArch:    ThreadItem := Board.GetArchiveThread(Item.Index);
+               gvtLive:    ThreadItem := Board.GetLiveThread(Item.Index);
                gvtUser:        ThreadItem := Board.GetUserThread(Item.Index);
        end;
        //////////////////////////////////////////////////////////////////////////
@@ -581,6 +596,25 @@ begin
        RepStr := CustomStringReplace(RepStr, '&quot;', '"' );
        RepStr := CustomStringReplace(RepStr, '&amp;', '&' );
        //RepStr := StringReplace(RepStr, '\81\97\81M', ',', [rfReplaceAll]);
+
+    if (ThreadNgList.IsNG(RepStr) = True) then begin
+        RepStr := '\81\83\82 \82Ú\81`\82ñ\81\84'
+    end else if (GikoSys.Setting.ThreadTitleTrim = True) then begin
+        while (True) do begin
+            Idx := Pos('[\93]\8dÚ\8bÖ\8e~]', RepStr);
+            if (Idx < 1) then
+                Break;
+            Delete(RepStr, Idx, 10);
+        end;
+        while (True) do begin
+            Idx := Pos('&copy;2ch.net', RepStr);
+            if (Idx < 1) then
+                Break;
+            Delete(RepStr, Idx, 13);
+        end;
+        RepStr := Trim(RepStr);
+    end;
+
        if Item.SubItems.Count <> ListView.Columns.Count then begin
                Item.SubItems.Clear;
                Item.SubItems.Capacity := GikoSys.Setting.BoardColumnOrder.Count;
@@ -598,6 +632,7 @@ begin
                gasNew: Item.StateIndex := 0;
                gasAge: Item.StateIndex := 1;
                gasSage: Item.StateIndex := 2;
+               gasArch: Item.StateIndex := 3;
        end;
 
        if ThreadItem.IsLogFile then begin
@@ -658,13 +693,20 @@ begin
                                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]);
+                               if (Thread.CreateDate <> ZERO_DATE)  then begin
+                                       if (Thread.AgeSage <> gasArch) then begin
+                                               spanday := DaySpan(Sort.GetSortDate, Thread.CreateDate);
+                                       end else begin
+                                               spanday := DaySpan(Thread.LastModified, Thread.CreateDate);
+                                       end;
+                                       if (spanday > 0) then begin
+                                               Item.SubItems[ idx ] := Format('%f', [Thread.AllResCount / spanday]);
+                                       end else begin
+                                               Item.SubItems[ idx ] := '';
+                                       end;
                                end else begin
                                        Item.SubItems[ idx ] := '';
                                end;
-
                        end;
                end;
                Inc( idx );
@@ -700,13 +742,21 @@ begin
                        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]);
+                               if (Thread.CreateDate <> ZERO_DATE)  then begin
+                                       if (Thread.AgeSage <> gasArch) then begin
+                                               spanday := DaySpan(Sort.GetSortDate, Thread.CreateDate);
+                                       end else begin
+                                               spanday := DaySpan(Thread.LastModified, Thread.CreateDate);
+                                       end;
+
+                                       if (spanday > 0) then begin
+                                               Item.SubItems[ idx ] := Format('%f', [Thread.AllResCount / spanday]);
+                                       end else begin
+                                               Item.SubItems[ idx ] := '';
+                                       end;
                                end else begin
                                        Item.SubItems[ idx ] := '';
                                end;
-
                        end;
                else
                        Item.SubItems[ idx ] := '';