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;
17 procedure SetSortOrder(Order: Boolean);
18 function GetSortOrder: Boolean;
19 procedure SetSortIndex(Index: Integer);
20 function GetSortIndex: Integer;
21 procedure SetSortNoFlag(Flag: Boolean);
22 function GetSortNoFlag: Boolean;
32 function CaclVigor(Thread: TThreadItem): Double;
36 if (Thread.AgeSage <> gasArch) then begin
37 span := DaySpan(Sort.GetSortDate, Thread.CreateDate);
39 span := DaySpan(Thread.LastModified, Thread.CreateDate);
41 if (span > 0) then begin
42 Result := Thread.AllResCount / span;
47 procedure SetSortOrder(Order: Boolean);
51 function GetSortOrder: Boolean;
55 procedure SetSortIndex(Index: Integer);
59 function GetSortIndex: Integer;
63 procedure SetSortNoFlag(Flag: Boolean);
67 function GetSortNoFlag: Boolean;
69 Result := FSortNoFlag;
72 function CategorySortProc(Item1, Item2: Pointer): integer;
74 CategoryItem1: TCategory;
75 CategoryItem2: TCategory;
77 CategoryItem1 := TCategory(Item1);
78 CategoryItem2 := TCategory(Item2);
80 case TGikoBBSColumnID( FSortIndex ) of
83 Result := CompareInt(CategoryItem1.No, CategoryItem2.No)
85 Result := AnsiCompareText(CategoryItem1.Title, CategoryItem2.Title);
87 Result := CompareInt(CategoryItem1.No, CategoryItem2.No)
90 if not FSortOrder then
91 Result := Result * -1;
94 function BoardSortProc(List: TStringList; Item1, Item2: Integer): integer;
99 BoardItem1 := TBoard(List.Objects[Item1]);
100 BoardItem2 := TBoard(List.Objects[Item2]);
101 case TGikoCategoryColumnID( FSortIndex ) of
104 Result := CompareInt(BoardItem1.No, BoardItem2.No)
106 Result := AnsiCompareText(BoardItem1.Title, BoardItem2.Title);
109 Result := CompareInt(BoardItem1.Count, BoardItem2.Count);
112 Result := CompareDate(BoardItem1.RoundDate, BoardItem2.RoundDate);
114 Result := CompareInt(BoardItem1.No, BoardItem2.No)
117 if not FSortOrder then
118 Result := Result * -1;
121 function ThreadItemSortProc(List: TStringList; Item1, Item2: Integer): integer;
123 ThreadItem1: TThreadItem;
124 ThreadItem2: TThreadItem;
126 ThreadItem1 := TThreadItem(List.Objects[ Item1 ]);
127 ThreadItem2 := TThreadItem(List.Objects[ Item2 ]);
128 case TGikoBoardColumnID( FSortIndex ) of
132 Result := CompareInt(ThreadItem1.No, ThreadItem2.No)
134 Result := AnsiCompareText(ThreadItem1.Title, ThreadItem2.Title)
137 gbcAllCount: Result := CompareInt(ThreadItem1.AllResCount, ThreadItem2.AllResCount);
138 gbcLocalCount: Result := CompareInt(ThreadItem1.Count, ThreadItem2.Count);
141 if ThreadItem1.IsLogFile and ThreadItem2.IsLogFile then
142 Result := CompareInt(ThreadItem1.AllResCount - ThreadItem1.Count, ThreadItem2.AllResCount - ThreadItem2.Count)
143 else if ThreadItem1.IsLogFile then
145 else if ThreadItem2.IsLogFile then
151 gbcNewCount: Result := CompareInt(ThreadItem1.NewResCount, ThreadItem2.NewResCount);
152 gbcUnReadCount: Result := 0;
153 gbcRoundName: Result := AnsiCompareText(ThreadItem1.RoundName, ThreadItem2.RoundName);
154 gbcRoundDate: Result := CompareDateTime(ThreadItem1.RoundDate, ThreadItem2.RoundDate); {gbcLastModified:}
155 gbcCreated: Result := CompareDateTime(ThreadItem1.CreateDate, ThreadItem2.CreateDate);
156 gbcLastModified: Result := CompareDateTime(ThreadItem1.LastModified, ThreadItem2.LastModified); {gbcLastModified:}
157 gbcVigor: Result := CompareValue(CaclVigor(ThreadItem1), CaclVigor(ThreadItem2));
162 { if SortIndex = 0 then
164 Result := CompareInt(ThreadItem1.No, ThreadItem2.No)
166 Result := CompareText(ThreadItem1.Title, ThreadItem2.Title)
167 else if SortIndex = 1 then
168 Result := CompareInt(ThreadItem1.Count, ThreadItem2.Count)
169 else if SortIndex = 2 then
170 // Result := CompareInt(ThreadItem1.RoundNo, ThreadItem2.RoundNo)
171 Result := CompareText(ThreadItem1.RoundName, ThreadItem2.RoundName)
173 Result := CompareDate(ThreadItem1.LastModified, ThreadItem2.LastModified);
175 if not FSortOrder then
176 Result := Result * -1;
178 //
\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
179 if Result = 0 then begin
181 Result := CompareInt(ThreadItem1.No, ThreadItem2.No)
183 Result := AnsiCompareText(ThreadItem1.Title, ThreadItem2.Title)
187 function CompareBool(Item1, Item2: Boolean): Integer;
189 if (Item1 = True) and (Item2 = False) then
191 else if (Item2 = False) and (Item2 = True) then
197 function CompareInt(Item1, Item2: Integer): Integer;
199 if Item1 > Item2 then
201 else if Item1 < Item2 then
207 function CompareDate(Item1, Item2: TDateTime): Integer;
209 if Item1 > Item2 then
211 else if Item1 < Item2 then
216 procedure SetSortDate(Date: TDateTime);
220 function GetSortDate(): TDateTime;