Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

表示スケールに合わせて拡大する処理を色々と追加 #1762

Merged
merged 2 commits into from
Mar 21, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions sakura_core/doc/layout/CLayoutMgr.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "debug/CRunningTimer.h"
#include "charset/charcode.h"
#include "config/app_constants.h"
#include "util/window.h"

// -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- //
// 生成と破棄 //
Expand Down Expand Up @@ -137,16 +138,16 @@ void CLayoutMgr::SetLayoutInfo(
if (nTsvModeOld != nTsvMode && nTsvMode != TSV_MODE_NONE) {
m_tsvInfo.CalcTabLength(this->m_pcDocLineMgr);
}
m_nSpacing = refType.m_nColumnSpace;
m_nSpacing = DpiScaleX(refType.m_nColumnSpace);
if( nCharLayoutXPerKeta == -1 )
{
// Viewが持ってるフォント情報は古い、しょうがないので自分で作る
HWND hwnd = NULL;
HDC hdc = ::GetDC(hwnd);
CViewFont viewFont(pLogfont);
CTextMetrics temp;
temp.Update(hdc, viewFont.GetFontHan(), refType.m_nLineSpace, refType.m_nColumnSpace);
m_nCharLayoutXPerKeta = temp.GetHankakuWidth() + m_pTypeConfig->m_nColumnSpace;
temp.Update(hdc, viewFont.GetFontHan(), DpiScaleY(refType.m_nLineSpace), DpiScaleX(refType.m_nColumnSpace));
m_nCharLayoutXPerKeta = temp.GetHankakuWidth() + DpiScaleX(m_pTypeConfig->m_nColumnSpace);
::ReleaseDC(hwnd, hdc);
}else{
m_nCharLayoutXPerKeta = nCharLayoutXPerKeta;
Expand Down
2 changes: 1 addition & 1 deletion sakura_core/env/CShareData.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -272,7 +272,7 @@ bool CShareData::InitShareData()
sWindow.m_bDispMiniMap = false; // ミニマップを表示する
sWindow.m_nFUNCKEYWND_Place = 1; /* ファンクションキー表示位置/0:上 1:下 */
sWindow.m_nFUNCKEYWND_GroupNum = 4; // 2002/11/04 Moca ファンクションキーのグループボタン数
sWindow.m_nMiniMapFontSize = -1;
sWindow.m_nMiniMapFontSize = -2;
berryzplus marked this conversation as resolved.
Show resolved Hide resolved
sWindow.m_nMiniMapQuality = NONANTIALIASED_QUALITY;
sWindow.m_nMiniMapWidth = 150;

Expand Down
16 changes: 8 additions & 8 deletions sakura_core/view/CEditView.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ BOOL CEditView::Create(
m_szComposition[0] = L'\0';

/* ルーラー表示 */
GetTextArea().SetAreaTop(GetTextArea().GetAreaTop()+GetDllShareData().m_Common.m_sWindow.m_nRulerHeight); /* ルーラー高さ */
GetTextArea().SetAreaTop(GetTextArea().GetAreaTop()+DpiScaleY(GetDllShareData().m_Common.m_sWindow.m_nRulerHeight)); /* ルーラー高さ */
GetRuler().SetRedrawFlag(); // ルーラー全体を描き直す時=true 2002.02.25 Add By KK
m_hdcCompatDC = NULL; /* 再描画用コンパチブルDC */
m_hbmpCompatBMP = NULL; /* 再描画用メモリBMP */
Expand Down Expand Up @@ -274,13 +274,13 @@ BOOL CEditView::Create(
m_cRegexKeyword = new CRegexKeyword( GetDllShareData().m_Common.m_sSearch.m_szRegexpLib ); //@@@ 2001.11.17 add MIK
m_cRegexKeyword->RegexKeySetTypes(m_pTypeData); //@@@ 2001.11.17 add MIK

GetTextArea().SetTopYohaku( GetDllShareData().m_Common.m_sWindow.m_nRulerBottomSpace ); /* ルーラーとテキストの隙間 */
GetTextArea().SetTopYohaku(DpiScaleY(GetDllShareData().m_Common.m_sWindow.m_nRulerBottomSpace)); /* ルーラーとテキストの隙間 */
GetTextArea().SetAreaTop( GetTextArea().GetTopYohaku() ); /* 表示域の上端座標 */
/* ルーラー表示 */
if( m_pTypeData->m_ColorInfoArr[COLORIDX_RULER].m_bDisp && !m_bMiniMap ){
GetTextArea().SetAreaTop( GetTextArea().GetAreaTop() + GetDllShareData().m_Common.m_sWindow.m_nRulerHeight); /* ルーラー高さ */
GetTextArea().SetAreaTop(GetTextArea().GetAreaTop() + DpiScaleY(GetDllShareData().m_Common.m_sWindow.m_nRulerHeight)); /* ルーラー高さ */
}
GetTextArea().SetLeftYohaku( GetDllShareData().m_Common.m_sWindow.m_nLineNumRightSpace );
GetTextArea().SetLeftYohaku(DpiScaleX(GetDllShareData().m_Common.m_sWindow.m_nLineNumRightSpace));

/* ウィンドウクラスの登録 */
// Apr. 27, 2000 genta
Expand Down Expand Up @@ -1121,7 +1121,7 @@ void CEditView::SetFont( void )
if( m_bMiniMap ){
GetTextMetrics().Update(hdc, GetFontset().GetFontHan(), 0, 0);
}else{
GetTextMetrics().Update(hdc, GetFontset().GetFontHan(), m_pTypeData->m_nLineSpace, m_pTypeData->m_nColumnSpace);
GetTextMetrics().Update(hdc, GetFontset().GetFontHan(), DpiScaleY(m_pTypeData->m_nLineSpace), DpiScaleX(m_pTypeData->m_nColumnSpace));
}

::ReleaseDC( GetHwnd(), hdc );
Expand Down Expand Up @@ -1690,17 +1690,17 @@ void CEditView::OnChangeSetting()
}
RECT rc;

GetTextArea().SetTopYohaku( GetDllShareData().m_Common.m_sWindow.m_nRulerBottomSpace ); /* ルーラーとテキストの隙間 */
GetTextArea().SetTopYohaku(DpiScaleY(GetDllShareData().m_Common.m_sWindow.m_nRulerBottomSpace)); /* ルーラーとテキストの隙間 */
GetTextArea().SetAreaTop( GetTextArea().GetTopYohaku() ); /* 表示域の上端座標 */

// 文書種別更新
m_pTypeData = &m_pcEditDoc->m_cDocType.GetDocumentAttribute();

/* ルーラー表示 */
if( m_pTypeData->m_ColorInfoArr[COLORIDX_RULER].m_bDisp && !m_bMiniMap ){
GetTextArea().SetAreaTop(GetTextArea().GetAreaTop() + GetDllShareData().m_Common.m_sWindow.m_nRulerHeight); /* ルーラー高さ */
GetTextArea().SetAreaTop(GetTextArea().GetAreaTop() + DpiScaleY(GetDllShareData().m_Common.m_sWindow.m_nRulerHeight)); /* ルーラー高さ */
}
GetTextArea().SetLeftYohaku( GetDllShareData().m_Common.m_sWindow.m_nLineNumRightSpace );
GetTextArea().SetLeftYohaku(DpiScaleX(GetDllShareData().m_Common.m_sWindow.m_nLineNumRightSpace));

/* フォントの変更 */
SetFont();
Expand Down
3 changes: 2 additions & 1 deletion sakura_core/view/CRuler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
#include "view/CEditView.h"
#include "doc/CEditDoc.h"
#include "types/CTypeSupport.h"
#include "util/window.h"

CRuler::CRuler(const CEditView* pEditView, const CEditDoc* pEditDoc)
: m_pEditView(pEditView)
Expand Down Expand Up @@ -122,7 +123,7 @@ void CRuler::DrawRulerBg(CGraphics& gr)
}
if (m_hFont == NULL) {
LOGFONT lf = {0};
lf.lfHeight = 1 - pCommon->m_sWindow.m_nRulerHeight; // 2002/05/13 ai
lf.lfHeight = DpiScaleY(1 - pCommon->m_sWindow.m_nRulerHeight); // 2002/05/13 ai
lf.lfWidth = 0;
lf.lfEscapement = 0;
lf.lfOrientation = 0;
Expand Down
5 changes: 3 additions & 2 deletions sakura_core/view/CTextArea.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@
#include "env/DLLSHAREDATA.h"
#include "doc/CEditDoc.h"
#include "config/app_constants.h"
#include "util/window.h"

// 2014.07.26 katze
//#define USE_LOG10 // この行のコメントを外すと行番号の最小桁数の計算にlog10()を用いる
Expand Down Expand Up @@ -63,8 +64,8 @@ CTextArea::CTextArea(CEditView* pEditView)
m_nViewRowNum = CLayoutInt(0); /* 表示域の行数 */
m_nViewTopLine = CLayoutInt(0); /* 表示域の一番上の行 */
m_nViewLeftCol = CLayoutInt(0); /* 表示域の一番左の桁 */
SetTopYohaku( pShareData->m_Common.m_sWindow.m_nRulerBottomSpace ); /* ルーラーとテキストの隙間 */
SetLeftYohaku( pShareData->m_Common.m_sWindow.m_nLineNumRightSpace );
SetTopYohaku(DpiScaleY(pShareData->m_Common.m_sWindow.m_nRulerBottomSpace)); /* ルーラーとテキストの隙間 */
SetLeftYohaku(DpiScaleX(pShareData->m_Common.m_sWindow.m_nLineNumRightSpace));
m_nViewAlignTop = GetTopYohaku(); /* 表示域の上端座標 */
}

Expand Down
3 changes: 2 additions & 1 deletion sakura_core/view/CViewFont.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,14 @@
#include "StdAfx.h"
#include "CViewFont.h"
#include "env/DLLSHAREDATA.h"
#include "util/window.h"

/*! フォント作成
*/
void CViewFont::CreateFonts( const LOGFONT *plf )
{
LOGFONT lf;
int miniSize = GetDllShareData().m_Common.m_sWindow.m_nMiniMapFontSize;
int miniSize = ::DpiScaleX(GetDllShareData().m_Common.m_sWindow.m_nMiniMapFontSize);
int quality = GetDllShareData().m_Common.m_sWindow.m_nMiniMapQuality;
int outPrec = OUT_TT_ONLY_PRECIS; // FixedSys等でMiniMapのフォントが小さくならない修正

Expand Down
3 changes: 2 additions & 1 deletion sakura_core/view/figures/CFigure_ZenSpace.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
#include "CFigure_ZenSpace.h"
#include "types/CTypeSupport.h"
#include "apiwrap/StdApi.h"
#include "util/window.h"

void Draw_ZenSpace( CGraphics& gr, const CMyRect& rc );

Expand Down Expand Up @@ -92,7 +93,7 @@ void CFigure_ZenSpace::DispSpace(CGraphics& gr, DispPos* pDispPos, CEditView* pc
CMyRect rcZenSp;
// 注:ベースライン無視
rcZenSp.SetPos(pDispPos->GetDrawPos().x, pDispPos->GetDrawPos().y);
rcZenSp.SetSize(dx[0]- pcView->m_pcEditDoc->m_cDocType.GetDocumentAttribute().m_nColumnSpace,
rcZenSp.SetSize(dx[0]- DpiScaleX(pcView->m_pcEditDoc->m_cDocType.GetDocumentAttribute().m_nColumnSpace),
berryzplus marked this conversation as resolved.
Show resolved Hide resolved
pcView->GetTextMetrics().GetHankakuHeight());

// 描画
Expand Down
2 changes: 1 addition & 1 deletion sakura_core/window/CEditWnd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3303,7 +3303,7 @@ LRESULT CEditWnd::OnSize2( WPARAM wParam, LPARAM lParam, bool bUpdateStatus )
// ミニマップ
int nMiniMapWidth = 0;
if( m_cMiniMapView.GetHwnd() ){
nMiniMapWidth = GetDllShareData().m_Common.m_sWindow.m_nMiniMapWidth;
nMiniMapWidth = ::DpiScaleX(GetDllShareData().m_Common.m_sWindow.m_nMiniMapWidth);
::MoveWindow( m_cMiniMapView.GetHwnd(),
(eDockSideFL == DOCKSIDE_RIGHT)? cx - nFuncListWidth - nMiniMapWidth: cx - nMiniMapWidth,
(eDockSideFL == DOCKSIDE_TOP)? nTop + nFuncListHeight: nTop,
Expand Down