From 9d21a895eb2f4845da71c180ae140bc06282a0d8 Mon Sep 17 00:00:00 2001 From: h677 Date: Sun, 27 Nov 2005 16:40:05 +0000 Subject: [PATCH] =?utf8?q?BrowserRecord=E9=96=A2=E4=BF=82=E3=81=AE?= =?utf8?q?=E3=83=A1=E3=82=BD=E3=83=83=E3=83=89=E3=82=92=E7=A7=BB=E5=8B=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- BrowserRecord.pas | 78 +++++++++++++++++++++++++++++++++- Giko.pas | 121 +++++++---------------------------------------------- GikoDataModule.pas | 8 ++-- 3 files changed, 96 insertions(+), 111 deletions(-) diff --git a/BrowserRecord.pas b/BrowserRecord.pas index ab6ee16..d03170e 100644 --- a/BrowserRecord.pas +++ b/BrowserRecord.pas @@ -30,11 +30,17 @@ type property LastSize : Integer read FLastSize write FLastSize; property Repaint : Boolean read FRepaint write FRepaint; property Movement : string read FMovement write FMovement; + procedure Move(const AName: string); + procedure IDAnchorPopup(Abody :string); end; // BrowserRecord‚ɂ‚¢‚Ä‚¢‚éFBrowser‚ðŠO‚· procedure ReleaseBrowser( BRecord: TBrowserRecord); implementation + +uses + Forms, SysUtils; + // ************************************************************************* //! BrowserRecord‚ɂ‚¢‚Ä‚¢‚éFBrowser‚ðŠO‚· // ************************************************************************* @@ -67,11 +73,81 @@ begin Self.Thread.ScrollTop := doc.Body.ScrollTop; end; end; - //TOleControl(Self.FBrowser).Visible := false; ShowWindow(Self.FBrowser.Handle, SW_HIDE); end; end; +// ************************************************************************* +//! ƒuƒ‰ƒEƒU‚ðƒXƒNƒ[ƒ‹‚³‚¹‚é +// ************************************************************************* +procedure TBrowserRecord.Move(const AName: string); +var + top: Integer; + item: OleVariant; +begin + //ƒuƒ‰ƒEƒU‚ª•t‚¢‚Ä‚é‚Æ‚«‚¾‚¯ˆ—‚·‚é + if (Self.Browser <> nil) then begin + //ƒuƒ‰ƒEƒU‚ªƒf[ƒ^‚̓ǂݍž‚Ý’†‚ÌŽž‚͓ǂݍž‚Ý‚ð‘Ò‚Â + while (Self.Browser.ReadyState <> READYSTATE_COMPLETE) and + (Self.Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin + Sleep(1); + Application.ProcessMessages; + end; + + try + top := 0; + item := OleVariant( Self.Browser.Document as IHTMLDocument2) + .anchors.item(OleVariant(AName)); + item.focus(); + repeat + top := top + item.offsetTop; + item := item.offsetParent; + until AnsiCompareText(item.tagName, 'body' ) = 0; + OleVariant(Self.Browser.Document as IHTMLDocument2).body.scrollTop := top; + except + end; + end; +end; +//IDƒAƒ“ƒJ[’ljÁ +procedure TBrowserRecord.IDAnchorPopup(Abody :string); +const + OUTER_HTML = '

'; + HIDDEN = 'hidden'; +var + firstElement: IHTMLElement; + document: IHTMLDocument2; + docAll: IHTMLElementCollection; + doc : Variant; + nCSS : string; +begin + if Self.Browser <> nil then begin + try + document := Self.Browser.Document as IHTMLDocument2; + + if Assigned(document) then begin + docAll := document.all; + firstElement := docAll.item('idSearch', 0) as IHTMLElement; + if (Assigned(firstElement)) then begin + if Length(Abody) > 0 then begin + doc := Idispatch( olevariant(Self.Browser.ControlInterface).Document) as IHTMLDocument2; + nCSS := '

' + + Abody + '

