Develop and Download Open Source Software

Browse CVS Repository

Diff of /gikonavigoeson/gikonavi/Sort.pas

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph | View Patch Patch

revision 1.3.2.2 by yoffy, Thu Sep 9 16:20:34 2004 UTC revision 1.3.2.3 by yoffy, Fri Oct 8 05:44:53 2004 UTC
# Line 3  unit Sort; Line 3  unit Sort;
3  interface  interface
4  uses  uses
5          Windows, Messages, SysUtils, Classes, Controls, Forms,          Windows, Messages, SysUtils, Classes, Controls, Forms,
6          BoardGroup,DateUtils;          BoardGroup,DateUtils,
7            Setting;
8    
9          function CategorySortProc(Item1, Item2: Pointer): integer;          function CategorySortProc(Item1, Item2: Pointer): integer;
10          function BoardSortProc(List: TStringList; Item1, Item2: Integer): integer;          function BoardSortProc(List: TStringList; Item1, Item2: Integer): integer;
# Line 16  var Line 17  var
17          SortOrder: Boolean;          SortOrder: Boolean;
18          SortIndex: Integer;          SortIndex: Integer;
19          SortNoFlag: Boolean;          SortNoFlag: Boolean;
         SortNonAcquiredCountFlag: Boolean;  
20    
21  implementation  implementation
22    
# Line 28  begin Line 28  begin
28          CategoryItem1 := TCategory(Item1);          CategoryItem1 := TCategory(Item1);
29          CategoryItem2 := TCategory(Item2);          CategoryItem2 := TCategory(Item2);
30    
31          if SortNoFlag then          case TGikoBBSColumnID( SortIndex ) of
32                  Result := CompareInt(CategoryItem1.No, CategoryItem2.No)          gbbscTitle:
33                    if SortNoFlag then
34                            Result := CompareInt(CategoryItem1.No, CategoryItem2.No)
35                    else
36                            Result := AnsiCompareText(CategoryItem1.Title, CategoryItem2.Title);
37          else          else
38                  Result := AnsiCompareText(CategoryItem1.Title, CategoryItem2.Title);                  Result := CompareInt(CategoryItem1.No, CategoryItem2.No)
39            end;
40    
41          if not SortOrder then          if not SortOrder then
42                  Result := Result * -1;                  Result := Result * -1;
# Line 44  var Line 49  var
49  begin  begin
50          BoardItem1 := TBoard(List.Objects[Item1]);          BoardItem1 := TBoard(List.Objects[Item1]);
51          BoardItem2 := TBoard(List.Objects[Item2]);          BoardItem2 := TBoard(List.Objects[Item2]);
52          if SortIndex = 0 then          case TGikoCategoryColumnID( SortIndex ) of
53            gccTitle:
54                  if SortNoFlag then                  if SortNoFlag then
55                          Result := CompareInt(BoardItem1.No, BoardItem2.No)                          Result := CompareInt(BoardItem1.No, BoardItem2.No)
56                  else                  else
57                          Result := AnsiCompareText(BoardItem1.Title, BoardItem2.Title)                          Result := AnsiCompareText(BoardItem1.Title, BoardItem2.Title);
58          else if SortIndex = 1 then  
59                  Result := CompareInt(BoardItem1.Count, BoardItem2.Count)          gccRoundName:
60      else                  Result := CompareInt(BoardItem1.Count, BoardItem2.Count);
61    
62            gccLastModified:
63                  Result := CompareDate(BoardItem1.RoundDate, BoardItem2.RoundDate);                  Result := CompareDate(BoardItem1.RoundDate, BoardItem2.RoundDate);
64            else
65                    Result := CompareInt(BoardItem1.No, BoardItem2.No)
66            end;
67    
68          if not SortOrder then          if not SortOrder then
69                  Result := Result * -1;                  Result := Result * -1;
# Line 65  var Line 76  var
76  begin  begin
77          ThreadItem1 := TThreadItem(List.Objects[ Item1 ]);          ThreadItem1 := TThreadItem(List.Objects[ Item1 ]);
78          ThreadItem2 := TThreadItem(List.Objects[ Item2 ]);          ThreadItem2 := TThreadItem(List.Objects[ Item2 ]);
79          case SortIndex of          case TGikoBoardColumnID( SortIndex ) of
80                  0:                  gbcTitle:
81                          begin                          begin
82                                  if SortNoFlag then                                  if SortNoFlag then
83                                          Result := CompareInt(ThreadItem1.No, ThreadItem2.No)                                          Result := CompareInt(ThreadItem1.No, ThreadItem2.No)
84                                  else                                  else
85                                          Result := AnsiCompareText(ThreadItem1.Title, ThreadItem2.Title)                                          Result := AnsiCompareText(ThreadItem1.Title, ThreadItem2.Title)
86                          end;                          end;
87                  1: Result := CompareInt(ThreadItem1.AllResCount, ThreadItem2.AllResCount);  
88                  2:                  gbcAllCount:                    Result := CompareInt(ThreadItem1.AllResCount, ThreadItem2.AllResCount);
89                    gbcLocalCount:          Result := CompareInt(ThreadItem1.Count, ThreadItem2.Count);
90                    gbcNonAcqCount:
91                          begin                          begin
92                                  if SortNonAcquiredCountFlag then                                  if ThreadItem1.IsLogFile and ThreadItem2.IsLogFile then
93                                          if ThreadItem1.IsLogFile and ThreadItem2.IsLogFile then                                          Result := CompareInt(ThreadItem1.AllResCount - ThreadItem1.Count, ThreadItem2.AllResCount - ThreadItem2.Count)
94                                                  Result := CompareInt(ThreadItem1.AllResCount - ThreadItem1.Count, ThreadItem2.AllResCount - ThreadItem2.Count)                                  else if ThreadItem1.IsLogFile then
95                                          else if ThreadItem1.IsLogFile then                                          Result := 1
96                                                  Result := 1                                  else if ThreadItem2.IsLogFile then
97                                          else if ThreadItem2.IsLogFile then                                          Result := -1
                                                 Result := -1  
                                         else  
                                                 Result := 0  
