Skip to content

Commit

Permalink
タイプ別設定画面のカラータブの色指定リストの背景色と前景色の色見本矩形の描画処理をDPIに合わせるように変更
Browse files Browse the repository at this point in the history
  • Loading branch information
beru committed Sep 30, 2018
1 parent 4055e4f commit dd0b317
Showing 1 changed file with 32 additions and 16 deletions.
48 changes: 32 additions & 16 deletions sakura_core/typeprop/CPropTypesColor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,10 +36,15 @@

using namespace std;

namespace {
//! カスタムカラー用の識別文字列
static const TCHAR* TSTR_PTRCUSTOMCOLORS = _T("ptrCustomColors");

WNDPROC m_wpColorListProc;
const TCHAR* TSTR_PTRCUSTOMCOLORS = _T("ptrCustomColors");
WNDPROC m_wpColorListProc;
int m_bgColorSampleLeft;
int m_bgColorSampleRight;
int m_fgColorSampleLeft;
int m_fgColorSampleRight;
}

static const DWORD p_helpids2[] = { //11400
IDC_LIST_COLORS, HIDC_LIST_COLORS, //色指定
Expand Down Expand Up @@ -229,7 +234,7 @@ LRESULT APIENTRY ColorList_SubclassProc( HWND hwnd, UINT uMsg, WPARAM wParam, LP
::InvalidateRect( hwnd, &rcItem, TRUE );
}else
/* 前景色見本 矩形 */
if( rcItem.right - 27 <= xPos && xPos <= rcItem.right - 27 + 12
if( m_fgColorSampleLeft <= xPos && xPos <= m_fgColorSampleRight
&& ( 0 == (g_ColorAttributeArr[nIndex].fAttribute & COLOR_ATTRIB_NO_TEXT) ) )
{
/* 色選択ダイアログ */
Expand All @@ -240,8 +245,8 @@ LRESULT APIENTRY ColorList_SubclassProc( HWND hwnd, UINT uMsg, WPARAM wParam, LP
::InvalidateRect( ::GetDlgItem( ::GetParent( hwnd ), IDC_BUTTON_TEXTCOLOR ), NULL, TRUE );
}
}else
/* 前景色見本 矩形 */
if( rcItem.right - 13 <= xPos && xPos <= rcItem.right - 13 + 12
/* 背景色見本 矩形 */
if( m_bgColorSampleLeft <= xPos && xPos <= m_bgColorSampleRight
&& ( 0 == (g_ColorAttributeArr[nIndex].fAttribute & COLOR_ATTRIB_NO_BACK) ) // 2006.12.18 ryoji フラグ利用で簡素化
)
{
Expand Down Expand Up @@ -1158,35 +1163,46 @@ void CPropTypesColor::DrawColorListItem( DRAWITEMSTRUCT* pDis )
}
// return;

const int colorSampleWidth = DpiScaleX(12);
const int scaled1 = DpiScaleX(1);
const int scaled2 = DpiScaleX(2);
const int scaled3 = DpiScaleX(3);

// 2002/11/02 Moca 比較方法変更
// if( 0 != strcmp( "カーソル行アンダーライン", pColorInfo->m_szName ) )
if ( 0 == (g_ColorAttributeArr[pColorInfo->m_nColorIdx].fAttribute & COLOR_ATTRIB_NO_BACK) ) // 2006.12.18 ryoji フラグ利用で簡素化
{
/* 背景色 見本矩形 */
rc1 = pDis->rcItem;
rc1.left = rc1.right - 13;
rc1.top += 2;
rc1.right = rc1.left + 12;
rc1.bottom -= 2;
rc1.left = rc1.right - (colorSampleWidth + scaled1);
rc1.top += scaled2;
rc1.right = rc1.left + colorSampleWidth;
rc1.bottom -= scaled2;

m_bgColorSampleLeft = rc1.left;
m_bgColorSampleRight = rc1.right;

gr.SetBrushColor( pColorInfo->m_sColorAttr.m_cBACK );
gr.SetPen( cRim );
::RoundRect( pDis->hDC, rc1.left, rc1.top, rc1.right, rc1.bottom , 3, 3 );
::RoundRect( pDis->hDC, rc1.left, rc1.top, rc1.right, rc1.bottom , scaled3, scaled3 );
}


if( 0 == (g_ColorAttributeArr[pColorInfo->m_nColorIdx].fAttribute & COLOR_ATTRIB_NO_TEXT) )
{
/* 前景色 見本矩形 */
rc1 = pDis->rcItem;
rc1.left = rc1.right - 27;
rc1.top += 2;
rc1.right = rc1.left + 12;
rc1.bottom -= 2;
rc1.left = rc1.right - (2 * colorSampleWidth + scaled3);
rc1.top += scaled2;
rc1.right = rc1.left + colorSampleWidth;
rc1.bottom -= scaled2;

m_fgColorSampleLeft = rc1.left;
m_fgColorSampleRight = rc1.right;

gr.SetBrushColor( pColorInfo->m_sColorAttr.m_cTEXT );
gr.SetPen( cRim );
::RoundRect( pDis->hDC, rc1.left, rc1.top, rc1.right, rc1.bottom , 3, 3 );
::RoundRect( pDis->hDC, rc1.left, rc1.top, rc1.right, rc1.bottom , scaled3, scaled3 );
}
}

Expand Down

0 comments on commit dd0b317

Please sign in to comment.