| 1105 |
{ Public 宣言 } |
{ Public 宣言 } |
| 1106 |
// FDownload: TDownload; |
// FDownload: TDownload; |
| 1107 |
FControlThread: TThreadControl; |
FControlThread: TThreadControl; |
| 1108 |
procedure MoveToURL(URL: string); |
procedure MoveToURL(const inURL: string); |
| 1109 |
procedure InsertBrowserTab(ThreadItem: TThreadItem; ActiveTab: Boolean = True); |
function InsertBrowserTab( |
| 1110 |
|
ThreadItem : TThreadItem; |
| 1111 |
|
ActiveTab : Boolean = True |
| 1112 |
|
) : TBrowserRecord; |
| 1113 |
procedure ReloadBBS; |
procedure ReloadBBS; |
| 1114 |
function GetHttpState: Boolean; |
function GetHttpState: Boolean; |
| 1115 |
procedure SetEnabledCloseButton(Enabled: Boolean); |
procedure SetEnabledCloseButton(Enabled: Boolean); |
| 1194 |
TBrowserRecord = class( TObject ) |
TBrowserRecord = class( TObject ) |
| 1195 |
private |
private |
| 1196 |
FBrowser : TWebBrowser; |
FBrowser : TWebBrowser; |
| 1197 |
FEvent: THTMLDocumentEventSink;//ブラウザドキュメントイベント |
FEvent: THTMLDocumentEventSink; //!< ブラウザドキュメントイベント |
| 1198 |
FThread : TThreadItem; |
FThread : TThreadItem; |
| 1199 |
FLastSize : Integer; |
FLastSize : Integer; |
| 1200 |
FRepaint : Boolean; |
FRepaint : Boolean; |
| 1201 |
// FOnlyHundred: Boolean; |
FMovement : string; //!< スクロール先アンカー |
| 1202 |
public |
public |
| 1203 |
destructor Destroy; override; |
destructor Destroy; override; |
| 1204 |
property Browser : TWebBrowser read FBrowser write FBrowser; |
property Browser : TWebBrowser read FBrowser write FBrowser; |
| 1205 |
property Thread : TThreadItem read FThread write FThread; |
property Thread : TThreadItem read FThread write FThread; |
| 1206 |
property LastSize : Integer read FLastSize write FLastSize; |
property LastSize : Integer read FLastSize write FLastSize; |
| 1207 |
property Repaint : Boolean read FRepaint write FRepaint; |
property Repaint : Boolean read FRepaint write FRepaint; |
| 1208 |
// property OnlyHundred : Boolean read FOnlyHundred write FOnlyHundred; |
property Movement : string read FMovement write FMovement; |
| 1209 |
end; |
end; |
| 1210 |
|
|
| 1211 |
var |
var |
| 3439 |
s: string; |
s: string; |
| 3440 |
boardPlugIn : TBoardPlugIn; |
boardPlugIn : TBoardPlugIn; |
| 3441 |
i: Integer; |
i: Integer; |
| 3442 |
|
browserRec : TBrowserRecord; |
| 3443 |
begin |
begin |
| 3444 |
try |
try |
| 3445 |
if Item.DownType = gdtBoard then |
if Item.DownType = gdtBoard then |
| 3481 |
end; |
end; |
| 3482 |
if GikoSys.Setting.BrowserTabVisible then begin |
if GikoSys.Setting.BrowserTabVisible then begin |
| 3483 |
if GetActiveContent = Item.ThreadItem then |
if GetActiveContent = Item.ThreadItem then |
| 3484 |
InsertBrowserTab(Item.ThreadItem) |
browserRec := InsertBrowserTab(Item.ThreadItem) |
| 3485 |
else if (ListView.Selected <> nil ) and ( TObject(ListView.Selected.Data) is TThreadItem ) and ( Item.ThreadItem = TThreadItem(ListView.Selected.Data)) then |
else if (ListView.Selected <> nil ) and ( TObject(ListView.Selected.Data) is TThreadItem ) and ( Item.ThreadItem = TThreadItem(ListView.Selected.Data)) then |
| 3486 |
InsertBrowserTab(Item.ThreadItem, True) |
browserRec := InsertBrowserTab(Item.ThreadItem, True) |
| 3487 |
else |
else |
| 3488 |
InsertBrowserTab(Item.ThreadItem, False); |
browserRec := InsertBrowserTab(Item.ThreadItem, False); |
| 3489 |
|
if browserRec.Thread = BrowserNullTab.Thread then begin |
| 3490 |
|
browserRec.Movement := BrowserNullTab.Movement; |
| 3491 |
|
BrowserNullTab.Movement := ''; |
| 3492 |
|
end; |
| 3493 |
end else begin |
end else begin |
| 3494 |
if (GetActiveContent = Item.ThreadItem) or (FActiveContent = nil) or(FActiveContent.Browser = BrowserNullTab.Browser) then |
if (GetActiveContent = Item.ThreadItem) or (FActiveContent = nil) or(FActiveContent.Browser = BrowserNullTab.Browser) then |
| 3495 |
InsertBrowserTab(Item.ThreadItem); |
InsertBrowserTab(Item.ThreadItem); |
| 3622 |
end; |
end; |
| 3623 |
end;} |
end;} |
| 3624 |
|
|
| 3625 |
procedure TGikoForm.InsertBrowserTab(ThreadItem: TThreadItem; ActiveTab: Boolean = True); |
function TGikoForm.InsertBrowserTab( |
| 3626 |
|
ThreadItem : TThreadItem; |
| 3627 |
|
ActiveTab : Boolean = True |
| 3628 |
|
) : TBrowserRecord; |
| 3629 |
var |
var |
| 3630 |
i, j, idx: Integer; |
i, j, idx : Integer; |
| 3631 |
favItem : TFavoriteThreadItem; |
favItem : TFavoriteThreadItem; |
| 3632 |
newBrowser : TBrowserRecord; |
newBrowser : TBrowserRecord; |
| 3633 |
begin |
begin |
| 3634 |
|
|
| 3635 |
|
Result := nil; |
| 3636 |
if Threaditem = nil then Exit; |
if Threaditem = nil then Exit; |
| 3637 |
|
|
| 3638 |
if ThreadItem.IsLogFile then begin |
if ThreadItem.IsLogFile then begin |
| 3651 |
for i := 0 to BrowserTab.Tabs.Count - 1 do begin |
for i := 0 to BrowserTab.Tabs.Count - 1 do begin |
| 3652 |
if TObject(BrowserTab.Tabs.Objects[i]) is TBrowserRecord then begin |
if TObject(BrowserTab.Tabs.Objects[i]) is TBrowserRecord then begin |
| 3653 |
if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread = ThreadItem then begin |
if TBrowserRecord(BrowserTab.Tabs.Objects[i]).Thread = ThreadItem then begin |
| 3654 |
|
Result := TBrowserRecord( BrowserTab.Tabs.Objects[j] ); |
| 3655 |
if TBrowserRecord(BrowserTab.Tabs.Objects[i]).FBrowser = nil then begin |
if TBrowserRecord(BrowserTab.Tabs.Objects[i]).FBrowser = nil then begin |
| 3656 |
for j := BrowserTab.Tabs.Count - 1 downto 0 do begin |
for j := BrowserTab.Tabs.Count - 1 downto 0 do begin |
| 3657 |
if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FBrowser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin |
if TBrowserRecord(BrowserTab.Tabs.Objects[j]).FBrowser = TWebBrowser(FBrowsers[BROWSER_COUNT - 1]) then begin |
| 3738 |
BrowserTab.TabIndex := i; |
BrowserTab.TabIndex := i; |
| 3739 |
end; |
end; |
| 3740 |
end; |
end; |
| 3741 |
|
Result := newBrowser; |
| 3742 |
if(ActiveTab) or (idx = -1) then begin |
if(ActiveTab) or (idx = -1) then begin |
| 3743 |
BrowserTab.OnChange(nil); |
BrowserTab.OnChange(nil); |
| 3744 |
end; |
end; |
| 3748 |
BrowserNullTab.Browser := Browser; |
BrowserNullTab.Browser := Browser; |
| 3749 |
end; |
end; |
| 3750 |
BrowserNullTab.thread := ThreadItem; |
BrowserNullTab.thread := ThreadItem; |
| 3751 |
|
Result := BrowserNullTab; |
| 3752 |
BrowserTab.TabIndex := -1; |
BrowserTab.TabIndex := -1; |
| 3753 |
SetContent(BrowserNullTab); |
SetContent(BrowserNullTab); |
| 3754 |
end; |
end; |
| 6668 |
Assigned( BrowserRecord.Thread ) then begin |
Assigned( BrowserRecord.Thread ) then begin |
| 6669 |
threadItem := BrowserRecord.Thread; |
threadItem := BrowserRecord.Thread; |
| 6670 |
|
|
| 6671 |
if threadItem.UnRead then begin |
if (BrowserRecord <> nil) and (Length( BrowserRecord.Movement ) > 0) then begin |
| 6672 |
|
BrowserMovement( BrowserRecord.Movement, BrowserRecord ); |
| 6673 |
|
BrowserRecord.Movement := ''; |
| 6674 |
|
end else if threadItem.UnRead then begin |
| 6675 |
threadItem.UnRead := False; |
threadItem.UnRead := False; |
| 6676 |
BrowserMovement( 'new', BrowserRecord ); |
BrowserMovement( 'new', BrowserRecord ); |
| 6677 |
ListView.Refresh; |
ListView.Refresh; |
| 7458 |
end; |
end; |
| 7459 |
end; |
end; |
| 7460 |
|
|
| 7461 |
procedure TGikoForm.MoveToURL(URL: string); |
procedure TGikoForm.MoveToURL(const inURL: string); |
| 7462 |
var |
var |
| 7463 |
protocol, host, path, document, port, bookmark : string; |
protocol, host, path, document, port, bookmark : string; |
| 7464 |
URL2, protocol2, host2, path2, document2, port2, bookmark2 : string; |
URL, protocol2, host2, path2, document2, port2, bookmark2 : string; |
| 7465 |
tmp1, tmp2: string; |
tmp1, tmp2: string; |
| 7466 |
BBSID, BBSKey: string; |
BBSID, BBSKey: string; |
| 7467 |
tmpBoard, Board: TBoard; |
tmpBoard, Board: TBoard; |
| 7474 |
// boardNode : TTreeNode; |
// boardNode : TTreeNode; |
| 7475 |
shiftDown : Boolean; |
shiftDown : Boolean; |
| 7476 |
ctrlDown : Boolean; |
ctrlDown : Boolean; |
| 7477 |
|
stRes, edRes : Int64; |
| 7478 |
|
browserRec : TBrowserRecord; |
| 7479 |
begin |
begin |
| 7480 |
|
|
| 7481 |
GikoSys.ParseURI( URL, protocol, host, path, document, port, bookmark ); |
GikoSys.ParseURI( inURL, protocol, host, path, document, port, bookmark ); |
| 7482 |
GikoSys.Parse2chURL( URL, path, document, BBSID, BBSKey ); |
GikoSys.Parse2chURL( inURL, path, document, BBSID, BBSKey ); |
| 7483 |
|
|
| 7484 |
|
|
| 7485 |
shiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001); |
shiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001); |
| 7486 |
ctrlDown := GetAsyncKeyState(VK_CONTROL) = Smallint($8001); |
ctrlDown := GetAsyncKeyState(VK_CONTROL) = Smallint($8001); |
| 7487 |
if shiftDown then begin |
if shiftDown then begin |
| 7488 |
GikoSys.OpenBrowser(URL, gbtUserApp); |
GikoSys.OpenBrowser(inURL, gbtUserApp); |
| 7489 |
Exit; |
Exit; |
| 7490 |
end else if ctrlDown then begin |
end else if ctrlDown then begin |
| 7491 |
GikoSys.OpenBrowser(URL, gbtIE); |
GikoSys.OpenBrowser(inURL, gbtIE); |
| 7492 |
Exit; |
Exit; |
| 7493 |
end; |
end; |
| 7494 |
|
|
| 7498 |
bi := High( BoardPlugIns ); |
bi := High( BoardPlugIns ); |
| 7499 |
for i := Low( BoardPlugIns ) to bi do begin |
for i := Low( BoardPlugIns ) to bi do begin |
| 7500 |
if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin |
if Assigned( Pointer( BoardPlugIns[ i ].Module ) ) then begin |
| 7501 |
case BoardPlugIns[ i ].AcceptURL( URL ) of |
case BoardPlugIns[ i ].AcceptURL( inURL ) of |
| 7502 |
atThread: |
atThread: |
| 7503 |
begin |
begin |
| 7504 |
tmpThread := TThreadItem.Create( BoardPlugIns[ i ], URL ); |
tmpThread := TThreadItem.Create( BoardPlugIns[ i ], inURL ); |
| 7505 |
boardURL := tmpThread.BoardPlugIn.GetBoardURL( DWORD( tmpThread ) ); |
boardURL := tmpThread.BoardPlugIn.GetBoardURL( DWORD( tmpThread ) ); |
| 7506 |
Board := BBSsFindBoardFromURL( boardURL ); |
Board := BBSsFindBoardFromURL( boardURL ); |
| 7507 |
if Board = nil then begin |
if Board = nil then begin |
| 7508 |
// ※作っても追加するところが無いので激しく保留 |
// ※作っても追加するところが無いので激しく保留 |
| 7509 |
//GikoSys.OpenBrowser(URL, gbtUserApp); |
//GikoSys.OpenBrowser(inURL, gbtUserApp); |
| 7510 |
//Exit; |
//Exit; |
| 7511 |
{ |
{ |
| 7512 |
Board := GikoSys.GetUnknownBoard( tmpThread.BoardPlugIn, boardURL ); |
Board := GikoSys.GetUnknownBoard( tmpThread.BoardPlugIn, boardURL ); |
| 7528 |
if TBoard(ActiveList) = Board then |
if TBoard(ActiveList) = Board then |
| 7529 |
ListView.Items.Count := ListView.Items.Count + 1; |
ListView.Items.Count := ListView.Items.Count + 1; |
| 7530 |
end; |
end; |
| 7531 |
InsertBrowserTab( ThreadItem ); |
GikoSys.GetPopupResNumber( inURL, stRes, edRes ); |
| 7532 |
|
browserRec := InsertBrowserTab( ThreadItem ); |
| 7533 |
|
if (browserRec <> nil) and (stRes > 0) then |
| 7534 |
|
browserRec.Movement := IntToStr( stRes ); |
| 7535 |
DownloadContent( ThreadItem ); |
DownloadContent( ThreadItem ); |
| 7536 |
Exit; |
Exit; |
| 7537 |
end else begin |
end else begin |
| 7538 |
tmpThread.Free; |
tmpThread.Free; |
| 7539 |
InsertBrowserTab( ThreadItem ); |
GikoSys.GetPopupResNumber( inURL, stRes, edRes ); |
| 7540 |
if not ThreadItem.IsLogFile then begin |
browserRec := InsertBrowserTab( ThreadItem ); |
| 7541 |
|
if ThreadItem.IsLogFile then begin |
| 7542 |
|
if (browserRec <> nil) and (stRes > 0) then |
| 7543 |
|
BrowserMovement( IntToStr( stRes ), browserRec ); |
| 7544 |
|
end else begin |
| 7545 |
|
if (browserRec <> nil) and (stRes > 0) then |
| 7546 |
|
browserRec.Movement := IntToStr( stRes ); |
| 7547 |
DownloadContent( ThreadItem ); |
DownloadContent( ThreadItem ); |
| 7548 |
end; |
end; |
| 7549 |
Exit; |
Exit; |
| 7554 |
|
|
| 7555 |
atBoard: |
atBoard: |
| 7556 |
begin |
begin |
| 7557 |
tmpBoard := TBoard.Create(BoardPlugIns[ i ], URL); |
tmpBoard := TBoard.Create(BoardPlugIns[ i ], inURL); |
| 7558 |
Board := BBSsFindBoardFromURL( tmpBoard.URL ); |
Board := BBSsFindBoardFromURL( tmpBoard.URL ); |
| 7559 |
tmpBoard.Free; |
tmpBoard.Free; |
| 7560 |
if Board <> nil then begin |
if Board <> nil then begin |
| 7573 |
|
|
| 7574 |
|
|
| 7575 |
if (Length( Trim(BBSKey) ) > 0) and (Length( Trim(BBSID) ) > 0) then begin |
if (Length( Trim(BBSKey) ) > 0) and (Length( Trim(BBSID) ) > 0) then begin |
| 7576 |
boardURL := GikoSys.Get2chThreadURL2BoardURL( URL ); |
boardURL := GikoSys.Get2chThreadURL2BoardURL( inURL ); |
| 7577 |
Board := BBSsFindBoardFromURL( boardURL ); |
Board := BBSsFindBoardFromURL( boardURL ); |
| 7578 |
if Board = nil then |
if Board = nil then |
| 7579 |
Board := BBSsFindBoardFromBBSID( BBSID ); |
Board := BBSsFindBoardFromBBSID( BBSID ); |
| 7585 |
end; |
end; |
| 7586 |
if Board = nil then begin |
if Board = nil then begin |
| 7587 |
// 入るべき板が見つからなかったので、普通のブラウザで開く |
// 入るべき板が見つからなかったので、普通のブラウザで開く |
| 7588 |
GikoSys.OpenBrowser(URL, gbtUserApp); |
GikoSys.OpenBrowser(inURL, gbtUserApp); |
| 7589 |
Exit; |
Exit; |
| 7590 |
end else begin |
end else begin |
| 7591 |
// 外部の板なのに2chのURLにされてしまった奴をここで確認する |
// 外部の板なのに2chのURLにされてしまった奴をここで確認する |
| 7592 |
URL2 := Board.URL; |
URL := Board.URL; |
| 7593 |
GikoSys.ParseURI(URL2 , protocol2, host2, path2, document2, port2, bookmark2 ); |
GikoSys.ParseURI(URL , protocol2, host2, path2, document2, port2, bookmark2 ); |
| 7594 |
tmp1 := Copy(host, AnsiPos('.', host) + 1, Length(host)); |
tmp1 := Copy(host, AnsiPos('.', host) + 1, Length(host)); |
| 7595 |
tmp2 := Copy(host2, AnsiPos('.', host2) + 1, Length(host2)); |
tmp2 := Copy(host2, AnsiPos('.', host2) + 1, Length(host2)); |
| 7596 |
if ( not GikoSys.Is2chHost(tmp1)) and (tmp1 <> tmp2) then begin |
if ( not GikoSys.Is2chHost(tmp1)) and (tmp1 <> tmp2) then begin |
| 7597 |
GikoSys.OpenBrowser(URL, gbtUserApp); |
GikoSys.OpenBrowser(inURL, gbtUserApp); |
| 7598 |
Exit; |
Exit; |
| 7599 |
end; |
end; |
| 7600 |
end; |
end; |
| 7601 |
|
|
| 7602 |
if not Board.IsThreadDatRead then |
if not Board.IsThreadDatRead then |
| 7603 |
GikoSys.ReadSubjectFile(Board); |
GikoSys.ReadSubjectFile(Board); |
| 7604 |
URL := GikoSys.Get2chBrowsableThreadURL( URL ); |
URL := GikoSys.Get2chBrowsableThreadURL( inURL ); |
| 7605 |
ThreadItem := Board.FindThreadFromURL( URL ); |
ThreadItem := Board.FindThreadFromURL( URL ); |
| 7606 |
// 過去ログ倉庫から、ダウソしたスレが発見できないのでここで探すようにする (2004/01/22) |
// 過去ログ倉庫から、ダウソしたスレが発見できないのでここで探すようにする (2004/01/22) |
| 7607 |
if ThreadItem = nil then begin |
if ThreadItem = nil then begin |
| 7614 |
{shiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001); |
{shiftDown := GetAsyncKeyState(VK_SHIFT) = Smallint($8001); |
| 7615 |
ctrlDown := GetAsyncKeyState(VK_CONTROL) = Smallint($8001); |
ctrlDown := GetAsyncKeyState(VK_CONTROL) = Smallint($8001); |
| 7616 |
if shiftDown then |
if shiftDown then |
| 7617 |
GikoSys.OpenBrowser(URL, gbtUserApp) |
GikoSys.OpenBrowser(URL1, gbtUserApp) |
| 7618 |
else if ctrlDown then |
else if ctrlDown then |
| 7619 |
GikoSys.OpenBrowser(URL, gbtIE) |
GikoSys.OpenBrowser(URL1, gbtIE) |
| 7620 |
else begin |
else begin |
| 7621 |
} |
} |
| 7622 |
ThreadItem := TThreadItem.Create( nil, URL ); |
ThreadItem := TThreadItem.Create( nil, URL ); |
| 7630 |
if TBoard(ActiveList) = Board then |
if TBoard(ActiveList) = Board then |
| 7631 |
ListView.Items.Count := ListView.Items.Count + 1; |
ListView.Items.Count := ListView.Items.Count + 1; |
| 7632 |
end; |
end; |
| 7633 |
InsertBrowserTab(ThreadItem); |
GikoSys.GetPopupResNumber( inURL, stRes, edRes ); |
| 7634 |
|
browserRec := InsertBrowserTab(ThreadItem); |
| 7635 |
|
if (browserRec <> nil) and (stRes > 0) then |
| 7636 |
|
browserRec.Movement := IntToStr( stRes ); |
| 7637 |
DownloadContent(ThreadItem); |
DownloadContent(ThreadItem); |
| 7638 |
{end;} |
{end;} |
| 7639 |
end else begin |
end else begin |
| 7640 |
if ThreadItem.IsLogFile then |
if ThreadItem.IsLogFile then begin |
| 7641 |
InsertBrowserTab(ThreadItem) |
GikoSys.GetPopupResNumber( inURL, stRes, edRes ); |
| 7642 |
else begin |
browserRec := InsertBrowserTab(ThreadItem); |
| 7643 |
|
if (browserRec <> nil) and (stRes > 0) then |
| 7644 |
|
browserRec.Movement := IntToStr( stRes ); |
| 7645 |
|
end else begin |
| 7646 |
if AnsiPos(Host, Board.URL) = 0 then |
if AnsiPos(Host, Board.URL) = 0 then |
| 7647 |
ThreadItem.DownloadHost := Host |
ThreadItem.DownloadHost := Host |
| 7648 |
else |
else |
| 7649 |
ThreadItem.DownloadHost := ''; |
ThreadItem.DownloadHost := ''; |
| 7650 |
InsertBrowserTab(ThreadItem); |
GikoSys.GetPopupResNumber( inURL, stRes, edRes ); |
| 7651 |
|
browserRec := InsertBrowserTab(ThreadItem); |
| 7652 |
|
if (browserRec <> nil) and (stRes > 0) then |
| 7653 |
|
browserRec.Movement := IntToStr( stRes ); |
| 7654 |
DownloadContent(ThreadItem); |
DownloadContent(ThreadItem); |
| 7655 |
end; |
end; |
| 7656 |
end; |
end; |
| 7657 |
end else begin |
end else begin |
| 7658 |
Board := BBSsFindBoardFromURL( URL ); |
Board := BBSsFindBoardFromURL( inURL ); |
| 7659 |
if Board = nil then begin |
if Board = nil then begin |
| 7660 |
GikoSys.OpenBrowser(URL, gbtAuto); |
GikoSys.OpenBrowser(inURL, gbtAuto); |
| 7661 |
end else begin |
end else begin |
| 7662 |
if FActiveBBS <> Board.ParentCategory.ParenTBBS then |
if FActiveBBS <> Board.ParentCategory.ParenTBBS then |
| 7663 |
ShowBBSTree( Board.ParentCategory.ParenTBBS ); |
ShowBBSTree( Board.ParentCategory.ParenTBBS ); |