OSDN Git Service

・TBoard がプラグインを保持するようになった。
authoryoffy <yoffy>
Fri, 14 Nov 2003 19:03:03 +0000 (19:03 +0000)
committeryoffy <yoffy>
Fri, 14 Nov 2003 19:03:03 +0000 (19:03 +0000)
BoardGroup.pas

index e23081c..74317c3 100644 (file)
@@ -142,6 +142,8 @@ type
        //\94Â
        TBoard = class(TList)
        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é)
+
                FNo: Integer;                                                                   //\94Ô\8d\86
                FTitle: string;                                                         //\83{\81[\83h\83^\83C\83g\83\8b
                FBBSID: string;                                                         //BBSID
@@ -164,6 +166,10 @@ type
                FUpdate: Boolean;
                FExpand: Boolean;
 
+               FBoardPlugIn    : TBoardPlugIn; // \82±\82Ì\94Â\82ð\83T\83|\81[\83g\82·\82é\83v\83\89\83O\83C\83\93
+    FFilePath                  : string;                               // \82±\82Ì\83X\83\8c\88ê\97\97\82ª\95Û\91\82³\82ê\82Ä\82¢\82é\83p\83X
+               FIsLogFile              : Boolean;                      // \83\8d\83O\91\8dÝ\83t\83\89\83O
+
                function GetThreadItem(index: integer): TThreadItem;
                procedure SetThreadItem(index: integer; value: TThreadItem);
                procedure SetRound(b: Boolean);
@@ -174,9 +180,12 @@ type
                procedure SetKotehanName(s: string);
                procedure SetKotehanMail(s: string);
        public
-               constructor Create;
+               constructor Create; overload;
+               constructor Create( inPlugIn : TBoardPlugIn; inURL : string = '' ); overload;
                destructor Destroy; override;
 
+               property Context: DWORD read FContext write FContext;
+
                property Items[index: integer]: TThreadItem read GetThreadItem write SetThreadItem;
                property No: Integer read FNo write FNo;
                property Title: string read FTitle write FTitle;
@@ -192,6 +201,11 @@ type
                property IsThreadDatRead: Boolean read FIsThreadDatRead write FIsThreadDatRead;
                property ParentCategory: TCategory read FParentCategory write FParentCategory;
 
+               property        BoardPlugIn     : TBoardPlugIn  read FBoardPlugIn;
+    property   FilePath                : string                                read FFilePath write FFilePath;
+    property   IsLogFile               : Boolean                               read FIsLogFile write FIsLogFile;
+    function   IsBoardPlugInAvailable : Boolean;
+
                function Add(item: TThreadItem): integer;
                procedure Insert(Index: Integer; Item: TThreadItem);
                procedure Delete(index: integer);
@@ -311,6 +325,7 @@ type
                property        BoardPlugIn     : TBoardPlugIn  read FBoardPlugIn;
                property        FilePath                : string                                read FFilePath write FFilePath;
                property        SizeByte                : Integer                               read FSizeByte write FSizeByte;
+    function   IsBoardPlugInAvailable : Boolean;
        end;
 
 
@@ -466,7 +481,8 @@ end;
  *************************************************************************)
 procedure TBBS2ch.ReadBoardFile;
 var
-       i, j: integer;
+       i, j, k: integer;
+  kbound: Integer;
        idx: Integer;
        ini: TMemIniFile;
        CategoryList: TStringList;
@@ -501,13 +517,33 @@ begin
                                Category.Title := CategoryList[i];
 
                                for j := 0 to BoardList.Count - 1 do begin
+               Board := nil;
                                        inistr := ini.ReadString(CategoryList[i], BoardList[j], '');
-                                       Board := TBoard.Create;
+
+               //===== \83v\83\89\83O\83C\83\93
+          try
+            kbound := High( BoardPlugIns );
+            for k := Low( BoardPlugIns ) to kbound do begin
+              if Assigned( Pointer( BoardPlugIns[ k ].Module ) ) then begin
+                if BoardPlugIns[ k ].AcceptURL( inistr ) then begin
+                  Board := TBoard.Create( BoardPlugIns[ k ], inistr );
+
+                                                                       Break;
+                end;
+              end;
+            end;
+          except
+            // exception \82ª\94­\90\82µ\82½\8fê\8d\87\82Í\93à\95\94\8f\88\97\9d\82É\94C\82¹\82½\82¢\82Ì\82Å\82±\82±\82Å\82Í\89½\82à\82µ\82È\82¢
+          end;
+
+                                       if Board = nil then begin
+                                               Board := TBoard.Create;
+                                               Board.URL := inistr;
+          end;
                                        Board.BeginUpdate;
                                        Board.No := j + 1;
                                        Board.Title := BoardList[j];
                                        Board.BBSID := GikoSys.UrlToID(inistr);
