[MSPAINT] Some minor improvements (#4264)

- Fix Japanese IDS_MINIATURETITLE resource string.
- Fix Japanese IDM_VIEWSHOWMINIATURE menu item text.
- Fix DWORD as COLORREF.
- Improve some OnPaint's.
CORE-17969
This commit is contained in:
Katayama Hirofumi MZ 2022-01-10 21:44:13 +09:00 committed by GitHub
parent edf92c004d
commit 3456538e3a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 21 additions and 19 deletions

View file

@ -246,7 +246,7 @@ RectSel(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2)
} }
void void
SelectionFrame(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, DWORD system_selection_color) SelectionFrame(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF system_selection_color)
{ {
HBRUSH oldBrush; HBRUSH oldBrush;
LOGBRUSH logbrush; LOGBRUSH logbrush;

View file

@ -32,6 +32,6 @@ void Brush(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF color, LONG sty
void RectSel(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2); void RectSel(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2);
void SelectionFrame(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, DWORD system_selection_color); void SelectionFrame(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF system_selection_color);
void Text(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LPCTSTR lpchText, HFONT font, LONG style); void Text(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LPCTSTR lpchText, HFONT font, LONG style);

View file

@ -143,7 +143,9 @@ LRESULT CImgAreaWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& b
DeleteObject(SelectObject(hdc, oldPen)); DeleteObject(SelectObject(hdc, oldPen));
} }
EndPaint(&ps); EndPaint(&ps);
if (selectionWindow.IsWindowVisible())
selectionWindow.Invalidate(FALSE); selectionWindow.Invalidate(FALSE);
if (miniature.IsWindowVisible())
miniature.Invalidate(FALSE); miniature.Invalidate(FALSE);
if (textEditWindow.IsWindowVisible()) if (textEditWindow.IsWindowVisible())
textEditWindow.Invalidate(FALSE); textEditWindow.Invalidate(FALSE);

View file

@ -71,7 +71,7 @@ BEGIN
END END
MENUITEM SEPARATOR MENUITEM SEPARATOR
MENUITEM "グリッドを表示(&G)\tCtrl+G", IDM_VIEWSHOWGRID MENUITEM "グリッドを表示(&G)\tCtrl+G", IDM_VIEWSHOWGRID
MENUITEM "実寸表示(&H)", IDM_VIEWSHOWMINIATURE MENUITEM "縮小表示(&H)", IDM_VIEWSHOWMINIATURE
END END
MENUITEM "全画面表示(&F)\tCtrl+F", IDM_VIEWFULLSCREEN MENUITEM "全画面表示(&F)\tCtrl+F", IDM_VIEWFULLSCREEN
END END
@ -212,7 +212,7 @@ BEGIN
IDS_INFOTEXT "GNU Lesser General Public License (LGPL, 詳細は www.gnu.org) の下で利用可能です。" IDS_INFOTEXT "GNU Lesser General Public License (LGPL, 詳細は www.gnu.org) の下で利用可能です。"
IDS_SAVEPROMPTTEXT "%s の変更内容を保存しますか?" IDS_SAVEPROMPTTEXT "%s の変更内容を保存しますか?"
IDS_DEFAULTFILENAME "無題" IDS_DEFAULTFILENAME "無題"
IDS_MINIATURETITLE "縮小" IDS_MINIATURETITLE "縮小表示"
IDS_TOOLTIP1 "自由選択" IDS_TOOLTIP1 "自由選択"
IDS_TOOLTIP2 "選択" IDS_TOOLTIP2 "選択"
IDS_TOOLTIP3 "消しゴム" IDS_TOOLTIP3 "消しゴム"

View file

@ -15,13 +15,13 @@
LRESULT CPaletteWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) LRESULT CPaletteWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{ {
RECT rc = { 0, 0, 31, 32 }; RECT rc = { 0, 0, 31, 32 };
HDC hDC = GetDC();
HPEN oldPen; HPEN oldPen;
HBRUSH oldBrush; HBRUSH oldBrush;
int i, a, b; int i, a, b;
DefWindowProc(WM_PAINT, wParam, lParam); DefWindowProc(WM_PAINT, wParam, lParam);
HDC hDC = GetDC();
for(b = 2; b < 30; b++) for(b = 2; b < 30; b++)
for(a = 2; a < 29; a++) for(a = 2; a < 29; a++)
if ((a + b) % 2 == 1) if ((a + b) % 2 == 1)

View file

@ -22,7 +22,9 @@ const LPCTSTR CSelectionWindow::m_lpszCursorLUT[9] = { /* action to mouse cursor
}; };
BOOL BOOL
ColorKeyedMaskBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, HDC hdcSrc, int nXSrc, int nYSrc, HBITMAP hbmMask, int xMask, int yMask, DWORD dwRop, COLORREF keyColor) ColorKeyedMaskBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight,
HDC hdcSrc, int nXSrc, int nYSrc, HBITMAP hbmMask, int xMask, int yMask,
DWORD dwRop, COLORREF keyColor)
{ {
HDC hTempDC; HDC hTempDC;
HDC hTempDC2; HDC hTempDC2;
@ -88,13 +90,14 @@ int CSelectionWindow::IdentifyCorner(int iXPos, int iYPos, int iWidth, int iHeig
LRESULT CSelectionWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) LRESULT CSelectionWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{ {
DefWindowProc(WM_PAINT, wParam, lParam);
if (!m_bMoving) if (!m_bMoving)
{ {
HDC hDC = GetDC(); HDC hDC = GetDC();
DefWindowProc(WM_PAINT, wParam, lParam); SelectionFrame(hDC, 1, 1,
SelectionFrame(hDC, 1, 1, Zoomed(selectionModel.GetDestRectWidth()) + 5, Zoomed(selectionModel.GetDestRectWidth()) + (GRIP_SIZE * 2) - 1,
Zoomed(selectionModel.GetDestRectHeight()) + 5, Zoomed(selectionModel.GetDestRectHeight()) + (GRIP_SIZE * 2) - 1,
m_dwSystemSelectionColor); GetSysColor(COLOR_HIGHLIGHT));
ReleaseDC(hDC); ReleaseDC(hDC);
} }
return 0; return 0;
@ -103,7 +106,7 @@ LRESULT CSelectionWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL&
LRESULT CSelectionWindow::OnEraseBkgnd(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) LRESULT CSelectionWindow::OnEraseBkgnd(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{ {
// do nothing => transparent background // do nothing => transparent background
return 0; return TRUE;
} }
LRESULT CSelectionWindow::OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) LRESULT CSelectionWindow::OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
@ -111,16 +114,14 @@ LRESULT CSelectionWindow::OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL
m_bMoving = FALSE; m_bMoving = FALSE;
m_iAction = ACTION_MOVE; m_iAction = ACTION_MOVE;
/* update the system selection color */ /* update the system selection color */
m_dwSystemSelectionColor = GetSysColor(COLOR_HIGHLIGHT); Invalidate();
SendMessage(WM_PAINT, 0, MAKELPARAM(0, 0));
return 0; return 0;
} }
LRESULT CSelectionWindow::OnSysColorChange(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) LRESULT CSelectionWindow::OnSysColorChange(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{ {
/* update the system selection color */ /* update the system selection color */
m_dwSystemSelectionColor = GetSysColor(COLOR_HIGHLIGHT); Invalidate();
SendMessage(WM_PAINT, 0, MAKELPARAM(0, 0));
return 0; return 0;
} }

View file

@ -55,7 +55,6 @@ private:
POINT m_ptPos; POINT m_ptPos;
POINT m_ptFrac; POINT m_ptFrac;
POINT m_ptDelta; POINT m_ptDelta;
DWORD m_dwSystemSelectionColor;
int IdentifyCorner(int iXPos, int iYPos, int iWidth, int iHeight); int IdentifyCorner(int iXPos, int iYPos, int iWidth, int iHeight);
}; };

