Skip to content

Commit

Permalink
画面先頭行を取得するマクロ関数 GetViewTop を追加
Browse files Browse the repository at this point in the history
  • Loading branch information
beru committed Sep 6, 2020
1 parent 2d2f3cb commit 7b2b130
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 2 deletions.
10 changes: 9 additions & 1 deletion help/sakura/res/HLP000268.html
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@
<META NAME="MS-HKWD" CONTENT="GetViewLines">
<META NAME="MS-HKWD" CONTENT="GetViewColumns">
<META NAME="MS-HKWD" CONTENT="CreateMenu">
<META NAME="MS-HKWD" CONTENT="GetViewTop">
</HEAD>
<BODY>
<script type="text/javascript" src="item.js"></script>
Expand Down Expand Up @@ -167,6 +168,7 @@ <h2>マクロ専用関数/変数</h2>
<a href="#GetViewLines">GetViewLines</a>() :Integer<br>
<a href="#GetViewColumns">GetViewColumns</a>() :Integer<br>
<a href="#CreateMenu">CreateMenu</a>( int1 :Integer, str2 :String ) :Integer<br>
<a href="#GetViewTop">GetViewTop</a>() :Integer<br>
<br>
■ function <span id="GetFilename">GetFilename</span>(): String; <small>[<a href="#list"></a>]</small><br>
<div class=li200>
Expand Down Expand Up @@ -1095,5 +1097,11 @@ <h2>マクロ専用関数/変数</h2>
</div>
sakura:2.2.0.0以降<br>
<br>

■ function <span id="GetViewTop">GetViewTop</span>() :Integer; <small>[<a href="#list"></a>]</small><br>
<div class=li200>
<b>戻り値</b><br>
画面に表示されている一番上の行のレイアウト行番号(1開始)を取得します。<br>
</div>
sakura:2.4.2.0以降<br>
<br>
</BODY></HTML>
2 changes: 1 addition & 1 deletion sakura_core/Funccode_x.hsrc
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ F_ISTEXTSELECTINGLOCK = 40055, // 選択状態のロックを取得
F_GETVIEWLINES = 40056, // ビューの行数取得
F_GETVIEWCOLUMNS = 40057, // ビューの列数取得
F_CREATEMENU = 40058, // メニュー作成

F_GETVIEWTOP = 40059, // 画面に表示される一番上の行番号を取得

// = 2005,.01.10 genta ISearch用補助コード
// 2007.07.07 genta 16bit以内に収めないと状況コードと衝突するのでコードを変更
Expand Down
6 changes: 6 additions & 0 deletions sakura_core/macro/CMacro.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2452,6 +2452,12 @@ bool CMacro::HandleFunction(CEditView *View, EFunctionCode ID, const VARIANT *Ar
}
return false;
}
case F_GETVIEWTOP:
{
int nLine = (Int)View->GetTextArea().GetViewTopLine();
Wrap( &Result )->Receive( nLine + 1 );
return true;
}
default:
return false;
}
Expand Down
1 change: 1 addition & 0 deletions sakura_core/macro/CSMacroMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -475,6 +475,7 @@ MacroFuncInfo CSMacroMgr::m_MacroFuncInfoArr[] =
{F_GETVIEWLINES, L"GetViewLines", {VT_EMPTY, VT_EMPTY, VT_EMPTY, VT_EMPTY}, VT_I4, NULL }, //ビューの行数取得
{F_GETVIEWCOLUMNS, L"GetViewColumns", {VT_EMPTY, VT_EMPTY, VT_EMPTY, VT_EMPTY}, VT_I4, NULL }, //ビューの列数取得
{F_CREATEMENU, L"CreateMenu", {VT_I4, VT_BSTR, VT_EMPTY, VT_EMPTY}, VT_I4, NULL }, //メニュー作成
{F_GETVIEWTOP, L"GetViewTop", {VT_EMPTY, VT_EMPTY, VT_EMPTY, VT_EMPTY}, VT_I4, NULL }, //画面に表示される一番上の行番号を取得

// 終端
// Jun. 27, 2002 genta
Expand Down

0 comments on commit 7b2b130

Please sign in to comment.