-                                       Board.URL := inistr;
                                        Board.RoundDate := ZERO_DATE;
 
                                        idx := RoundList.Find(Board);
@@ -696,8 +732,32 @@ begin
 //     FItemNoVisible := True;
 
        FUpdate := True;
+
+  FBoardPlugIn := nil;
+end;
+
+// *************************************************************************
+// \8aO\95\94\94Â\83v\83\89\83O\83C\83\93\82ð\8ew\92è\82µ\82½\83R\83\93\83X\83g\83\89\83N\83^
+// *************************************************************************
+constructor TBoard.Create(
+       inPlugIn        : TBoardPlugIn;
+       inURL                   : string = ''
+);
+begin
+
+       Create;
+
+       FBoardPlugIn    := inPlugIn;
+       URL                                             := inURL;
+
+  // \83v\83\89\83O\83C\83\93\82É TBoardItem \82ª\8dì\90¬\82³\82ê\82½\82±\82Æ\82ð\93`\82¦\82é
+       inPlugIn.CreateBoardItem( DWORD( Self ) );
+
 end;
 
+// *************************************************************************
+// \83f\83X\83g\83\89\83N\83^
+// *************************************************************************
 destructor TBoard.Destroy;
 begin
        if FModified then begin
@@ -705,10 +765,35 @@ begin
                SaveSettings;
        end;
 
+  // \83v\83\89\83O\83C\83\93\82É TBoardItem \82ª\94j\8aü\82³\82ê\82½\82±\82Æ\82ð\93`\82¦\82é
+  if IsBoardPlugInAvailable then
+       BoardPlugIn.DisposeBoardItem( DWORD( Self ) );
+
        Clear;
        inherited;
 end;
 
+// *************************************************************************
+// \8aO\95\94\94Â\83v\83\89\83O\83C\83\93\82ª\8eg\97p\89Â\94\\82©
+// *************************************************************************
+function       TBoard.IsBoardPlugInAvailable : Boolean;
+begin
+
+       repeat
+    if BoardPlugIn = nil then
+      Break;
+      
+    if not Assigned( Pointer( BoardPlugIn.Module ) ) then
+      Break;
+
+    Result := True;
+    Exit;
+  until True;
+
+  Result := False;
+
+end;
+
 function TBoard.GetThreadItem(index: integer): TThreadItem;
 begin
        Result := TThreadItem(inherited Items[index]);
@@ -1177,16 +1262,44 @@ begin
        FBoardPlugIn    := inPlugIn;
        URL                                             := inURL;
 
+  // \83v\83\89\83O\83C\83\93\82É TThreadItem \82ª\8dì\90¬\82³\82ê\82½\82±\82Æ\82ð\93`\82¦\82é
        inPlugIn.CreateThreadItem( DWORD( Self ) );
 
 end;
 
+// *************************************************************************
+// \83f\83X\83g\83\89\83N\83^
+// *************************************************************************
 destructor TThreadItem.Destroy;
 begin
-       if Assigned( Pointer( FBoardPlugIn ) ) then
+
+       // \83v\83\89\83O\83C\83\93\82É TThreadItem \82ª\94j\8aü\82³\82ê\82½\82±\82Æ\82ð\93`\82¦\82é
+       if IsBoardPlugInAvailable then
                FBoardPlugIn.DisposeThreadItem( DWORD( Self ) );
 
        inherited;
+
+end;
+
+// *************************************************************************
+// \8aO\95\94\94Â\83v\83\89\83O\83C\83\93\82ª\8eg\97p\89Â\94\\82©
+// *************************************************************************
+function       TThreadItem.IsBoardPlugInAvailable : Boolean;
+begin
+
+       repeat
+    if BoardPlugIn = nil then
+      Break;
+
+    if not Assigned( Pointer( BoardPlugIn.Module ) ) then
+      Break;
+
+    Result := True;
+    Exit;
+  until True;
+
+  Result := False;
+
 end;
 
 function TThreadItem.GetDatURL: string;