5 Windows, Messages, SysUtils, Classes, Controls, Forms,
9 function CategorySortProc(Item1, Item2: Pointer): integer;
10 function BoardSortProc(List: TStringList; Item1, Item2: Integer): integer;
11 function ThreadItemSortProc(List: TStringList; Item1, Item2: Integer): integer;
12 function CompareBool(Item1, Item2: Boolean): integer;
13 function CompareInt(Item1, Item2: Integer): Integer;
14 function CompareDate(Item1, Item2: TDateTime): Integer;
15 procedure SetSortDate(Date: TDateTime);
16 function GetSortDate(): TDateTime;
26 function CategorySortProc(Item1, Item2: Pointer): integer;
28 CategoryItem1: TCategory;
29 CategoryItem2: TCategory;
31 CategoryItem1 := TCategory(Item1);
32 CategoryItem2 := TCategory(Item2);
34 case TGikoBBSColumnID( SortIndex ) of
37 Result := CompareInt(CategoryItem1.No, CategoryItem2.No)
39 Result := AnsiCompareText(CategoryItem1.Title, CategoryItem2.Title);
41 Result := CompareInt(CategoryItem1.No, CategoryItem2.No)
45 Result := Result * -1;
48 function BoardSortProc(List: TStringList; Item1, Item2: Integer): integer;
53 BoardItem1 := TBoard(List.Objects[Item1]);
54 BoardItem2 := TBoard(List.Objects[Item2]);
55 case TGikoCategoryColumnID( SortIndex ) of
58 Result := CompareInt(BoardItem1.No, BoardItem2.No)
60 Result := AnsiCompareText(BoardItem1.Title, BoardItem2.Title);
63 Result := CompareInt(BoardItem1.Count, BoardItem2.Count);
66 Result := CompareDate(BoardItem1.RoundDate, BoardItem2.RoundDate);
68 Result := CompareInt(BoardItem1.No, BoardItem2.No)
72 Result := Result * -1;
75 function ThreadItemSortProc(List: TStringList; Item1, Item2: Integer): integer;
77 ThreadItem1: TThreadItem;
78 ThreadItem2: TThreadItem;
79 SpanDay1, SpanDay2: Double;
81 ThreadItem1 := TThreadItem(List.Objects[ Item1 ]);
82 ThreadItem2 := TThreadItem(List.Objects[ Item2 ]);
83 case TGikoBoardColumnID( SortIndex ) of
87 Result := CompareInt(ThreadItem1.No, ThreadItem2.No)
89 Result := AnsiCompareText(ThreadItem1.Title, ThreadItem2.Title)
92 gbcAllCount: Result := CompareInt(ThreadItem1.AllResCount, ThreadItem2.AllResCount);
93 gbcLocalCount: Result := CompareInt(ThreadItem1.Count, ThreadItem2.Count);
96 if ThreadItem1.IsLogFile and ThreadItem2.IsLogFile then
97 Result := CompareInt(ThreadItem1.AllResCount - ThreadItem1.Count, ThreadItem2.AllResCount - ThreadItem2.Count)
98 else if ThreadItem1.IsLogFile then
100 else if ThreadItem2.IsLogFile then
106 gbcNewCount: Result := CompareInt(ThreadItem1.NewResCount, ThreadItem2.NewResCount);
107 gbcUnReadCount: Result := 0;
108 gbcRoundName: Result := AnsiCompareText(ThreadItem1.RoundName, ThreadItem2.RoundName);
109 gbcRoundDate: Result := CompareDateTime(ThreadItem1.RoundDate, ThreadItem2.RoundDate); {gbcLastModified:}
110 gbcCreated: Result := CompareDateTime(ThreadItem1.CreateDate, ThreadItem2.CreateDate);
111 gbcLastModified: Result := CompareDateTime(ThreadItem1.LastModified, ThreadItem2.LastModified); {gbcLastModified:}
114 SpanDay1 := DaySpan(FSortDate, ThreadItem1.CreateDate);
115 SpanDay2 := DaySpan(FSortDate, ThreadItem2.CreateDate);
116 if (SpanDay1 > 0) and (SpanDay2 > 0) then begin
117 Result := CompareValue(
118 ThreadItem1.AllResCount / SpanDay1,
119 ThreadItem2.AllResCount / SpanDay2);
120 end else if (SpanDay1 > 0) then begin
122 end else if (SpanDay2 > 0) then begin
132 { if SortIndex = 0 then
134 Result := CompareInt(ThreadItem1.No, ThreadItem2.No)
136 Result := CompareText(ThreadItem1.Title, ThreadItem2.Title)
137 else if SortIndex = 1 then
138 Result := CompareInt(ThreadItem1.Count, ThreadItem2.Count)
139 else if SortIndex = 2 then
140 // Result := CompareInt(ThreadItem1.RoundNo, ThreadItem2.RoundNo)
141 Result := CompareText(ThreadItem1.RoundName, ThreadItem2.RoundName)
143 Result := CompareDate(ThreadItem1.LastModified, ThreadItem2.LastModified);
145 if not SortOrder then
146 Result := Result * -1;
148 //
\83\
\81[
\83g
\95]
\89¿
\82ª
\93¯
\82¶
\8fê
\8d\87\82Í
\81A
\91æ1
\83J
\83\89\83\80\82Ì
\8f¸
\8f\87\82É
\83\
\81[
\83g
149 if Result = 0 then begin
151 Result := CompareInt(ThreadItem1.No, ThreadItem2.No)
153 Result := AnsiCompareText(ThreadItem1.Title, ThreadItem2.Title)
157 function CompareBool(Item1, Item2: Boolean): Integer;
159 if (Item1 = True) and (Item2 = False) then
161 else if (Item2 = False) and (Item2 = True) then
167 function CompareInt(Item1, Item2: Integer): Integer;
169 if Item1 > Item2 then
171 else if Item1 < Item2 then
177 function CompareDate(Item1, Item2: TDateTime): Integer;
179 if Item1 > Item2 then
181 else if Item1 < Item2 then
186 procedure SetSortDate(Date: TDateTime);
190 function GetSortDate(): TDateTime;