'; + firstElement.outerHTML := nCSS; + firstElement.style.visibility := 'visible'; + end else begin + firstElement.outerHTML := OUTER_HTML; + firstElement.style.visibility := HIDDEN; + end; + end else if (Assigned(firstElement)) then begin + firstElement.outerHTML := OUTER_HTML; + firstElement.style.visibility := HIDDEN; + end; + end; + except + end; + end; +end; end. diff --git a/Giko.pas b/Giko.pas index 5bfd2a5..33956dd 100644 --- a/Giko.pas +++ b/Giko.pas @@ -741,8 +741,6 @@ type procedure IndividualAbonID(Atype : Integer); //‚±‚̃ŒƒX‚ ‚ځ`‚ñ procedure IndividualAbon(Atag, Atype : Integer); - //IDƒAƒ“ƒJ[’ljÁ - procedure IDAnchorPopup(Abody :string); //ƒuƒ‰ƒEƒU‚̍ĕ`‰æ true:‘S‚Ẵ^ƒu false:ƒAƒNƒeƒBƒu‚ȃ^ƒu‚Ì‚Ý procedure RepaintAllTabsBrowser(); //ƒŠƒ“ƒNƒo[Ý’è @@ -758,9 +756,7 @@ type procedure DeleteTab(ThreadItem: TThreadItem); overload; procedure DeleteTab(BrowserRecord: TBrowserRecord); overload; //Œ»Ý•\Ž¦‚µ‚Ä‚¢‚éƒXƒŒƒbƒh‚ðƒXƒNƒ[ƒ‹ - procedure BrowserMovement(const AName: string); overload; - //Žw’肵‚½ƒuƒ‰ƒEƒU‚ðƒXƒNƒ[ƒ‹ - procedure BrowserMovement(const AName: string; BrowserRecord: TBrowserRecord); overload; + procedure BrowserMovement(const AName: string); //Application‚ÌMainForm‚ðŽæ“¾‚·‚é function GetMainForm(): TComponent; procedure SelectTreeNode(Item: TObject; CallEvent: Boolean); @@ -3489,61 +3485,13 @@ begin end; end; end; -procedure TGikoForm.BrowserMovement(const AName: string; BrowserRecord: TBrowserRecord); -var - top: Integer; - item: OleVariant; - nm: OleVariant; - activeBrower :TWebBrowser; -begin - // - while (BrowserRecord.Browser.ReadyState <> READYSTATE_COMPLETE) and - (BrowserRecord.Browser.ReadyState <> READYSTATE_INTERACTIVE) do begin - Sleep(1); - Application.ProcessMessages; - end; - - // Access Violation ‚ª‹N‚«‚鎖‚ª‚ ‚é‚̂ō¡Œã—vƒ`ƒFƒbƒN - if(BrowserRecord <> nil) and (BrowserRecord.Browser <> nil) then begin - activeBrower := BrowserRecord.Browser; - try - top := 0; - nm := AName; - item := OleVariant( activeBrower.Document as IHTMLDocument2).anchors.item(nm); - item.focus(); - repeat - top := top + item.offsetTop; - item := item.offsetParent; - until AnsiCompareText(item.tagName, 'body' ) = 0; - OleVariant(activeBrower.Document as IHTMLDocument2).body.scrollTop := top; - except - end; - end; -end; procedure TGikoForm.BrowserMovement(const AName: string); -var - top: Integer; - item: OleVariant; - nm: OleVariant; - activeBrower :TWebBrowser; begin // Access Violation ‚ª‹N‚«‚鎖‚ª‚ ‚é‚̂ō¡Œã—vƒ`ƒFƒbƒN - if(BrowserTab.Tabs.Count > 0) and (BrowserTab.TabIndex >= 0) then begin - activeBrower := FActiveContent.Browser; - try - top := 0; - nm := AName; - item := OleVariant( activeBrower.Document as IHTMLDocument2).anchors.item(nm); - item.focus(); - repeat - top := top + item.offsetTop; - item := item.offsetParent; - until AnsiCompareText(item.tagName, 'body' ) = 0; - - OleVariant(activeBrower.Document as IHTMLDocument2).body.scrollTop := top; - except - end; + if(BrowserTab.Tabs.Count > 0) and (BrowserTab.TabIndex >= 0) + and (FActiveContent <> nil) then begin + FActiveContent.Move(AName); end; end; @@ -3871,7 +3819,7 @@ begin if(AnsiPos('>>', Text) = 1) or (AnsiPos('>', Text) = 1) or (AnsiPos('„„', Text) = 1) or (AnsiPos('„', Text) = 1) then begin if GikoSys.Setting.ResAnchorJamp then begin - Text := ZenToHan(Text); + Text := ZenToHan(Trim(Text)); if(AnsiPos('>>', Text) = 1) then begin //Text := Copy(Text, 3, Length(Text) - 2); @@ -3880,18 +3828,19 @@ begin //Text := Copy(Text, 2, Length(Text) - 1); Delete(Text, 1, 1); end; + if AnsiPos('-', Text) <> 0 then begin wkIntSt := StrToIntDef(Copy(Text, 1, AnsiPos('-', Text) - 1), 0); Text := Copy(Text, AnsiPos('-', Text) + 1, Length(Text)); wkIntTo := StrToIntDef(Text, 0); if wkIntTo < wkIntSt then wkIntSt := wkIntTo; - end else + end else begin wkIntSt := StrToIntDef(Text, 0); + end; if wkIntSt <> 0 then begin - document := FActiveContent.Browser.Document as IHTMLDocument2; - IDAnchorPopup(''); + FActiveContent.IDAnchorPopup(''); BrowserMovement(IntToStr(wkIntSt)); end; @@ -4223,14 +4172,14 @@ begin TreeView.Refresh; ListView.Refresh; end; - BrowserMovement( BrowserRecord.Movement, BrowserRecord ); + BrowserRecord.Move(BrowserRecord.Movement); BrowserRecord.Movement := ''; end else if threadItem.UnRead then begin threadItem.UnRead := False; threadItem.ParentBoard.UnRead := ThreadItem.ParentBoard.UnRead - 1; if threadItem.ParentBoard.UnRead < 0 then threadItem.ParentBoard.UnRead := 0; TreeView.Refresh; - BrowserMovement( 'new', BrowserRecord ); + BrowserRecord.Move('new'); ListView.Refresh; end else if threadItem.ScrollTop <> 0 then begin try @@ -4637,7 +4586,7 @@ begin browserRec := InsertBrowserTab( ThreadItem ); if ThreadItem.IsLogFile then begin if (browserRec <> nil) and (stRes > 0) then - BrowserMovement( IntToStr( stRes ), browserRec ); + browserRec.Move(IntToStr( stRes )); end else begin if (browserRec <> nil) and (stRes > 0) then browserRec.Movement := IntToStr( stRes ); @@ -5032,7 +4981,7 @@ var ThreadItem: TThreadItem; begin Result := False; - IDAnchorPopup(''); + FactiveContent.IDAnchorPopup(''); Doc := FactiveContent.Browser.Document as IHtmlDocument2; if Assigned(Doc) then begin Range := Doc.selection.createRange as IHTMLTxtRange; @@ -6848,11 +6797,11 @@ begin rc := GikoUtil.MsgBox(Handle, '20ŒÂˆÈã‚ ‚è‚Ü‚·‚ªA‚·‚ׂĕ\Ž¦‚µ‚Ü‚·‚©H', 'IDƒ|ƒbƒvƒAƒbƒvŒx', - MB_YESNO or MB_ICONQUESTION); + MB_YESNO or MB_ICONQUESTION); limited := rc <> ID_YES; end; - body := GikoSys.GetSameIDResAnchor(AID, FActiveContent.Thread, limited); - IDAnchorPopup(body); + body := GikoSys.GetSameIDResAnchor(AID, FActiveContent.Thread, limited); + FActiveContent.IDAnchorPopup(body); end; end; except @@ -6861,8 +6810,6 @@ begin end; end; - - //ƒXƒŒƒbƒhˆê——‚ðÅ‘剻‚µ‚ătƒH[ƒJƒX‚ð“–‚Ä‚é procedure TGikoForm.SelectTimerTimer(Sender: TObject); begin @@ -7341,42 +7288,6 @@ begin CoolBarResized( Sender, BrowserCoolBar ); end; -//IDƒAƒ“ƒJ[’ljÁ -procedure TGikoForm.IDAnchorPopup(Abody :string); -var - firstElement: IHTMLElement; - document: IHTMLDocument2; - docAll: IHTMLElementCollection; - doc : Variant; - nCSS : string; -begin - try - document := FActiveContent.Browser.Document as IHTMLDocument2; - - if Assigned(document) then begin - docAll := document.all; - firstElement := docAll.item('idSearch', 0) as IHTMLElement; - if (Assigned(firstElement)) then begin - if Length(Abody) > 0 then begin - doc := Idispatch( olevariant(FActiveContent.Browser.ControlInterface).Document) as IHTMLDocument2; - nCSS := '

