Skip to content

Commit

Permalink
共通処理を新規関数にまとめて使いまわすように変更
Browse files Browse the repository at this point in the history
  • Loading branch information
7-rate committed Nov 30, 2019
1 parent 2f83590 commit 354e4e1
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 31 deletions.
1 change: 1 addition & 0 deletions sakura_core/cmd/CViewCommander.h
Original file line number Diff line number Diff line change
Expand Up @@ -403,6 +403,7 @@ class CViewCommander{
/* その他 */

private:
void MoveViewTopLine(CLayoutInt nViewTopLine);
void AlertNotFound(HWND hwnd, bool bReplaceAll, LPCWSTR format, ...);
void DelCharForOverwrite(const wchar_t* pszInput, int nLen); // 上書き用の一文字削除 // 2009.04.11 ryoji
bool Sub_PreProcTagJumpByTagsFile( WCHAR* szCurrentPath, int count ); // タグジャンプの前処理
Expand Down
48 changes: 17 additions & 31 deletions sakura_core/cmd/CViewCommander_Cursor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -826,23 +826,29 @@ void CViewCommander::Command_GOFILEEND( bool bSelect )
}
}

/* カーソル行をウィンドウ中央へ */
void CViewCommander::Command_CURLINECENTER( void )
/* nViewTopLineをウィンドウの上部へ */
void CViewCommander::MoveViewTopLine(CLayoutInt nViewTopLine)
{
CLayoutInt nViewTopLine;
nViewTopLine = GetCaret().GetCaretLayoutPos().GetY2() - ( m_pCommanderView->GetTextArea().m_nViewRowNum / 2 );

// sui 02/08/09
if( 0 > nViewTopLine ) nViewTopLine = CLayoutInt(0);
if (0 > nViewTopLine) nViewTopLine = CLayoutInt(0);

CLayoutInt nScrollLines = nViewTopLine - m_pCommanderView->GetTextArea().GetViewTopLine(); //Sep. 11, 2004 genta 同期用に行数を記憶
m_pCommanderView->GetTextArea().SetViewTopLine( nViewTopLine );
m_pCommanderView->GetTextArea().SetViewTopLine(nViewTopLine);
/* フォーカス移動時の再描画 */
m_pCommanderView->RedrawAll();
// sui 02/08/09

// Sep. 11, 2004 genta 同期スクロールの関数化
m_pCommanderView->SyncScrollV( nScrollLines );
m_pCommanderView->SyncScrollV(nScrollLines);
}

/* カーソル行をウィンドウ中央へ */
void CViewCommander::Command_CURLINECENTER( void )
{
CLayoutInt nViewTopLine;
nViewTopLine = GetCaret().GetCaretLayoutPos().GetY2() - ( m_pCommanderView->GetTextArea().m_nViewRowNum / 2 );

MoveViewTopLine(nViewTopLine);
}

/* カーソル行をウィンドウ上部へ */
Expand All @@ -851,17 +857,7 @@ void CViewCommander::Command_CURLINETOP(void)
CLayoutInt nViewTopLine;
nViewTopLine = GetCaret().GetCaretLayoutPos().GetY2();

// sui 02/08/09
if (0 > nViewTopLine) nViewTopLine = CLayoutInt(0);

CLayoutInt nScrollLines = nViewTopLine - m_pCommanderView->GetTextArea().GetViewTopLine(); //Sep. 11, 2004 genta 同期用に行数を記憶
m_pCommanderView->GetTextArea().SetViewTopLine(nViewTopLine);
/* フォーカス移動時の再描画 */
m_pCommanderView->RedrawAll();
// sui 02/08/09

// Sep. 11, 2004 genta 同期スクロールの関数化
m_pCommanderView->SyncScrollV(nScrollLines);
MoveViewTopLine(nViewTopLine);
}

/* カーソル行をウィンドウ下部へ */
Expand All @@ -870,17 +866,7 @@ void CViewCommander::Command_CURLINEBOTTOM(void)
CLayoutInt nViewTopLine;
nViewTopLine = GetCaret().GetCaretLayoutPos().GetY2() - (m_pCommanderView->GetTextArea().m_nViewRowNum);

// sui 02/08/09
if (0 > nViewTopLine) nViewTopLine = CLayoutInt(0);

CLayoutInt nScrollLines = nViewTopLine - m_pCommanderView->GetTextArea().GetViewTopLine(); //Sep. 11, 2004 genta 同期用に行数を記憶
m_pCommanderView->GetTextArea().SetViewTopLine(nViewTopLine);
/* フォーカス移動時の再描画 */
m_pCommanderView->RedrawAll();
// sui 02/08/09

// Sep. 11, 2004 genta 同期スクロールの関数化
m_pCommanderView->SyncScrollV(nScrollLines);
MoveViewTopLine(nViewTopLine);
}

// 移動履歴を前へたどる
Expand Down

0 comments on commit 354e4e1

Please sign in to comment.