From: yoffy Date: Fri, 28 Nov 2003 02:28:38 +0000 (+0000) Subject: ・板がない場合は IE で開くように変更。 X-Git-Tag: v1_64_1_820~1526 X-Git-Url: http://git.osdn.net/view?a=commitdiff_plain;h=76a721af3eea4f34f657d7015a6ff76ab846a278;p=gikonavigoeson%2Fgikonavi.git ・板がない場合は IE で開くように変更。 --- diff --git a/BoardGroup.pas b/BoardGroup.pas index aca137f..8bce471 100644 --- a/BoardGroup.pas +++ b/BoardGroup.pas @@ -96,6 +96,7 @@ type function FindBoardFromURL(inURL: string): TBoard; function FindThreadFromURL( inURL : string ) : TThreadItem; function FindThreadItem(BBSID: string; FileName: string): TThreadItem; + function FindCategoryFromTitle( inTitle : string ) : TCategory; function GetLogFolder: string; property Items[index: integer]: TCategory read GetCategory write SetCategory; @@ -580,6 +581,22 @@ begin Result := Board.Find(FileName); end; +function TBBS.FindCategoryFromTitle( inTitle : string ) : TCategory; +var + i : Integer; +begin + + for i := Count - 1 downto 0 do begin + if Items[ i ].Title = inTitle then begin + Result := Items[ i ]; + Exit; + end; + end; + + Result := nil; + +end; + (************************************************************************* *ƒƒOƒtƒHƒ‹ƒ_Žæ“¾ * @@ -1136,23 +1153,23 @@ var i: Integer; begin Result := 0; - if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then - begin - for i := 0 to Count - 1 do begin - if Items[i].NewArrival then - inc(Result); - end; - end else begin - for i := 0 to Count - 1 do begin - if Items[i].NewArrival then - begin - if Items[i].ShortTitle = '' then - Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title); - if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then - inc(Result); - end; - end; - end; + if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then + begin + for i := 0 to Count - 1 do begin + if Items[i].NewArrival then + inc(Result); + end; + end else begin + for i := 0 to Count - 1 do begin + if Items[i].NewArrival then + begin + if Items[i].ShortTitle = '' then + Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title); + if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then + inc(Result); + end; + end; + end; end; function TBoard.GetLogThreadCount: Integer; @@ -1160,23 +1177,23 @@ var i: Integer; begin Result := 0; - if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then - begin - for i := 0 to Count - 1 do begin - if Items[i].IsLogFile then - inc(Result); - end; - end else begin - for i := 0 to Count - 1 do begin - if Items[i].IsLogFile then - begin - if Items[i].ShortTitle = '' then - Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title); - if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then - inc(Result); - end; - end; - end; + if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then + begin + for i := 0 to Count - 1 do begin + if Items[i].IsLogFile then + inc(Result); + end; + end else begin + for i := 0 to Count - 1 do begin + if Items[i].IsLogFile then + begin + if Items[i].ShortTitle = '' then + Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title); + if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then + inc(Result); + end; + end; + end; end; function TBoard.GetUserThreadCount: Integer; @@ -1184,15 +1201,15 @@ var i: Integer; begin Result := 0; - if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then - Result := Count - else - for i := 0 to Count - 1 do begin - if Items[i].ShortTitle = '' then - Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title); - if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then - inc(Result); - end; + if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then + Result := Count + else + for i := 0 to Count - 1 do begin + if Items[i].ShortTitle = '' then + Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title); + if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then + inc(Result); + end; end; function TBoard.GetNewThread(Index: Integer): TThreadItem; @@ -1202,34 +1219,34 @@ var begin Result := nil; Cnt := 0; - if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then - begin - for i := 0 to Count - 1 do begin - if Items[i].NewArrival then - begin - if Index = Cnt then begin - Result := Items[i]; - Exit; - end; - inc(Cnt); - end; - end; - end else begin - for i := 0 to Count - 1 do begin - if Items[i].NewArrival then - begin - if Items[i].ShortTitle = '' then - Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title); - if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin - if Index = Cnt then begin - Result := Items[i]; - Exit; - end; - inc(Cnt); - end; - end; - end; - end; + if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then + begin + for i := 0 to Count - 1 do begin + if Items[i].NewArrival then + begin + if Index = Cnt then begin + Result := Items[i]; + Exit; + end; + inc(Cnt); + end; + end; + end else begin + for i := 0 to Count - 1 do begin + if Items[i].NewArrival then + begin + if Items[i].ShortTitle = '' then + Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title); + if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin + if Index = Cnt then begin + Result := Items[i]; + Exit; + end; + inc(Cnt); + end; + end; + end; + end; end; function TBoard.GetLogThread(Index: Integer): TThreadItem; @@ -1237,36 +1254,36 @@ var i: Integer; Cnt: Integer; begin - Cnt := 0; - if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then - begin - for i := 0 to Count - 1 do begin - if Items[i].IsLogFile then - begin - if Index = Cnt then begin - Result := Items[i]; - Exit; - end; - inc(Cnt); - end; - end; - end else begin - for i := 0 to Count - 1 do begin - if Items[i].IsLogFile then - begin - if Items[i].ShortTitle = '' then - Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title); - if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin - if Index = Cnt then begin - Result := Items[i]; - Exit; - end; - inc(Cnt); - end; - end; - end; - end; - Result := nil; + Cnt := 0; + if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then + begin + for i := 0 to Count - 1 do begin + if Items[i].IsLogFile then + begin + if Index = Cnt then begin + Result := Items[i]; + Exit; + end; + inc(Cnt); + end; + end; + end else begin + for i := 0 to Count - 1 do begin + if Items[i].IsLogFile then + begin + if Items[i].ShortTitle = '' then + Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title); + if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin + if Index = Cnt then begin + Result := Items[i]; + Exit; + end; + inc(Cnt); + end; + end; + end; + end; + Result := nil; end; function TBoard.GetUserThread(Index: Integer): TThreadItem; @@ -1276,28 +1293,28 @@ var begin Result := nil; Cnt := 0; - if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then - begin - for i := 0 to Count - 1 do begin - if Index = Cnt then - begin - Result := Items[ i ]; - Exit; - end; - inc( Cnt ); - end; - end else begin - for i := 0 to Count - 1 do begin - if Items[i].ShortTitle = '' then - Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title); - if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin - if Index = Cnt then begin - Result := Items[i]; - Exit; - end; - inc(Cnt); - end; - end; + if Length( ParentCategory.ParenTBBS.ShortSelectText ) = 0 then + begin + for i := 0 to Count - 1 do begin + if Index = Cnt then + begin + Result := Items[ i ]; + Exit; + end; + inc( Cnt ); + end; + end else begin + for i := 0 to Count - 1 do begin + if Items[i].ShortTitle = '' then + Items[i].ShortTitle := GikoSys.ZenToHan(Items[i].Title); + if AnsiPos(ParentCategory.ParenTBBS.ShortSelectText, Items[i].ShortTitle) <> 0 then begin + if Index = Cnt then begin + Result := Items[i]; + Exit; + end; + inc(Cnt); + end; + end; end; end; diff --git a/Favorite.pas b/Favorite.pas index 1603877..fec8939 100644 --- a/Favorite.pas +++ b/Favorite.pas @@ -105,14 +105,19 @@ begin end; function TFavoriteBoardItem.GetItem : TBoard; +var + category : TCategory; begin if FItem = nil then begin FItem := BBSsFindBoardFromURL( URL ); - // ‹ŒŽ®‚Ì‚¨‹C‚É“ü‚è‚Ƃ̌݊·«‚Ì‚½‚ß - if FItem = nil then + { + if FItem = nil then begin // ¦ì‚Á‚Ä‚àA’ljÁ‚·‚éƒJƒeƒSƒŠ‚ª–³‚¢‚Ì‚ÅŒƒ‚µ‚­•Û—¯ - FItem := TBoard.Create( nil, URL ); + FItem := GikoSys.GetUnknownBoard( nil, URL ); + FItem.Title := Title; + end; + } end; Result := FItem; @@ -154,8 +159,9 @@ begin board := BBSsFindBoardFromURL( boardURL ); if board = nil then + Exit // ¦ì‚Á‚Ä‚àA’ljÁ‚·‚éƒJƒeƒSƒŠ‚ª–³‚¢‚Ì‚ÅŒƒ‚µ‚­•Û—¯ - board := TBoard.Create( nil, boardURL ) + //board := GikoSys.GetUnknownBoard( nil, boardURL ) else FItem := board.FindThreadFromURL( URL ); diff --git a/Giko.pas b/Giko.pas index cddd459..90274a8 100644 --- a/Giko.pas +++ b/Giko.pas @@ -6225,30 +6225,14 @@ begin boardURL := tmpThread.BoardPlugIn.GetBoardURL( DWORD( tmpThread ) ); Board := BBSsFindBoardFromURL( boardURL ); if Board = nil then begin - Board := TBoard.Create( tmpThread.BoardPlugIn, boardURL ); - category := TCategory.Create; - category.Title := '(–¼Ì•s–¾)'; - category.Add( Board ); - // ¦Œƒ‚µ‚­•Û—¯’† - BBSs[ 0 ].Add( category ); - - if FTreeType = gtt2ch then begin - // ”ƒŠƒXƒg‚É“o˜^‚³‚ê‚Ä‚¢‚È‚¢‚̂ŃcƒŠ[‚ɒljÁ - // SetBoardTreeNode; 1 s‚ōς܂¹‚Ä‚à‚悵 - categoryNode := TreeView.Items.AddChild( - TreeView.Items.GetFirstNode, category.Title ); - categoryNode.Data := category; - categoryNode.ImageIndex := ITEM_ICON_CATEGORY1; - categoryNode.SelectedIndex := ITEM_ICON_CATEGORY2; - - Board.BeginUpdate; - boardNode := - TreeView.Items.AddChild( categoryNode, Board.Title ); - boardNode.Data := Board; - boardNode.ImageIndex := ITEM_ICON_BOARD1; - boardNode.SelectedIndex := ITEM_ICON_BOARD2; - Board.EndUpdate; - end; + // ¦ì‚Á‚Ä‚à’ljÁ‚·‚é‚Æ‚±‚낪–³‚¢‚Ì‚ÅŒƒ‚µ‚­•Û—¯ + GikoSys.OpenBrowser(URL, gbtUserApp); + Exit; + { + Board := GikoSys.GetUnknownBoard( tmpThread.BoardPlugIn, boardURL ); + if (FTreeType = gtt2ch) and (FActiveBBS = BBSs[ 1 ]) then + ShowBBSTree( BBSs[ 1 ] ); + } end else begin if not Board.IsThreadDatRead then GikoSys.ReadSubjectFile( Board ); @@ -6299,9 +6283,14 @@ begin Board := BBSsFindBoardFromURL( boardURL ); if Board = nil then Board := BBSsFindBoardFromBBSID( BBSID ); - if Board = nil then + if Board = nil then begin // ¦ì‚Á‚Ä‚à’ljÁ‚·‚é‚Æ‚±‚낪–³‚¢‚Ì‚ÅŒƒ‚µ‚­•Û—¯ - Board := TBoard.Create( nil, boardURL ); + GikoSys.OpenBrowser(URL, gbtUserApp); + Exit; + //Board := GikoSys.GetUnknownBoard( nil, boardURL ); + //if (FTreeType = gtt2ch) and (FActiveBBS = BBSs[ 1 ]) then + // ShowBBSTree( BBSs[ 1 ] ); + end; if not Board.IsThreadDatRead then GikoSys.ReadSubjectFile(Board); ThreadItem := Board.FindThreadFromURL( URL ); diff --git a/GikoSystem.pas b/GikoSystem.pas index 2a6b60e..ffc398b 100644 --- a/GikoSystem.pas +++ b/GikoSystem.pas @@ -14,7 +14,7 @@ uses {$IFEND} {HttpApp,} YofUtils, URLMon, IdGlobal, IdURI, {Masks,} Setting, BoardGroup, gzip, Dolib, bmRegExp, AbonUnit, - MojuUtils; + MojuUtils, ExternalBoardManager, ExternalBoardPlugInMain; type //BBSƒ^ƒCƒv @@ -189,6 +189,9 @@ type function Get2chBoard2ThreadURL( inBoard : TBoard; inKey : string ) : string; procedure ReadBoardFile; + function GetUnknownCategory : TCategory; + function GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard; + // ƒXƒLƒ“‚ð“ǂݍž‚݁A’l‚ð’uŠ·‚·‚é function LoadFromSkin( fileName: string; ThreadItem: TThreadItem; SizeByte: Integer ): string; // ƒŒƒX‚Ì’l‚ð’uŠ·‚·‚é @@ -210,7 +213,7 @@ const implementation uses - Giko, RoundData, ExternalBoardManager, ExternalBoardPlugInMain; + Giko, RoundData; const FOLDER_INDEX_VERSION = '1.01'; @@ -2921,6 +2924,46 @@ begin end; end; +function TGikoSys.GetUnknownCategory : TCategory; +const + UNKNOWN_CATEGORY = '(–¼Ì•s–¾)'; +begin + + if Length( BBSs ) < 2 then begin + Result := nil; + Exit; + end; + + Result := BBSs[ 1 ].FindCategoryFromTitle( UNKNOWN_CATEGORY ); + if Result = nil then begin + Result := TCategory.Create; + Result.Title := UNKNOWN_CATEGORY; + BBSs[ 1 ].Add( Result ); + end; + +end; + +function TGikoSys.GetUnknownBoard( inPlugIn : TBoardPlugIn; inURL : string ) : TBoard; +var + category : TCategory; +const + UNKNOWN_BOARD = '(–¼Ì•s–¾)'; +begin + + category := GetUnknownCategory; + if category = nil then begin + Result := nil; + end else begin + Result := category.FindBoardFromTitle( UNKNOWN_BOARD ); + if Result = nil then begin + Result := TBoard.Create( inPlugIn, inURL ); + Result.Title := UNKNOWN_BOARD; + category.Add( Result ); + end; + end; + +end; + initialization GikoSys := TGikoSys.Create;