Skip to content

Commit

Permalink
Merge pull request #1536 from suconbu/feature/fix_nozooming_when_noini
Browse files Browse the repository at this point in the history
sakura.iniがない状態で起動した時にマウスホイールでフォントサイズが変更できない問題を修正
  • Loading branch information
suconbu authored Feb 13, 2021
2 parents 17df698 + 63ae6f2 commit 503d619
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
8 changes: 7 additions & 1 deletion sakura_core/cmd/CViewCommander_Settings.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -296,8 +296,14 @@ void CViewCommander::Command_SETFONTSIZE( int fontSize, int shift, int mode )
nCurrentZoom = 1.0;
}else if( 0 != shift ){
// 現在のフォントに対して、縮小or拡大したフォント選択する場合
double nBasePointSizeF = nOriginalPointSize;
if( nBasePointSizeF == 0.0 ){
// 基準値が無効値の時はLOGFONTのサイズから逆算
const LOGFONT& lfBase = (mode == 0) ? GetDllShareData().m_Common.m_sView.m_lf : GetEditWindow()->GetLogfont( false );
nBasePointSizeF = (lfBase.lfHeight != 0) ? (std::abs( DpiPixelsToPoints( lfBase.lfHeight ) ) * 10.0) : nPointSizeMin;
}
double nPointSizeF = 0.0;
if( !GetZoomedValue( zoomSetting, nOriginalPointSize, nCurrentZoom, shift, &nPointSizeF, &nCurrentZoom ) ){
if( !GetZoomedValue( zoomSetting, nBasePointSizeF, nCurrentZoom, shift, &nPointSizeF, &nCurrentZoom ) ){
return;
}
nPointSize = (int)nPointSizeF;
Expand Down
2 changes: 2 additions & 0 deletions tests/unittests/test-winmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ TEST_P(WinMainTest, runEditorProcess)
strStartupMacro += L"ShowTab();"; //ShowTab 消す
strStartupMacro += L"ExpandParameter('$I');"; // INIファイルパスの取得(呼ぶだけ)
// フォントサイズ設定のテスト(ここから)
strStartupMacro += L"SetFontSize(0, 1, 0);"; // 相対指定 - 拡大 - 対象:共通設定
strStartupMacro += L"SetFontSize(0, -1, 0);"; // 相対指定 - 縮小 - 対象:共通設定
strStartupMacro += L"SetFontSize(100, 0, 0);"; // 直接指定 - 対象:共通設定
strStartupMacro += L"SetFontSize(100, 0, 1);"; // 直接指定 - 対象:タイプ別設定
strStartupMacro += L"SetFontSize(100, 0, 2);"; // 直接指定 - 対象:一時適用
Expand Down

0 comments on commit 503d619

Please sign in to comment.