' - + Abody + '

'; - firstElement.outerHTML := nCSS; - firstElement.style.visibility := 'visible'; - end else begin - firstElement.outerHTML := '

'; - firstElement.style.visibility := 'hidden'; - end; - end else if (Assigned(firstElement)) then begin - firstElement.outerHTML := '

'; - firstElement.style.visibility := 'hidden'; - end; - end; - except - end; -end; - //‚±‚̃ŒƒX‚ ‚ځ`‚ñ procedure TGikoForm.IndividualAbon(Atag, Atype : Integer); var diff --git a/GikoDataModule.pas b/GikoDataModule.pas index 9f3a7d0..6c80978 100644 --- a/GikoDataModule.pas +++ b/GikoDataModule.pas @@ -1525,10 +1525,10 @@ begin str := ZenToHan(str); res := StrToIntDef(str, -1); if (res > 0) and (res <= GikoForm.GetActiveContent.Count) then begin - GikoForm.BrowserMovement(IntToStr(res), GikoForm.ActiveContent); + GikoForm.ActiveContent.Move(IntToStr(res)); SetFocusForBrowserAction.Execute; end else if res > GikoForm.GetActiveContent.Count then begin - GikoForm.BrowserMovement(IntToStr(GikoForm.GetActiveContent.Count), GikoForm.ActiveContent); + GikoForm.ActiveContent.Move(IntToStr(GikoForm.GetActiveContent.Count)); SetFocusForBrowserAction.Execute; end; end; @@ -1681,8 +1681,6 @@ procedure TGikoDM.ToolBarSettingActionExecute(Sender: TObject); var Dlg: TToolBarSettingDialog; i: Integer; - //Component: TComponent; - ToolButton : TToolButton; begin Dlg := TToolBarSettingDialog.Create(GikoForm, GikoFormActionList); try @@ -2354,7 +2352,7 @@ begin limited := rc <> ID_YES; end; body := GikoSys.GetSameIDResAnchor(No, ThreadItem, limited); - GikoForm.IDAnchorPopup(body); + GikoForm.ActiveContent.IDAnchorPopup(body); end; // ************************************************************************* //! ‚±‚̃ŒƒX‚ ‚ځ`‚ñ@i’ʏíj -- 2.11.0