https://git.reactos.org/?p=reactos.git;a=commitdiff;h=3456538e3a8ce41d5653fc...
commit 3456538e3a8ce41d5653fc6492e67964ee22776c Author: Katayama Hirofumi MZ katayama.hirofumi.mz@gmail.com AuthorDate: Mon Jan 10 21:44:13 2022 +0900 Commit: GitHub noreply@github.com CommitDate: Mon Jan 10 21:44:13 2022 +0900
[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 --- base/applications/mspaint/drawing.cpp | 2 +- base/applications/mspaint/drawing.h | 2 +- base/applications/mspaint/imgarea.cpp | 6 ++++-- base/applications/mspaint/lang/ja-JP.rc | 4 ++-- base/applications/mspaint/palette.cpp | 2 +- base/applications/mspaint/selection.cpp | 21 +++++++++++---------- base/applications/mspaint/selection.h | 1 - base/applications/mspaint/toolsettings.cpp | 2 +- 8 files changed, 21 insertions(+), 19 deletions(-)
diff --git a/base/applications/mspaint/drawing.cpp b/base/applications/mspaint/drawing.cpp index d7453ff198a..059559252b9 100644 --- a/base/applications/mspaint/drawing.cpp +++ b/base/applications/mspaint/drawing.cpp @@ -246,7 +246,7 @@ 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) +SelectionFrame(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF system_selection_color) { HBRUSH oldBrush; LOGBRUSH logbrush; diff --git a/base/applications/mspaint/drawing.h b/base/applications/mspaint/drawing.h index 737d035250a..017b71f6ddb 100644 --- a/base/applications/mspaint/drawing.h +++ b/base/applications/mspaint/drawing.h @@ -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 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); diff --git a/base/applications/mspaint/imgarea.cpp b/base/applications/mspaint/imgarea.cpp index 6c117591dc6..cfa9a84d8d3 100644 --- a/base/applications/mspaint/imgarea.cpp +++ b/base/applications/mspaint/imgarea.cpp @@ -143,8 +143,10 @@ LRESULT CImgAreaWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& b DeleteObject(SelectObject(hdc, oldPen)); } EndPaint(&ps); - selectionWindow.Invalidate(FALSE); - miniature.Invalidate(FALSE); + if (selectionWindow.IsWindowVisible()) + selectionWindow.Invalidate(FALSE); + if (miniature.IsWindowVisible()) + miniature.Invalidate(FALSE); if (textEditWindow.IsWindowVisible()) textEditWindow.Invalidate(FALSE); return 0; diff --git a/base/applications/mspaint/lang/ja-JP.rc b/base/applications/mspaint/lang/ja-JP.rc index 02fa6324bd4..8da4c05a2a5 100644 --- a/base/applications/mspaint/lang/ja-JP.rc +++ b/base/applications/mspaint/lang/ja-JP.rc @@ -71,7 +71,7 @@ BEGIN END MENUITEM SEPARATOR MENUITEM "グリッドを表示(&G)\tCtrl+G", IDM_VIEWSHOWGRID - MENUITEM "実寸表示(&H)", IDM_VIEWSHOWMINIATURE + MENUITEM "縮小表示(&H)", IDM_VIEWSHOWMINIATURE END MENUITEM "全画面表示(&F)\tCtrl+F", IDM_VIEWFULLSCREEN END @@ -212,7 +212,7 @@ BEGIN IDS_INFOTEXT "GNU Lesser General Public License (LGPL, 詳細は www.gnu.org) の下で利用可能です。" IDS_SAVEPROMPTTEXT "%s の変更内容を保存しますか?" IDS_DEFAULTFILENAME "無題" - IDS_MINIATURETITLE "縮小図" + IDS_MINIATURETITLE "縮小表示" IDS_TOOLTIP1 "自由選択" IDS_TOOLTIP2 "選択" IDS_TOOLTIP3 "消しゴム" diff --git a/base/applications/mspaint/palette.cpp b/base/applications/mspaint/palette.cpp index c83dad82580..9667397a5bf 100644 --- a/base/applications/mspaint/palette.cpp +++ b/base/applications/mspaint/palette.cpp @@ -15,13 +15,13 @@ LRESULT CPaletteWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { RECT rc = { 0, 0, 31, 32 }; - HDC hDC = GetDC(); HPEN oldPen; HBRUSH oldBrush; int i, a, b;
DefWindowProc(WM_PAINT, wParam, lParam);
+ HDC hDC = GetDC(); for(b = 2; b < 30; b++) for(a = 2; a < 29; a++) if ((a + b) % 2 == 1) diff --git a/base/applications/mspaint/selection.cpp b/base/applications/mspaint/selection.cpp index 90bcbde70bb..c2c32880f97 100644 --- a/base/applications/mspaint/selection.cpp +++ b/base/applications/mspaint/selection.cpp @@ -22,7 +22,9 @@ const LPCTSTR CSelectionWindow::m_lpszCursorLUT[9] = { /* action to mouse cursor };
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 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) { + DefWindowProc(WM_PAINT, wParam, lParam); if (!m_bMoving) { HDC hDC = GetDC(); - DefWindowProc(WM_PAINT, wParam, lParam); - SelectionFrame(hDC, 1, 1, Zoomed(selectionModel.GetDestRectWidth()) + 5, - Zoomed(selectionModel.GetDestRectHeight()) + 5, - m_dwSystemSelectionColor); + SelectionFrame(hDC, 1, 1, + Zoomed(selectionModel.GetDestRectWidth()) + (GRIP_SIZE * 2) - 1, + Zoomed(selectionModel.GetDestRectHeight()) + (GRIP_SIZE * 2) - 1, + GetSysColor(COLOR_HIGHLIGHT)); ReleaseDC(hDC); } 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) { // do nothing => transparent background - return 0; + return TRUE; }
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_iAction = ACTION_MOVE; /* update the system selection color */ - m_dwSystemSelectionColor = GetSysColor(COLOR_HIGHLIGHT); - SendMessage(WM_PAINT, 0, MAKELPARAM(0, 0)); + Invalidate(); return 0; }
LRESULT CSelectionWindow::OnSysColorChange(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { /* update the system selection color */ - m_dwSystemSelectionColor = GetSysColor(COLOR_HIGHLIGHT); - SendMessage(WM_PAINT, 0, MAKELPARAM(0, 0)); + Invalidate(); return 0; }
diff --git a/base/applications/mspaint/selection.h b/base/applications/mspaint/selection.h index 4dcd5541bdb..82ba84a6016 100644 --- a/base/applications/mspaint/selection.h +++ b/base/applications/mspaint/selection.h @@ -55,7 +55,6 @@ private: POINT m_ptPos; POINT m_ptFrac; POINT m_ptDelta; - DWORD m_dwSystemSelectionColor;
int IdentifyCorner(int iXPos, int iYPos, int iWidth, int iHeight); }; diff --git a/base/applications/mspaint/toolsettings.cpp b/base/applications/mspaint/toolsettings.cpp index 4639d81da66..0c3d3e0bdf9 100644 --- a/base/applications/mspaint/toolsettings.cpp +++ b/base/applications/mspaint/toolsettings.cpp @@ -33,12 +33,12 @@ LRESULT CToolSettingsWindow::OnVScroll(UINT nMsg, WPARAM wParam, LPARAM lParam,
LRESULT CToolSettingsWindow::OnPaint(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { - HDC hdc = GetDC(); RECT rect1 = { 0, 0, 42, 66 }; RECT rect2 = { 0, 70, 42, 136 };
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, &rect2, (toolsModel.GetActiveTool() >= TOOL_RECT) ? BDR_SUNKENOUTER : 0, BF_RECT | BF_MIDDLE); switch (toolsModel.GetActiveTool())