View file

@ -33,12 +33,12 @@ LRESULT CToolSettingsWindow::OnVScroll(UINT nMsg, WPARAM wParam, LPARAM lParam,
LRESULT CToolSettingsWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) LRESULT CToolSettingsWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
{ {
HDC hdc = GetDC();
RECT rect1 = { 0, 0, 42, 66 }; RECT rect1 = { 0, 0, 42, 66 };
RECT rect2 = { 0, 70, 42, 136 }; RECT rect2 = { 0, 70, 42, 136 };
DefWindowProc(WM_PAINT, wParam, lParam); DefWindowProc(WM_PAINT, wParam, lParam);
HDC hdc = GetDC();
DrawEdge(hdc, &rect1, BDR_SUNKENOUTER, (toolsModel.GetActiveTool() == TOOL_ZOOM) ? BF_RECT : BF_RECT | BF_MIDDLE); DrawEdge(hdc, &rect1, BDR_SUNKENOUTER, (toolsModel.GetActiveTool() == TOOL_ZOOM) ? BF_RECT : BF_RECT | BF_MIDDLE);
DrawEdge(hdc, &rect2, (toolsModel.GetActiveTool() >= TOOL_RECT) ? BDR_SUNKENOUTER : 0, BF_RECT | BF_MIDDLE); DrawEdge(hdc, &rect2, (toolsModel.GetActiveTool() >= TOOL_RECT) ? BDR_SUNKENOUTER : 0, BF_RECT | BF_MIDDLE);
switch (toolsModel.GetActiveTool()) switch (toolsModel.GetActiveTool())