property IsBoardFileRead : Boolean read FIsBoardFileRead write FIsBoardFileRead;
end;
- //\83J\83e\83S\83\8a
- TCategory = class(TList)
+ // \83J\83e\83S\83\8a(\94Â URL \82Ì\83\8a\83X\83g)
+ TCategory = class(THashedStringList)
private
FNo: Integer;
FTitle: string;
property NodeExpand: Boolean read FExpand write FExpand;
end;
- //\94Â
- TBoard = class(TList)
+ // \94Â(\83X\83\8c\83b\83h URL \82Ì\83\8a\83X\83g)
+ TBoard = class(THashedStringList)
private
- FContext: DWORD; // \83v\83\89\83O\83C\83\93\82ª\8e©\97R\82É\90Ý\92è\82µ\82Ä\82¢\82¢\92l(\8eå\82É\83C\83\93\83X\83^\83\93\83X\82ª\93ü\82é)
+ FContext: DWORD; // \83v\83\89\83O\83C\83\93\82ª\8e©\97R\82É\90Ý\92è\82µ\82Ä\82¢\82¢\92l(\8eå\82É\83C\83\93\83X\83^\83\93\83X\82ª\93ü\82é)
FNo: Integer; //\94Ô\8d\86
FTitle: string; //\83{\81[\83h\83^\83C\83g\83\8b
FLastGetTime: TDateTime; //\83X\83\8c\83b\83h\82Ü\82½\82Í\83X\83\8c\83b\83h\88ê\97\97\82ð\8dÅ\8cã\82É\8dX\90V\82µ\82½\93ú\8e\9e\81i\83T\81[\83o\91¤\93ú\8e\9e\81E\8f\91\82«\8d\9e\82Ý\8e\9e\82É\8eg\97p\82·\82é\81j
FIsThreadDatRead: Boolean; //\83X\83\8c\83b\83h\83\8a\83X\83g\82Í\93Ç\82Ý\8d\9e\82Ü\82ê\82Ä\82¢\82é\82©\81H
FUnRead: Integer; //\83X\83\8c\83b\83h\96¢\93Ç\90\94
- FParentCategory: TCategory; //\90e\83J\83e\83S\83\8a
+ FParentCategory: TCategory; //\90e\83J\83e\83S\83\8a
FModified: Boolean; //\8fC\90³\83t\83\89\83O
FBoolData: Boolean; //\82¢\82ë\82ñ\82È\97p\93r\82É\8eg\82¤yo
FSPID: string; //\8f\91\82«\8d\9e\82Ý\97pSPID
procedure Delete(index: integer);
procedure DeleteList(index: integer);
procedure Clear; override;
- function Find(ItemFileName: string): TThreadItem;
+ function FindThreadFromFileName(ItemFileName: string): TThreadItem;
function FindThreadFromURL( inURL : string ) : TThreadItem;
- function GetIndex(ItemFileName: string): Integer;
+ function GetIndexFromFileName(ItemFileName: string): Integer;
function GetIndexFromURL(URL: string): Integer;
procedure LoadSettings;
procedure SaveSettings;
Board := FindBBSID(BBSID);
if Board = nil then
Exit;
- Result := Board.Find(FileName);
+ Result := Board.FindThreadFromFileName(FileName);
end;
function TBBS.FindCategoryFromTitle( inTitle : string ) : TCategory;
function TCategory.GetBoard(index: integer): TBoard;
begin
- Result := TBoard(inherited Items[index]);
+ Result := TBoard( Objects[index] );
end;
procedure TCategory.SetBoard(index: integer; value: TBoard);
begin
- inherited Items[index] := value;
+ Objects[index] := value;
+ Strings[index] := value.URL
end;
function TCategory.Add(item: TBoard): integer;
begin
Item.ParentCategory := self;
- Result := inherited Add(item);
+ Result := AddObject( item.URL, item );
end;
procedure TCategory.Delete(index: integer);
begin
if Items[index] <> nil then
TBoard(Items[index]).Free;
- Items[index] := nil;
inherited Delete(index);
end;
var
i : Integer;
begin
- for i := Count - 1 downto 0 do begin
- if Pos( Items[i].URL, inURL ) = 1 then begin
- Result := Items[i];
- Exit;
- end;
- end;
- Result := nil;
+ i := IndexOf( inURL );
+ if i >= 0 then
+ Result := TBoard( Objects[ i ] )
+ else
+ Result := nil;
end;
//*************************************************************************
function TBoard.GetThreadItem(index: integer): TThreadItem;
begin
- Result := TThreadItem(inherited Items[index]);
+ Result := TThreadItem( Objects[index] );
end;
procedure TBoard.SetThreadItem(index: integer; value: TThreadItem);
begin
- inherited Items[index] := value;
+ Objects[index] := value;
+ Strings[index] := value.URL;
end;
function TBoard.Add(Item: TThreadItem): Integer;
begin
Item.ParentBoard := Self;
- Result := inherited Add(Item);
+ Result := inherited AddObject(Item.URL, Item);
end;
procedure TBoard.Insert(Index: Integer; Item: TThreadItem);
begin
Item.ParentBoard := Self;
- inherited Insert(Index, Item);
+ inherited InsertObject(Index, Item.URL, Item);
+
end;
//Index\82Å\8ew\92è\82³\82ê\82½\83X\83\8c\83b\83h\83I\83u\83W\83F\83N\83g\82ð\94j\8aü
begin
if Items[index] <> nil then
TThreadItem(Items[index]).Free;
- Items[index] := nil;
inherited Delete(index);
end;
// FUnRead := 0;
for i := Count - 1 downto 0 do
Delete(i);
- Capacity := Count;
+ Capacity := Count;
end;
-function TBoard.Find(ItemFileName: string): TThreadItem;
+function TBoard.FindThreadFromFileName(ItemFileName: string): TThreadItem;
var
i: integer;
begin
end;
end;
-function TBoard.GetIndex(ItemFileName: string): Integer;
+function TBoard.GetIndexFromFileName(ItemFileName: string): Integer;
var
i: integer;
begin
end;
function TBoard.GetIndexFromURL(URL: string): Integer;
-var
- i: integer;
begin
- Result := -1;
- for i := 0 to Count - 1 do begin
- if Pos( URL, Items[ i ].URL ) = 1 then begin
- Result := i;
- Exit;
- end;
- end;
+ Result := IndexOf( URL );
end;
function TBoard.FindThreadFromURL( inURL : string ) : TThreadItem;
if not IsThreadDatRead then
GikoSys.ReadSubjectFile( Self );
-
- for i := Count - 1 downto 0 do begin
- if Pos( inURL, Items[ i ].URL ) = 1 then begin
- Result := Items[ i ];
- Exit;
- end;
- end;
- Result := nil;
+
+ i := IndexOf( inURL );
+ if i >= 0 then
+ Result := TThreadItem( Objects[ i ] )
+ else
+ Result := nil;
end;
if (threadItem = nil) and GikoSys.Is2chHost( Host ) then begin
board := BBSs[ 0 ].FindBBSID( PathRec.FBBS );
if board <> nil then
- threadItem := board.Find( PathRec.FKey + '.dat' );
+ threadItem := board.FindThreadFromFileName( PathRec.FKey + '.dat' );
end;
wkCategory := TCategory( FActiveList );
Sort.SortOrder := FSortOrder;
Sort.SortIndex := Column.Index;
- wkCategory.Sort(BoardSortProc);
+ wkCategory.CustomSort(BoardSortProc);
ListView.Refresh;
//end else if TObject(TreeView.Selected.Data) is TBoard then begin
end else if TObject( FActiveList ) is TBoard then begin
wkBoard := TBoard( FActiveList );
Sort.SortOrder := FSortOrder;
Sort.SortIndex := Column.Index;
- wkBoard.Sort(ThreadItemSortProc);
+ wkBoard.CustomSort(ThreadItemSortProc);
ListView.Refresh;
end;
FSortIndex := Column.Index;
end;
end;
- ThreadItem := Board.Find( tmpThread.FileName );
+ ThreadItem := Board.FindThreadFromFileName( tmpThread.FileName );
if ThreadItem = nil then begin
ThreadItem := tmpThread;
Board.Insert( 0, ThreadItem );
ThreadItem := Board.FindThreadFromURL( URL );
//\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)
if ThreadItem = nil then begin
- ThreadItem := Board.Find( BBSKey + '.dat' );
+ ThreadItem := Board.FindThreadFromFileName( BBSKey + '.dat' );
end;
if ThreadItem = nil then begin
BoardGroup,DateUtils;
function CategorySortProc(Item1, Item2: Pointer): integer;
- function BoardSortProc(Item1, Item2: Pointer): integer;
- function ThreadItemSortProc(Item1, Item2: Pointer): integer;
+ function BoardSortProc(List: TStringList; Item1, Item2: Integer): integer;
+ function ThreadItemSortProc(List: TStringList; Item1, Item2: Integer): integer;
function CompareBool(Item1, Item2: Boolean): integer;
function CompareInt(Item1, Item2: Integer): Integer;
function CompareDate(Item1, Item2: TDateTime): Integer;
Result := Result * -1;
end;
-function BoardSortProc(Item1, Item2: Pointer): integer;
+function BoardSortProc(List: TStringList; Item1, Item2: Integer): integer;
var
BoardItem1: TBoard;
BoardItem2: TBoard;
begin
- BoardItem1 := TBoard(Item1);
- BoardItem2 := TBoard(Item2);
+ BoardItem1 := TBoard(List.Objects[Item1]);
+ BoardItem2 := TBoard(List.Objects[Item2]);
if SortIndex = 0 then
if SortNoFlag then
Result := CompareInt(BoardItem1.No, BoardItem2.No)
Result := Result * -1;
end;
-function ThreadItemSortProc(Item1, Item2: Pointer): integer;
+function ThreadItemSortProc(List: TStringList; Item1, Item2: Integer): integer;
var
ThreadItem1: TThreadItem;
ThreadItem2: TThreadItem;
begin
- ThreadItem1 := TThreadItem(Item1);
- ThreadItem2 := TThreadItem(Item2);
+ ThreadItem1 := TThreadItem(List.Objects[ Item1 ]);
+ ThreadItem2 := TThreadItem(List.Objects[ Item2 ]);
case SortIndex of
0:
begin