98                                  else                                  else
99                                          Result := CompareInt(ThreadItem1.Count, ThreadItem2.Count);                                          Result := 0;
100                          end;                          end;
101                  3: Result := CompareInt(ThreadItem1.NewResCount, ThreadItem2.NewResCount);  
102                  4: Result := 0;                  gbcNewCount:                    Result := CompareInt(ThreadItem1.NewResCount, ThreadItem2.NewResCount);
103                  5: Result := AnsiCompareText(ThreadItem1.RoundName, ThreadItem2.RoundName);                  gbcUnReadCount:         Result := 0;
104                  6: Result := CompareDateTime(ThreadItem1.RoundDate, ThreadItem2.RoundDate);                  gbcRoundName:           Result := AnsiCompareText(ThreadItem1.RoundName, ThreadItem2.RoundName);
105                  7: Result := CompareDateTime(ThreadItem1.CreateDate, ThreadItem2.CreateDate);                  gbcRoundDate:   Result := CompareDateTime(ThreadItem1.RoundDate, ThreadItem2.RoundDate); {gbcLastModified:}
106                    gbcCreated:                             Result := CompareDateTime(ThreadItem1.CreateDate, ThreadItem2.CreateDate);
107                    gbcLastModified:        Result := CompareDateTime(ThreadItem1.LastModified, ThreadItem2.LastModified); {gbcLastModified:}
108          else          else
109                  Result := 0;                  Result := 0;
110          end;          end;

Legend:
Removed from v.1.3.2.2  
changed lines
  Added in v.1.3.2.3

Back to OSDN">Back to OSDN
ViewVC Help
Powered by ViewVC 1.1.26