From d6fc54b14de257d519742374a85e2c173ea8d562 Mon Sep 17 00:00:00 2001 From: h677 Date: Sun, 30 Jul 2006 17:25:32 +0000 Subject: [PATCH] =?utf8?q?=E3=83=AA=E3=83=B3=E3=82=AF=E3=81=A7=E9=A3=9B?= =?utf8?q?=E3=82=93=E3=81=A0=E3=81=A8=E3=81=8D=E3=81=AE=E5=B1=A5=E6=AD=B4?= =?utf8?q?=E3=82=92=E3=81=A8=E3=81=A3=E3=81=A6=E7=A7=BB=E5=8B=95=E3=81=A7?= =?utf8?q?=E3=81=8D=E3=82=8B=E3=82=88=E3=81=86=E3=81=AA=E6=A9=9F=E8=83=BD?= =?utf8?q?=E3=82=92=E8=BF=BD=E5=8A=A0=20=EF=BC=88=E3=83=90=E3=82=BF54?= =?utf8?q?=E3=81=AB=E6=97=A2=E3=81=AB=E3=81=AA=E3=81=A3=E3=81=A6=E3=81=84?= =?utf8?q?=E3=81=BE=E3=81=99=EF=BC=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit --- Giko.dfm | 4 +- Giko.pas | 16 ++++-- GikoDataModule.dfm | 14 +++++ GikoDataModule.pas | 107 ++++++++++++++++++++++++++++++------ GikoSystem.pas | 2 +- MoveHistoryItem.pas | 154 ++++++++++++++++++++++++++++++++++++++++++++++++++++ gikoNavi.dpr | 3 +- gikoNavi.res | Bin 4292 -> 4292 bytes 8 files changed, 274 insertions(+), 26 deletions(-) create mode 100644 MoveHistoryItem.pas diff --git a/Giko.dfm b/Giko.dfm index 4b8d7f5..fdedcd6 100644 --- a/Giko.dfm +++ b/Giko.dfm @@ -159,7 +159,7 @@ object GikoForm: TGikoForm object ToolBar1: TToolBar Left = 2 Top = 4 - Width = 15 + Width = 16 Height = 18 Align = alNone AutoSize = True @@ -971,7 +971,7 @@ object GikoForm: TGikoForm OnResize = AddressToolBarResize object AddressComboBox: TComboBox Left = 0 - Top = 0 + Top = 1 Width = 177 Height = 20 DropDownCount = 20 diff --git a/Giko.pas b/Giko.pas index 6a905a3..e244c08 100644 --- a/Giko.pas +++ b/Giko.pas @@ -18,7 +18,7 @@ uses Editor, RoundData, GikoPanel, Favorite, HTMLDocumentEvent, HintWindow, GikoCoolBar, GikoListView, Search, ExternalBoardManager, ExternalBoardPlugInMain, StdActns, Variants, ExtActns,IdTCPConnection, - IdBaseComponent, IdTCPClient, AppEvnts, BrowserRecord; + IdBaseComponent, IdTCPClient, AppEvnts, BrowserRecord, MoveHistoryItem; const NGWORDNAME_PANEL = 3; @@ -594,6 +594,7 @@ type FOrigenCaption: String; //‚¨‹C‚É“ü‚èƒcƒŠ[‚̃AƒCƒeƒ€•ÒWŽž‚̕ҏW‘O‚Ì•¶Žš—ñ FPreviewBrowserRect: TRect; ///< ƒvƒŒƒrƒ…[‚Ì•\Ž¦ˆÊ’u‚ð‹L‰¯‚·‚é FActionListGroupIndexes: array of Integer; /// nil) then begin - Text := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerText; - Html := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement.Get_outerHTML; + aElement := IHTMLDocument2(TWebBrowser(Sender).Document).activeElement; + if ( aElement <> nil) then begin + Text := aElement.Get_outerText; + Html := aElement.Get_outerHTML; 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(Trim(Text)); if(AnsiPos('>>', Text) = 1) then begin @@ -3915,6 +3919,7 @@ begin if wkIntSt <> 0 then begin FActiveContent.IDAnchorPopup(''); + MoveHisotryManager.pushItem(FActiveContent); BrowserMovement(IntToStr(wkIntSt)); end; @@ -3948,6 +3953,7 @@ begin AddressComboBox.Items.Insert(0, URL); end; end; + MoveHisotryManager.pushItem(FActiveContent); MoveToURL( URL ); end; end; diff --git a/GikoDataModule.dfm b/GikoDataModule.dfm index d0e31f8..04ffb06 100644 --- a/GikoDataModule.dfm +++ b/GikoDataModule.dfm @@ -1235,6 +1235,20 @@ object GikoDM: TGikoDM OnExecute = CloseAllEditorActionExecute OnUpdate = CloseAllEditorActionUpdate end + object PrevMoveHistory: TAction + Category = #12473#12524#12483#12489 + Caption = #12522#12531#12463#23653#27508#12434#25147#12427 + Hint = #12522#12531#12463#23653#27508#12434#25147#12427 + OnExecute = PrevMoveHistoryExecute + OnUpdate = PrevMoveHistoryUpdate + end + object NextMoveHistory: TAction + Category = #12473#12524#12483#12489 + Caption = #12522#12531#12463#23653#27508#12434#36914#12416 + Hint = #12522#12531#12463#23653#27508#12434#36914#12416 + OnExecute = NextMoveHistoryExecute + OnUpdate = NextMoveHistoryUpdate + end end object ToobarImageList: TImageList Left = 44 diff --git a/GikoDataModule.pas b/GikoDataModule.pas index 789a651..097d739 100644 --- a/GikoDataModule.pas +++ b/GikoDataModule.pas @@ -12,7 +12,7 @@ uses MSHTML_TLB, {$IFEND} ComCtrls, BrowserRecord, Graphics, Messages, Setting, Dialogs, - ActiveX; + ActiveX, MoveHistoryItem; const CAPTION_NAME: string = 'ƒMƒRƒiƒr'; @@ -219,6 +219,8 @@ type LiveItemAction: TAction; FavoriteTreeViewItemNameCopyAction: TAction; CloseAllEditorAction: TAction; + PrevMoveHistory: TAction; + NextMoveHistory: TAction; procedure EditNGActionExecute(Sender: TObject); procedure ReloadActionExecute(Sender: TObject); procedure GoFowardActionExecute(Sender: TObject); @@ -406,6 +408,10 @@ type procedure FavoriteTreeViewItemNameCopyActionExecute(Sender: TObject); procedure CloseAllEditorActionExecute(Sender: TObject); procedure CloseAllEditorActionUpdate(Sender: TObject); + procedure PrevMoveHistoryUpdate(Sender: TObject); + procedure PrevMoveHistoryExecute(Sender: TObject); + procedure NextMoveHistoryUpdate(Sender: TObject); + procedure NextMoveHistoryExecute(Sender: TObject); private { Private éŒ¾ } procedure ClearResFilter; @@ -421,6 +427,8 @@ type procedure ClearSelectComboBox; procedure ClearMailAllEditor(); procedure ClearNameTextAllEditor(); + procedure MoveURLWithHistory(URL : String); + procedure BackToHistory(item: TMoveHistoryItem); public { Public éŒ¾ } procedure RepaintStatusBar; @@ -554,24 +562,10 @@ end; //! ƒAƒhƒŒƒXƒo[‚É•\Ž¦‚µ‚Ä‚¢‚éƒAƒhƒŒƒX‚ÖˆÚ“®‚·‚é // ************************************************************************* procedure TGikoDM.MoveToActionExecute(Sender: TObject); -var - URL: string; - idx: Integer; begin //ƒAƒhƒŒƒXƒRƒ“ƒ{ƒ{ƒbƒNƒX‚©‚çURL‚ðŽæ“¾ - URL := Trim(GikoForm.AddressComboBox.Text); //URL‚Ɉړ® - GikoForm.MoveToURL(URL); - //ˆÈ‰ºA—š—ð‚̏ˆ— - idx := GikoForm.AddressComboBox.Items.IndexOf(URL); - if idx = -1 then begin - GikoForm.AddressComboBox.Items.Insert(0, URL); - if GikoForm.AddressComboBox.Items.Count > GikoSys.Setting.AddressHistoryCount then - GikoForm.AddressComboBox.Items.Delete(GikoForm.AddressComboBox.Items.Count - 1); - end else begin - GikoForm.AddressComboBox.Items.Delete(idx); - GikoForm.AddressComboBox.Items.Insert(0, URL); - end; + MoveURLWithHistory( Trim(GikoForm.AddressComboBox.Text) ); end; // ************************************************************************* //! ‚¨‹C‚É“ü‚è‚̒ljÁƒ_ƒCƒAƒƒO‚ðŠJ‚­ @@ -2235,7 +2229,8 @@ begin URLs.Free; end; - if (GikoForm.BrowserTab.Tabs.Count = 0) then begin + if (GikoForm.BrowserTab.Tabs.Count = 0) and + (TabsOpenAction.Tag <> 1) then begin ShowMessage('•\Ž¦‚·‚éƒ^ƒu‚ª‚ ‚è‚Ü‚¹‚ñB'); end; end; @@ -4038,5 +4033,83 @@ begin end; end; +// ************************************************************************* +//! ƒŠƒ“ƒN—š—ð‚ð–ß‚é‚̍XVˆ— +// ************************************************************************* +procedure TGikoDM.PrevMoveHistoryUpdate(Sender: TObject); +begin + PrevMoveHistory.Enabled := + (MoveHisotryManager.HisotryIndex > 0) +end; +// ************************************************************************* +//! ƒŠƒ“ƒN—š—ð‚ð–ß‚é +// ************************************************************************* +procedure TGikoDM.PrevMoveHistoryExecute(Sender: TObject); +begin + if ( GikoForm.BrowserTab.TabIndex >= 0 ) then begin + BackToHistory(MoveHisotryManager.getPrevItem + (TBrowserRecord(GikoForm.BrowserTab.Tabs + .Objects[GikoForm.BrowserTab.TabIndex]))); + end else begin + BackToHistory(MoveHisotryManager.getPrevItem( nil ) ); + end; +end; +//! ƒŠƒ“ƒN—š—ðˆ— +procedure TGikoDM.BackToHistory(item: TMoveHistoryItem); +var + browser : TWebBrowser; + doc : OleVariant; +begin + if ( item <> nil ) then begin + if ( GikoForm.GetActiveContent = item.ThreadItem ) then begin + browser := TBrowserRecord(GikoForm.BrowserTab.Tabs + .Objects[GikoForm.BrowserTab.TabIndex]).Browser; + if (browser <> nil) then begin + try + doc := Idispatch( olevariant(browser.ControlInterface).Document) as IHTMLDocument2; + doc.Body.ScrollTop := item.ScrollTop; + except + end; + end; + end else begin + //URL‚Ɉړ® + MoveURLWithHistory(item.ThreadItem.URL); + end; + end; +end; +//! —š—ðˆ—‚‚«URLˆÚ“® +procedure TGikoDM.MoveURLWithHistory(URL : String); +var + idx : Integer; +begin + //URL‚Ɉړ® + GikoForm.MoveToURL(URL); + //ˆÈ‰ºA—š—ð‚̏ˆ— + idx := GikoForm.AddressComboBox.Items.IndexOf(URL); + if idx = -1 then begin + GikoForm.AddressComboBox.Items.Insert(0, URL); + if GikoForm.AddressComboBox.Items.Count > GikoSys.Setting.AddressHistoryCount then + GikoForm.AddressComboBox.Items.Delete(GikoForm.AddressComboBox.Items.Count - 1); + end else begin + GikoForm.AddressComboBox.Items.Delete(idx); + GikoForm.AddressComboBox.Items.Insert(0, URL); + end; +end; +// ************************************************************************* +//! ƒŠƒ“ƒN—š—ð‚ði‚ނ̍XVˆ— +// ************************************************************************* +procedure TGikoDM.NextMoveHistoryUpdate(Sender: TObject); +begin + NextMoveHistory.Enabled := + (MoveHisotryManager.HisotryIndex < MoveHisotryManager.Count - 1); +end; +// ************************************************************************* +//! ƒŠƒ“ƒN—š—ð‚ði‚Þ +// ************************************************************************* +procedure TGikoDM.NextMoveHistoryExecute(Sender: TObject); +begin + BackToHistory(MoveHisotryManager.getNextItem); +end; + end. diff --git a/GikoSystem.pas b/GikoSystem.pas index 2157255..a096d1a 100644 --- a/GikoSystem.pas +++ b/GikoSystem.pas @@ -256,7 +256,7 @@ const ZERO_DATE: Integer = 25569; BETA_VERSION_NAME_E = 'beta'; BETA_VERSION_NAME_J = 'ÊÞÀ'; - BETA_VERSION = 53; + BETA_VERSION = 54; BETA_VERSION_BUILD = ''; //!< debug”Å‚È‚Ç APP_NAME = 'gikoNavi'; BE_PHP_URL = 'http://be.2ch.net/test/p.php?i='; diff --git a/MoveHistoryItem.pas b/MoveHistoryItem.pas new file mode 100644 index 0000000..7682c5c --- /dev/null +++ b/MoveHistoryItem.pas @@ -0,0 +1,154 @@ +unit MoveHistoryItem; + +interface + +uses + SysUtils, Classes, BoardGroup, BrowserRecord, +{$IF Defined(DELPRO) } + SHDocVw, + MSHTML, +{$ELSE} + SHDocVw_TLB, + MSHTML_TLB, +{$IFEND} + OleCtrls, ActiveX; +type + + TMoveHistoryItem = class(TObject) + private + FThreadItem : TThreadItem; + FScrollTop : Integer; + public + property ThreadItem : TThreadItem read FThreadItem write FThreadItem; + property ScrollTop : Integer read FScrollTop write FScrollTop; + end; + + TMoveHistory = class(TList) + private + FHistoryMax : Integer; + FIndex : Integer; + public + constructor Create( max : Integer ); overload; + function pushItem( item: TMoveHistoryItem): Integer; overload; + function pushItem( item: TBrowserRecord): Integer; overload; + function getPrevItem( item: TBrowserRecord): TMoveHistoryItem; + function getNextItem: TMoveHistoryItem; + procedure clear; override; + property HistoryMax : Integer read FHistoryMax write FHistoryMax; + property HisotryIndex: Integer read FIndex; + end; + +var + MoveHisotryManager : TMoveHistory; + +implementation + +//! ƒRƒ“ƒXƒgƒ‰ƒNƒ^ +constructor TMoveHistory.Create( max : Integer ); +begin + inherited Create; + + FIndex := 0; + FHistoryMax := max; + if (FHistoryMax < 0) then begin + FHistoryMax := 20; + end; +end; +//! ˆÚ“®—š—ð‚̃AƒCƒeƒ€’ljÁ +function TMoveHistory.pushItem( item: TMoveHistoryItem): Integer; +var + i : Integer; + top: TMoveHistoryItem; +begin + Result := -1; + if (Self.Count > 0) then begin + top := TMoveHistoryItem( Self.Items[Self.Count - 1] ); + if (top.FThreadItem = item.FThreadItem) and + (top.FScrollTop = item.FScrollTop) then begin + Exit; + end; + end; + // •ÛŽ”‚̍őå’l‚ð’´‚¦‚éê‡æ“ª‚ðíœ + if (FIndex + 1 > FHistoryMax) then begin + if ( Self.Items[0] <> nil ) then begin + TMoveHistoryItem( Self.Items[0] ).Free; + end; + Self.Delete(0); + Dec(Findex); + end; + // FIndex‚æ‚èŒã‚ë‚̃AƒCƒeƒ€‚ðíœ‚·‚é + for i := Self.Count - 1 downto Findex do begin + if (Self.Items [i] <> nil) then begin + TMoveHistoryItem( Self.Items[i] ).Free; + end; + Self.Delete(i); + end; + Inc(FIndex); + Result := Self.Add( item ); +end; +//! ˆÚ“®—š—ð‚̃AƒCƒeƒ€’ljÁ +function TMoveHistory.pushItem( item: TBrowserRecord): Integer; +var + history : TMoveHistoryItem; + doc : OleVariant; +begin + Result := -1; + if ( item <> nil ) and ( item.Thread <> nil ) + and ( item.Browser <> nil) then begin + history := TMoveHistoryItem.Create; + history.FThreadItem := item.Thread; + doc := Idispatch( olevariant(item.Browser.ControlInterface).Document) as IHTMLDocument2; + history.ScrollTop := doc.Body.ScrollTop; + + Result := pushItem( history ); + end; +end; +//! ˆê‚‘O‚Ì—š—ðƒAƒCƒeƒ€Žæ“¾ +function TMoveHistory.getPrevItem(item: TBrowserRecord): TMoveHistoryItem; +begin + Result := nil; + if (FIndex = Self.Count) and (item <> nil) then begin + pushItem( item ); + Dec(FIndex); + end; + if ( FIndex > 0 ) then begin + Dec( FIndex ); + Result := TMoveHistoryItem( Self.items[ FIndex ] ); + end; +end; +//! ˆê‚ÂŒã‚ë‚Ì—š—ðƒAƒCƒeƒ€Žæ“¾ +function TMoveHistory.getNextItem: TMoveHistoryItem; +begin + Result := nil; + if ( FIndex < Self.Count - 1 ) then begin + Inc( FIndex ); + Result := TMoveHistoryItem( Self.items[ FIndex ] ); + end; +end; +//! —š—ð‚Ì‘SÁ‹Ž +procedure TMoveHistory.clear; +var + i : Integer; +begin + // FIndex‚æ‚èŒã‚ë‚̃AƒCƒeƒ€‚ðíœ‚·‚é + for i := Self.Count - 1 downto 0 do begin + if (Self.Items [i] <> nil) then begin + TMoveHistoryItem( Self.Items[i] ).Free; + end; + Self.Delete(i); + end; + Self.Capacity := 0; + + inherited; +end; + +initialization + MoveHisotryManager := TMoveHistory.Create( 20 ); + +finalization + if MoveHisotryManager <> nil then begin + MoveHisotryManager.clear; + MoveHisotryManager.Free; + MoveHisotryManager := nil; + end; +end. diff --git a/gikoNavi.dpr b/gikoNavi.dpr index 50ad56e..188a7b7 100644 --- a/gikoNavi.dpr +++ b/gikoNavi.dpr @@ -72,7 +72,8 @@ uses GikoMessage in 'GikoMessage.pas', InputAssist in 'InputAssist.pas' {InputAssistForm}, InputAssistDataModule in 'InputAssistDataModule.pas' {InputAssistDM: TDataModule}, - DefaultFileManager in 'DefaultFileManager.pas'; + DefaultFileManager in 'DefaultFileManager.pas', + MoveHistoryItem in 'MoveHistoryItem.pas'; {$R *.RES} {$R gikoResource.res} diff --git a/gikoNavi.res b/gikoNavi.res index 4b6ad47adf55900d3cd873fd83099c34f22bd90a..aa1761939b40c4681f4e8843d7f75b63e61e8226 100644 GIT binary patch delta 44 vcmX@2ctml-3tnC`21bTOObiTQdh%D^kGv)fdJG0YY{p>DV6yo$-$h0M5sM3} delta 44 vcmX@2ctml-3tnDR21bVYObiTQdh%D^kG#eVdJG0YY{p>DV7U1+-$h0M5Pu7w -- 2.11.0