ReactOS.org
Sign In
Sign Up
Sign In
Sign Up
Manage this list
×
Keyboard Shortcuts
Thread View
j
: Next unread message
k
: Previous unread message
j a
: Jump to all threads
j l
: Jump to MailingList overview
2024
December
November
October
September
August
July
June
May
April
March
February
January
2023
December
November
October
September
August
July
June
May
April
March
February
January
2022
December
November
October
September
August
July
June
May
April
March
February
January
2021
December
November
October
September
August
July
June
May
April
March
February
January
2020
December
November
October
September
August
July
June
May
April
March
February
January
2019
December
November
October
September
August
July
June
May
April
March
February
January
2018
December
November
October
September
August
July
June
May
April
March
February
January
2017
December
November
October
September
August
July
June
May
April
March
February
January
2016
December
November
October
September
August
July
June
May
April
March
February
January
2015
December
November
October
September
August
July
June
May
April
March
February
January
2014
December
November
October
September
August
July
June
May
April
March
February
January
2013
December
November
October
September
August
July
June
May
April
March
February
January
2012
December
November
October
September
August
July
June
May
April
March
February
January
2011
December
November
October
September
August
July
June
May
April
March
February
January
2010
December
November
October
September
August
July
June
May
April
March
February
January
2009
December
November
October
September
August
July
June
May
April
March
February
January
2008
December
November
October
September
August
July
June
May
April
March
February
January
2007
December
November
October
September
August
July
June
May
April
March
February
January
2006
December
November
October
September
August
July
June
May
April
March
February
January
2005
December
November
October
September
August
July
June
May
April
March
February
January
2004
December
November
October
September
August
July
June
May
April
March
February
List overview
Download
Ros-diffs
November 2023
----- 2024 -----
December 2024
November 2024
October 2024
September 2024
August 2024
July 2024
June 2024
May 2024
April 2024
March 2024
February 2024
January 2024
----- 2023 -----
December 2023
November 2023
October 2023
September 2023
August 2023
July 2023
June 2023
May 2023
April 2023
March 2023
February 2023
January 2023
----- 2022 -----
December 2022
November 2022
October 2022
September 2022
August 2022
July 2022
June 2022
May 2022
April 2022
March 2022
February 2022
January 2022
----- 2021 -----
December 2021
November 2021
October 2021
September 2021
August 2021
July 2021
June 2021
May 2021
April 2021
March 2021
February 2021
January 2021
----- 2020 -----
December 2020
November 2020
October 2020
September 2020
August 2020
July 2020
June 2020
May 2020
April 2020
March 2020
February 2020
January 2020
----- 2019 -----
December 2019
November 2019
October 2019
September 2019
August 2019
July 2019
June 2019
May 2019
April 2019
March 2019
February 2019
January 2019
----- 2018 -----
December 2018
November 2018
October 2018
September 2018
August 2018
July 2018
June 2018
May 2018
April 2018
March 2018
February 2018
January 2018
----- 2017 -----
December 2017
November 2017
October 2017
September 2017
August 2017
July 2017
June 2017
May 2017
April 2017
March 2017
February 2017
January 2017
----- 2016 -----
December 2016
November 2016
October 2016
September 2016
August 2016
July 2016
June 2016
May 2016
April 2016
March 2016
February 2016
January 2016
----- 2015 -----
December 2015
November 2015
October 2015
September 2015
August 2015
July 2015
June 2015
May 2015
April 2015
March 2015
February 2015
January 2015
----- 2014 -----
December 2014
November 2014
October 2014
September 2014
August 2014
July 2014
June 2014
May 2014
April 2014
March 2014
February 2014
January 2014
----- 2013 -----
December 2013
November 2013
October 2013
September 2013
August 2013
July 2013
June 2013
May 2013
April 2013
March 2013
February 2013
January 2013
----- 2012 -----
December 2012
November 2012
October 2012
September 2012
August 2012
July 2012
June 2012
May 2012
April 2012
March 2012
February 2012
January 2012
----- 2011 -----
December 2011
November 2011
October 2011
September 2011
August 2011
July 2011
June 2011
May 2011
April 2011
March 2011
February 2011
January 2011
----- 2010 -----
December 2010
November 2010
October 2010
September 2010
August 2010
July 2010
June 2010
May 2010
April 2010
March 2010
February 2010
January 2010
----- 2009 -----
December 2009
November 2009
October 2009
September 2009
August 2009
July 2009
June 2009
May 2009
April 2009
March 2009
February 2009
January 2009
----- 2008 -----
December 2008
November 2008
October 2008
September 2008
August 2008
July 2008
June 2008
May 2008
April 2008
March 2008
February 2008
January 2008
----- 2007 -----
December 2007
November 2007
October 2007
September 2007
August 2007
July 2007
June 2007
May 2007
April 2007
March 2007
February 2007
January 2007
----- 2006 -----
December 2006
November 2006
October 2006
September 2006
August 2006
July 2006
June 2006
May 2006
April 2006
March 2006
February 2006
January 2006
----- 2005 -----
December 2005
November 2005
October 2005
September 2005
August 2005
July 2005
June 2005
May 2005
April 2005
March 2005
February 2005
January 2005
----- 2004 -----
December 2004
November 2004
October 2004
September 2004
August 2004
July 2004
June 2004
May 2004
April 2004
March 2004
February 2004
ros-diffs@reactos.org
20 participants
274 discussions
Start a n
N
ew thread
[reactos] 01/01: [MSPAINT] Localize g_ptStart and g_ptEnd into mouse.cpp
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=fa4b38d902d13072b7b98…
commit fa4b38d902d13072b7b982a4411a31cb84ab24b3 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sat Nov 4 23:00:43 2023 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Sat Nov 4 23:00:43 2023 +0900 [MSPAINT] Localize g_ptStart and g_ptEnd into mouse.cpp And move some ToolsModel code into mouse.cpp CORE-19094 --- base/applications/mspaint/globalvar.h | 2 - base/applications/mspaint/main.cpp | 1 - base/applications/mspaint/mouse.cpp | 129 ++++++++++++++++++++++++++++++- base/applications/mspaint/toolsmodel.cpp | 126 ------------------------------ 4 files changed, 128 insertions(+), 130 deletions(-) diff --git a/base/applications/mspaint/globalvar.h b/base/applications/mspaint/globalvar.h index cb6eed1ebd4..e2257fbb693 100644 --- a/base/applications/mspaint/globalvar.h +++ b/base/applications/mspaint/globalvar.h @@ -11,8 +11,6 @@ extern BOOL g_askBeforeEnlarging; -extern POINT g_ptStart, g_ptEnd; - extern HINSTANCE g_hinstExe; extern WCHAR g_szFileName[MAX_LONG_PATH]; diff --git a/base/applications/mspaint/main.cpp b/base/applications/mspaint/main.cpp index 470c4fd4348..dcc3bab80f1 100644 --- a/base/applications/mspaint/main.cpp +++ b/base/applications/mspaint/main.cpp @@ -10,7 +10,6 @@ #include <dlgs.h> #include <mapi.h> -POINT g_ptStart, g_ptEnd; BOOL g_askBeforeEnlarging = FALSE; // TODO: initialize from registry HINSTANCE g_hinstExe = NULL; WCHAR g_szFileName[MAX_LONG_PATH] = { 0 }; diff --git a/base/applications/mspaint/mouse.cpp b/base/applications/mspaint/mouse.cpp index d4b22296a16..ad709d9c3db 100644 --- a/base/applications/mspaint/mouse.cpp +++ b/base/applications/mspaint/mouse.cpp @@ -3,7 +3,7 @@ * LICENSE: LGPL-2.0-or-later (
https://spdx.org/licenses/LGPL-2.0-or-later
) * PURPOSE: Things which should not be in the mouse event handler itself * COPYRIGHT: Copyright 2015 Benedikt Freisen <b.freisen(a)gmx.net> - * Copyright 2021 Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> + * Copyright 2021-2023 Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> */ /* INCLUDES *********************************************************/ @@ -12,6 +12,7 @@ INT ToolBase::s_pointSP = 0; POINT ToolBase::s_pointStack[256] = { { 0 } }; +static POINT g_ptStart, g_ptEnd; /* FUNCTIONS ********************************************************/ @@ -1097,3 +1098,129 @@ ToolBase::createToolObject(TOOLTYPE type) UNREACHABLE; return NULL; } + +void ToolsModel::OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) +{ + m_pToolObject->beginEvent(); + g_ptStart.x = g_ptEnd.x = x; + g_ptStart.y = g_ptEnd.y = y; + m_pToolObject->OnButtonDown(bLeftButton, x, y, bDoubleClick); + m_pToolObject->endEvent(); +} + +void ToolsModel::OnMouseMove(BOOL bLeftButton, LONG x, LONG y) +{ + m_pToolObject->beginEvent(); + if (m_pToolObject->OnMouseMove(bLeftButton, x, y)) + { + g_ptEnd.x = x; + g_ptEnd.y = y; + } + m_pToolObject->endEvent(); +} + +void ToolsModel::OnButtonUp(BOOL bLeftButton, LONG x, LONG y) +{ + m_pToolObject->beginEvent(); + if (m_pToolObject->OnButtonUp(bLeftButton, x, y)) + { + g_ptEnd.x = x; + g_ptEnd.y = y; + } + m_pToolObject->endEvent(); +} + +void ToolsModel::OnEndDraw(BOOL bCancel) +{ + ATLTRACE("ToolsModel::OnEndDraw(%d)\n", bCancel); + m_pToolObject->beginEvent(); + m_pToolObject->OnEndDraw(bCancel); + m_pToolObject->endEvent(); +} + +void ToolsModel::OnDrawOverlayOnImage(HDC hdc) +{ + m_pToolObject->OnDrawOverlayOnImage(hdc); +} + +void ToolsModel::OnDrawOverlayOnCanvas(HDC hdc) +{ + m_pToolObject->OnDrawOverlayOnCanvas(hdc); +} + +void ToolsModel::SpecialTweak(BOOL bMinus) +{ + m_pToolObject->OnSpecialTweak(bMinus); +} + +void ToolsModel::DrawWithMouseTool(POINT pt, WPARAM wParam) +{ + LONG xRel = pt.x - g_ptStart.x, yRel = pt.y - g_ptStart.y; + + switch (m_activeTool) + { + // freesel, rectsel and text tools always show numbers limited to fit into image area + case TOOL_FREESEL: + case TOOL_RECTSEL: + case TOOL_TEXT: + if (xRel < 0) + xRel = (pt.x < 0) ? -g_ptStart.x : xRel; + else if (pt.x > imageModel.GetWidth()) + xRel = imageModel.GetWidth() - g_ptStart.x; + if (yRel < 0) + yRel = (pt.y < 0) ? -g_ptStart.y : yRel; + else if (pt.y > imageModel.GetHeight()) + yRel = imageModel.GetHeight() - g_ptStart.y; + break; + + // while drawing, update cursor coordinates only for tools 3, 7, 8, 9, 14 + case TOOL_RUBBER: + case TOOL_PEN: + case TOOL_BRUSH: + case TOOL_AIRBRUSH: + case TOOL_SHAPE: + { + CStringW strCoord; + strCoord.Format(L"%ld, %ld", pt.x, pt.y); + ::SendMessageW(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)(LPCWSTR)strCoord); + break; + } + default: + break; + } + + // rectsel and shape tools always show non-negative numbers when drawing + if (m_activeTool == TOOL_RECTSEL || m_activeTool == TOOL_SHAPE) + { + xRel = labs(xRel); + yRel = labs(yRel); + } + + if (wParam & MK_LBUTTON) + { + OnMouseMove(TRUE, pt.x, pt.y); + canvasWindow.Invalidate(FALSE); + if ((m_activeTool >= TOOL_TEXT) || IsSelection()) + { + CStringW strSize; + if ((m_activeTool >= TOOL_LINE) && (GetAsyncKeyState(VK_SHIFT) < 0)) + yRel = xRel; + strSize.Format(L"%ld x %ld", xRel, yRel); + ::SendMessageW(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)(LPCWSTR)strSize); + } + } + + if (wParam & MK_RBUTTON) + { + OnMouseMove(FALSE, pt.x, pt.y); + canvasWindow.Invalidate(FALSE); + if (m_activeTool >= TOOL_TEXT) + { + CStringW strSize; + if ((m_activeTool >= TOOL_LINE) && (GetAsyncKeyState(VK_SHIFT) < 0)) + yRel = xRel; + strSize.Format(L"%ld x %ld", xRel, yRel); + ::SendMessageW(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)(LPCWSTR)strSize); + } + } +} diff --git a/base/applications/mspaint/toolsmodel.cpp b/base/applications/mspaint/toolsmodel.cpp index 0700617403e..884b92d7d6c 100644 --- a/base/applications/mspaint/toolsmodel.cpp +++ b/base/applications/mspaint/toolsmodel.cpp @@ -255,55 +255,6 @@ void ToolsModel::NotifyZoomChanged() canvasWindow.SendMessage(WM_TOOLSMODELZOOMCHANGED); } -void ToolsModel::OnButtonDown(BOOL bLeftButton, LONG x, LONG y, BOOL bDoubleClick) -{ - m_pToolObject->beginEvent(); - g_ptStart.x = g_ptEnd.x = x; - g_ptStart.y = g_ptEnd.y = y; - m_pToolObject->OnButtonDown(bLeftButton, x, y, bDoubleClick); - m_pToolObject->endEvent(); -} - -void ToolsModel::OnMouseMove(BOOL bLeftButton, LONG x, LONG y) -{ - m_pToolObject->beginEvent(); - if (m_pToolObject->OnMouseMove(bLeftButton, x, y)) - { - g_ptEnd.x = x; - g_ptEnd.y = y; - } - m_pToolObject->endEvent(); -} - -void ToolsModel::OnButtonUp(BOOL bLeftButton, LONG x, LONG y) -{ - m_pToolObject->beginEvent(); - if (m_pToolObject->OnButtonUp(bLeftButton, x, y)) - { - g_ptEnd.x = x; - g_ptEnd.y = y; - } - m_pToolObject->endEvent(); -} - -void ToolsModel::OnEndDraw(BOOL bCancel) -{ - ATLTRACE("ToolsModel::OnEndDraw(%d)\n", bCancel); - m_pToolObject->beginEvent(); - m_pToolObject->OnEndDraw(bCancel); - m_pToolObject->endEvent(); -} - -void ToolsModel::OnDrawOverlayOnImage(HDC hdc) -{ - m_pToolObject->OnDrawOverlayOnImage(hdc); -} - -void ToolsModel::OnDrawOverlayOnCanvas(HDC hdc) -{ - m_pToolObject->OnDrawOverlayOnCanvas(hdc); -} - void ToolsModel::resetTool() { m_pToolObject->reset(); @@ -316,80 +267,3 @@ void ToolsModel::selectAll() OnMouseMove(TRUE, imageModel.GetWidth(), imageModel.GetHeight()); OnButtonUp(TRUE, imageModel.GetWidth(), imageModel.GetHeight()); } - -void ToolsModel::SpecialTweak(BOOL bMinus) -{ - m_pToolObject->OnSpecialTweak(bMinus); -} - -void ToolsModel::DrawWithMouseTool(POINT pt, WPARAM wParam) -{ - LONG xRel = pt.x - g_ptStart.x, yRel = pt.y - g_ptStart.y; - - switch (m_activeTool) - { - // freesel, rectsel and text tools always show numbers limited to fit into image area - case TOOL_FREESEL: - case TOOL_RECTSEL: - case TOOL_TEXT: - if (xRel < 0) - xRel = (pt.x < 0) ? -g_ptStart.x : xRel; - else if (pt.x > imageModel.GetWidth()) - xRel = imageModel.GetWidth() - g_ptStart.x; - if (yRel < 0) - yRel = (pt.y < 0) ? -g_ptStart.y : yRel; - else if (pt.y > imageModel.GetHeight()) - yRel = imageModel.GetHeight() - g_ptStart.y; - break; - - // while drawing, update cursor coordinates only for tools 3, 7, 8, 9, 14 - case TOOL_RUBBER: - case TOOL_PEN: - case TOOL_BRUSH: - case TOOL_AIRBRUSH: - case TOOL_SHAPE: - { - CStringW strCoord; - strCoord.Format(L"%ld, %ld", pt.x, pt.y); - ::SendMessageW(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)(LPCWSTR)strCoord); - break; - } - default: - break; - } - - // rectsel and shape tools always show non-negative numbers when drawing - if (m_activeTool == TOOL_RECTSEL || m_activeTool == TOOL_SHAPE) - { - xRel = labs(xRel); - yRel = labs(yRel); - } - - if (wParam & MK_LBUTTON) - { - OnMouseMove(TRUE, pt.x, pt.y); - canvasWindow.Invalidate(FALSE); - if ((m_activeTool >= TOOL_TEXT) || IsSelection()) - { - CStringW strSize; - if ((m_activeTool >= TOOL_LINE) && (GetAsyncKeyState(VK_SHIFT) < 0)) - yRel = xRel; - strSize.Format(L"%ld x %ld", xRel, yRel); - ::SendMessageW(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)(LPCWSTR)strSize); - } - } - - if (wParam & MK_RBUTTON) - { - OnMouseMove(FALSE, pt.x, pt.y); - canvasWindow.Invalidate(FALSE); - if (m_activeTool >= TOOL_TEXT) - { - CStringW strSize; - if ((m_activeTool >= TOOL_LINE) && (GetAsyncKeyState(VK_SHIFT) < 0)) - yRel = xRel; - strSize.Format(L"%ld x %ld", xRel, yRel); - ::SendMessageW(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)(LPCWSTR)strSize); - } - } -}
1 year, 1 month
1
0
0
0
[reactos] 01/01: [MSPAINT] Distinguish between icons and cursors (#5884)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=56828b82d9fd6f92015e1…
commit 56828b82d9fd6f92015e10cd581c3f04cf6a9488 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sat Nov 4 22:15:43 2023 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Sat Nov 4 22:15:43 2023 +0900 [MSPAINT] Distinguish between icons and cursors (#5884) - Convert icons/*_cur.ico to the cursor files (*.cur). - The hot spot is (16, 16) (default). - Rename icons/ folder as img/. - Use LoadCursorW instead of LoadIconW for cursors. - Use CURSOR statements for cursor files instead of ICON statements in rsrc.rc. - I used GIMP to convert the icon files to the PNG files. - I used RealWorld Cursor Editor to convert the PNG files to the cursor files. CORE-19297 --- base/applications/mspaint/CMakeLists.txt | 2 +- base/applications/mspaint/canvas.cpp | 10 ++++---- base/applications/mspaint/icons/airbrush_cur.ico | Bin 2238 -> 0 bytes base/applications/mspaint/icons/color_cur.ico | Bin 2238 -> 0 bytes base/applications/mspaint/icons/fill_cur.ico | Bin 2238 -> 0 bytes base/applications/mspaint/icons/pen_cur.ico | Bin 2238 -> 0 bytes base/applications/mspaint/icons/zoom_cur.ico | Bin 2238 -> 0 bytes base/applications/mspaint/img/airbrush.cur | Bin 0 -> 766 bytes base/applications/mspaint/img/color.cur | Bin 0 -> 766 bytes base/applications/mspaint/img/fill.cur | Bin 0 -> 766 bytes .../mspaint/{icons => img}/fontstoolbar.bmp | Bin .../mspaint/{icons => img}/handdrag.cur | Bin .../mspaint/{icons => img}/horzskew.ico | Bin .../mspaint/{icons => img}/horzstretch.ico | Bin .../mspaint/{icons => img}/iconbar.bmp | Bin .../mspaint/{icons => img}/nontransparent.ico | Bin base/applications/mspaint/{icons => img}/paint.ico | Bin base/applications/mspaint/{icons => img}/paint.svg | 0 base/applications/mspaint/img/pen.cur | Bin 0 -> 766 bytes .../mspaint/{icons => img}/transparency.xcf | Bin .../mspaint/{icons => img}/transparent.ico | Bin .../mspaint/{icons => img}/vertskew.ico | Bin .../mspaint/{icons => img}/vertstretch.ico | Bin base/applications/mspaint/img/zoom.cur | Bin 0 -> 766 bytes base/applications/mspaint/lang/bg-BG.rc | 2 +- base/applications/mspaint/lang/cs-CZ.rc | 2 +- base/applications/mspaint/lang/de-DE.rc | 2 +- base/applications/mspaint/lang/en-GB.rc | 2 +- base/applications/mspaint/lang/en-US.rc | 2 +- base/applications/mspaint/lang/es-ES.rc | 2 +- base/applications/mspaint/lang/et-EE.rc | 2 +- base/applications/mspaint/lang/eu-ES.rc | 2 +- base/applications/mspaint/lang/fr-FR.rc | 2 +- base/applications/mspaint/lang/he-IL.rc | 2 +- base/applications/mspaint/lang/hu-HU.rc | 2 +- base/applications/mspaint/lang/id-ID.rc | 2 +- base/applications/mspaint/lang/it-IT.rc | 2 +- base/applications/mspaint/lang/ja-JP.rc | 2 +- base/applications/mspaint/lang/nl-NL.rc | 2 +- base/applications/mspaint/lang/no-NO.rc | 2 +- base/applications/mspaint/lang/pl-PL.rc | 2 +- base/applications/mspaint/lang/pt-BR.rc | 2 +- base/applications/mspaint/lang/pt-PT.rc | 2 +- base/applications/mspaint/lang/ro-RO.rc | 2 +- base/applications/mspaint/lang/ru-RU.rc | 2 +- base/applications/mspaint/lang/sk-SK.rc | 2 +- base/applications/mspaint/lang/sq-AL.rc | 2 +- base/applications/mspaint/lang/sv-SE.rc | 2 +- base/applications/mspaint/lang/tr-TR.rc | 2 +- base/applications/mspaint/lang/uk-UA.rc | 2 +- base/applications/mspaint/lang/vi-VN.rc | 2 +- base/applications/mspaint/lang/zh-CN.rc | 2 +- base/applications/mspaint/lang/zh-HK.rc | 2 +- base/applications/mspaint/lang/zh-TW.rc | 2 +- base/applications/mspaint/rsrc.rc | 28 ++++++++++----------- 55 files changed, 50 insertions(+), 50 deletions(-) diff --git a/base/applications/mspaint/CMakeLists.txt b/base/applications/mspaint/CMakeLists.txt index 94b8e26c680..d90fea481fd 100644 --- a/base/applications/mspaint/CMakeLists.txt +++ b/base/applications/mspaint/CMakeLists.txt @@ -28,7 +28,7 @@ list(APPEND SOURCE winproc.cpp precomp.h) -file(GLOB mspaint_rc_deps icons/*.*) +file(GLOB mspaint_rc_deps img/*.*) add_rc_deps(rsrc.rc ${mspaint_rc_deps}) add_executable(mspaint ${SOURCE} rsrc.rc) set_module_type(mspaint win32gui UNICODE) diff --git a/base/applications/mspaint/canvas.cpp b/base/applications/mspaint/canvas.cpp index 87553d04400..6ebe32a48ec 100644 --- a/base/applications/mspaint/canvas.cpp +++ b/base/applications/mspaint/canvas.cpp @@ -659,19 +659,19 @@ LRESULT CCanvasWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL switch (toolsModel.GetActiveTool()) { case TOOL_FILL: - ::SetCursor(::LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDC_FILL))); + ::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_FILL))); break; case TOOL_COLOR: - ::SetCursor(::LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDC_COLOR))); + ::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_COLOR))); break; case TOOL_ZOOM: - ::SetCursor(::LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDC_ZOOM))); + ::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_ZOOM))); break; case TOOL_PEN: - ::SetCursor(::LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDC_PEN))); + ::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_PEN))); break; case TOOL_AIRBRUSH: - ::SetCursor(::LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDC_AIRBRUSH))); + ::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_AIRBRUSH))); break; default: ::SetCursor(::LoadCursorW(NULL, (LPCWSTR)IDC_CROSS)); diff --git a/base/applications/mspaint/icons/airbrush_cur.ico b/base/applications/mspaint/icons/airbrush_cur.ico deleted file mode 100644 index aa1a09c5962..00000000000 Binary files a/base/applications/mspaint/icons/airbrush_cur.ico and /dev/null differ diff --git a/base/applications/mspaint/icons/color_cur.ico b/base/applications/mspaint/icons/color_cur.ico deleted file mode 100644 index 49d536df9c6..00000000000 Binary files a/base/applications/mspaint/icons/color_cur.ico and /dev/null differ diff --git a/base/applications/mspaint/icons/fill_cur.ico b/base/applications/mspaint/icons/fill_cur.ico deleted file mode 100644 index fa2679fe3f1..00000000000 Binary files a/base/applications/mspaint/icons/fill_cur.ico and /dev/null differ diff --git a/base/applications/mspaint/icons/pen_cur.ico b/base/applications/mspaint/icons/pen_cur.ico deleted file mode 100644 index 107e55551ec..00000000000 Binary files a/base/applications/mspaint/icons/pen_cur.ico and /dev/null differ diff --git a/base/applications/mspaint/icons/zoom_cur.ico b/base/applications/mspaint/icons/zoom_cur.ico deleted file mode 100644 index 072b2c3a238..00000000000 Binary files a/base/applications/mspaint/icons/zoom_cur.ico and /dev/null differ diff --git a/base/applications/mspaint/img/airbrush.cur b/base/applications/mspaint/img/airbrush.cur new file mode 100644 index 00000000000..cf044906c78 Binary files /dev/null and b/base/applications/mspaint/img/airbrush.cur differ diff --git a/base/applications/mspaint/img/color.cur b/base/applications/mspaint/img/color.cur new file mode 100644 index 00000000000..ac736b21b79 Binary files /dev/null and b/base/applications/mspaint/img/color.cur differ diff --git a/base/applications/mspaint/img/fill.cur b/base/applications/mspaint/img/fill.cur new file mode 100644 index 00000000000..df2fbe6c1a2 Binary files /dev/null and b/base/applications/mspaint/img/fill.cur differ diff --git a/base/applications/mspaint/icons/fontstoolbar.bmp b/base/applications/mspaint/img/fontstoolbar.bmp similarity index 100% rename from base/applications/mspaint/icons/fontstoolbar.bmp rename to base/applications/mspaint/img/fontstoolbar.bmp diff --git a/base/applications/mspaint/icons/handdrag.cur b/base/applications/mspaint/img/handdrag.cur similarity index 100% rename from base/applications/mspaint/icons/handdrag.cur rename to base/applications/mspaint/img/handdrag.cur diff --git a/base/applications/mspaint/icons/horzskew.ico b/base/applications/mspaint/img/horzskew.ico similarity index 100% rename from base/applications/mspaint/icons/horzskew.ico rename to base/applications/mspaint/img/horzskew.ico diff --git a/base/applications/mspaint/icons/horzstretch.ico b/base/applications/mspaint/img/horzstretch.ico similarity index 100% rename from base/applications/mspaint/icons/horzstretch.ico rename to base/applications/mspaint/img/horzstretch.ico diff --git a/base/applications/mspaint/icons/iconbar.bmp b/base/applications/mspaint/img/iconbar.bmp similarity index 100% rename from base/applications/mspaint/icons/iconbar.bmp rename to base/applications/mspaint/img/iconbar.bmp diff --git a/base/applications/mspaint/icons/nontransparent.ico b/base/applications/mspaint/img/nontransparent.ico similarity index 100% rename from base/applications/mspaint/icons/nontransparent.ico rename to base/applications/mspaint/img/nontransparent.ico diff --git a/base/applications/mspaint/icons/paint.ico b/base/applications/mspaint/img/paint.ico similarity index 100% rename from base/applications/mspaint/icons/paint.ico rename to base/applications/mspaint/img/paint.ico diff --git a/base/applications/mspaint/icons/paint.svg b/base/applications/mspaint/img/paint.svg similarity index 100% rename from base/applications/mspaint/icons/paint.svg rename to base/applications/mspaint/img/paint.svg diff --git a/base/applications/mspaint/img/pen.cur b/base/applications/mspaint/img/pen.cur new file mode 100644 index 00000000000..98f90d0388b Binary files /dev/null and b/base/applications/mspaint/img/pen.cur differ diff --git a/base/applications/mspaint/icons/transparency.xcf b/base/applications/mspaint/img/transparency.xcf similarity index 100% rename from base/applications/mspaint/icons/transparency.xcf rename to base/applications/mspaint/img/transparency.xcf diff --git a/base/applications/mspaint/icons/transparent.ico b/base/applications/mspaint/img/transparent.ico similarity index 100% rename from base/applications/mspaint/icons/transparent.ico rename to base/applications/mspaint/img/transparent.ico diff --git a/base/applications/mspaint/icons/vertskew.ico b/base/applications/mspaint/img/vertskew.ico similarity index 100% rename from base/applications/mspaint/icons/vertskew.ico rename to base/applications/mspaint/img/vertskew.ico diff --git a/base/applications/mspaint/icons/vertstretch.ico b/base/applications/mspaint/img/vertstretch.ico similarity index 100% rename from base/applications/mspaint/icons/vertstretch.ico rename to base/applications/mspaint/img/vertstretch.ico diff --git a/base/applications/mspaint/img/zoom.cur b/base/applications/mspaint/img/zoom.cur new file mode 100644 index 00000000000..23adbec2bf7 Binary files /dev/null and b/base/applications/mspaint/img/zoom.cur differ diff --git a/base/applications/mspaint/lang/bg-BG.rc b/base/applications/mspaint/lang/bg-BG.rc index e880803577d..94ce4e67db4 100644 --- a/base/applications/mspaint/lang/bg-BG.rc +++ b/base/applications/mspaint/lang/bg-BG.rc @@ -8,7 +8,7 @@ LANGUAGE LANG_BULGARIAN, SUBLANG_DEFAULT -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-bg-BG.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-bg-BG.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/cs-CZ.rc b/base/applications/mspaint/lang/cs-CZ.rc index 22f2387752a..8d367b9e21f 100644 --- a/base/applications/mspaint/lang/cs-CZ.rc +++ b/base/applications/mspaint/lang/cs-CZ.rc @@ -8,7 +8,7 @@ LANGUAGE LANG_CZECH, SUBLANG_DEFAULT -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-cs-CZ.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-cs-CZ.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/de-DE.rc b/base/applications/mspaint/lang/de-DE.rc index 07511f578ed..3af564c5035 100644 --- a/base/applications/mspaint/lang/de-DE.rc +++ b/base/applications/mspaint/lang/de-DE.rc @@ -7,7 +7,7 @@ LANGUAGE LANG_GERMAN, SUBLANG_NEUTRAL -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-de-DE.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-de-DE.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/en-GB.rc b/base/applications/mspaint/lang/en-GB.rc index 29b47c1b7de..25ce4329748 100644 --- a/base/applications/mspaint/lang/en-GB.rc +++ b/base/applications/mspaint/lang/en-GB.rc @@ -7,7 +7,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_UK -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-en-GB.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-en-GB.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/en-US.rc b/base/applications/mspaint/lang/en-US.rc index 9119010ce53..9fb7a622aa5 100644 --- a/base/applications/mspaint/lang/en-US.rc +++ b/base/applications/mspaint/lang/en-US.rc @@ -8,7 +8,7 @@ LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US -IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar.bmp" +IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/es-ES.rc b/base/applications/mspaint/lang/es-ES.rc index 6af66999fea..805353c3968 100644 --- a/base/applications/mspaint/lang/es-ES.rc +++ b/base/applications/mspaint/lang/es-ES.rc @@ -10,7 +10,7 @@ LANGUAGE LANG_SPANISH, SUBLANG_NEUTRAL -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-es-ES.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-es-ES.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/et-EE.rc b/base/applications/mspaint/lang/et-EE.rc index c6fef7bb171..350f1a0f90f 100644 --- a/base/applications/mspaint/lang/et-EE.rc +++ b/base/applications/mspaint/lang/et-EE.rc @@ -7,7 +7,7 @@ LANGUAGE LANG_ESTONIAN, SUBLANG_DEFAULT -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-et-EE.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-et-EE.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/eu-ES.rc b/base/applications/mspaint/lang/eu-ES.rc index fdda0e8edbd..41a8abc6a7b 100644 --- a/base/applications/mspaint/lang/eu-ES.rc +++ b/base/applications/mspaint/lang/eu-ES.rc @@ -8,7 +8,7 @@ LANGUAGE LANG_BASQUE, SUBLANG_DEFAULT -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-eu-ES.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-eu-ES.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/fr-FR.rc b/base/applications/mspaint/lang/fr-FR.rc index 056a79f6f8e..f37bf8a8444 100644 --- a/base/applications/mspaint/lang/fr-FR.rc +++ b/base/applications/mspaint/lang/fr-FR.rc @@ -8,7 +8,7 @@ LANGUAGE LANG_FRENCH, SUBLANG_FRENCH -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-fr-FR.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-fr-FR.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/he-IL.rc b/base/applications/mspaint/lang/he-IL.rc index 853dfb9852f..acfb1c65f0f 100644 --- a/base/applications/mspaint/lang/he-IL.rc +++ b/base/applications/mspaint/lang/he-IL.rc @@ -7,7 +7,7 @@ LANGUAGE LANG_HEBREW, SUBLANG_DEFAULT -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-he-IL.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-he-IL.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/hu-HU.rc b/base/applications/mspaint/lang/hu-HU.rc index 266ab21eeb2..bb63ad06f54 100644 --- a/base/applications/mspaint/lang/hu-HU.rc +++ b/base/applications/mspaint/lang/hu-HU.rc @@ -8,7 +8,7 @@ LANGUAGE LANG_HUNGARIAN, SUBLANG_DEFAULT -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-hu-HU.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-hu-HU.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/id-ID.rc b/base/applications/mspaint/lang/id-ID.rc index b03210330f4..fb7dfe53482 100644 --- a/base/applications/mspaint/lang/id-ID.rc +++ b/base/applications/mspaint/lang/id-ID.rc @@ -7,7 +7,7 @@ LANGUAGE LANG_INDONESIAN, SUBLANG_DEFAULT -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-id-ID.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-id-ID.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/it-IT.rc b/base/applications/mspaint/lang/it-IT.rc index 6ef469f5923..a97c7034912 100644 --- a/base/applications/mspaint/lang/it-IT.rc +++ b/base/applications/mspaint/lang/it-IT.rc @@ -8,7 +8,7 @@ LANGUAGE LANG_ITALIAN, SUBLANG_NEUTRAL -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-it-IT.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-it-IT.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/ja-JP.rc b/base/applications/mspaint/lang/ja-JP.rc index 5c41f90053b..cb8d2f91061 100644 --- a/base/applications/mspaint/lang/ja-JP.rc +++ b/base/applications/mspaint/lang/ja-JP.rc @@ -9,7 +9,7 @@ LANGUAGE LANG_JAPANESE, SUBLANG_DEFAULT -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-ja-JP.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-ja-JP.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/nl-NL.rc b/base/applications/mspaint/lang/nl-NL.rc index de8539ebfc3..972814c2cb1 100644 --- a/base/applications/mspaint/lang/nl-NL.rc +++ b/base/applications/mspaint/lang/nl-NL.rc @@ -7,7 +7,7 @@ LANGUAGE LANG_DUTCH, SUBLANG_NEUTRAL -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-nl-NL.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-nl-NL.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/no-NO.rc b/base/applications/mspaint/lang/no-NO.rc index 001ca09b9f2..3e5f1a57146 100644 --- a/base/applications/mspaint/lang/no-NO.rc +++ b/base/applications/mspaint/lang/no-NO.rc @@ -7,7 +7,7 @@ LANGUAGE LANG_NORWEGIAN, SUBLANG_NEUTRAL -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-no-NO.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-no-NO.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/pl-PL.rc b/base/applications/mspaint/lang/pl-PL.rc index 0f9b0076a7a..9128980bc7c 100644 --- a/base/applications/mspaint/lang/pl-PL.rc +++ b/base/applications/mspaint/lang/pl-PL.rc @@ -10,7 +10,7 @@ LANGUAGE LANG_POLISH, SUBLANG_DEFAULT -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-pl-PL.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-pl-PL.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/pt-BR.rc b/base/applications/mspaint/lang/pt-BR.rc index be53b2cc1b4..f69ff23f54d 100644 --- a/base/applications/mspaint/lang/pt-BR.rc +++ b/base/applications/mspaint/lang/pt-BR.rc @@ -8,7 +8,7 @@ LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE_BRAZILIAN -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-pt-BR.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-pt-BR.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/pt-PT.rc b/base/applications/mspaint/lang/pt-PT.rc index f4b9638e03e..c698236a6c4 100644 --- a/base/applications/mspaint/lang/pt-PT.rc +++ b/base/applications/mspaint/lang/pt-PT.rc @@ -8,7 +8,7 @@ LANGUAGE LANG_PORTUGUESE, SUBLANG_PORTUGUESE -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-pt-PT.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-pt-PT.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/ro-RO.rc b/base/applications/mspaint/lang/ro-RO.rc index 274c14a28ea..6bd7c0e3698 100644 --- a/base/applications/mspaint/lang/ro-RO.rc +++ b/base/applications/mspaint/lang/ro-RO.rc @@ -9,7 +9,7 @@ LANGUAGE LANG_ROMANIAN, SUBLANG_NEUTRAL -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-ro-RO.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-ro-RO.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/ru-RU.rc b/base/applications/mspaint/lang/ru-RU.rc index 964453968e6..644ef61ad8a 100644 --- a/base/applications/mspaint/lang/ru-RU.rc +++ b/base/applications/mspaint/lang/ru-RU.rc @@ -11,7 +11,7 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-ru-RU.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-ru-RU.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/sk-SK.rc b/base/applications/mspaint/lang/sk-SK.rc index 5fa46a01124..e42f6ac69e0 100644 --- a/base/applications/mspaint/lang/sk-SK.rc +++ b/base/applications/mspaint/lang/sk-SK.rc @@ -7,7 +7,7 @@ LANGUAGE LANG_SLOVAK, SUBLANG_DEFAULT -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-sk-SK.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-sk-SK.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/sq-AL.rc b/base/applications/mspaint/lang/sq-AL.rc index 5da01332cd3..584d180bcfc 100644 --- a/base/applications/mspaint/lang/sq-AL.rc +++ b/base/applications/mspaint/lang/sq-AL.rc @@ -7,7 +7,7 @@ LANGUAGE LANG_ALBANIAN, SUBLANG_NEUTRAL -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-sq-AL.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-sq-AL.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/sv-SE.rc b/base/applications/mspaint/lang/sv-SE.rc index ec2f3205a74..0c3b2907d02 100644 --- a/base/applications/mspaint/lang/sv-SE.rc +++ b/base/applications/mspaint/lang/sv-SE.rc @@ -8,7 +8,7 @@ LANGUAGE LANG_SWEDISH, SUBLANG_NEUTRAL -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-sv-SE.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-sv-SE.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/tr-TR.rc b/base/applications/mspaint/lang/tr-TR.rc index b7768297a36..9a5b7004afd 100644 --- a/base/applications/mspaint/lang/tr-TR.rc +++ b/base/applications/mspaint/lang/tr-TR.rc @@ -8,7 +8,7 @@ LANGUAGE LANG_TURKISH, SUBLANG_DEFAULT -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-tr-TR.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-tr-TR.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/uk-UA.rc b/base/applications/mspaint/lang/uk-UA.rc index e54a662e1fe..1a6a3f86fec 100644 --- a/base/applications/mspaint/lang/uk-UA.rc +++ b/base/applications/mspaint/lang/uk-UA.rc @@ -9,7 +9,7 @@ LANGUAGE LANG_UKRAINIAN, SUBLANG_DEFAULT -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-uk-UA.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-uk-UA.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/vi-VN.rc b/base/applications/mspaint/lang/vi-VN.rc index cebeb1d53cc..d40302055e6 100644 --- a/base/applications/mspaint/lang/vi-VN.rc +++ b/base/applications/mspaint/lang/vi-VN.rc @@ -7,7 +7,7 @@ LANGUAGE LANG_VIETNAMESE, SUBLANG_VIETNAMESE_VIETNAM -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-vi-VN.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-vi-VN.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/zh-CN.rc b/base/applications/mspaint/lang/zh-CN.rc index 962479ab51f..19408aaebfc 100644 --- a/base/applications/mspaint/lang/zh-CN.rc +++ b/base/applications/mspaint/lang/zh-CN.rc @@ -10,7 +10,7 @@ LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_SIMPLIFIED -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-zh-CN.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-zh-CN.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/zh-HK.rc b/base/applications/mspaint/lang/zh-HK.rc index 65dd0e96eb3..5691d4d8811 100644 --- a/base/applications/mspaint/lang/zh-HK.rc +++ b/base/applications/mspaint/lang/zh-HK.rc @@ -8,7 +8,7 @@ LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_HONGKONG -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-zh-HK.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-zh-HK.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/lang/zh-TW.rc b/base/applications/mspaint/lang/zh-TW.rc index f08299a24f1..33963d485fd 100644 --- a/base/applications/mspaint/lang/zh-TW.rc +++ b/base/applications/mspaint/lang/zh-TW.rc @@ -8,7 +8,7 @@ LANGUAGE LANG_CHINESE, SUBLANG_CHINESE_TRADITIONAL -//IDB_FONTSTOOLBAR BITMAP "icons/fontstoolbar-zh-TW.bmp" +//IDB_FONTSTOOLBAR BITMAP "img/fontstoolbar-zh-TW.bmp" ID_MENU MENU BEGIN diff --git a/base/applications/mspaint/rsrc.rc b/base/applications/mspaint/rsrc.rc index 5798f4c9ff7..e16d27fce9e 100644 --- a/base/applications/mspaint/rsrc.rc +++ b/base/applications/mspaint/rsrc.rc @@ -21,24 +21,24 @@ /* Icons */ -IDI_APPICON ICON "icons/paint.ico" +IDI_APPICON ICON "img/paint.ico" -IDB_TOOLBARICONS BITMAP "icons/iconbar.bmp" +IDB_TOOLBARICONS BITMAP "img/iconbar.bmp" -IDI_TRANSPARENT ICON "icons/transparent.ico" -IDI_NONTRANSPARENT ICON "icons/nontransparent.ico" +IDI_TRANSPARENT ICON "img/transparent.ico" +IDI_NONTRANSPARENT ICON "img/nontransparent.ico" -IDC_FILL ICON "icons/fill_cur.ico" -IDC_COLOR ICON "icons/color_cur.ico" -IDC_ZOOM ICON "icons/zoom_cur.ico" -IDC_PEN ICON "icons/pen_cur.ico" -IDC_AIRBRUSH ICON "icons/airbrush_cur.ico" -IDC_HANDDRAG CURSOR "icons/handdrag.cur" +IDC_FILL CURSOR "img/fill.cur" +IDC_COLOR CURSOR "img/color.cur" +IDC_ZOOM CURSOR "img/zoom.cur" +IDC_PEN CURSOR "img/pen.cur" +IDC_AIRBRUSH CURSOR "img/airbrush.cur" +IDC_HANDDRAG CURSOR "img/handdrag.cur" -IDI_HORZSTRETCH ICON "icons/horzstretch.ico" -IDI_VERTSTRETCH ICON "icons/vertstretch.ico" -IDI_HORZSKEW ICON "icons/horzskew.ico" -IDI_VERTSKEW ICON "icons/vertskew.ico" +IDI_HORZSTRETCH ICON "img/horzstretch.ico" +IDI_VERTSTRETCH ICON "img/vertstretch.ico" +IDI_HORZSKEW ICON "img/horzskew.ico" +IDI_VERTSKEW ICON "img/vertskew.ico" CREATEPROCESS_MANIFEST_RESOURCE_ID RT_MANIFEST "mspaint.exe.manifest"
1 year, 1 month
1
0
0
0
[reactos] 01/01: [SHELL32] Commonize CCopyToMenu and CMoveToMenu (#5873)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=a938d19714f9ab659c8d9…
commit a938d19714f9ab659c8d9c2250f2cafc5db8f637 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sat Nov 4 21:56:15 2023 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Sat Nov 4 21:56:15 2023 +0900 [SHELL32] Commonize CCopyToMenu and CMoveToMenu (#5873) Reduce code. And correctly do the filename check. CORE-18909 --- .../{CMoveToMenu.cpp => CCopyMoveToMenu.cpp} | 187 ++++++---- dll/win32/shell32/CCopyMoveToMenu.h | 111 ++++++ dll/win32/shell32/CCopyToMenu.cpp | 381 --------------------- dll/win32/shell32/CCopyToMoveToMenu.h | 112 ------ dll/win32/shell32/CMakeLists.txt | 3 +- dll/win32/shell32/precomp.h | 2 +- 6 files changed, 233 insertions(+), 563 deletions(-) diff --git a/dll/win32/shell32/CMoveToMenu.cpp b/dll/win32/shell32/CCopyMoveToMenu.cpp similarity index 66% rename from dll/win32/shell32/CMoveToMenu.cpp rename to dll/win32/shell32/CCopyMoveToMenu.cpp index a2d35f1ade1..859b05eb5b7 100644 --- a/dll/win32/shell32/CMoveToMenu.cpp +++ b/dll/win32/shell32/CCopyMoveToMenu.cpp @@ -1,33 +1,29 @@ /* - * PROJECT: shell32 + * PROJECT: ReactOS shell32 * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later
) - * PURPOSE: MoveTo implementation - * COPYRIGHT: Copyright 2020 Katayama Hirofumi MZ (katayama.hirofumi.mz(a)gmail.com) + * PURPOSE: CopyTo and MoveTo implementation + * COPYRIGHT: Copyright 2020-2023 Katayama Hirofumi MZ (katayama.hirofumi.mz(a)gmail.com) */ #include "precomp.h" WINE_DEFAULT_DEBUG_CHANNEL(shell); -CMoveToMenu::CMoveToMenu() : +CCopyMoveToMenu::CCopyMoveToMenu() : m_idCmdFirst(0), m_idCmdLast(0), - m_idCmdMoveTo(-1), + m_idCmdAction(-1), m_fnOldWndProc(NULL), m_bIgnoreTextBoxChange(FALSE) { } -CMoveToMenu::~CMoveToMenu() -{ -} - static LRESULT CALLBACK WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { WCHAR szPath[MAX_PATH]; - CMoveToMenu *this_ = - reinterpret_cast<CMoveToMenu *>(GetWindowLongPtr(hwnd, GWLP_USERDATA)); + CCopyMoveToMenu *this_ = + reinterpret_cast<CCopyMoveToMenu *>(GetWindowLongPtr(hwnd, GWLP_USERDATA)); switch (uMsg) { @@ -64,30 +60,30 @@ WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) return CallWindowProcW(this_->m_fnOldWndProc, hwnd, uMsg, wParam, lParam); } -static int CALLBACK +static INT CALLBACK BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData) { - CMoveToMenu *this_ = - reinterpret_cast<CMoveToMenu *>(GetWindowLongPtr(hwnd, GWLP_USERDATA)); + CCopyMoveToMenu *this_ = + reinterpret_cast<CCopyMoveToMenu *>(GetWindowLongPtr(hwnd, GWLP_USERDATA)); switch (uMsg) { case BFFM_INITIALIZED: { SetWindowLongPtr(hwnd, GWLP_USERDATA, lpData); - this_ = reinterpret_cast<CMoveToMenu *>(lpData); + this_ = reinterpret_cast<CCopyMoveToMenu *>(lpData); // Select initial directory SendMessageW(hwnd, BFFM_SETSELECTION, FALSE, reinterpret_cast<LPARAM>(static_cast<LPCITEMIDLIST>(this_->m_pidlFolder))); // Set caption - CString strCaption(MAKEINTRESOURCEW(IDS_MOVEITEMS)); + CString strCaption(MAKEINTRESOURCEW(this_->GetCaptionStringID())); SetWindowTextW(hwnd, strCaption); // Set OK button text - CString strMove(MAKEINTRESOURCEW(IDS_MOVEBUTTON)); - SetDlgItemText(hwnd, IDOK, strMove); + CString strCopyOrMove(MAKEINTRESOURCEW(this_->GetButtonStringID())); + SetDlgItemText(hwnd, IDOK, strCopyOrMove); // Subclassing this_->m_fnOldWndProc = @@ -125,7 +121,8 @@ BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData) return FALSE; } -HRESULT CMoveToMenu::DoRealMove(LPCMINVOKECOMMANDINFO lpici, LPCITEMIDLIST pidl) +HRESULT +CCopyMoveToMenu::DoRealFileOp(LPCMINVOKECOMMANDINFO lpici, LPCITEMIDLIST pidl) { CDataObjectHIDA pCIDA(m_pDataObject); if (FAILED_UNEXPECTEDLY(pCIDA.hr())) @@ -175,10 +172,7 @@ HRESULT CMoveToMenu::DoRealMove(LPCMINVOKECOMMANDINFO lpici, LPCITEMIDLIST pidl) return E_FAIL; } - SHFILEOPSTRUCTW op = { lpici->hwnd }; - op.wFunc = FO_MOVE; - op.pFrom = strFiles; - op.pTo = szPath; + SHFILEOPSTRUCTW op = { lpici->hwnd, GetFileOp(), strFiles, szPath }; op.fFlags = FOF_ALLOWUNDO; int res = SHFileOperationW(&op); if (res) @@ -189,19 +183,18 @@ HRESULT CMoveToMenu::DoRealMove(LPCMINVOKECOMMANDINFO lpici, LPCITEMIDLIST pidl) return S_OK; } -CStringW CMoveToMenu::DoGetFileTitle() +static HRESULT +DoGetFileTitle(CStringW& strTitle, IDataObject *pDataObject) { - CStringW ret = L"(file)"; - - CDataObjectHIDA pCIDA(m_pDataObject); + CDataObjectHIDA pCIDA(pDataObject); if (FAILED_UNEXPECTEDLY(pCIDA.hr())) - return ret; + return E_FAIL; PCUIDLIST_ABSOLUTE pidlParent = HIDA_GetPIDLFolder(pCIDA); if (!pidlParent) { ERR("HIDA_GetPIDLFolder failed\n"); - return ret; + return E_FAIL; } WCHAR szPath[MAX_PATH]; @@ -209,28 +202,33 @@ CStringW CMoveToMenu::DoGetFileTitle() if (!pidlRelative) { ERR("HIDA_GetPIDLItem failed\n"); - return ret; + return E_FAIL; } CComHeapPtr<ITEMIDLIST> pidlCombine(ILCombine(pidlParent, pidlRelative)); - if (SHGetPathFromIDListW(pidlCombine, szPath)) - ret = PathFindFileNameW(szPath); - else + if (!SHGetPathFromIDListW(pidlCombine, szPath)) + { ERR("Cannot get path\n"); + return E_FAIL; + } + + strTitle = PathFindFileNameW(szPath); + if (strTitle.IsEmpty()) + return E_FAIL; if (pCIDA->cidl > 1) - ret += L" ..."; + strTitle += L" ..."; - return ret; + return S_OK; } -HRESULT CMoveToMenu::DoMoveToFolder(LPCMINVOKECOMMANDINFO lpici) +HRESULT CCopyMoveToMenu::DoAction(LPCMINVOKECOMMANDINFO lpici) { WCHAR wszPath[MAX_PATH]; HRESULT hr = E_FAIL; - TRACE("DoMoveToFolder(%p)\n", lpici); + TRACE("(%p)\n", lpici); if (!SHGetPathFromIDListW(m_pidlFolder, wszPath)) { @@ -238,9 +236,13 @@ HRESULT CMoveToMenu::DoMoveToFolder(LPCMINVOKECOMMANDINFO lpici) return hr; } - CStringW strFileTitle = DoGetFileTitle(); + CStringW strFileTitle; + hr = DoGetFileTitle(strFileTitle, m_pDataObject); + if (FAILED(hr)) + return hr; + CStringW strTitle; - strTitle.Format(IDS_MOVETOTITLE, static_cast<LPCWSTR>(strFileTitle)); + strTitle.Format(GetActionTitleStringID(), static_cast<LPCWSTR>(strFileTitle)); BROWSEINFOW info = { lpici->hwnd }; info.pidlRoot = NULL; @@ -250,14 +252,67 @@ HRESULT CMoveToMenu::DoMoveToFolder(LPCMINVOKECOMMANDINFO lpici) info.lParam = reinterpret_cast<LPARAM>(this); CComHeapPtr<ITEMIDLIST> pidl(SHBrowseForFolder(&info)); if (pidl) + hr = DoRealFileOp(lpici, pidl); + + return hr; +} + +STDMETHODIMP +CCopyToMenu::QueryContextMenu(HMENU hMenu, + UINT indexMenu, + UINT idCmdFirst, + UINT idCmdLast, + UINT uFlags) +{ + MENUITEMINFOW mii; + UINT Count = 0; + + TRACE("CCopyToMenu::QueryContextMenu(%p, %u, %u, %u, %u)\n", + hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags); + + if (uFlags & (CMF_NOVERBS | CMF_VERBSONLY)) + return MAKE_HRESULT(SEVERITY_SUCCESS, 0, idCmdFirst); + + m_idCmdFirst = m_idCmdLast = idCmdFirst; + + // insert separator if necessary + ZeroMemory(&mii, sizeof(mii)); + mii.cbSize = sizeof(mii); + mii.fMask = MIIM_TYPE; + if (GetMenuItemInfoW(hMenu, indexMenu - 1, TRUE, &mii) && + mii.fType != MFT_SEPARATOR) { - hr = DoRealMove(lpici, pidl); + ZeroMemory(&mii, sizeof(mii)); + mii.cbSize = sizeof(mii); + mii.fMask = MIIM_TYPE; + mii.fType = MFT_SEPARATOR; + if (InsertMenuItemW(hMenu, indexMenu, TRUE, &mii)) + { + ++indexMenu; + ++Count; + } } - return hr; + // insert "Copy to folder..." + CStringW strText(MAKEINTRESOURCEW(IDS_COPYTOMENU)); + ZeroMemory(&mii, sizeof(mii)); + mii.cbSize = sizeof(mii); + mii.fMask = MIIM_ID | MIIM_TYPE; + mii.fType = MFT_STRING; + mii.dwTypeData = strText.GetBuffer(); + mii.cch = wcslen(mii.dwTypeData); + mii.wID = m_idCmdLast; + if (InsertMenuItemW(hMenu, indexMenu, TRUE, &mii)) + { + m_idCmdAction = m_idCmdLast++; + ++indexMenu; + ++Count; + } + + return MAKE_HRESULT(SEVERITY_SUCCESS, 0, idCmdFirst + Count); } -HRESULT WINAPI +STDMETHODIMP CMoveToMenu::QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, @@ -309,7 +364,7 @@ CMoveToMenu::QueryContextMenu(HMENU hMenu, mii.wID = m_idCmdLast; if (InsertMenuItemW(hMenu, indexMenu, TRUE, &mii)) { - m_idCmdMoveTo = m_idCmdLast++; + m_idCmdAction = m_idCmdLast++; ++indexMenu; ++Count; } @@ -317,36 +372,33 @@ CMoveToMenu::QueryContextMenu(HMENU hMenu, return MAKE_HRESULT(SEVERITY_SUCCESS, 0, idCmdFirst + Count); } -HRESULT WINAPI -CMoveToMenu::InvokeCommand(LPCMINVOKECOMMANDINFO lpici) +STDMETHODIMP +CCopyMoveToMenu::InvokeCommand(LPCMINVOKECOMMANDINFO lpici) { HRESULT hr = E_FAIL; - TRACE("CMoveToMenu::InvokeCommand(%p)\n", lpici); + TRACE("CCopyMoveToMenu::InvokeCommand(%p)\n", lpici); if (IS_INTRESOURCE(lpici->lpVerb)) { - if (m_idCmdFirst + LOWORD(lpici->lpVerb) == m_idCmdMoveTo) - { - hr = DoMoveToFolder(lpici); - } + if (m_idCmdFirst + LOWORD(lpici->lpVerb) == m_idCmdAction) + hr = DoAction(lpici); } else { - if (::lstrcmpiA(lpici->lpVerb, "moveto") == 0) - { - hr = DoMoveToFolder(lpici); - } + if (::lstrcmpiA(lpici->lpVerb, GetVerb()) == 0) + hr = DoAction(lpici); } return hr; } -HRESULT WINAPI -CMoveToMenu::GetCommandString(UINT_PTR idCmd, - UINT uType, - UINT *pwReserved, - LPSTR pszName, - UINT cchMax) +STDMETHODIMP +CCopyMoveToMenu::GetCommandString( + UINT_PTR idCmd, + UINT uType, + UINT *pwReserved, + LPSTR pszName, + UINT cchMax) { FIXME("%p %lu %u %p %p %u\n", this, idCmd, uType, pwReserved, pszName, cchMax); @@ -354,29 +406,30 @@ CMoveToMenu::GetCommandString(UINT_PTR idCmd, return E_NOTIMPL; } -HRESULT WINAPI -CMoveToMenu::HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam) +STDMETHODIMP +CCopyMoveToMenu::HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam) { TRACE("This %p uMsg %x\n", this, uMsg); return E_NOTIMPL; } -HRESULT WINAPI -CMoveToMenu::Initialize(PCIDLIST_ABSOLUTE pidlFolder, - IDataObject *pdtobj, HKEY hkeyProgID) +STDMETHODIMP +CCopyMoveToMenu::Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID) { m_pidlFolder.Attach(ILClone(pidlFolder)); m_pDataObject = pdtobj; return S_OK; } -HRESULT WINAPI CMoveToMenu::SetSite(IUnknown *pUnkSite) +STDMETHODIMP +CCopyMoveToMenu::SetSite(IUnknown *pUnkSite) { m_pSite = pUnkSite; return S_OK; } -HRESULT WINAPI CMoveToMenu::GetSite(REFIID riid, void **ppvSite) +STDMETHODIMP +CCopyMoveToMenu::GetSite(REFIID riid, void **ppvSite) { if (!m_pSite) return E_FAIL; diff --git a/dll/win32/shell32/CCopyMoveToMenu.h b/dll/win32/shell32/CCopyMoveToMenu.h new file mode 100644 index 00000000000..3b9de7ad91a --- /dev/null +++ b/dll/win32/shell32/CCopyMoveToMenu.h @@ -0,0 +1,111 @@ +/* + * PROJECT: ReactOS shell32 + * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later
) + * PURPOSE: CopyTo and MoveTo implementation + * COPYRIGHT: Copyright 2020-2023 Katayama Hirofumi MZ (katayama.hirofumi.mz(a)gmail.com) + */ +#pragma once + +class CCopyMoveToMenu : + public CComObjectRootEx<CComMultiThreadModelNoCS>, + public IContextMenu2, + public IObjectWithSite, + public IShellExtInit +{ +protected: + UINT m_idCmdFirst, m_idCmdLast, m_idCmdAction; + CComPtr<IDataObject> m_pDataObject; + CComPtr<IUnknown> m_pSite; + + HRESULT DoRealFileOp(LPCMINVOKECOMMANDINFO lpici, PCUIDLIST_ABSOLUTE pidl); + HRESULT DoAction(LPCMINVOKECOMMANDINFO lpici); + +public: + CComHeapPtr<ITEMIDLIST> m_pidlFolder; + WNDPROC m_fnOldWndProc; + BOOL m_bIgnoreTextBoxChange; + + CCopyMoveToMenu(); + + virtual UINT GetCaptionStringID() const = 0; + virtual UINT GetButtonStringID() const = 0; + virtual UINT GetActionTitleStringID() const = 0; + virtual UINT GetFileOp() const = 0; + virtual LPCSTR GetVerb() const = 0; + + // IContextMenu + STDMETHODIMP GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen) override; + STDMETHODIMP InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi) override; + + // IContextMenu2 + STDMETHODIMP HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam) override; + + // IShellExtInit + STDMETHODIMP Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID) override; + + // IObjectWithSite + STDMETHODIMP SetSite(IUnknown *pUnkSite) override; + STDMETHODIMP GetSite(REFIID riid, void **ppvSite) override; +}; + +class CCopyToMenu + : public CComCoClass<CCopyToMenu, &CLSID_CopyToMenu> + , public CCopyMoveToMenu +{ +public: + CComHeapPtr<ITEMIDLIST> m_pidlFolder; + WNDPROC m_fnOldWndProc; + BOOL m_bIgnoreTextBoxChange; + + CCopyToMenu() { } + + // IContextMenu + STDMETHODIMP QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override; + + DECLARE_REGISTRY_RESOURCEID(IDR_COPYTOMENU) + DECLARE_NOT_AGGREGATABLE(CCopyToMenu) + + DECLARE_PROTECT_FINAL_CONSTRUCT() + + BEGIN_COM_MAP(CCopyToMenu) + COM_INTERFACE_ENTRY_IID(IID_IContextMenu2, IContextMenu2) + COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu) + COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit) + COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite) + END_COM_MAP() + + UINT GetCaptionStringID() const override { return IDS_COPYITEMS; } + UINT GetButtonStringID() const override { return IDS_COPYBUTTON; } + UINT GetActionTitleStringID() const override { return IDS_COPYTOTITLE; } + UINT GetFileOp() const override { return FO_COPY; } + LPCSTR GetVerb() const override { return "copyto"; } +}; + +class CMoveToMenu + : public CComCoClass<CMoveToMenu, &CLSID_MoveToMenu> + , public CCopyMoveToMenu +{ +public: + CMoveToMenu() { } + + // IContextMenu + STDMETHODIMP QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags) override; + + DECLARE_REGISTRY_RESOURCEID(IDR_MOVETOMENU) + DECLARE_NOT_AGGREGATABLE(CMoveToMenu) + + DECLARE_PROTECT_FINAL_CONSTRUCT() + + BEGIN_COM_MAP(CMoveToMenu) + COM_INTERFACE_ENTRY_IID(IID_IContextMenu2, IContextMenu2) + COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu) + COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit) + COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite) + END_COM_MAP() + + UINT GetCaptionStringID() const override { return IDS_MOVEITEMS; } + UINT GetButtonStringID() const override { return IDS_MOVEBUTTON; } + UINT GetActionTitleStringID() const override { return IDS_MOVETOTITLE; } + UINT GetFileOp() const override { return FO_MOVE; } + LPCSTR GetVerb() const override { return "moveto"; } +}; diff --git a/dll/win32/shell32/CCopyToMenu.cpp b/dll/win32/shell32/CCopyToMenu.cpp deleted file mode 100644 index d3da9d1f5a8..00000000000 --- a/dll/win32/shell32/CCopyToMenu.cpp +++ /dev/null @@ -1,381 +0,0 @@ -/* - * PROJECT: shell32 - * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later
) - * PURPOSE: CopyTo implementation - * COPYRIGHT: Copyright 2020 Katayama Hirofumi MZ (katayama.hirofumi.mz(a)gmail.com) - */ - -#include "precomp.h" - -WINE_DEFAULT_DEBUG_CHANNEL(shell); - - -CCopyToMenu::CCopyToMenu() : - m_idCmdFirst(0), - m_idCmdLast(0), - m_idCmdCopyTo(-1), - m_fnOldWndProc(NULL), - m_bIgnoreTextBoxChange(FALSE) -{ -} - -CCopyToMenu::~CCopyToMenu() -{ -} - -static LRESULT CALLBACK -WindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - WCHAR szPath[MAX_PATH]; - CCopyToMenu *this_ = - reinterpret_cast<CCopyToMenu *>(GetWindowLongPtr(hwnd, GWLP_USERDATA)); - - switch (uMsg) - { - case WM_COMMAND: - { - switch (LOWORD(wParam)) - { - case IDC_BROWSE_FOR_FOLDER_FOLDER_TEXT: - { - if (HIWORD(wParam) == EN_CHANGE) - { - if (!this_->m_bIgnoreTextBoxChange) - { - // get the text - GetDlgItemTextW(hwnd, IDC_BROWSE_FOR_FOLDER_FOLDER_TEXT, szPath, _countof(szPath)); - StrTrimW(szPath, L" \t"); - - // update OK button - BOOL bValid = !PathIsRelative(szPath) && PathIsDirectoryW(szPath); - SendMessageW(hwnd, BFFM_ENABLEOK, 0, bValid); - - return 0; - } - - // reset flag - this_->m_bIgnoreTextBoxChange = FALSE; - } - break; - } - } - break; - } - } - return CallWindowProcW(this_->m_fnOldWndProc, hwnd, uMsg, wParam, lParam); -} - -static int CALLBACK -BrowseCallbackProc(HWND hwnd, UINT uMsg, LPARAM lParam, LPARAM lpData) -{ - CCopyToMenu *this_ = - reinterpret_cast<CCopyToMenu *>(GetWindowLongPtr(hwnd, GWLP_USERDATA)); - - switch (uMsg) - { - case BFFM_INITIALIZED: - { - SetWindowLongPtr(hwnd, GWLP_USERDATA, lpData); - this_ = reinterpret_cast<CCopyToMenu *>(lpData); - - // Select initial directory - SendMessageW(hwnd, BFFM_SETSELECTION, FALSE, - reinterpret_cast<LPARAM>(static_cast<LPCITEMIDLIST>(this_->m_pidlFolder))); - - // Set caption - CString strCaption(MAKEINTRESOURCEW(IDS_COPYITEMS)); - SetWindowTextW(hwnd, strCaption); - - // Set OK button text - CString strCopy(MAKEINTRESOURCEW(IDS_COPYBUTTON)); - SetDlgItemText(hwnd, IDOK, strCopy); - - // Subclassing - this_->m_fnOldWndProc = - reinterpret_cast<WNDPROC>( - SetWindowLongPtr(hwnd, GWLP_WNDPROC, reinterpret_cast<LONG_PTR>(WindowProc))); - - // Disable OK - PostMessageW(hwnd, BFFM_ENABLEOK, 0, FALSE); - break; - } - case BFFM_SELCHANGED: - { - if (!this_) - break; - - WCHAR szPath[MAX_PATH]; - LPCITEMIDLIST pidl = reinterpret_cast<LPCITEMIDLIST>(lParam); - - szPath[0] = 0; - SHGetPathFromIDListW(pidl, szPath); - - if (ILIsEqual(pidl, this_->m_pidlFolder)) - PostMessageW(hwnd, BFFM_ENABLEOK, 0, FALSE); - else if (PathFileExistsW(szPath) || _ILIsDesktop(pidl)) - PostMessageW(hwnd, BFFM_ENABLEOK, 0, TRUE); - else - PostMessageW(hwnd, BFFM_ENABLEOK, 0, FALSE); - - // the text box will be updated later soon, ignore it - this_->m_bIgnoreTextBoxChange = TRUE; - break; - } - } - - return FALSE; -} - -HRESULT CCopyToMenu::DoRealCopy(LPCMINVOKECOMMANDINFO lpici, LPCITEMIDLIST pidl) -{ - CDataObjectHIDA pCIDA(m_pDataObject); - if (FAILED_UNEXPECTEDLY(pCIDA.hr())) - return pCIDA.hr(); - - PCUIDLIST_ABSOLUTE pidlParent = HIDA_GetPIDLFolder(pCIDA); - if (!pidlParent) - { - ERR("HIDA_GetPIDLFolder failed\n"); - return E_FAIL; - } - - CStringW strFiles; - WCHAR szPath[MAX_PATH]; - for (UINT n = 0; n < pCIDA->cidl; ++n) - { - PCUIDLIST_RELATIVE pidlRelative = HIDA_GetPIDLItem(pCIDA, n); - if (!pidlRelative) - continue; - - CComHeapPtr<ITEMIDLIST> pidlCombine(ILCombine(pidlParent, pidlRelative)); - if (!pidl) - return E_FAIL; - - SHGetPathFromIDListW(pidlCombine, szPath); - - if (n > 0) - strFiles += L'|'; - strFiles += szPath; - } - - strFiles += L'|'; // double null-terminated - strFiles.Replace(L'|', L'\0'); - - if (_ILIsDesktop(pidl)) - SHGetSpecialFolderPathW(NULL, szPath, CSIDL_DESKTOPDIRECTORY, FALSE); - else - SHGetPathFromIDListW(pidl, szPath); - INT cchPath = lstrlenW(szPath); - if (cchPath + 1 < MAX_PATH) - { - szPath[cchPath + 1] = 0; // double null-terminated - } - else - { - ERR("Too long path\n"); - return E_FAIL; - } - - SHFILEOPSTRUCTW op = { lpici->hwnd }; - op.wFunc = FO_COPY; - op.pFrom = strFiles; - op.pTo = szPath; - op.fFlags = FOF_ALLOWUNDO; - int res = SHFileOperationW(&op); - if (res) - { - ERR("SHFileOperationW failed with 0x%x\n", res); - return E_FAIL; - } - return S_OK; -} - -CStringW CCopyToMenu::DoGetFileTitle() -{ - CStringW ret = L"(file)"; - - CDataObjectHIDA pCIDA(m_pDataObject); - if (FAILED_UNEXPECTEDLY(pCIDA.hr())) - return ret; - - PCUIDLIST_ABSOLUTE pidlParent = HIDA_GetPIDLFolder(pCIDA); - if (!pidlParent) - { - ERR("HIDA_GetPIDLFolder failed\n"); - return ret; - } - - WCHAR szPath[MAX_PATH]; - PCUIDLIST_RELATIVE pidlRelative = HIDA_GetPIDLItem(pCIDA, 0); - if (!pidlRelative) - { - ERR("HIDA_GetPIDLItem failed\n"); - return ret; - } - - CComHeapPtr<ITEMIDLIST> pidlCombine(ILCombine(pidlParent, pidlRelative)); - - if (SHGetPathFromIDListW(pidlCombine, szPath)) - ret = PathFindFileNameW(szPath); - else - ERR("Cannot get path\n"); - - if (pCIDA->cidl > 1) - ret += L" ..."; - - return ret; -} - -HRESULT CCopyToMenu::DoCopyToFolder(LPCMINVOKECOMMANDINFO lpici) -{ - WCHAR wszPath[MAX_PATH]; - HRESULT hr = E_FAIL; - - TRACE("DoCopyToFolder(%p)\n", lpici); - - if (!SHGetPathFromIDListW(m_pidlFolder, wszPath)) - { - ERR("SHGetPathFromIDListW failed\n"); - return hr; - } - - CStringW strFileTitle = DoGetFileTitle(); - CStringW strTitle; - strTitle.Format(IDS_COPYTOTITLE, static_cast<LPCWSTR>(strFileTitle)); - - BROWSEINFOW info = { lpici->hwnd }; - info.pidlRoot = NULL; - info.lpszTitle = strTitle; - info.ulFlags = BIF_RETURNONLYFSDIRS | BIF_USENEWUI; - info.lpfn = BrowseCallbackProc; - info.lParam = reinterpret_cast<LPARAM>(this); - CComHeapPtr<ITEMIDLIST> pidl(SHBrowseForFolder(&info)); - if (pidl) - { - hr = DoRealCopy(lpici, pidl); - } - - return hr; -} - -HRESULT WINAPI -CCopyToMenu::QueryContextMenu(HMENU hMenu, - UINT indexMenu, - UINT idCmdFirst, - UINT idCmdLast, - UINT uFlags) -{ - MENUITEMINFOW mii; - UINT Count = 0; - - TRACE("CCopyToMenu::QueryContextMenu(%p, %u, %u, %u, %u)\n", - hMenu, indexMenu, idCmdFirst, idCmdLast, uFlags); - - if (uFlags & (CMF_NOVERBS | CMF_VERBSONLY)) - return MAKE_HRESULT(SEVERITY_SUCCESS, 0, idCmdFirst); - - m_idCmdFirst = m_idCmdLast = idCmdFirst; - - // insert separator if necessary - ZeroMemory(&mii, sizeof(mii)); - mii.cbSize = sizeof(mii); - mii.fMask = MIIM_TYPE; - if (GetMenuItemInfoW(hMenu, indexMenu - 1, TRUE, &mii) && - mii.fType != MFT_SEPARATOR) - { - ZeroMemory(&mii, sizeof(mii)); - mii.cbSize = sizeof(mii); - mii.fMask = MIIM_TYPE; - mii.fType = MFT_SEPARATOR; - if (InsertMenuItemW(hMenu, indexMenu, TRUE, &mii)) - { - ++indexMenu; - ++Count; - } - } - - // insert "Copy to folder..." - CStringW strText(MAKEINTRESOURCEW(IDS_COPYTOMENU)); - ZeroMemory(&mii, sizeof(mii)); - mii.cbSize = sizeof(mii); - mii.fMask = MIIM_ID | MIIM_TYPE; - mii.fType = MFT_STRING; - mii.dwTypeData = strText.GetBuffer(); - mii.cch = wcslen(mii.dwTypeData); - mii.wID = m_idCmdLast; - if (InsertMenuItemW(hMenu, indexMenu, TRUE, &mii)) - { - m_idCmdCopyTo = m_idCmdLast++; - ++indexMenu; - ++Count; - } - - return MAKE_HRESULT(SEVERITY_SUCCESS, 0, idCmdFirst + Count); -} - -HRESULT WINAPI -CCopyToMenu::InvokeCommand(LPCMINVOKECOMMANDINFO lpici) -{ - HRESULT hr = E_FAIL; - TRACE("CCopyToMenu::InvokeCommand(%p)\n", lpici); - - if (IS_INTRESOURCE(lpici->lpVerb)) - { - if (m_idCmdFirst + LOWORD(lpici->lpVerb) == m_idCmdCopyTo) - { - hr = DoCopyToFolder(lpici); - } - } - else - { - if (::lstrcmpiA(lpici->lpVerb, "copyto") == 0) - { - hr = DoCopyToFolder(lpici); - } - } - - return hr; -} - -HRESULT WINAPI -CCopyToMenu::GetCommandString(UINT_PTR idCmd, - UINT uType, - UINT *pwReserved, - LPSTR pszName, - UINT cchMax) -{ - FIXME("%p %lu %u %p %p %u\n", this, - idCmd, uType, pwReserved, pszName, cchMax); - - return E_NOTIMPL; -} - -HRESULT WINAPI -CCopyToMenu::HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam) -{ - TRACE("This %p uMsg %x\n", this, uMsg); - return E_NOTIMPL; -} - -HRESULT WINAPI -CCopyToMenu::Initialize(PCIDLIST_ABSOLUTE pidlFolder, - IDataObject *pdtobj, HKEY hkeyProgID) -{ - m_pidlFolder.Attach(ILClone(pidlFolder)); - m_pDataObject = pdtobj; - return S_OK; -} - -HRESULT WINAPI CCopyToMenu::SetSite(IUnknown *pUnkSite) -{ - m_pSite = pUnkSite; - return S_OK; -} - -HRESULT WINAPI CCopyToMenu::GetSite(REFIID riid, void **ppvSite) -{ - if (!m_pSite) - return E_FAIL; - - return m_pSite->QueryInterface(riid, ppvSite); -} diff --git a/dll/win32/shell32/CCopyToMoveToMenu.h b/dll/win32/shell32/CCopyToMoveToMenu.h deleted file mode 100644 index 01ee85d30c7..00000000000 --- a/dll/win32/shell32/CCopyToMoveToMenu.h +++ /dev/null @@ -1,112 +0,0 @@ -/* - * PROJECT: shell32 - * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later
) - * PURPOSE: CopyTo and MoveTo implementation - * COPYRIGHT: Copyright 2020 Katayama Hirofumi MZ (katayama.hirofumi.mz(a)gmail.com) - */ -#pragma once - - -class CCopyToMenu : - public CComCoClass<CCopyToMenu, &CLSID_CopyToMenu>, - public CComObjectRootEx<CComMultiThreadModelNoCS>, - public IContextMenu2, - public IObjectWithSite, - public IShellExtInit -{ -protected: - UINT m_idCmdFirst, m_idCmdLast, m_idCmdCopyTo; - CComPtr<IDataObject> m_pDataObject; - CComPtr<IUnknown> m_pSite; - - HRESULT DoCopyToFolder(LPCMINVOKECOMMANDINFO lpici); - HRESULT DoRealCopy(LPCMINVOKECOMMANDINFO lpici, PCUIDLIST_ABSOLUTE pidl); - CStringW DoGetFileTitle(); - -public: - CComHeapPtr<ITEMIDLIST> m_pidlFolder; - WNDPROC m_fnOldWndProc; - BOOL m_bIgnoreTextBoxChange; - - CCopyToMenu(); - ~CCopyToMenu(); - - // IContextMenu - virtual HRESULT WINAPI QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags); - virtual HRESULT WINAPI InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi); - virtual HRESULT WINAPI GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen); - - // IContextMenu2 - virtual HRESULT WINAPI HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam); - - // IShellExtInit - virtual HRESULT WINAPI Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID); - - // IObjectWithSite - virtual HRESULT WINAPI SetSite(IUnknown *pUnkSite); - virtual HRESULT WINAPI GetSite(REFIID riid, void **ppvSite); - - DECLARE_REGISTRY_RESOURCEID(IDR_COPYTOMENU) - DECLARE_NOT_AGGREGATABLE(CCopyToMenu) - - DECLARE_PROTECT_FINAL_CONSTRUCT() - - BEGIN_COM_MAP(CCopyToMenu) - COM_INTERFACE_ENTRY_IID(IID_IContextMenu2, IContextMenu2) - COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu) - COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit) - COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite) - END_COM_MAP() -}; - -class CMoveToMenu : - public CComCoClass<CMoveToMenu, &CLSID_MoveToMenu>, - public CComObjectRootEx<CComMultiThreadModelNoCS>, - public IContextMenu2, - public IObjectWithSite, - public IShellExtInit -{ -protected: - UINT m_idCmdFirst, m_idCmdLast, m_idCmdMoveTo; - CComPtr<IDataObject> m_pDataObject; - CComPtr<IUnknown> m_pSite; - - HRESULT DoMoveToFolder(LPCMINVOKECOMMANDINFO lpici); - HRESULT DoRealMove(LPCMINVOKECOMMANDINFO lpici, PCUIDLIST_ABSOLUTE pidl); - CStringW DoGetFileTitle(); - -public: - CComHeapPtr<ITEMIDLIST> m_pidlFolder; - WNDPROC m_fnOldWndProc; - BOOL m_bIgnoreTextBoxChange; - - CMoveToMenu(); - ~CMoveToMenu(); - - // IContextMenu - virtual HRESULT WINAPI QueryContextMenu(HMENU hMenu, UINT indexMenu, UINT idCmdFirst, UINT idCmdLast, UINT uFlags); - virtual HRESULT WINAPI InvokeCommand(LPCMINVOKECOMMANDINFO lpcmi); - virtual HRESULT WINAPI GetCommandString(UINT_PTR idCommand, UINT uFlags, UINT *lpReserved, LPSTR lpszName, UINT uMaxNameLen); - - // IContextMenu2 - virtual HRESULT WINAPI HandleMenuMsg(UINT uMsg, WPARAM wParam, LPARAM lParam); - - // IShellExtInit - virtual HRESULT WINAPI Initialize(PCIDLIST_ABSOLUTE pidlFolder, IDataObject *pdtobj, HKEY hkeyProgID); - - // IObjectWithSite - virtual HRESULT WINAPI SetSite(IUnknown *pUnkSite); - virtual HRESULT WINAPI GetSite(REFIID riid, void **ppvSite); - - DECLARE_REGISTRY_RESOURCEID(IDR_MOVETOMENU) - DECLARE_NOT_AGGREGATABLE(CMoveToMenu) - - DECLARE_PROTECT_FINAL_CONSTRUCT() - - BEGIN_COM_MAP(CMoveToMenu) - COM_INTERFACE_ENTRY_IID(IID_IContextMenu2, IContextMenu2) - COM_INTERFACE_ENTRY_IID(IID_IContextMenu, IContextMenu) - COM_INTERFACE_ENTRY_IID(IID_IShellExtInit, IShellExtInit) - COM_INTERFACE_ENTRY_IID(IID_IObjectWithSite, IObjectWithSite) - END_COM_MAP() -}; diff --git a/dll/win32/shell32/CMakeLists.txt b/dll/win32/shell32/CMakeLists.txt index 5f972807c8b..264b116f5a2 100644 --- a/dll/win32/shell32/CMakeLists.txt +++ b/dll/win32/shell32/CMakeLists.txt @@ -73,8 +73,7 @@ list(APPEND SOURCE COpenWithMenu.cpp CNewMenu.cpp CSendToMenu.cpp - CCopyToMenu.cpp - CMoveToMenu.cpp + CCopyMoveToMenu.cpp CShellDispatch.cpp CFolder.cpp CFolderItems.cpp diff --git a/dll/win32/shell32/precomp.h b/dll/win32/shell32/precomp.h index 9b422353e6c..393693885ac 100644 --- a/dll/win32/shell32/precomp.h +++ b/dll/win32/shell32/precomp.h @@ -95,7 +95,7 @@ #include "COpenWithMenu.h" #include "CNewMenu.h" #include "CSendToMenu.h" -#include "CCopyToMoveToMenu.h" +#include "CCopyMoveToMenu.h" #include "dialogs/filedefext.h" #include "dialogs/drvdefext.h" #include "CQueryAssociations.h"
1 year, 1 month
1
0
0
0
[reactos] 01/01: [MSPAINT] Use <winuser.rh> instead of <winuser.h> in rsrc.rc (#5883)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d21def4819a51cbc22d38…
commit d21def4819a51cbc22d382a724fa5455bfa15cdd Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sat Nov 4 21:53:04 2023 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Sat Nov 4 21:53:04 2023 +0900 [MSPAINT] Use <winuser.rh> instead of <winuser.h> in rsrc.rc (#5883) CORE-19094 --- base/applications/mspaint/rsrc.rc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/base/applications/mspaint/rsrc.rc b/base/applications/mspaint/rsrc.rc index 1f0ee5aca23..5798f4c9ff7 100644 --- a/base/applications/mspaint/rsrc.rc +++ b/base/applications/mspaint/rsrc.rc @@ -8,7 +8,7 @@ /* INCLUDES *********************************************************/ #include <windef.h> -#include <winuser.h> +#include <winuser.rh> #include <commctrl.h> #include "resource.h"
1 year, 1 month
1
0
0
0
[reactos] 01/01: [HOTPLUG] Add device removal support (#5836)
by Thamatip Chitpong
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=119057800efd0d2bb8620…
commit 119057800efd0d2bb86204ebf1f99558302edc51 Author: Thamatip Chitpong <thamatip.chitpong(a)reactos.org> AuthorDate: Sat Nov 4 19:31:26 2023 +0700 Commit: GitHub <noreply(a)github.com> CommitDate: Sat Nov 4 13:31:26 2023 +0100 [HOTPLUG] Add device removal support (#5836) --- dll/cpl/hotplug/CMakeLists.txt | 1 + dll/cpl/hotplug/eject.c | 137 ++++++++++++++++++++ dll/cpl/hotplug/enum.c | 285 ++++++++++++++++++++++++++++++++++++++++- dll/cpl/hotplug/hotplug.c | 267 +++++--------------------------------- dll/cpl/hotplug/hotplug.h | 31 +++++ dll/cpl/hotplug/lang/de-DE.rc | 14 ++ dll/cpl/hotplug/lang/en-US.rc | 14 ++ dll/cpl/hotplug/lang/es-ES.rc | 14 ++ dll/cpl/hotplug/lang/fr-FR.rc | 14 ++ dll/cpl/hotplug/lang/id-ID.rc | 14 ++ dll/cpl/hotplug/lang/ja-JP.rc | 14 ++ dll/cpl/hotplug/lang/pl-PL.rc | 14 ++ dll/cpl/hotplug/lang/pt-PT.rc | 14 ++ dll/cpl/hotplug/lang/ro-RO.rc | 14 ++ dll/cpl/hotplug/lang/ru-RU.rc | 14 ++ dll/cpl/hotplug/lang/tr-TR.rc | 14 ++ dll/cpl/hotplug/lang/zh-CN.rc | 14 ++ dll/cpl/hotplug/lang/zh-HK.rc | 14 ++ dll/cpl/hotplug/lang/zh-TW.rc | 14 ++ dll/cpl/hotplug/resource.h | 8 +- 20 files changed, 686 insertions(+), 239 deletions(-) diff --git a/dll/cpl/hotplug/CMakeLists.txt b/dll/cpl/hotplug/CMakeLists.txt index ec6588697c5..c5e636d8938 100644 --- a/dll/cpl/hotplug/CMakeLists.txt +++ b/dll/cpl/hotplug/CMakeLists.txt @@ -3,6 +3,7 @@ spec2def(hotplug.dll hotplug.spec) list(APPEND SOURCE hotplug.c + eject.c enum.c) file(GLOB hotplug_rc_deps resources/*.*) diff --git a/dll/cpl/hotplug/eject.c b/dll/cpl/hotplug/eject.c new file mode 100644 index 00000000000..8f310ce5d0c --- /dev/null +++ b/dll/cpl/hotplug/eject.c @@ -0,0 +1,137 @@ +/* + * PROJECT: Safely Remove Hardware Applet + * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later
) + * PURPOSE: Device removal support + * COPYRIGHT: Copyright 2023 Thamatip Chitpong <thamatip.chitpong(a)reactos.org> + */ + +#include "hotplug.h" + +#include <strsafe.h> + +DEVINST +GetDeviceInstForRemoval( + _In_ PHOTPLUG_DATA pHotplugData) +{ + HTREEITEM hItem, hParentItem; + TVITEMW tvItem; + + hItem = TreeView_GetSelection(pHotplugData->hwndDeviceTree); + if (!hItem) + return 0; + + /* Find root item */ + hParentItem = TreeView_GetParent(pHotplugData->hwndDeviceTree, hItem); + while (hParentItem) + { + hItem = hParentItem; + hParentItem = TreeView_GetParent(pHotplugData->hwndDeviceTree, hItem); + } + + ZeroMemory(&tvItem, sizeof(tvItem)); + tvItem.mask = TVIF_PARAM; + tvItem.hItem = hItem; + + TreeView_GetItem(pHotplugData->hwndDeviceTree, &tvItem); + + return tvItem.lParam; +} + +static +VOID +FillConfirmDeviceList( + _In_ HWND hwndCfmDeviceList, + _In_ PHOTPLUG_DATA pHotplugData) +{ + LVCOLUMNW lvColumn; + + ZeroMemory(&lvColumn, sizeof(lvColumn)); + lvColumn.mask = LVCF_FMT; + lvColumn.fmt = LVCFMT_LEFT | LVCFMT_IMAGE; + ListView_InsertColumn(hwndCfmDeviceList, 0, &lvColumn); + + CfmListEnumDevices(hwndCfmDeviceList, pHotplugData); + + ListView_SetColumnWidth(hwndCfmDeviceList, 0, LVSCW_AUTOSIZE_USEHEADER); +} + +static +VOID +SafeRemoveDevice( + _In_ DEVINST DevInst, + _In_opt_ HWND hwndDlg) +{ + PNP_VETO_TYPE VetoType = PNP_VetoTypeUnknown; + CONFIGRET cr; + + cr = CM_Request_Device_EjectW(DevInst, &VetoType, NULL, 0, 0); + if (cr != CR_SUCCESS && VetoType == PNP_VetoTypeUnknown) + { + LPCWSTR pszFormat = L""; + WCHAR szError[64]; + + /* NOTES: IDS_EJECT_ERROR_FORMAT resource has to be explicitly NULL-terminated + * so we can use the string directly without having to make a copy of it. */ + LoadStringW(hApplet, IDS_EJECT_ERROR_FORMAT, (LPWSTR)&pszFormat, 0); + StringCbPrintfW(szError, sizeof(szError), pszFormat, cr); + + MessageBoxW(hwndDlg, szError, NULL, MB_ICONEXCLAMATION | MB_OK); + } +} + +INT_PTR +CALLBACK +ConfirmRemovalDlgProc( + _In_ HWND hwndDlg, + _In_ UINT uMsg, + _In_ WPARAM wParam, + _In_ LPARAM lParam) +{ + PHOTPLUG_DATA pHotplugData; + + pHotplugData = (PHOTPLUG_DATA)GetWindowLongPtrW(hwndDlg, DWLP_USER); + + switch (uMsg) + { + case WM_INITDIALOG: + { + HWND hwndDevList; + + pHotplugData = (PHOTPLUG_DATA)lParam; + SetWindowLongPtrW(hwndDlg, DWLP_USER, (LONG_PTR)pHotplugData); + + hwndDevList = GetDlgItem(hwndDlg, IDC_CONFIRM_STOP_DEVICE_LIST); + + ListView_SetImageList(hwndDevList, + pHotplugData->ImageListData.ImageList, + LVSIL_SMALL); + + FillConfirmDeviceList(hwndDevList, pHotplugData); + + return TRUE; + } + + case WM_COMMAND: + { + switch (LOWORD(wParam)) + { + case IDOK: + SafeRemoveDevice(GetDeviceInstForRemoval(pHotplugData), hwndDlg); + EndDialog(hwndDlg, LOWORD(wParam)); + break; + + case IDCANCEL: + EndDialog(hwndDlg, LOWORD(wParam)); + break; + } + + break; + } + + case WM_DESTROY: + SetWindowLongPtrW(hwndDlg, DWLP_USER, (LONG_PTR)NULL); + break; + } + + return FALSE; +} diff --git a/dll/cpl/hotplug/enum.c b/dll/cpl/hotplug/enum.c index 26e25e660b8..698e94b0cb3 100644 --- a/dll/cpl/hotplug/enum.c +++ b/dll/cpl/hotplug/enum.c @@ -1,7 +1,284 @@ /* * PROJECT: Safely Remove Hardware Applet - * LICENSE: GPL - See COPYING in the top level directory - * FILE: dll/cpl/hotplug/enum.c - * PURPOSE: device enumeration - * PROGRAMMERS: Johannes Anderwald (johannes.anderwald(a)reactos.org) + * LICENSE: GPL-2.0-or-later (
https://spdx.org/licenses/GPL-2.0-or-later
) + * PURPOSE: Device enumeration + * COPYRIGHT: Copyright 2013 Johannes Anderwald <johannes.anderwald(a)reactos.org> + * Copyright 2023 Thamatip Chitpong <thamatip.chitpong(a)reactos.org> */ + +#include "hotplug.h" + +#include <initguid.h> +#include <devguid.h> + +#define MAX_DEVICE_DISPLAYNAME_LEN 256 + +static +VOID +GetDeviceDisplayInfo( + _In_ DEVINST DevInst, + _In_ PHOTPLUG_DATA pHotplugData, + _Out_writes_z_(cchDesc) LPWSTR pszDesc, + _In_ ULONG cchDesc, + _Out_ PINT pImageIndex) +{ + WCHAR szGuidString[MAX_GUID_STRING_LEN]; + GUID ClassGuid; + ULONG ulSize; + CONFIGRET cr; + + /* Get the device description */ + ulSize = cchDesc * sizeof(WCHAR); + cr = CM_Get_DevNode_Registry_PropertyW(DevInst, + CM_DRP_FRIENDLYNAME, + NULL, + pszDesc, + &ulSize, + 0); + if (cr != CR_SUCCESS) + { + ulSize = cchDesc * sizeof(WCHAR); + cr = CM_Get_DevNode_Registry_PropertyW(DevInst, + CM_DRP_DEVICEDESC, + NULL, + pszDesc, + &ulSize, + 0); + if (cr != CR_SUCCESS) + LoadStringW(hApplet, IDS_UNKNOWN_DEVICE, pszDesc, cchDesc); + } + + /* Get the class GUID */ + ulSize = sizeof(szGuidString); + cr = CM_Get_DevNode_Registry_PropertyW(DevInst, + CM_DRP_CLASSGUID, + NULL, + szGuidString, + &ulSize, + 0); + if (cr == CR_SUCCESS) + { + pSetupGuidFromString(szGuidString, &ClassGuid); + } + else + { + ClassGuid = GUID_DEVCLASS_UNKNOWN; + } + + /* Get the image for the class this device is in */ + SetupDiGetClassImageIndex(&pHotplugData->ImageListData, + &ClassGuid, + pImageIndex); +} + +static +HTREEITEM +InsertDeviceTreeItem( + _In_ HTREEITEM hParent, + _In_ DEVINST DevInst, + _In_ PHOTPLUG_DATA pHotplugData) +{ + WCHAR szDisplayName[MAX_DEVICE_DISPLAYNAME_LEN]; + INT nClassImage; + TVINSERTSTRUCTW tvItem; + + GetDeviceDisplayInfo(DevInst, + pHotplugData, + szDisplayName, + ARRAYSIZE(szDisplayName), + &nClassImage); + + ZeroMemory(&tvItem, sizeof(tvItem)); + tvItem.hParent = hParent; + tvItem.hInsertAfter = TVI_LAST; + + tvItem.item.mask = TVIF_STATE | TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE; + tvItem.item.state = TVIS_EXPANDED; + tvItem.item.stateMask = TVIS_EXPANDED; + tvItem.item.pszText = szDisplayName; + tvItem.item.iImage = nClassImage; + tvItem.item.iSelectedImage = nClassImage; + tvItem.item.lParam = (LPARAM)DevInst; + + return TreeView_InsertItem(pHotplugData->hwndDeviceTree, &tvItem); +} + +static +VOID +DevTreeRecursiveInsertSubDevices( + _In_ HTREEITEM hParentItem, + _In_ DEVINST ParentDevInst, + _In_ PHOTPLUG_DATA pHotplugData) +{ + HTREEITEM hTreeItem; + DEVINST ChildDevInst; + CONFIGRET cr; + + cr = CM_Get_Child(&ChildDevInst, ParentDevInst, 0); + if (cr != CR_SUCCESS) + return; + + hTreeItem = InsertDeviceTreeItem(hParentItem, + ChildDevInst, + pHotplugData); + if (hTreeItem != NULL) + { + DevTreeRecursiveInsertSubDevices(hTreeItem, + ChildDevInst, + pHotplugData); + } + + for (;;) + { + cr = CM_Get_Sibling(&ChildDevInst, ChildDevInst, 0); + if (cr != CR_SUCCESS) + return; + + hTreeItem = InsertDeviceTreeItem(hParentItem, + ChildDevInst, + pHotplugData); + if (hTreeItem != NULL) + { + DevTreeRecursiveInsertSubDevices(hTreeItem, + ChildDevInst, + pHotplugData); + } + } +} + +VOID +EnumHotpluggedDevices( + _In_ PHOTPLUG_DATA pHotplugData) +{ + SP_DEVINFO_DATA did = { 0 }; + HDEVINFO hdev; + int idev; + DWORD dwCapabilities, dwSize; + ULONG ulStatus, ulProblem; + HTREEITEM hTreeItem; + CONFIGRET cr; + + TreeView_DeleteAllItems(pHotplugData->hwndDeviceTree); + + hdev = SetupDiGetClassDevs(NULL, NULL, 0, DIGCF_ALLCLASSES | DIGCF_PRESENT); + if (hdev == INVALID_HANDLE_VALUE) + return; + + did.cbSize = sizeof(did); + + /* Enumerate all the attached devices */ + for (idev = 0; SetupDiEnumDeviceInfo(hdev, idev, &did); idev++) + { + ulStatus = 0; + ulProblem = 0; + + cr = CM_Get_DevNode_Status(&ulStatus, + &ulProblem, + did.DevInst, + 0); + if (cr != CR_SUCCESS) + continue; + + dwCapabilities = 0, + dwSize = sizeof(dwCapabilities); + cr = CM_Get_DevNode_Registry_Property(did.DevInst, + CM_DRP_CAPABILITIES, + NULL, + &dwCapabilities, + &dwSize, + 0); + if (cr != CR_SUCCESS) + continue; + + /* Add devices that require safe removal to the device tree */ + if ( (dwCapabilities & CM_DEVCAP_REMOVABLE) && + !(dwCapabilities & CM_DEVCAP_DOCKDEVICE) && + !(dwCapabilities & CM_DEVCAP_SURPRISEREMOVALOK) && + ((dwCapabilities & CM_DEVCAP_EJECTSUPPORTED) || (ulStatus & DN_DISABLEABLE)) && + ulProblem == 0) + { + hTreeItem = InsertDeviceTreeItem(TVI_ROOT, + did.DevInst, + pHotplugData); + + if ((hTreeItem != NULL) && (pHotplugData->dwFlags & HOTPLUG_DISPLAY_DEVICE_COMPONENTS)) + { + DevTreeRecursiveInsertSubDevices(hTreeItem, + did.DevInst, + pHotplugData); + } + } + } + + SetupDiDestroyDeviceInfoList(hdev); +} + +static +VOID +InsertConfirmDeviceListItem( + _In_ HWND hwndCfmDeviceList, + _In_ DEVINST DevInst, + _In_ PHOTPLUG_DATA pHotplugData) +{ + WCHAR szDisplayName[MAX_DEVICE_DISPLAYNAME_LEN]; + INT nClassImage; + LVITEMW lvItem; + + GetDeviceDisplayInfo(DevInst, + pHotplugData, + szDisplayName, + ARRAYSIZE(szDisplayName), + &nClassImage); + + ZeroMemory(&lvItem, sizeof(lvItem)); + lvItem.mask = LVIF_TEXT | LVIF_IMAGE | LVIF_PARAM; + lvItem.iItem = ListView_GetItemCount(hwndCfmDeviceList); + lvItem.pszText = szDisplayName; + lvItem.iImage = nClassImage; + lvItem.lParam = (LPARAM)DevInst; + + ListView_InsertItem(hwndCfmDeviceList, &lvItem); +} + +static +VOID +CfmListRecursiveInsertSubDevices( + _In_ HWND hwndCfmDeviceList, + _In_ DEVINST ParentDevInst, + _In_ PHOTPLUG_DATA pHotplugData) +{ + DEVINST ChildDevInst; + CONFIGRET cr; + + cr = CM_Get_Child(&ChildDevInst, ParentDevInst, 0); + if (cr != CR_SUCCESS) + return; + + InsertConfirmDeviceListItem(hwndCfmDeviceList, ChildDevInst, pHotplugData); + CfmListRecursiveInsertSubDevices(hwndCfmDeviceList, ChildDevInst, pHotplugData); + + for (;;) + { + cr = CM_Get_Sibling(&ChildDevInst, ChildDevInst, 0); + if (cr != CR_SUCCESS) + return; + + InsertConfirmDeviceListItem(hwndCfmDeviceList, ChildDevInst, pHotplugData); + CfmListRecursiveInsertSubDevices(hwndCfmDeviceList, ChildDevInst, pHotplugData); + } +} + +VOID +CfmListEnumDevices( + _In_ HWND hwndCfmDeviceList, + _In_ PHOTPLUG_DATA pHotplugData) +{ + DEVINST DevInst; + + DevInst = GetDeviceInstForRemoval(pHotplugData); + if (DevInst != 0) + { + InsertConfirmDeviceListItem(hwndCfmDeviceList, DevInst, pHotplugData); + CfmListRecursiveInsertSubDevices(hwndCfmDeviceList, DevInst, pHotplugData); + } +} diff --git a/dll/cpl/hotplug/hotplug.c b/dll/cpl/hotplug/hotplug.c index 15dea9c7583..1c50fc62fb1 100644 --- a/dll/cpl/hotplug/hotplug.c +++ b/dll/cpl/hotplug/hotplug.c @@ -8,23 +8,9 @@ #include "hotplug.h" -#include <initguid.h> -#include <devguid.h> - #define NDEBUG #include <debug.h> - -typedef struct _HOTPLUG_DATA -{ - HICON hIcon; - HICON hIconSm; - SP_CLASSIMAGELIST_DATA ImageListData; - HMENU hPopupMenu; - DWORD dwFlags; -} HOTPLUG_DATA, *PHOTPLUG_DATA; - - // globals HINSTANCE hApplet = 0; @@ -102,215 +88,22 @@ done: return dwError; } - -static -HTREEITEM -InsertDeviceTreeItem( - _In_ HWND hwndDeviceTree, - _In_ HTREEITEM hParent, - _In_ DWORD DevInst, - _In_ PHOTPLUG_DATA pHotplugData) -{ - WCHAR szDisplayName[40]; - WCHAR szGuidString[MAX_GUID_STRING_LEN]; - TVINSERTSTRUCTW tvItem; - GUID ClassGuid; - INT nClassImage; - DWORD dwSize; - CONFIGRET cr; - - /* Get the device description */ - dwSize = sizeof(szDisplayName); - cr = CM_Get_DevNode_Registry_Property(DevInst, - CM_DRP_DEVICEDESC, - NULL, - szDisplayName, - &dwSize, - 0); - if (cr != CR_SUCCESS) - wcscpy(szDisplayName, L"Unknown Device"); - - /* Get the class GUID */ - dwSize = sizeof(szGuidString); - cr = CM_Get_DevNode_Registry_Property(DevInst, - CM_DRP_CLASSGUID, - NULL, - szGuidString, - &dwSize, - 0); - if (cr == CR_SUCCESS) - { - pSetupGuidFromString(szGuidString, &ClassGuid); - } - else - { - memcpy(&ClassGuid, &GUID_DEVCLASS_UNKNOWN, sizeof(GUID)); - } - - /* Get the image for the class this device is in */ - SetupDiGetClassImageIndex(&pHotplugData->ImageListData, - &ClassGuid, - &nClassImage); - - /* Add it to the device tree */ - ZeroMemory(&tvItem, sizeof(tvItem)); - tvItem.hParent = hParent; - tvItem.hInsertAfter = TVI_LAST; - - tvItem.item.mask = TVIF_STATE | TVIF_TEXT | TVIF_PARAM | TVIF_IMAGE | TVIF_SELECTEDIMAGE; - tvItem.item.state = TVIS_EXPANDED; - tvItem.item.stateMask = TVIS_EXPANDED; - tvItem.item.pszText = szDisplayName; - tvItem.item.iImage = nClassImage; - tvItem.item.iSelectedImage = nClassImage; - tvItem.item.lParam = (LPARAM)DevInst; - - return TreeView_InsertItem(hwndDeviceTree, &tvItem); -} - - static VOID -RecursiveInsertSubDevices( - _In_ HWND hwndDeviceTree, - _In_ HTREEITEM hParentItem, - _In_ DWORD ParentDevInst, - _In_ PHOTPLUG_DATA pHotplugData) +UpdateDialog( + _In_ HWND hwndDlg) { - HTREEITEM hTreeItem; - DEVINST ChildDevInst; - CONFIGRET cr; - - DPRINT("RecursiveInsertSubDevices()\n"); + HWND hwndDeviceTree; + BOOL bHasItem; - cr = CM_Get_Child(&ChildDevInst, ParentDevInst, 0); - if (cr != CR_SUCCESS) - { - DPRINT("No child! %lu\n", cr); - return; - } + hwndDeviceTree = GetDlgItem(hwndDlg, IDC_SAFE_REMOVE_DEVICE_TREE); - hTreeItem = InsertDeviceTreeItem(hwndDeviceTree, - hParentItem, - ChildDevInst, - pHotplugData); - if (hTreeItem != NULL) - { - RecursiveInsertSubDevices(hwndDeviceTree, - hTreeItem, - ChildDevInst, - pHotplugData); - } + bHasItem = (TreeView_GetCount(hwndDeviceTree) != 0); + if (bHasItem) + TreeView_SelectItem(hwndDeviceTree, TreeView_GetFirstVisible(hwndDeviceTree)); - for (;;) - { - cr = CM_Get_Sibling(&ChildDevInst, ChildDevInst, 0); - if (cr != CR_SUCCESS) - { - DPRINT("No sibling! %lu\n", cr); - return; - } - - hTreeItem = InsertDeviceTreeItem(hwndDeviceTree, - hParentItem, - ChildDevInst, - pHotplugData); - if (hTreeItem != NULL) - { - RecursiveInsertSubDevices(hwndDeviceTree, - hTreeItem, - ChildDevInst, - pHotplugData); - } - } -} - - -static -VOID -EnumHotpluggedDevices( - HWND hwndDeviceTree, - PHOTPLUG_DATA pHotplugData) -{ - SP_DEVINFO_DATA did = { 0 }; - HDEVINFO hdev; - int idev; - DWORD dwCapabilities, dwSize; - ULONG ulStatus, ulProblem; - HTREEITEM hTreeItem; - CONFIGRET cr; - - DPRINT1("EnumHotpluggedDevices()\n"); - - TreeView_DeleteAllItems(hwndDeviceTree); - - hdev = SetupDiGetClassDevs(NULL, NULL, 0, DIGCF_ALLCLASSES | DIGCF_PRESENT); - if (hdev == INVALID_HANDLE_VALUE) - return; - - did.cbSize = sizeof(did); - - /* Enumerate all the attached devices */ - for (idev = 0; SetupDiEnumDeviceInfo(hdev, idev, &did); idev++) - { - ulStatus = 0; - ulProblem = 0; - - cr = CM_Get_DevNode_Status(&ulStatus, - &ulProblem, - did.DevInst, - 0); - if (cr != CR_SUCCESS) - continue; - - dwCapabilities = 0, - dwSize = sizeof(dwCapabilities); - cr = CM_Get_DevNode_Registry_Property(did.DevInst, - CM_DRP_CAPABILITIES, - NULL, - &dwCapabilities, - &dwSize, - 0); - if (cr != CR_SUCCESS) - continue; - - /* Add devices that require safe removal to the device tree */ - if ( (dwCapabilities & CM_DEVCAP_REMOVABLE) && - !(dwCapabilities & CM_DEVCAP_DOCKDEVICE) && - !(dwCapabilities & CM_DEVCAP_SURPRISEREMOVALOK) && - ((dwCapabilities & CM_DEVCAP_EJECTSUPPORTED) || (ulStatus & DN_DISABLEABLE)) && - ulProblem == 0) - { - hTreeItem = InsertDeviceTreeItem(hwndDeviceTree, - TVI_ROOT, - did.DevInst, - pHotplugData); - - if ((hTreeItem != NULL) && (pHotplugData->dwFlags & HOTPLUG_DISPLAY_DEVICE_COMPONENTS)) - { - RecursiveInsertSubDevices(hwndDeviceTree, - hTreeItem, - did.DevInst, - pHotplugData); - } - } - } - - SetupDiDestroyDeviceInfoList(hdev); -} - - -static -VOID -UpdateButtons( - HWND hwndDlg) -{ - BOOL bEnabled; - - bEnabled = (TreeView_GetCount(GetDlgItem(hwndDlg, IDC_SAFE_REMOVE_DEVICE_TREE)) != 0); - - EnableWindow(GetDlgItem(hwndDlg, IDC_SAFE_REMOVE_PROPERTIES), bEnabled); - EnableWindow(GetDlgItem(hwndDlg, IDC_SAFE_REMOVE_STOP), bEnabled); + EnableWindow(GetDlgItem(hwndDlg, IDC_SAFE_REMOVE_PROPERTIES), bHasItem); + EnableWindow(GetDlgItem(hwndDlg, IDC_SAFE_REMOVE_STOP), bHasItem); } @@ -347,12 +140,12 @@ ShowContextMenu( static DEVINST GetSelectedDeviceInst( - _In_ HWND hwndDeviceTree) + _In_ PHOTPLUG_DATA pHotplugData) { HTREEITEM hTreeItem; TVITEMW item; - hTreeItem = TreeView_GetSelection(hwndDeviceTree); + hTreeItem = TreeView_GetSelection(pHotplugData->hwndDeviceTree); if (hTreeItem == NULL) return 0; @@ -360,7 +153,7 @@ GetSelectedDeviceInst( item.mask = TVIF_PARAM; item.hItem = hTreeItem; - TreeView_GetItem(hwndDeviceTree, &item); + TreeView_GetItem(pHotplugData->hwndDeviceTree, &item); return item.lParam; } @@ -456,19 +249,18 @@ SafeRemovalDlgProc( SetupDiGetClassImageList(&pHotplugData->ImageListData); pHotplugData->hPopupMenu = LoadMenu(hApplet, MAKEINTRESOURCE(IDM_POPUP_DEVICE_TREE)); - + pHotplugData->hwndDeviceTree = GetDlgItem(hwndDlg, IDC_SAFE_REMOVE_DEVICE_TREE); pHotplugData->dwFlags = GetHotPlugFlags(); if (pHotplugData->dwFlags & HOTPLUG_DISPLAY_DEVICE_COMPONENTS) Button_SetCheck(GetDlgItem(hwndDlg, IDC_SAFE_REMOVE_DISPLAY_COMPONENTS), BST_CHECKED); - TreeView_SetImageList(GetDlgItem(hwndDlg, IDC_SAFE_REMOVE_DEVICE_TREE), + TreeView_SetImageList(pHotplugData->hwndDeviceTree, pHotplugData->ImageListData.ImageList, TVSIL_NORMAL); - EnumHotpluggedDevices(GetDlgItem(hwndDlg, IDC_SAFE_REMOVE_DEVICE_TREE), - pHotplugData); - UpdateButtons(hwndDlg); + EnumHotpluggedDevices(pHotplugData); + UpdateDialog(hwndDlg); } return TRUE; @@ -492,17 +284,29 @@ SafeRemovalDlgProc( SetHotPlugFlags(pHotplugData->dwFlags); - EnumHotpluggedDevices(GetDlgItem(hwndDlg, IDC_SAFE_REMOVE_DEVICE_TREE), - pHotplugData); + EnumHotpluggedDevices(pHotplugData); + UpdateDialog(hwndDlg); } } break; case IDC_SAFE_REMOVE_PROPERTIES: case IDM_PROPERTIES: + ShowDeviceProperties(hwndDlg, GetSelectedDeviceInst(pHotplugData)); + break; + + case IDC_SAFE_REMOVE_STOP: + case IDM_STOP: { - HWND hwndDevTree = GetDlgItem(hwndDlg, IDC_SAFE_REMOVE_DEVICE_TREE); - ShowDeviceProperties(hwndDlg, GetSelectedDeviceInst(hwndDevTree)); + if (pHotplugData != NULL) + { + DialogBoxParamW(hApplet, + MAKEINTRESOURCEW(IDD_CONFIRM_STOP_HARDWARE_DIALOG), + hwndDlg, + ConfirmRemovalDlgProc, + (LPARAM)pHotplugData); + } + break; } } @@ -524,9 +328,8 @@ SafeRemovalDlgProc( if (pHotplugData != NULL) { - EnumHotpluggedDevices(GetDlgItem(hwndDlg, IDC_SAFE_REMOVE_DEVICE_TREE), - pHotplugData); - UpdateButtons(hwndDlg); + EnumHotpluggedDevices(pHotplugData); + UpdateDialog(hwndDlg); } } break; diff --git a/dll/cpl/hotplug/hotplug.h b/dll/cpl/hotplug/hotplug.h index 8e11875c613..1f61a2fb894 100644 --- a/dll/cpl/hotplug/hotplug.h +++ b/dll/cpl/hotplug/hotplug.h @@ -38,7 +38,38 @@ typedef struct APPLET_PROC AppletProc; }APPLET, *PAPPLET; +typedef struct _HOTPLUG_DATA +{ + HICON hIcon; + HICON hIconSm; + SP_CLASSIMAGELIST_DATA ImageListData; + HMENU hPopupMenu; + HWND hwndDeviceTree; + DWORD dwFlags; +} HOTPLUG_DATA, *PHOTPLUG_DATA; + +// eject.c +DEVINST +GetDeviceInstForRemoval( + _In_ PHOTPLUG_DATA pHotplugData); + +INT_PTR +CALLBACK +ConfirmRemovalDlgProc( + _In_ HWND hwndDlg, + _In_ UINT uMsg, + _In_ WPARAM wParam, + _In_ LPARAM lParam); + +// enum.c +VOID +EnumHotpluggedDevices( + _In_ PHOTPLUG_DATA pHotplugData); +VOID +CfmListEnumDevices( + _In_ HWND hwndCfmDeviceList, + _In_ PHOTPLUG_DATA pHotplugData); // hotplug.c LONG diff --git a/dll/cpl/hotplug/lang/de-DE.rc b/dll/cpl/hotplug/lang/de-DE.rc index 32ae783b3d4..bc70584c158 100644 --- a/dll/cpl/hotplug/lang/de-DE.rc +++ b/dll/cpl/hotplug/lang/de-DE.rc @@ -17,6 +17,18 @@ BEGIN PUSHBUTTON "&Schließen", IDCLOSE, 216, 224, 55, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP END +IDD_CONFIRM_STOP_HARDWARE_DIALOG DIALOGEX 32, 10, 256, 148 +CAPTION "Stop a Hardware Device" +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Confirm devices to be stopped, choose OK to continue.", IDC_STATIC, 7, 8, 241, 14, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "ReactOS will attempt to stop the following devices. After the devices are stopped they may be removed safely.", IDC_STATIC, 7, 22, 240, 18, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "", IDC_CONFIRM_STOP_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 8, 45, 240, 78 + DEFPUSHBUTTON "OK", IDOK, 144, 127, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 198, 127, 50, 14 +END + /* Menus */ @@ -36,4 +48,6 @@ STRINGTABLE BEGIN IDS_CPLNAME "Hardware sicher entfernen" IDS_CPLDESCRIPTION "Safely unplug or eject devices from your computer." + IDS_UNKNOWN_DEVICE "Unknown Device" + IDS_EJECT_ERROR_FORMAT "Failed to remove device (0x%x)\0" END diff --git a/dll/cpl/hotplug/lang/en-US.rc b/dll/cpl/hotplug/lang/en-US.rc index f0728860bba..20acd4ecb5c 100644 --- a/dll/cpl/hotplug/lang/en-US.rc +++ b/dll/cpl/hotplug/lang/en-US.rc @@ -17,6 +17,18 @@ BEGIN PUSHBUTTON "&Close", IDCLOSE, 216, 224, 55, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP END +IDD_CONFIRM_STOP_HARDWARE_DIALOG DIALOGEX 32, 10, 256, 148 +CAPTION "Stop a Hardware Device" +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Confirm devices to be stopped, choose OK to continue.", IDC_STATIC, 7, 8, 241, 14, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "ReactOS will attempt to stop the following devices. After the devices are stopped they may be removed safely.", IDC_STATIC, 7, 22, 240, 18, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "", IDC_CONFIRM_STOP_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 8, 45, 240, 78 + DEFPUSHBUTTON "OK", IDOK, 144, 127, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 198, 127, 50, 14 +END + /* Menus */ @@ -36,4 +48,6 @@ STRINGTABLE BEGIN IDS_CPLNAME "Safely Remove Hardware" IDS_CPLDESCRIPTION "Safely unplug or eject devices from your computer." + IDS_UNKNOWN_DEVICE "Unknown Device" + IDS_EJECT_ERROR_FORMAT "Failed to remove device (0x%x)\0" END diff --git a/dll/cpl/hotplug/lang/es-ES.rc b/dll/cpl/hotplug/lang/es-ES.rc index 47165e847b7..512a0ae4850 100644 --- a/dll/cpl/hotplug/lang/es-ES.rc +++ b/dll/cpl/hotplug/lang/es-ES.rc @@ -17,6 +17,18 @@ BEGIN PUSHBUTTON "&Cerrar", IDCLOSE, 216, 224, 55, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP END +IDD_CONFIRM_STOP_HARDWARE_DIALOG DIALOGEX 32, 10, 256, 148 +CAPTION "Stop a Hardware Device" +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Confirm devices to be stopped, choose OK to continue.", IDC_STATIC, 7, 8, 241, 14, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "ReactOS will attempt to stop the following devices. After the devices are stopped they may be removed safely.", IDC_STATIC, 7, 22, 240, 18, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "", IDC_CONFIRM_STOP_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 8, 45, 240, 78 + DEFPUSHBUTTON "OK", IDOK, 144, 127, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 198, 127, 50, 14 +END + /* Menus */ @@ -36,4 +48,6 @@ STRINGTABLE BEGIN IDS_CPLNAME "Retirar hardware con seguridad" IDS_CPLDESCRIPTION "Safely unplug or eject devices from your computer." + IDS_UNKNOWN_DEVICE "Unknown Device" + IDS_EJECT_ERROR_FORMAT "Failed to remove device (0x%x)\0" END diff --git a/dll/cpl/hotplug/lang/fr-FR.rc b/dll/cpl/hotplug/lang/fr-FR.rc index 36577034316..c7f9e2ab7c7 100644 --- a/dll/cpl/hotplug/lang/fr-FR.rc +++ b/dll/cpl/hotplug/lang/fr-FR.rc @@ -24,6 +24,18 @@ BEGIN PUSHBUTTON "&Fermer", IDCLOSE, 216, 224, 55, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP END +IDD_CONFIRM_STOP_HARDWARE_DIALOG DIALOGEX 32, 10, 256, 148 +CAPTION "Stop a Hardware Device" +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Confirm devices to be stopped, choose OK to continue.", IDC_STATIC, 7, 8, 241, 14, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "ReactOS will attempt to stop the following devices. After the devices are stopped they may be removed safely.", IDC_STATIC, 7, 22, 240, 18, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "", IDC_CONFIRM_STOP_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 8, 45, 240, 78 + DEFPUSHBUTTON "OK", IDOK, 144, 127, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 198, 127, 50, 14 +END + /* Menus */ @@ -43,4 +55,6 @@ STRINGTABLE BEGIN IDS_CPLNAME "Retirer un périphérique en toute sécurité" IDS_CPLDESCRIPTION "Déconnecter ou éjecter un périphérique de votre ordinateur en sécurité." + IDS_UNKNOWN_DEVICE "Unknown Device" + IDS_EJECT_ERROR_FORMAT "Failed to remove device (0x%x)\0" END diff --git a/dll/cpl/hotplug/lang/id-ID.rc b/dll/cpl/hotplug/lang/id-ID.rc index 29f9c5994fe..45c2963177c 100644 --- a/dll/cpl/hotplug/lang/id-ID.rc +++ b/dll/cpl/hotplug/lang/id-ID.rc @@ -17,6 +17,18 @@ BEGIN PUSHBUTTON "&Tutup", IDCLOSE, 216, 224, 55, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP END +IDD_CONFIRM_STOP_HARDWARE_DIALOG DIALOGEX 32, 10, 256, 148 +CAPTION "Stop a Hardware Device" +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Confirm devices to be stopped, choose OK to continue.", IDC_STATIC, 7, 8, 241, 14, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "ReactOS will attempt to stop the following devices. After the devices are stopped they may be removed safely.", IDC_STATIC, 7, 22, 240, 18, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "", IDC_CONFIRM_STOP_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 8, 45, 240, 78 + DEFPUSHBUTTON "OK", IDOK, 144, 127, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 198, 127, 50, 14 +END + /* Menus */ @@ -36,4 +48,6 @@ STRINGTABLE BEGIN IDS_CPLNAME "Hapus perangkat keras dengan aman" IDS_CPLDESCRIPTION "Safely unplug or eject devices from your computer." + IDS_UNKNOWN_DEVICE "Unknown Device" + IDS_EJECT_ERROR_FORMAT "Failed to remove device (0x%x)\0" END diff --git a/dll/cpl/hotplug/lang/ja-JP.rc b/dll/cpl/hotplug/lang/ja-JP.rc index c2a9c356d50..0940057bd35 100644 --- a/dll/cpl/hotplug/lang/ja-JP.rc +++ b/dll/cpl/hotplug/lang/ja-JP.rc @@ -17,6 +17,18 @@ BEGIN PUSHBUTTON "閉じる(&C)", IDCLOSE, 216, 224, 55, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP END +IDD_CONFIRM_STOP_HARDWARE_DIALOG DIALOGEX 32, 10, 256, 148 +CAPTION "Stop a Hardware Device" +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Confirm devices to be stopped, choose OK to continue.", IDC_STATIC, 7, 8, 241, 14, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "ReactOS will attempt to stop the following devices. After the devices are stopped they may be removed safely.", IDC_STATIC, 7, 22, 240, 18, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "", IDC_CONFIRM_STOP_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 8, 45, 240, 78 + DEFPUSHBUTTON "OK", IDOK, 144, 127, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 198, 127, 50, 14 +END + /* Menus */ @@ -36,4 +48,6 @@ STRINGTABLE BEGIN IDS_CPLNAME "安全なハードウェアの取り外し" IDS_CPLDESCRIPTION "コンピュータからデバイスを安全に取り外しできます。" + IDS_UNKNOWN_DEVICE "Unknown Device" + IDS_EJECT_ERROR_FORMAT "Failed to remove device (0x%x)\0" END diff --git a/dll/cpl/hotplug/lang/pl-PL.rc b/dll/cpl/hotplug/lang/pl-PL.rc index 2c13620fd6f..cf7af16f8ea 100644 --- a/dll/cpl/hotplug/lang/pl-PL.rc +++ b/dll/cpl/hotplug/lang/pl-PL.rc @@ -17,6 +17,18 @@ BEGIN PUSHBUTTON "Za&mknij", IDCLOSE, 216, 224, 55, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP END +IDD_CONFIRM_STOP_HARDWARE_DIALOG DIALOGEX 32, 10, 256, 148 +CAPTION "Stop a Hardware Device" +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Confirm devices to be stopped, choose OK to continue.", IDC_STATIC, 7, 8, 241, 14, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "ReactOS will attempt to stop the following devices. After the devices are stopped they may be removed safely.", IDC_STATIC, 7, 22, 240, 18, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "", IDC_CONFIRM_STOP_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 8, 45, 240, 78 + DEFPUSHBUTTON "OK", IDOK, 144, 127, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 198, 127, 50, 14 +END + /* Menus */ @@ -36,4 +48,6 @@ STRINGTABLE BEGIN IDS_CPLNAME "Bezpieczne usuwanie sprzętu" IDS_CPLDESCRIPTION "Safely unplug or eject devices from your computer." + IDS_UNKNOWN_DEVICE "Unknown Device" + IDS_EJECT_ERROR_FORMAT "Failed to remove device (0x%x)\0" END diff --git a/dll/cpl/hotplug/lang/pt-PT.rc b/dll/cpl/hotplug/lang/pt-PT.rc index ae7db1f835e..8e1ed9d4a18 100644 --- a/dll/cpl/hotplug/lang/pt-PT.rc +++ b/dll/cpl/hotplug/lang/pt-PT.rc @@ -17,6 +17,18 @@ BEGIN PUSHBUTTON "&Fechar", IDCLOSE, 216, 224, 55, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP END +IDD_CONFIRM_STOP_HARDWARE_DIALOG DIALOGEX 32, 10, 256, 148 +CAPTION "Stop a Hardware Device" +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Confirm devices to be stopped, choose OK to continue.", IDC_STATIC, 7, 8, 241, 14, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "ReactOS will attempt to stop the following devices. After the devices are stopped they may be removed safely.", IDC_STATIC, 7, 22, 240, 18, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "", IDC_CONFIRM_STOP_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 8, 45, 240, 78 + DEFPUSHBUTTON "OK", IDOK, 144, 127, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 198, 127, 50, 14 +END + /* Menus */ @@ -36,4 +48,6 @@ STRINGTABLE BEGIN IDS_CPLNAME "Remover Hardware com segurança" IDS_CPLDESCRIPTION "Safely unplug or eject devices from your computer." + IDS_UNKNOWN_DEVICE "Unknown Device" + IDS_EJECT_ERROR_FORMAT "Failed to remove device (0x%x)\0" END diff --git a/dll/cpl/hotplug/lang/ro-RO.rc b/dll/cpl/hotplug/lang/ro-RO.rc index 5c0df0fbdf3..d0e9dd9c5c2 100644 --- a/dll/cpl/hotplug/lang/ro-RO.rc +++ b/dll/cpl/hotplug/lang/ro-RO.rc @@ -24,6 +24,18 @@ BEGIN PUSHBUTTON "Î&nchidere", IDCLOSE, 216, 224, 55, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP END +IDD_CONFIRM_STOP_HARDWARE_DIALOG DIALOGEX 32, 10, 256, 148 +CAPTION "Stop a Hardware Device" +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Confirm devices to be stopped, choose OK to continue.", IDC_STATIC, 7, 8, 241, 14, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "ReactOS will attempt to stop the following devices. After the devices are stopped they may be removed safely.", IDC_STATIC, 7, 22, 240, 18, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "", IDC_CONFIRM_STOP_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 8, 45, 240, 78 + DEFPUSHBUTTON "OK", IDOK, 144, 127, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 198, 127, 50, 14 +END + /* Menus */ @@ -43,4 +55,6 @@ STRINGTABLE BEGIN IDS_CPLNAME "Eliminare în siguranță a dispozitivul fizic" IDS_CPLDESCRIPTION "Deconectare sau scoatere în siguranță a dispozitivelor din calculator." + IDS_UNKNOWN_DEVICE "Unknown Device" + IDS_EJECT_ERROR_FORMAT "Failed to remove device (0x%x)\0" END diff --git a/dll/cpl/hotplug/lang/ru-RU.rc b/dll/cpl/hotplug/lang/ru-RU.rc index 953fb4230d4..688ee84c6f6 100644 --- a/dll/cpl/hotplug/lang/ru-RU.rc +++ b/dll/cpl/hotplug/lang/ru-RU.rc @@ -17,6 +17,18 @@ BEGIN PUSHBUTTON "&Закрыть", IDCLOSE, 216, 224, 55, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP END +IDD_CONFIRM_STOP_HARDWARE_DIALOG DIALOGEX 32, 10, 256, 148 +CAPTION "Stop a Hardware Device" +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Confirm devices to be stopped, choose OK to continue.", IDC_STATIC, 7, 8, 241, 14, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "ReactOS will attempt to stop the following devices. After the devices are stopped they may be removed safely.", IDC_STATIC, 7, 22, 240, 18, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "", IDC_CONFIRM_STOP_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 8, 45, 240, 78 + DEFPUSHBUTTON "OK", IDOK, 144, 127, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 198, 127, 50, 14 +END + /* Menus */ @@ -36,4 +48,6 @@ STRINGTABLE BEGIN IDS_CPLNAME "Безопасное извлечение устройств" IDS_CPLDESCRIPTION "Безопасно отключайте или извлекайте устройства из вашего компьютера." + IDS_UNKNOWN_DEVICE "Unknown Device" + IDS_EJECT_ERROR_FORMAT "Failed to remove device (0x%x)\0" END diff --git a/dll/cpl/hotplug/lang/tr-TR.rc b/dll/cpl/hotplug/lang/tr-TR.rc index a77aa3d16c2..7ffed72f7e0 100644 --- a/dll/cpl/hotplug/lang/tr-TR.rc +++ b/dll/cpl/hotplug/lang/tr-TR.rc @@ -19,6 +19,18 @@ BEGIN PUSHBUTTON "&Kapat", IDCLOSE, 216, 224, 55, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP END +IDD_CONFIRM_STOP_HARDWARE_DIALOG DIALOGEX 32, 10, 256, 148 +CAPTION "Stop a Hardware Device" +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Confirm devices to be stopped, choose OK to continue.", IDC_STATIC, 7, 8, 241, 14, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "ReactOS will attempt to stop the following devices. After the devices are stopped they may be removed safely.", IDC_STATIC, 7, 22, 240, 18, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "", IDC_CONFIRM_STOP_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 8, 45, 240, 78 + DEFPUSHBUTTON "OK", IDOK, 144, 127, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 198, 127, 50, 14 +END + /* Menus */ @@ -38,4 +50,6 @@ STRINGTABLE BEGIN IDS_CPLNAME "Donanımı Güvenli Kaldır" IDS_CPLDESCRIPTION "Aygıtları bilgisayarınızdan güvenle çıkarın veya çıkarın." + IDS_UNKNOWN_DEVICE "Unknown Device" + IDS_EJECT_ERROR_FORMAT "Failed to remove device (0x%x)\0" END diff --git a/dll/cpl/hotplug/lang/zh-CN.rc b/dll/cpl/hotplug/lang/zh-CN.rc index 53c3eacb3bc..9ca1e3e351e 100644 --- a/dll/cpl/hotplug/lang/zh-CN.rc +++ b/dll/cpl/hotplug/lang/zh-CN.rc @@ -24,6 +24,18 @@ BEGIN PUSHBUTTON "关闭(&C)", IDCLOSE, 216, 224, 55, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP END +IDD_CONFIRM_STOP_HARDWARE_DIALOG DIALOGEX 32, 10, 256, 148 +CAPTION "Stop a Hardware Device" +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Confirm devices to be stopped, choose OK to continue.", IDC_STATIC, 7, 8, 241, 14, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "ReactOS will attempt to stop the following devices. After the devices are stopped they may be removed safely.", IDC_STATIC, 7, 22, 240, 18, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "", IDC_CONFIRM_STOP_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 8, 45, 240, 78 + DEFPUSHBUTTON "OK", IDOK, 144, 127, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 198, 127, 50, 14 +END + IDM_POPUP_DEVICE_TREE MENU BEGIN POPUP "" @@ -37,4 +49,6 @@ STRINGTABLE BEGIN IDS_CPLNAME "安全地移除硬件" IDS_CPLDESCRIPTION "从您的计算机安全地拔出或弹出设备。" + IDS_UNKNOWN_DEVICE "Unknown Device" + IDS_EJECT_ERROR_FORMAT "Failed to remove device (0x%x)\0" END diff --git a/dll/cpl/hotplug/lang/zh-HK.rc b/dll/cpl/hotplug/lang/zh-HK.rc index f004ed02c18..75399afc4ab 100644 --- a/dll/cpl/hotplug/lang/zh-HK.rc +++ b/dll/cpl/hotplug/lang/zh-HK.rc @@ -24,6 +24,18 @@ BEGIN PUSHBUTTON "關閉(&C)", IDCLOSE, 216, 224, 55, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP END +IDD_CONFIRM_STOP_HARDWARE_DIALOG DIALOGEX 32, 10, 256, 148 +CAPTION "Stop a Hardware Device" +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Confirm devices to be stopped, choose OK to continue.", IDC_STATIC, 7, 8, 241, 14, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "ReactOS will attempt to stop the following devices. After the devices are stopped they may be removed safely.", IDC_STATIC, 7, 22, 240, 18, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "", IDC_CONFIRM_STOP_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 8, 45, 240, 78 + DEFPUSHBUTTON "OK", IDOK, 144, 127, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 198, 127, 50, 14 +END + /* Menus */ @@ -43,4 +55,6 @@ STRINGTABLE BEGIN IDS_CPLNAME "安全地移除硬件" IDS_CPLDESCRIPTION "Safely unplug or eject devices from your computer." + IDS_UNKNOWN_DEVICE "Unknown Device" + IDS_EJECT_ERROR_FORMAT "Failed to remove device (0x%x)\0" END diff --git a/dll/cpl/hotplug/lang/zh-TW.rc b/dll/cpl/hotplug/lang/zh-TW.rc index afbdbf4b4d6..dd49a385693 100644 --- a/dll/cpl/hotplug/lang/zh-TW.rc +++ b/dll/cpl/hotplug/lang/zh-TW.rc @@ -24,6 +24,18 @@ BEGIN PUSHBUTTON "關閉(&C)", IDCLOSE, 216, 224, 55, 14, WS_CHILD | WS_VISIBLE | WS_TABSTOP END +IDD_CONFIRM_STOP_HARDWARE_DIALOG DIALOGEX 32, 10, 256, 148 +CAPTION "Stop a Hardware Device" +STYLE DS_SHELLFONT | DS_MODALFRAME | WS_POPUP | WS_VISIBLE | WS_CAPTION | WS_SYSMENU +FONT 8, "MS Shell Dlg" +BEGIN + LTEXT "Confirm devices to be stopped, choose OK to continue.", IDC_STATIC, 7, 8, 241, 14, WS_CHILD | WS_VISIBLE | WS_GROUP + LTEXT "ReactOS will attempt to stop the following devices. After the devices are stopped they may be removed safely.", IDC_STATIC, 7, 22, 240, 18, WS_CHILD | WS_VISIBLE | WS_GROUP + CONTROL "", IDC_CONFIRM_STOP_DEVICE_LIST, "SysListView32", LVS_REPORT | LVS_SINGLESEL | LVS_SHOWSELALWAYS | LVS_SHAREIMAGELISTS | LVS_ALIGNLEFT | LVS_NOCOLUMNHEADER | LVS_NOSORTHEADER | WS_CHILD | WS_VISIBLE | WS_BORDER | WS_GROUP | WS_TABSTOP, 8, 45, 240, 78 + DEFPUSHBUTTON "OK", IDOK, 144, 127, 50, 14 + PUSHBUTTON "Cancel", IDCANCEL, 198, 127, 50, 14 +END + /* Menus */ @@ -43,4 +55,6 @@ STRINGTABLE BEGIN IDS_CPLNAME "安全地移除硬體" IDS_CPLDESCRIPTION "Safely unplug or eject devices from your computer." + IDS_UNKNOWN_DEVICE "Unknown Device" + IDS_EJECT_ERROR_FORMAT "Failed to remove device (0x%x)\0" END diff --git a/dll/cpl/hotplug/resource.h b/dll/cpl/hotplug/resource.h index af8d359670d..7206d24bab5 100644 --- a/dll/cpl/hotplug/resource.h +++ b/dll/cpl/hotplug/resource.h @@ -15,6 +15,7 @@ #define IDC_SAFE_REMOVE_DISPLAY_COMPONENTS 306 #define IDD_CONFIRM_STOP_HARDWARE_DIALOG 310 +#define IDC_CONFIRM_STOP_DEVICE_LIST 311 /* Menu IDs */ #define IDM_POPUP_DEVICE_TREE 500 @@ -22,6 +23,7 @@ #define IDM_PROPERTIES 502 /* Resource strings IDs */ -#define IDS_CPLNAME 1000 -#define IDS_CPLDESCRIPTION 1001 - +#define IDS_CPLNAME 1000 +#define IDS_CPLDESCRIPTION 1001 +#define IDS_UNKNOWN_DEVICE 1002 +#define IDS_EJECT_ERROR_FORMAT 1003
1 year, 1 month
1
0
0
0
[reactos] 01/01: [MSPAINT] Fix filter string UNICODE_NULL problem
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b69a7460db5a8e71cdf9d…
commit b69a7460db5a8e71cdf9d49565ea2910088bffac Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sat Nov 4 19:47:58 2023 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Sat Nov 4 19:50:36 2023 +0900 [MSPAINT] Fix filter string UNICODE_NULL problem Follow-up to #5882. Some ATL CString do not append the string if there is a UNICODE_NULL in the middle. CORE-19094 --- base/applications/mspaint/main.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/base/applications/mspaint/main.cpp b/base/applications/mspaint/main.cpp index b98f8ee841b..470c4fd4348 100644 --- a/base/applications/mspaint/main.cpp +++ b/base/applications/mspaint/main.cpp @@ -209,7 +209,8 @@ BOOL CMainWindow::GetOpenFileName(IN OUT LPWSTR pszFile, INT cchMaxFile) // Get the import filter CSimpleArray<GUID> aguidFileTypesI; CImage::GetImporterFilterString(strFilter, aguidFileTypesI, strAllPictureFiles, - CImage::excludeDefaultLoad, UNICODE_NULL); + CImage::excludeDefaultLoad, L'|'); + strFilter.Replace(L'|', UNICODE_NULL); // Initializing the OPENFILENAME structure for GetOpenFileName ZeroMemory(&ofn, sizeof(ofn)); @@ -236,7 +237,8 @@ BOOL CMainWindow::GetSaveFileName(IN OUT LPWSTR pszFile, INT cchMaxFile) // Get the export filter CSimpleArray<GUID> aguidFileTypesE; CImage::GetExporterFilterString(strFilter, aguidFileTypesE, NULL, - CImage::excludeDefaultSave, UNICODE_NULL); + CImage::excludeDefaultSave, L'|'); + strFilter.Replace(L'|', UNICODE_NULL); // Initializing the OPENFILENAME structure for GetSaveFileName ZeroMemory(&sfn, sizeof(sfn));
1 year, 1 month
1
0
0
0
[reactos] 01/01: [MSPAINT] Adapt to Unicode and <strsafe.h> (#5882)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=640d67d12ae2d5b2b89ff…
commit 640d67d12ae2d5b2b89ff7782b2494681ebd50c9 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sat Nov 4 19:25:45 2023 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Sat Nov 4 19:25:45 2023 +0900 [MSPAINT] Adapt to Unicode and <strsafe.h> (#5882) - TCHAR --> WCHAR - LPTSTR --> LPWSTR - LPCTSTR --> LPCWSTR - CString --> CStringW - TEXT("...") --> L"..." - _T("...") --> L"..." - ::SendMessage( --> ::SendMessageW( - ::GetWindowText( --> ::GetWindowTextW( - ::SetWindowText( --> ::SetWindowTextW( - Replace _tcscat with StringCchCatW. - Replace _tcslen with wcslen. etc. CORE-19094 --- base/applications/mspaint/atlimagedx.h | 16 +-- base/applications/mspaint/canvas.cpp | 36 +++--- base/applications/mspaint/canvas.h | 2 +- base/applications/mspaint/dialogs.cpp | 127 ++++++++++---------- base/applications/mspaint/dib.cpp | 48 ++++---- base/applications/mspaint/drawing.cpp | 29 +++-- base/applications/mspaint/drawing.h | 2 +- base/applications/mspaint/fullscreen.cpp | 4 +- base/applications/mspaint/fullscreen.h | 2 +- base/applications/mspaint/globalvar.h | 2 +- base/applications/mspaint/history.cpp | 6 +- base/applications/mspaint/history.h | 2 +- base/applications/mspaint/main.cpp | 48 ++++---- base/applications/mspaint/miniature.cpp | 4 +- base/applications/mspaint/miniature.h | 2 +- base/applications/mspaint/mouse.cpp | 2 +- base/applications/mspaint/palette.h | 2 +- base/applications/mspaint/registry.cpp | 166 +++++++++++++-------------- base/applications/mspaint/registry.h | 8 +- base/applications/mspaint/selectionmodel.cpp | 4 +- base/applications/mspaint/sizebox.cpp | 2 +- base/applications/mspaint/textedit.cpp | 20 ++-- base/applications/mspaint/textedit.h | 2 +- base/applications/mspaint/toolbox.cpp | 16 +-- base/applications/mspaint/toolbox.h | 2 +- base/applications/mspaint/toolsettings.cpp | 16 +-- base/applications/mspaint/toolsettings.h | 2 +- base/applications/mspaint/winproc.cpp | 71 ++++++------ base/applications/mspaint/winproc.h | 6 +- 29 files changed, 321 insertions(+), 328 deletions(-) diff --git a/base/applications/mspaint/atlimagedx.h b/base/applications/mspaint/atlimagedx.h index 6469e9d471b..366774719af 100644 --- a/base/applications/mspaint/atlimagedx.h +++ b/base/applications/mspaint/atlimagedx.h @@ -69,7 +69,7 @@ public: return TRUE; } - HRESULT LoadDx(LPCTSTR pszFileName, float *pxDpi, float *pyDpi) throw() + HRESULT LoadDx(LPCWSTR pszFileName, float *pxDpi, float *pyDpi) throw() { using namespace Gdiplus; @@ -111,7 +111,7 @@ public: return (status == Ok ? S_OK : E_FAIL); } - HRESULT SaveDx(LPCTSTR pszFileName, REFGUID guidFileType = GUID_NULL, + HRESULT SaveDx(LPCWSTR pszFileName, REFGUID guidFileType = GUID_NULL, float xDpi = 0, float yDpi = 0) throw() { using namespace Gdiplus; @@ -141,7 +141,7 @@ public: CLSID clsid; if (::IsEqualGUID(guidFileType, GUID_NULL)) { - CString strExt(PathFindExtension(pszFileName)); + CStringW strExt(PathFindExtensionW(pszFileName)); clsid = FindCodecForExtension(strExt, pEncoders, cEncoders); } else @@ -300,23 +300,23 @@ protected: // CImage::FindCodecForExtension is private. We have to duplicate it at here... static CLSID - FindCodecForExtension(LPCTSTR dotext, const Gdiplus::ImageCodecInfo *pCodecs, UINT nCodecs) + FindCodecForExtension(LPCWSTR dotext, const Gdiplus::ImageCodecInfo *pCodecs, UINT nCodecs) { for (UINT i = 0; i < nCodecs; ++i) { - CString strSpecs(pCodecs[i].FilenameExtension); + CStringW strSpecs(pCodecs[i].FilenameExtension); int ichOld = 0, ichSep; for (;;) { - ichSep = strSpecs.Find(TEXT(';'), ichOld); + ichSep = strSpecs.Find(L';', ichOld); - CString strSpec; + CStringW strSpec; if (ichSep < 0) strSpec = strSpecs.Mid(ichOld); else strSpec = strSpecs.Mid(ichOld, ichSep - ichOld); - int ichDot = strSpec.ReverseFind(TEXT('.')); + int ichDot = strSpec.ReverseFind(L'.'); if (ichDot >= 0) strSpec = strSpec.Mid(ichDot); diff --git a/base/applications/mspaint/canvas.cpp b/base/applications/mspaint/canvas.cpp index b1b76ce9901..87553d04400 100644 --- a/base/applications/mspaint/canvas.cpp +++ b/base/applications/mspaint/canvas.cpp @@ -321,7 +321,7 @@ LRESULT CCanvasWindow::OnButtonDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO { m_ptOrig = pt; SetCapture(); - ::SetCursor(::LoadCursor(g_hinstExe, MAKEINTRESOURCE(IDC_HANDDRAG))); + ::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_HANDDRAG))); return 0; } @@ -450,10 +450,10 @@ LRESULT CCanvasWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL RECT rcImage; GetImageRect(rcImage); - CString strCoord; + CStringW strCoord; if (::PtInRect(&rcImage, pt)) - strCoord.Format(_T("%ld, %ld"), pt.x, pt.y); - ::SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM) (LPCTSTR) strCoord); + strCoord.Format(L"%ld, %ld", pt.x, pt.y); + ::SendMessageW(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)(LPCWSTR)strCoord); } } @@ -511,9 +511,9 @@ LRESULT CCanvasWindow::OnMouseMove(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL cyImage = min(MAXWORD, cyImage); // Display new size - CString strSize; - strSize.Format(_T("%d x %d"), cxImage, cyImage); - ::SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM) (LPCTSTR) strSize); + CStringW strSize; + strSize.Format(L"%d x %d", cxImage, cyImage); + ::SendMessageW(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)(LPCWSTR)strSize); // Dragging now... Fix the position... CRect rcResizing = { 0, 0, cxImage, cyImage }; @@ -559,7 +559,7 @@ LRESULT CCanvasWindow::OnButtonUp(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& m_drawing = FALSE; toolsModel.OnButtonUp(bLeftButton, pt.x, pt.y); Invalidate(FALSE); - ::SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)_T("")); + ::SendMessageW(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)L""); return 0; } else if (m_hitSelection != HIT_NONE && bLeftButton) @@ -625,7 +625,7 @@ LRESULT CCanvasWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL if (m_nMouseDownMsg == WM_MBUTTONDOWN) { - ::SetCursor(::LoadCursor(g_hinstExe, MAKEINTRESOURCE(IDC_HANDDRAG))); + ::SetCursor(::LoadCursorW(g_hinstExe, MAKEINTRESOURCEW(IDC_HANDDRAG))); return 0; } @@ -646,7 +646,7 @@ LRESULT CCanvasWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL if (hitSelection != HIT_NONE) { if (!setCursorOnSizeBox(hitSelection)) - ::SetCursor(::LoadCursor(NULL, IDC_SIZEALL)); + ::SetCursor(::LoadCursorW(NULL, (LPCWSTR)IDC_SIZEALL)); return 0; } @@ -659,22 +659,22 @@ LRESULT CCanvasWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL switch (toolsModel.GetActiveTool()) { case TOOL_FILL: - ::SetCursor(::LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDC_FILL))); + ::SetCursor(::LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDC_FILL))); break; case TOOL_COLOR: - ::SetCursor(::LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDC_COLOR))); + ::SetCursor(::LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDC_COLOR))); break; case TOOL_ZOOM: - ::SetCursor(::LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDC_ZOOM))); + ::SetCursor(::LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDC_ZOOM))); break; case TOOL_PEN: - ::SetCursor(::LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDC_PEN))); + ::SetCursor(::LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDC_PEN))); break; case TOOL_AIRBRUSH: - ::SetCursor(::LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDC_AIRBRUSH))); + ::SetCursor(::LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDC_AIRBRUSH))); break; default: - ::SetCursor(::LoadCursor(NULL, IDC_CROSS)); + ::SetCursor(::LoadCursorW(NULL, (LPCWSTR)IDC_CROSS)); } return 0; } @@ -711,12 +711,12 @@ LRESULT CCanvasWindow::OnCancelMode(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO LRESULT CCanvasWindow::OnMouseWheel(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { - return ::SendMessage(GetParent(), nMsg, wParam, lParam); + return ::SendMessageW(GetParent(), nMsg, wParam, lParam); } LRESULT CCanvasWindow::OnCaptureChanged(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { - ::SendMessage(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)_T("")); + ::SendMessageW(g_hStatusBar, SB_SETTEXT, 2, (LPARAM)L""); return 0; } diff --git a/base/applications/mspaint/canvas.h b/base/applications/mspaint/canvas.h index 76e7225ccfd..e275e97a4d3 100644 --- a/base/applications/mspaint/canvas.h +++ b/base/applications/mspaint/canvas.h @@ -10,7 +10,7 @@ class CCanvasWindow : public CWindowImpl<CCanvasWindow> { public: - DECLARE_WND_CLASS_EX(_T("ReactOSPaintCanvas"), CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW, + DECLARE_WND_CLASS_EX(L"ReactOSPaintCanvas", CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW, COLOR_APPWORKSPACE) BEGIN_MSG_MAP(CCanvasWindow) diff --git a/base/applications/mspaint/dialogs.cpp b/base/applications/mspaint/dialogs.cpp index c56eaaf5f49..36841639d5e 100644 --- a/base/applications/mspaint/dialogs.cpp +++ b/base/applications/mspaint/dialogs.cpp @@ -113,22 +113,21 @@ LRESULT CAttributesDialog::OnInitDialog(UINT nMsg, WPARAM wParam, LPARAM lParam, if (g_isAFile) { - TCHAR date[100]; - TCHAR temp[100]; - GetDateFormat(LOCALE_USER_DEFAULT, 0, &g_fileTime, NULL, date, _countof(date)); - GetTimeFormat(LOCALE_USER_DEFAULT, 0, &g_fileTime, NULL, temp, _countof(temp)); - _tcscat(date, _T(" ")); - _tcscat(date, temp); - CString strSize; + WCHAR date[100], temp[100]; + GetDateFormatW(LOCALE_USER_DEFAULT, 0, &g_fileTime, NULL, date, _countof(date)); + GetTimeFormatW(LOCALE_USER_DEFAULT, 0, &g_fileTime, NULL, temp, _countof(temp)); + StringCchCatW(date, _countof(date), L" "); + StringCchCatW(date, _countof(date), temp); + CStringW strSize; strSize.Format(IDS_FILESIZE, g_fileSize); SetDlgItemText(IDD_ATTRIBUTESTEXT6, date); SetDlgItemText(IDD_ATTRIBUTESTEXT7, strSize); } - CString strUnit; + CStringW strUnit; GetDlgItemText(IDD_ATTRIBUTESTEXT8, strUnit); - CString strRes; + CStringW strRes; if (strUnit == L"dpi") strRes.Format(IDS_PRINTRES, ROUND(g_xDpi), ROUND(g_yDpi)); else @@ -173,10 +172,10 @@ LRESULT CAttributesDialog::OnRadioButton1(WORD wNotifyCode, WORD wID, HWND hWndC if (IsDlgButtonChecked(IDD_ATTRIBUTESRB1) != BST_CHECKED) return 0; - CString strNum; - strNum.Format(_T("%.3lf"), newWidth / g_xDpi); + CStringW strNum; + strNum.Format(L"%.3lf", newWidth / g_xDpi); SetDlgItemText(IDD_ATTRIBUTESEDIT1, strNum); - strNum.Format(_T("%.3lf"), newHeight / g_yDpi); + strNum.Format(L"%.3lf", newHeight / g_yDpi); SetDlgItemText(IDD_ATTRIBUTESEDIT2, strNum); return 0; } @@ -186,10 +185,10 @@ LRESULT CAttributesDialog::OnRadioButton2(WORD wNotifyCode, WORD wID, HWND hWndC if (IsDlgButtonChecked(IDD_ATTRIBUTESRB2) != BST_CHECKED) return 0; - CString strNum; - strNum.Format(_T("%.3lf"), newWidth / PpcmFromDpi(g_xDpi)); + CStringW strNum; + strNum.Format(L"%.3lf", newWidth / PpcmFromDpi(g_xDpi)); SetDlgItemText(IDD_ATTRIBUTESEDIT1, strNum); - strNum.Format(_T("%.3lf"), newHeight / PpcmFromDpi(g_yDpi)); + strNum.Format(L"%.3lf", newHeight / PpcmFromDpi(g_yDpi)); SetDlgItemText(IDD_ATTRIBUTESEDIT2, strNum); return 0; } @@ -208,21 +207,21 @@ LRESULT CAttributesDialog::OnEdit1(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOO { if (Edit_GetModify(hWndCtl)) { - TCHAR tempS[100]; + WCHAR tempS[100]; if (IsDlgButtonChecked(IDD_ATTRIBUTESRB1)) { GetDlgItemText(IDD_ATTRIBUTESEDIT1, tempS, _countof(tempS)); - newWidth = max(1, (int) (_tcstod(tempS, NULL) * g_xDpi)); + newWidth = max(1, (int)(wcstod(tempS, NULL) * g_xDpi)); } else if (IsDlgButtonChecked(IDD_ATTRIBUTESRB2)) { GetDlgItemText(IDD_ATTRIBUTESEDIT1, tempS, _countof(tempS)); - newWidth = max(1, (int) (_tcstod(tempS, NULL) * PpcmFromDpi(g_xDpi))); + newWidth = max(1, (int)(wcstod(tempS, NULL) * PpcmFromDpi(g_xDpi))); } else if (IsDlgButtonChecked(IDD_ATTRIBUTESRB3)) { GetDlgItemText(IDD_ATTRIBUTESEDIT1, tempS, _countof(tempS)); - newWidth = max(1, _tstoi(tempS)); + newWidth = max(1, _wtoi(tempS)); } Edit_SetModify(hWndCtl, FALSE); } @@ -233,21 +232,21 @@ LRESULT CAttributesDialog::OnEdit2(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOO { if (Edit_GetModify(hWndCtl)) { - TCHAR tempS[100]; + WCHAR tempS[100]; if (IsDlgButtonChecked(IDD_ATTRIBUTESRB1)) { GetDlgItemText(IDD_ATTRIBUTESEDIT2, tempS, _countof(tempS)); - newHeight = max(1, (int) (_tcstod(tempS, NULL) * g_yDpi)); + newHeight = max(1, (int)(wcstod(tempS, NULL) * g_yDpi)); } else if (IsDlgButtonChecked(IDD_ATTRIBUTESRB2)) { GetDlgItemText(IDD_ATTRIBUTESEDIT2, tempS, _countof(tempS)); - newHeight = max(1, (int) (_tcstod(tempS, NULL) * PpcmFromDpi(g_yDpi))); + newHeight = max(1, (int)(wcstod(tempS, NULL) * PpcmFromDpi(g_yDpi))); } else if (IsDlgButtonChecked(IDD_ATTRIBUTESRB3)) { GetDlgItemText(IDD_ATTRIBUTESEDIT2, tempS, _countof(tempS)); - newHeight = max(1, _tstoi(tempS)); + newHeight = max(1, _wtoi(tempS)); } Edit_SetModify(hWndCtl, FALSE); } @@ -273,9 +272,7 @@ LRESULT CStretchSkewDialog::OnClose(UINT nMsg, WPARAM wParam, LPARAM lParam, BOO LRESULT CStretchSkewDialog::OnOk(WORD wNotifyCode, WORD wID, HWND hWndCtl, BOOL& bHandled) { - CString strrcIntNumbers; - CString strrcPercentage; - CString strrcAngle; + CStringW strrcIntNumbers, strrcPercentage, strrcAngle; BOOL tr1, tr2, tr3, tr4; strrcIntNumbers.LoadString(g_hinstExe, IDS_INTNUMBERS); @@ -305,11 +302,11 @@ LRESULT CStretchSkewDialog::OnCancel(WORD wNotifyCode, WORD wID, HWND hWndCtl, B } static INT CALLBACK -EnumFontFamProc(ENUMLOGFONT *lpelf, NEWTEXTMETRIC *lpntm, INT FontType, LPARAM lParam) +EnumFontFamProc(ENUMLOGFONTW *lpelf, NEWTEXTMETRICW *lpntm, INT FontType, LPARAM lParam) { - CSimpleArray<CString>& arrFontNames = *reinterpret_cast<CSimpleArray<CString>*>(lParam); - LPTSTR name = lpelf->elfLogFont.lfFaceName; - if (name[0] == TEXT('@')) // Vertical fonts + CSimpleArray<CStringW>& arrFontNames = *reinterpret_cast<CSimpleArray<CStringW>*>(lParam); + LPWSTR name = lpelf->elfLogFont.lfFaceName; + if (name[0] == L'@') // Vertical fonts return TRUE; for (INT i = 0; i < arrFontNames.GetSize(); ++i) @@ -331,24 +328,24 @@ CFontsDialog::CFontsDialog() void CFontsDialog::InitFontNames() { // List the fonts - CSimpleArray<CString> arrFontNames; + CSimpleArray<CStringW> arrFontNames; HDC hDC = CreateCompatibleDC(NULL); if (hDC) { - EnumFontFamilies(hDC, NULL, (FONTENUMPROC)EnumFontFamProc, - reinterpret_cast<LPARAM>(&arrFontNames)); - DeleteDC(hDC); + EnumFontFamiliesW(hDC, NULL, (FONTENUMPROCW)EnumFontFamProc, + reinterpret_cast<LPARAM>(&arrFontNames)); + ::DeleteDC(hDC); } // Actually add them to the combobox HWND hwndNames = GetDlgItem(IDD_FONTSNAMES); - SendMessage(hwndNames, CB_RESETCONTENT, 0, 0); + ::SendMessageW(hwndNames, CB_RESETCONTENT, 0, 0); for (INT i = 0; i < arrFontNames.GetSize(); ++i) { ComboBox_AddString(hwndNames, arrFontNames[i]); } - ::SetWindowText(hwndNames, registrySettings.strFontName); + ::SetWindowTextW(hwndNames, registrySettings.strFontName); } void CFontsDialog::InitFontSizes() @@ -373,26 +370,26 @@ void CFontsDialog::InitFontSizes() if (ComboBox_GetCurSel(hwndSizes) == CB_ERR) { StringCchPrintfW(szText, _countof(szText), L"%d", (INT)registrySettings.PointSize); - ::SetWindowText(hwndSizes, szText); + ::SetWindowTextW(hwndSizes, szText); } } void CFontsDialog::InitToolbar() { HWND hwndToolbar = GetDlgItem(IDD_FONTSTOOLBAR); - SendMessage(hwndToolbar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); - SendMessage(hwndToolbar, TB_SETBITMAPSIZE, 0, MAKELPARAM(16, 16)); - SendMessage(hwndToolbar, TB_SETBUTTONWIDTH, 0, MAKELPARAM(20, 20)); + ::SendMessageW(hwndToolbar, TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); + ::SendMessageW(hwndToolbar, TB_SETBITMAPSIZE, 0, MAKELPARAM(16, 16)); + ::SendMessageW(hwndToolbar, TB_SETBUTTONWIDTH, 0, MAKELPARAM(20, 20)); TBADDBITMAP AddBitmap; AddBitmap.hInst = g_hinstExe; AddBitmap.nID = IDB_FONTSTOOLBAR; - SendMessage(hwndToolbar, TB_ADDBITMAP, 4, (LPARAM)&AddBitmap); + ::SendMessageW(hwndToolbar, TB_ADDBITMAP, 4, (LPARAM)&AddBitmap); - HIMAGELIST himl = ImageList_LoadImage(g_hinstExe, MAKEINTRESOURCE(IDB_FONTSTOOLBAR), + HIMAGELIST himl = ImageList_LoadImage(g_hinstExe, MAKEINTRESOURCEW(IDB_FONTSTOOLBAR), 16, 8, RGB(255, 0, 255), IMAGE_BITMAP, LR_CREATEDIBSECTION); - SendMessage(hwndToolbar, TB_SETIMAGELIST, 0, (LPARAM)himl); + ::SendMessageW(hwndToolbar, TB_SETIMAGELIST, 0, (LPARAM)himl); TBBUTTON buttons[] = { @@ -401,11 +398,11 @@ void CFontsDialog::InitToolbar() { 2, IDM_UNDERLINE, TBSTATE_ENABLED, TBSTYLE_CHECK }, { 3, IDM_VERTICAL, 0, TBSTYLE_CHECK }, // TODO: }; - SendMessage(hwndToolbar, TB_ADDBUTTONS, _countof(buttons), (LPARAM)&buttons); + ::SendMessageW(hwndToolbar, TB_ADDBUTTONS, _countof(buttons), (LPARAM)&buttons); - SendMessage(hwndToolbar, TB_CHECKBUTTON, IDM_BOLD, registrySettings.Bold); - SendMessage(hwndToolbar, TB_CHECKBUTTON, IDM_ITALIC, registrySettings.Italic); - SendMessage(hwndToolbar, TB_CHECKBUTTON, IDM_UNDERLINE, registrySettings.Underline); + ::SendMessageW(hwndToolbar, TB_CHECKBUTTON, IDM_BOLD, registrySettings.Bold); + ::SendMessageW(hwndToolbar, TB_CHECKBUTTON, IDM_ITALIC, registrySettings.Italic); + ::SendMessageW(hwndToolbar, TB_CHECKBUTTON, IDM_UNDERLINE, registrySettings.Underline); } LRESULT CFontsDialog::OnInitDialog(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) @@ -441,7 +438,7 @@ void CFontsDialog::OnFontName(UINT codeNotify) HWND hwndNames = GetDlgItem(IDD_FONTSNAMES); INT iItem = CB_ERR; UINT cch; - TCHAR szText[LF_FACESIZE]; + WCHAR szText[LF_FACESIZE]; switch (codeNotify) { @@ -449,9 +446,7 @@ void CFontsDialog::OnFontName(UINT codeNotify) iItem = ComboBox_GetCurSel(hwndNames); cch = ComboBox_GetLBTextLen(hwndNames, iItem); if (iItem != CB_ERR && 0 < cch && cch < _countof(szText)) - { ComboBox_GetLBText(hwndNames, iItem, szText); - } break; case CBN_EDITCHANGE: @@ -482,13 +477,13 @@ void CFontsDialog::OnFontSize(UINT codeNotify) if (iItem != CB_ERR && 0 < cch && cch < _countof(szText)) { ComboBox_GetLBText(hwndSizes, iItem, szText); - PointSize = _ttoi(szText); + PointSize = _wtoi(szText); } break; case CBN_EDITCHANGE: - ::GetWindowText(hwndSizes, szText, _countof(szText)); - PointSize = _ttoi(szText); + ::GetWindowTextW(hwndSizes, szText, _countof(szText)); + PointSize = _wtoi(szText); break; } @@ -504,7 +499,7 @@ LRESULT CFontsDialog::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& b UINT id = LOWORD(wParam); UINT codeNotify = HIWORD(wParam); HWND hwndToolbar = GetDlgItem(IDD_FONTSTOOLBAR); - BOOL bChecked = (BOOL)::SendMessage(hwndToolbar, TB_ISBUTTONCHECKED, id, 0); + BOOL bChecked = (BOOL)::SendMessageW(hwndToolbar, TB_ISBUTTONCHECKED, id, 0); switch (id) { @@ -548,14 +543,14 @@ LRESULT CFontsDialog::OnNotify(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH NMHDR *pnmhdr = reinterpret_cast<NMHDR *>(lParam); if (pnmhdr->code == TTN_NEEDTEXT) { - LPTOOLTIPTEXT pToolTip = reinterpret_cast<LPTOOLTIPTEXT>(lParam); + LPTOOLTIPTEXTW pToolTip = reinterpret_cast<LPTOOLTIPTEXTW>(lParam); pToolTip->hinst = g_hinstExe; switch (pnmhdr->idFrom) { - case IDM_BOLD: pToolTip->lpszText = MAKEINTRESOURCE(IDS_BOLD); break; - case IDM_ITALIC: pToolTip->lpszText = MAKEINTRESOURCE(IDS_ITALIC); break; - case IDM_UNDERLINE: pToolTip->lpszText = MAKEINTRESOURCE(IDS_UNDERLINE); break; - case IDM_VERTICAL: pToolTip->lpszText = MAKEINTRESOURCE(IDS_VERTICAL); break; + case IDM_BOLD: pToolTip->lpszText = MAKEINTRESOURCEW(IDS_BOLD); break; + case IDM_ITALIC: pToolTip->lpszText = MAKEINTRESOURCEW(IDS_ITALIC); break; + case IDM_UNDERLINE: pToolTip->lpszText = MAKEINTRESOURCEW(IDS_UNDERLINE); break; + case IDM_VERTICAL: pToolTip->lpszText = MAKEINTRESOURCEW(IDS_VERTICAL); break; default: break; @@ -604,29 +599,29 @@ LRESULT CFontsDialog::OnDrawItem(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& if (pDrawItem->itemID == (UINT)-1) return TRUE; - SetBkMode(pDrawItem->hDC, TRANSPARENT); + ::SetBkMode(pDrawItem->hDC, TRANSPARENT); HWND hwndItem = pDrawItem->hwndItem; RECT rcItem = pDrawItem->rcItem; if (pDrawItem->itemState & ODS_SELECTED) { - FillRect(pDrawItem->hDC, &rcItem, GetSysColorBrush(COLOR_HIGHLIGHT)); - SetTextColor(pDrawItem->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT)); + ::FillRect(pDrawItem->hDC, &rcItem, GetSysColorBrush(COLOR_HIGHLIGHT)); + ::SetTextColor(pDrawItem->hDC, GetSysColor(COLOR_HIGHLIGHTTEXT)); } else { - FillRect(pDrawItem->hDC, &rcItem, GetSysColorBrush(COLOR_WINDOW)); - SetTextColor(pDrawItem->hDC, GetSysColor(COLOR_WINDOWTEXT)); + ::FillRect(pDrawItem->hDC, &rcItem, GetSysColorBrush(COLOR_WINDOW)); + ::SetTextColor(pDrawItem->hDC, GetSysColor(COLOR_WINDOWTEXT)); } - TCHAR szText[LF_FACESIZE]; + WCHAR szText[LF_FACESIZE]; if ((UINT)ComboBox_GetLBTextLen(hwndItem, pDrawItem->itemID) < _countof(szText)) { szText[0] = 0; ComboBox_GetLBText(hwndItem, pDrawItem->itemID, szText); rcItem.left += 24; - DrawText(pDrawItem->hDC, szText, -1, &rcItem, DT_LEFT | DT_VCENTER | DT_SINGLELINE); + ::DrawTextW(pDrawItem->hDC, szText, -1, &rcItem, DT_LEFT | DT_VCENTER | DT_SINGLELINE); } if (pDrawItem->itemState & ODS_FOCUS) diff --git a/base/applications/mspaint/dib.cpp b/base/applications/mspaint/dib.cpp index 2c13cc2f785..d6ea224de79 100644 --- a/base/applications/mspaint/dib.cpp +++ b/base/applications/mspaint/dib.cpp @@ -87,7 +87,7 @@ CreateColorDIB(int width, int height, COLORREF rgb) HBITMAP CopyMonoImage(HBITMAP hbm, INT cx, INT cy) { BITMAP bm; - if (!GetObject(hbm, sizeof(bm), &bm)) + if (!::GetObjectW(hbm, sizeof(bm), &bm)) return NULL; if (cx == 0 || cy == 0) @@ -96,19 +96,19 @@ HBITMAP CopyMonoImage(HBITMAP hbm, INT cx, INT cy) cy = bm.bmHeight; } - HBITMAP hbmNew = CreateBitmap(cx, cy, 1, 1, NULL); + HBITMAP hbmNew = ::CreateBitmap(cx, cy, 1, 1, NULL); if (!hbmNew) return NULL; - HDC hdc1 = CreateCompatibleDC(NULL); - HDC hdc2 = CreateCompatibleDC(NULL); - HGDIOBJ hbm1Old = SelectObject(hdc1, hbm); - HGDIOBJ hbm2Old = SelectObject(hdc2, hbmNew); - StretchBlt(hdc2, 0, 0, cx, cy, hdc1, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY); - SelectObject(hdc1, hbm1Old); - SelectObject(hdc2, hbm2Old); - DeleteDC(hdc1); - DeleteDC(hdc2); + HDC hdc1 = ::CreateCompatibleDC(NULL); + HDC hdc2 = ::CreateCompatibleDC(NULL); + HGDIOBJ hbm1Old = ::SelectObject(hdc1, hbm); + HGDIOBJ hbm2Old = ::SelectObject(hdc2, hbmNew); + ::StretchBlt(hdc2, 0, 0, cx, cy, hdc1, 0, 0, bm.bmWidth, bm.bmHeight, SRCCOPY); + ::SelectObject(hdc1, hbm1Old); + ::SelectObject(hdc2, hbm2Old); + ::DeleteDC(hdc1); + ::DeleteDC(hdc2); return hbmNew; } @@ -120,7 +120,7 @@ HBITMAP CachedBufferDIB(HBITMAP hbm, int minimalWidth, int minimalHeight) minimalHeight = 1; BITMAP bm; - if (!GetObject(hbm, sizeof(bm), &bm)) + if (!GetObjectW(hbm, sizeof(bm), &bm)) hbm = NULL; if (hbm && minimalWidth <= bm.bmWidth && minimalHeight <= bm.bmHeight) @@ -136,7 +136,7 @@ int GetDIBWidth(HBITMAP hBitmap) { BITMAP bm; - GetObject(hBitmap, sizeof(BITMAP), &bm); + ::GetObjectW(hBitmap, sizeof(BITMAP), &bm); return bm.bmWidth; } @@ -144,7 +144,7 @@ int GetDIBHeight(HBITMAP hBitmap) { BITMAP bm; - GetObject(hBitmap, sizeof(BITMAP), &bm); + ::GetObjectW(hBitmap, sizeof(BITMAP), &bm); return bm.bmHeight; } @@ -211,8 +211,8 @@ void SetFileInfo(LPCWSTR name, LPWIN32_FIND_DATAW pFound, BOOL isAFile) } // set title - CString strTitle; - strTitle.Format(IDS_WINDOWTITLE, PathFindFileName(g_szFileName)); + CStringW strTitle; + strTitle.Format(IDS_WINDOWTITLE, PathFindFileNameW(g_szFileName)); mainWindow.SetWindowText(strTitle); // update file info and recent @@ -258,7 +258,7 @@ HBITMAP DoLoadImageFile(HWND hwnd, LPCWSTR name, BOOL fIsMainFile) CWaitCursor waitCursor; // find the file - WIN32_FIND_DATA find; + WIN32_FIND_DATAW find; HANDLE hFind = ::FindFirstFileW(name, &find); if (hFind == INVALID_HANDLE_VALUE) // does not exist { @@ -358,7 +358,7 @@ HBITMAP SkewDIB(HDC hDC1, HBITMAP hbm, INT nDegree, BOOL bVertical, BOOL bMono) const double eTan = tan(abs(nDegree) * M_PI / 180); BITMAP bm; - GetObjectW(hbm, sizeof(bm), &bm); + ::GetObjectW(hbm, sizeof(bm), &bm); INT cx = bm.bmWidth, cy = bm.bmHeight, dx = 0, dy = 0; if (bVertical) dy = INT(cx * eTan); @@ -384,9 +384,9 @@ HBITMAP SkewDIB(HDC hDC1, HBITMAP hbm, INT nDegree, BOOL bVertical, BOOL bMono) { INT delta = INT(x * eTan); if (nDegree > 0) - BitBlt(hDC2, x, (dy - delta), 1, cy, hDC1, x, 0, SRCCOPY); + ::BitBlt(hDC2, x, (dy - delta), 1, cy, hDC1, x, 0, SRCCOPY); else - BitBlt(hDC2, x, delta, 1, cy, hDC1, x, 0, SRCCOPY); + ::BitBlt(hDC2, x, delta, 1, cy, hDC1, x, 0, SRCCOPY); } } else @@ -395,9 +395,9 @@ HBITMAP SkewDIB(HDC hDC1, HBITMAP hbm, INT nDegree, BOOL bVertical, BOOL bMono) { INT delta = INT(y * eTan); if (nDegree > 0) - BitBlt(hDC2, (dx - delta), y, cx, 1, hDC1, 0, y, SRCCOPY); + ::BitBlt(hDC2, (dx - delta), y, cx, 1, hDC1, 0, y, SRCCOPY); else - BitBlt(hDC2, delta, y, cx, 1, hDC1, 0, y, SRCCOPY); + ::BitBlt(hDC2, delta, y, cx, 1, hDC1, 0, y, SRCCOPY); } } @@ -416,7 +416,7 @@ HGLOBAL BitmapToClipboardDIB(HBITMAP hBitmap) CWaitCursor waitCursor; BITMAP bm; - if (!GetObject(hBitmap, sizeof(BITMAP), &bm)) + if (!GetObjectW(hBitmap, sizeof(BITMAP), &bm)) return NULL; BITMAPINFODX bmi; @@ -600,7 +600,7 @@ HBITMAP ConvertToBlackAndWhite(HBITMAP hbm) CWaitCursor waitCursor; BITMAP bm; - if (!::GetObject(hbm, sizeof(bm), &bm)) + if (!::GetObjectW(hbm, sizeof(bm), &bm)) return NULL; BITMAPINFOEX bmi; diff --git a/base/applications/mspaint/drawing.cpp b/base/applications/mspaint/drawing.cpp index 3b7579196ce..77d78d465b4 100644 --- a/base/applications/mspaint/drawing.cpp +++ b/base/applications/mspaint/drawing.cpp @@ -253,38 +253,37 @@ RectSel(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2) } void -Text(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LPCTSTR lpchText, HFONT font, LONG style) +Text(HDC hdc, LONG x1, LONG y1, LONG x2, LONG y2, COLORREF fg, COLORREF bg, LPCWSTR lpchText, HFONT font, LONG style) { - INT iSaveDC = SaveDC(hdc); // We will modify the clipping region. Save now. + INT iSaveDC = ::SaveDC(hdc); // We will modify the clipping region. Save now. RECT rc; - SetRect(&rc, x1, y1, x2, y2); + ::SetRect(&rc, x1, y1, x2, y2); if (style == 0) // Transparent { - SetBkMode(hdc, TRANSPARENT); - GetBkColor(hdc); + ::SetBkMode(hdc, TRANSPARENT); } else // Opaque { - SetBkMode(hdc, OPAQUE); - SetBkColor(hdc, bg); + ::SetBkMode(hdc, OPAQUE); + ::SetBkColor(hdc, bg); - HBRUSH hbr = CreateSolidBrush(bg); - FillRect(hdc, &rc, hbr); // Fill the background - DeleteObject(hbr); + HBRUSH hbr = ::CreateSolidBrush(bg); + ::FillRect(hdc, &rc, hbr); // Fill the background + ::DeleteObject(hbr); } IntersectClipRect(hdc, rc.left, rc.top, rc.right, rc.bottom); - HGDIOBJ hFontOld = SelectObject(hdc, font); - SetTextColor(hdc, fg); + HGDIOBJ hFontOld = ::SelectObject(hdc, font); + ::SetTextColor(hdc, fg); const UINT uFormat = DT_LEFT | DT_TOP | DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_EXPANDTABS | DT_WORDBREAK; - DrawText(hdc, lpchText, -1, &rc, uFormat); - SelectObject(hdc, hFontOld); + ::DrawTextW(hdc, lpchText, -1, &rc, uFormat); + ::SelectObject(hdc, hFontOld); - RestoreDC(hdc, iSaveDC); // Restore + ::RestoreDC(hdc, iSaveDC); // Restore } BOOL diff --git a/base/applications/mspaint/drawing.h b/base/applications/mspaint/drawing.h index 44936f08503..676bb578bb7 100644 --- a/base/applications/mspaint/drawing.h +++ b/base/applications/mspaint/drawing.h @@ -31,7 +31,7 @@ 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 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, LPCWSTR lpchText, HFONT font, LONG style); BOOL ColorKeyedMaskBlt(HDC hdcDest, int nXDest, int nYDest, int nWidth, int nHeight, diff --git a/base/applications/mspaint/fullscreen.cpp b/base/applications/mspaint/fullscreen.cpp index 53e7f8ceb30..8443cedeb6c 100644 --- a/base/applications/mspaint/fullscreen.cpp +++ b/base/applications/mspaint/fullscreen.cpp @@ -22,8 +22,8 @@ HWND CFullscreenWindow::DoCreate() LRESULT CFullscreenWindow::OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { - SendMessage(WM_SETICON, ICON_BIG, (LPARAM) LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDI_APPICON))); - SendMessage(WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDI_APPICON))); + SendMessage(WM_SETICON, ICON_BIG, (LPARAM)::LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDI_APPICON))); + SendMessage(WM_SETICON, ICON_SMALL, (LPARAM)::LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDI_APPICON))); return 0; } diff --git a/base/applications/mspaint/fullscreen.h b/base/applications/mspaint/fullscreen.h index 02efcca0c91..e335bb2e0c5 100644 --- a/base/applications/mspaint/fullscreen.h +++ b/base/applications/mspaint/fullscreen.h @@ -10,7 +10,7 @@ class CFullscreenWindow : public CWindowImpl<CFullscreenWindow> { public: - DECLARE_WND_CLASS_EX(_T("FullscreenWindow"), CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW, + DECLARE_WND_CLASS_EX(L"FullscreenWindow", CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW, COLOR_BACKGROUND) BEGIN_MSG_MAP(CFullscreenWindow) diff --git a/base/applications/mspaint/globalvar.h b/base/applications/mspaint/globalvar.h index 7c27a1cc3d2..cb6eed1ebd4 100644 --- a/base/applications/mspaint/globalvar.h +++ b/base/applications/mspaint/globalvar.h @@ -15,7 +15,7 @@ extern POINT g_ptStart, g_ptEnd; extern HINSTANCE g_hinstExe; -extern TCHAR g_szFileName[MAX_LONG_PATH]; +extern WCHAR g_szFileName[MAX_LONG_PATH]; extern BOOL g_isAFile; extern BOOL g_imageSaved; extern BOOL g_showGrid; diff --git a/base/applications/mspaint/history.cpp b/base/applications/mspaint/history.cpp index 22aaf6835f4..9c0d18f5878 100644 --- a/base/applications/mspaint/history.cpp +++ b/base/applications/mspaint/history.cpp @@ -179,7 +179,7 @@ void ImageModel::Crop(int nWidth, int nHeight, int nOffsetX, int nOffsetY) NotifyImageChanged(); } -void ImageModel::SaveImage(LPCTSTR lpFileName) +void ImageModel::SaveImage(LPCWSTR lpFileName) { SaveDIBToFile(m_hBms[m_currInd], lpFileName, TRUE); } @@ -266,8 +266,8 @@ void ImageModel::RotateNTimes90Degrees(int iN) case 2: { PushImageForUndo(); - StretchBlt(m_hDrawingDC, GetWidth() - 1, GetHeight() - 1, -GetWidth(), -GetHeight(), - m_hDrawingDC, 0, 0, GetWidth(), GetHeight(), SRCCOPY); + ::StretchBlt(m_hDrawingDC, GetWidth() - 1, GetHeight() - 1, -GetWidth(), -GetHeight(), + m_hDrawingDC, 0, 0, GetWidth(), GetHeight(), SRCCOPY); break; } } diff --git a/base/applications/mspaint/history.h b/base/applications/mspaint/history.h index 716db560a8e..14b5e38a582 100644 --- a/base/applications/mspaint/history.h +++ b/base/applications/mspaint/history.h @@ -25,7 +25,7 @@ public: void Redo(void); void ClearHistory(void); void Crop(int nWidth, int nHeight, int nOffsetX = 0, int nOffsetY = 0); - void SaveImage(LPCTSTR lpFileName); + void SaveImage(LPCWSTR lpFileName); BOOL IsImageSaved() const; void StretchSkew(int nStretchPercentX, int nStretchPercentY, int nSkewDegX = 0, int nSkewDegY = 0); int GetWidth() const; diff --git a/base/applications/mspaint/main.cpp b/base/applications/mspaint/main.cpp index 0f133cbe485..b98f8ee841b 100644 --- a/base/applications/mspaint/main.cpp +++ b/base/applications/mspaint/main.cpp @@ -13,7 +13,7 @@ POINT g_ptStart, g_ptEnd; BOOL g_askBeforeEnlarging = FALSE; // TODO: initialize from registry HINSTANCE g_hinstExe = NULL; -TCHAR g_szFileName[MAX_LONG_PATH] = { 0 }; +WCHAR g_szFileName[MAX_LONG_PATH] = { 0 }; WCHAR g_szMailTempFile[MAX_LONG_PATH] = { 0 }; BOOL g_isAFile = FALSE; BOOL g_imageSaved = FALSE; @@ -37,18 +37,18 @@ void ShowOutOfMemory(void) // get file name extension from filter string static BOOL -FileExtFromFilter(LPTSTR pExt, OPENFILENAME *pOFN) +FileExtFromFilter(LPWSTR pExt, OPENFILENAME *pOFN) { - LPTSTR pchExt = pExt; + LPWSTR pchExt = pExt; *pchExt = 0; DWORD nIndex = 1; - for (LPCTSTR pch = pOFN->lpstrFilter; *pch; ++nIndex) + for (LPCWSTR pch = pOFN->lpstrFilter; *pch; ++nIndex) { pch += lstrlen(pch) + 1; if (pOFN->nFilterIndex == nIndex) { - for (++pch; *pch && *pch != _T(';'); ++pch) + for (++pch; *pch && *pch != L';'; ++pch) { *pchExt++ = *pch; } @@ -66,12 +66,12 @@ static UINT_PTR APIENTRY OFNHookProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { HWND hParent; - OFNOTIFY *pon; + OFNOTIFYW *pon; WCHAR Path[MAX_PATH]; switch (uMsg) { case WM_NOTIFY: - pon = (OFNOTIFY *)lParam; + pon = (OFNOTIFYW *)lParam; if (pon->hdr.code == CDN_TYPECHANGE) { hParent = GetParent(hwnd); @@ -195,21 +195,21 @@ BOOL OpenMailer(HWND hWnd, LPCWSTR pszPathName) return FALSE; // Failure } -BOOL CMainWindow::GetOpenFileName(IN OUT LPTSTR pszFile, INT cchMaxFile) +BOOL CMainWindow::GetOpenFileName(IN OUT LPWSTR pszFile, INT cchMaxFile) { - static OPENFILENAME ofn = { 0 }; - static CString strFilter; + static OPENFILENAMEW ofn = { 0 }; + static CStringW strFilter; if (ofn.lStructSize == 0) { // The "All Files" item text - CString strAllPictureFiles; + CStringW strAllPictureFiles; strAllPictureFiles.LoadString(g_hinstExe, IDS_ALLPICTUREFILES); // Get the import filter CSimpleArray<GUID> aguidFileTypesI; CImage::GetImporterFilterString(strFilter, aguidFileTypesI, strAllPictureFiles, - CImage::excludeDefaultLoad, _T('\0')); + CImage::excludeDefaultLoad, UNICODE_NULL); // Initializing the OPENFILENAME structure for GetOpenFileName ZeroMemory(&ofn, sizeof(ofn)); @@ -223,20 +223,20 @@ BOOL CMainWindow::GetOpenFileName(IN OUT LPTSTR pszFile, INT cchMaxFile) ofn.lpstrFile = pszFile; ofn.nMaxFile = cchMaxFile; - return ::GetOpenFileName(&ofn); + return ::GetOpenFileNameW(&ofn); } -BOOL CMainWindow::GetSaveFileName(IN OUT LPTSTR pszFile, INT cchMaxFile) +BOOL CMainWindow::GetSaveFileName(IN OUT LPWSTR pszFile, INT cchMaxFile) { - static OPENFILENAME sfn = { 0 }; - static CString strFilter; + static OPENFILENAMEW sfn = { 0 }; + static CStringW strFilter; if (sfn.lStructSize == 0) { // Get the export filter CSimpleArray<GUID> aguidFileTypesE; CImage::GetExporterFilterString(strFilter, aguidFileTypesE, NULL, - CImage::excludeDefaultSave, _T('\0')); + CImage::excludeDefaultSave, UNICODE_NULL); // Initializing the OPENFILENAME structure for GetSaveFileName ZeroMemory(&sfn, sizeof(sfn)); @@ -266,7 +266,7 @@ BOOL CMainWindow::GetSaveFileName(IN OUT LPTSTR pszFile, INT cchMaxFile) sfn.lpstrFile = pszFile; sfn.nMaxFile = cchMaxFile; - return ::GetSaveFileName(&sfn); + return ::GetSaveFileNameW(&sfn); } BOOL CMainWindow::ChooseColor(IN OUT COLORREF *prgbColor) @@ -298,9 +298,9 @@ BOOL CMainWindow::ChooseColor(IN OUT COLORREF *prgbColor) HWND CMainWindow::DoCreate() { - ::LoadString(g_hinstExe, IDS_DEFAULTFILENAME, g_szFileName, _countof(g_szFileName)); + ::LoadStringW(g_hinstExe, IDS_DEFAULTFILENAME, g_szFileName, _countof(g_szFileName)); - CString strTitle; + CStringW strTitle; strTitle.Format(IDS_WINDOWTITLE, PathFindFileName(g_szFileName)); RECT& rc = registrySettings.WindowPlacement.rcNormalPosition; @@ -309,7 +309,7 @@ HWND CMainWindow::DoCreate() // entry point INT WINAPI -_tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, INT nCmdShow) +wWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPWSTR lpCmdLine, INT nCmdShow) { g_hinstExe = hInstance; @@ -325,7 +325,7 @@ _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, INT nC // Create the main window if (!mainWindow.DoCreate()) { - MessageBox(NULL, TEXT("Failed to create main window."), NULL, MB_ICONERROR); + MessageBox(NULL, L"Failed to create main window.", NULL, MB_ICONERROR); return 1; } @@ -337,7 +337,7 @@ _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, INT nC mainWindow.ShowWindow(registrySettings.WindowPlacement.showCmd); // Load the access keys - HACCEL hAccel = ::LoadAccelerators(hInstance, MAKEINTRESOURCE(800)); + HACCEL hAccel = ::LoadAcceleratorsW(hInstance, MAKEINTRESOURCEW(800)); // The message loop MSG msg; @@ -346,7 +346,7 @@ _tWinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPTSTR lpCmdLine, INT nC if (fontsDialog.IsWindow() && fontsDialog.IsDialogMessage(&msg)) continue; - if (::TranslateAccelerator(mainWindow, hAccel, &msg)) + if (::TranslateAcceleratorW(mainWindow, hAccel, &msg)) continue; ::TranslateMessage(&msg); diff --git a/base/applications/mspaint/miniature.cpp b/base/applications/mspaint/miniature.cpp index dc9eacbca2f..907dcf5d759 100644 --- a/base/applications/mspaint/miniature.cpp +++ b/base/applications/mspaint/miniature.cpp @@ -36,8 +36,8 @@ HWND CMiniatureWindow::DoCreate(HWND hwndParent) (LONG)(registrySettings.ThumbYPos + registrySettings.ThumbHeight) }; - TCHAR strTitle[100]; - ::LoadString(g_hinstExe, IDS_MINIATURETITLE, strTitle, _countof(strTitle)); + WCHAR strTitle[100]; + ::LoadStringW(g_hinstExe, IDS_MINIATURETITLE, strTitle, _countof(strTitle)); DWORD style = WS_OVERLAPPED | WS_CAPTION | WS_SYSMENU | WS_THICKFRAME; return Create(hwndParent, rc, strTitle, style, WS_EX_PALETTEWINDOW); diff --git a/base/applications/mspaint/miniature.h b/base/applications/mspaint/miniature.h index 7c7d30d2c7f..6e9fdacc370 100644 --- a/base/applications/mspaint/miniature.h +++ b/base/applications/mspaint/miniature.h @@ -11,7 +11,7 @@ class CMiniatureWindow : public CWindowImpl<CMiniatureWindow> { public: - DECLARE_WND_CLASS_EX(_T("MiniatureWindow"), CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW, + DECLARE_WND_CLASS_EX(L"MiniatureWindow", CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW, COLOR_BTNFACE) BEGIN_MSG_MAP(CMiniatureWindow) diff --git a/base/applications/mspaint/mouse.cpp b/base/applications/mspaint/mouse.cpp index 01379f97dc7..d4b22296a16 100644 --- a/base/applications/mspaint/mouse.cpp +++ b/base/applications/mspaint/mouse.cpp @@ -703,7 +703,7 @@ struct TextTool : ToolBase void draw(HDC hdc) { - CString szText; + CStringW szText; textEditWindow.GetWindowText(szText); RECT rc; diff --git a/base/applications/mspaint/palette.h b/base/applications/mspaint/palette.h index d9268dcf2c6..856f2e2233b 100644 --- a/base/applications/mspaint/palette.h +++ b/base/applications/mspaint/palette.h @@ -14,7 +14,7 @@ class CPaletteWindow : public CWindowImpl<CPaletteWindow> { public: - DECLARE_WND_CLASS_EX(_T("Palette"), CS_DBLCLKS, COLOR_BTNFACE) + DECLARE_WND_CLASS_EX(L"Palette", CS_DBLCLKS, COLOR_BTNFACE) BEGIN_MSG_MAP(CPaletteWindow) MESSAGE_HANDLER(WM_ERASEBKGND, OnEraseBkgnd) diff --git a/base/applications/mspaint/registry.cpp b/base/applications/mspaint/registry.cpp index 07778117ae8..68c54f5201c 100644 --- a/base/applications/mspaint/registry.cpp +++ b/base/applications/mspaint/registry.cpp @@ -15,18 +15,18 @@ RegistrySettings registrySettings; /* FUNCTIONS ********************************************************/ -static void ReadDWORD(CRegKey &key, LPCTSTR lpName, DWORD &dwValue) +static void ReadDWORD(CRegKey &key, LPCWSTR lpName, DWORD &dwValue) { DWORD dwTemp; if (key.QueryDWORDValue(lpName, dwTemp) == ERROR_SUCCESS) dwValue = dwTemp; } -static void ReadString(CRegKey &key, LPCTSTR lpName, CString &strValue, LPCTSTR lpDefault = TEXT("")) +static void ReadString(CRegKey &key, LPCWSTR lpName, CStringW &strValue, LPCWSTR lpDefault = L"") { - CString strTemp; + CStringW strTemp; ULONG nChars = MAX_PATH; - LPTSTR psz = strTemp.GetBuffer(nChars); + LPWSTR psz = strTemp.GetBuffer(nChars); LONG error = key.QueryStringValue(lpName, psz, &nChars); strTemp.ReleaseBuffer(); @@ -36,15 +36,15 @@ static void ReadString(CRegKey &key, LPCTSTR lpName, CString &strValue, LPCTSTR strValue = lpDefault; } -void RegistrySettings::SetWallpaper(LPCTSTR szFileName, RegistrySettings::WallpaperStyle style) +void RegistrySettings::SetWallpaper(LPCWSTR szFileName, RegistrySettings::WallpaperStyle style) { CRegKey desktop; - if (desktop.Open(HKEY_CURRENT_USER, _T("Control Panel\\Desktop")) == ERROR_SUCCESS) + if (desktop.Open(HKEY_CURRENT_USER, L"Control Panel\\Desktop") == ERROR_SUCCESS) { - desktop.SetStringValue(_T("Wallpaper"), szFileName); + desktop.SetStringValue(L"Wallpaper", szFileName); - desktop.SetStringValue(_T("WallpaperStyle"), (style == RegistrySettings::STRETCHED) ? _T("2") : _T("0")); - desktop.SetStringValue(_T("TileWallpaper"), (style == RegistrySettings::TILED) ? _T("1") : _T("0")); + desktop.SetStringValue(L"WallpaperStyle", (style == RegistrySettings::STRETCHED) ? L"2" : L"0"); + desktop.SetStringValue(L"TileWallpaper", (style == RegistrySettings::TILED) ? L"1" : L"0"); } SystemParametersInfo(SPI_SETDESKWALLPAPER, 0, (PVOID) szFileName, SPIF_UPDATEINIFILE | SPIF_SENDCHANGE); @@ -77,8 +77,8 @@ void RegistrySettings::LoadPresets(INT nCmdShow) Bar1ID = BAR1ID_TOP; Bar2ID = BAR2ID_LEFT; - LOGFONT lf; - GetObject(GetStockObject(DEFAULT_GUI_FONT), sizeof(lf), &lf); + LOGFONTW lf; + ::GetObjectW(GetStockObject(DEFAULT_GUI_FONT), sizeof(lf), &lf); strFontName = lf.lfFaceName; ZeroMemory(&WindowPlacement, sizeof(WindowPlacement)); @@ -94,33 +94,33 @@ void RegistrySettings::Load(INT nCmdShow) LoadPresets(nCmdShow); CRegKey paint; - if (paint.Open(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Applets\\Paint"), KEY_READ) != ERROR_SUCCESS) + if (paint.Open(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Applets\\Paint", KEY_READ) != ERROR_SUCCESS) return; CRegKey view; - if (view.Open(paint, _T("View"), KEY_READ) == ERROR_SUCCESS) + if (view.Open(paint, L"View", KEY_READ) == ERROR_SUCCESS) { - ReadDWORD(view, _T("BMPHeight"), BMPHeight); - ReadDWORD(view, _T("BMPWidth"), BMPWidth); - ReadDWORD(view, _T("GridExtent"), GridExtent); - ReadDWORD(view, _T("NoStretching"), NoStretching); - ReadDWORD(view, _T("ShowThumbnail"), ShowThumbnail); - ReadDWORD(view, _T("SnapToGrid"), SnapToGrid); - ReadDWORD(view, _T("ThumbHeight"), ThumbHeight); - ReadDWORD(view, _T("ThumbWidth"), ThumbWidth); - ReadDWORD(view, _T("ThumbXPos"), ThumbXPos); - ReadDWORD(view, _T("ThumbYPos"), ThumbYPos); - ReadDWORD(view, _T("UnitSetting"), UnitSetting); - ReadDWORD(view, _T("ShowStatusBar"), ShowStatusBar); + ReadDWORD(view, L"BMPHeight", BMPHeight); + ReadDWORD(view, L"BMPWidth", BMPWidth); + ReadDWORD(view, L"GridExtent", GridExtent); + ReadDWORD(view, L"NoStretching", NoStretching); + ReadDWORD(view, L"ShowThumbnail", ShowThumbnail); + ReadDWORD(view, L"SnapToGrid", SnapToGrid); + ReadDWORD(view, L"ThumbHeight", ThumbHeight); + ReadDWORD(view, L"ThumbWidth", ThumbWidth); + ReadDWORD(view, L"ThumbXPos", ThumbXPos); + ReadDWORD(view, L"ThumbYPos", ThumbYPos); + ReadDWORD(view, L"UnitSetting", UnitSetting); + ReadDWORD(view, L"ShowStatusBar", ShowStatusBar); ULONG pnBytes = sizeof(WINDOWPLACEMENT); - view.QueryBinaryValue(_T("WindowPlacement"), &WindowPlacement, &pnBytes); + view.QueryBinaryValue(L"WindowPlacement", &WindowPlacement, &pnBytes); } CRegKey files; - if (files.Open(paint, _T("Recent File List"), KEY_READ) == ERROR_SUCCESS) + if (files.Open(paint, L"Recent File List", KEY_READ) == ERROR_SUCCESS) { - TCHAR szName[64]; + WCHAR szName[64]; for (INT i = 0; i < MAX_RECENT_FILES; ++i) { StringCchPrintfW(szName, _countof(szName), L"File%u", i + 1); @@ -129,41 +129,41 @@ void RegistrySettings::Load(INT nCmdShow) } CRegKey text; - if (text.Open(paint, _T("Text"), KEY_READ) == ERROR_SUCCESS) + if (text.Open(paint, L"Text", KEY_READ) == ERROR_SUCCESS) { - ReadDWORD(text, _T("Bold"), Bold); - ReadDWORD(text, _T("Italic"), Italic); - ReadDWORD(text, _T("Underline"), Underline); - ReadDWORD(text, _T("CharSet"), CharSet); - ReadDWORD(text, _T("PointSize"), PointSize); - ReadDWORD(text, _T("PositionX"), FontsPositionX); - ReadDWORD(text, _T("PositionY"), FontsPositionY); - ReadDWORD(text, _T("ShowTextTool"), ShowTextTool); - ReadString(text, _T("TypeFaceName"), strFontName, strFontName); + ReadDWORD(text, L"Bold", Bold); + ReadDWORD(text, L"Italic", Italic); + ReadDWORD(text, L"Underline", Underline); + ReadDWORD(text, L"CharSet", CharSet); + ReadDWORD(text, L"PointSize", PointSize); + ReadDWORD(text, L"PositionX", FontsPositionX); + ReadDWORD(text, L"PositionY", FontsPositionY); + ReadDWORD(text, L"ShowTextTool", ShowTextTool); + ReadString(text, L"TypeFaceName", strFontName, strFontName); } CRegKey bar1; - if (bar1.Open(paint, _T("General-Bar1"), KEY_READ) == ERROR_SUCCESS) + if (bar1.Open(paint, L"General-Bar1", KEY_READ) == ERROR_SUCCESS) { - ReadDWORD(bar1, _T("BarID"), Bar1ID); + ReadDWORD(bar1, L"BarID", Bar1ID); } CRegKey bar2; - if (bar2.Open(paint, _T("General-Bar2"), KEY_READ) == ERROR_SUCCESS) + if (bar2.Open(paint, L"General-Bar2", KEY_READ) == ERROR_SUCCESS) { - ReadDWORD(bar2, _T("BarID"), Bar2ID); + ReadDWORD(bar2, L"BarID", Bar2ID); } CRegKey bar3; - if (bar3.Open(paint, _T("General-Bar3"), KEY_READ) == ERROR_SUCCESS) + if (bar3.Open(paint, L"General-Bar3", KEY_READ) == ERROR_SUCCESS) { - ReadDWORD(bar3, _T("Visible"), ShowToolBox); + ReadDWORD(bar3, L"Visible", ShowToolBox); } CRegKey bar4; - if (bar4.Open(paint, _T("General-Bar4"), KEY_READ) == ERROR_SUCCESS) + if (bar4.Open(paint, L"General-Bar4", KEY_READ) == ERROR_SUCCESS) { - ReadDWORD(bar4, _T("Visible"), ShowPalette); + ReadDWORD(bar4, L"Visible", ShowPalette); } // Fix the bitmap size if too large @@ -179,30 +179,30 @@ void RegistrySettings::Store() BMPHeight = imageModel.GetHeight(); CRegKey paint; - if (paint.Create(HKEY_CURRENT_USER, _T("Software\\Microsoft\\Windows\\CurrentVersion\\Applets\\Paint")) != ERROR_SUCCESS) + if (paint.Create(HKEY_CURRENT_USER, L"Software\\Microsoft\\Windows\\CurrentVersion\\Applets\\Paint") != ERROR_SUCCESS) return; CRegKey view; - if (view.Create(paint, _T("View")) == ERROR_SUCCESS) + if (view.Create(paint, L"View") == ERROR_SUCCESS) { - view.SetDWORDValue(_T("BMPHeight"), BMPHeight); - view.SetDWORDValue(_T("BMPWidth"), BMPWidth); - view.SetDWORDValue(_T("GridExtent"), GridExtent); - view.SetDWORDValue(_T("NoStretching"), NoStretching); - view.SetDWORDValue(_T("ShowThumbnail"), ShowThumbnail); - view.SetDWORDValue(_T("SnapToGrid"), SnapToGrid); - view.SetDWORDValue(_T("ThumbHeight"), ThumbHeight); - view.SetDWORDValue(_T("ThumbWidth"), ThumbWidth); - view.SetDWORDValue(_T("ThumbXPos"), ThumbXPos); - view.SetDWORDValue(_T("ThumbYPos"), ThumbYPos); - view.SetDWORDValue(_T("UnitSetting"), UnitSetting); - view.SetDWORDValue(_T("ShowStatusBar"), ShowStatusBar); - - view.SetBinaryValue(_T("WindowPlacement"), &WindowPlacement, sizeof(WINDOWPLACEMENT)); + view.SetDWORDValue(L"BMPHeight", BMPHeight); + view.SetDWORDValue(L"BMPWidth", BMPWidth); + view.SetDWORDValue(L"GridExtent", GridExtent); + view.SetDWORDValue(L"NoStretching", NoStretching); + view.SetDWORDValue(L"ShowThumbnail", ShowThumbnail); + view.SetDWORDValue(L"SnapToGrid", SnapToGrid); + view.SetDWORDValue(L"ThumbHeight", ThumbHeight); + view.SetDWORDValue(L"ThumbWidth", ThumbWidth); + view.SetDWORDValue(L"ThumbXPos", ThumbXPos); + view.SetDWORDValue(L"ThumbYPos", ThumbYPos); + view.SetDWORDValue(L"UnitSetting", UnitSetting); + view.SetDWORDValue(L"ShowStatusBar", ShowStatusBar); + + view.SetBinaryValue(L"WindowPlacement", &WindowPlacement, sizeof(WINDOWPLACEMENT)); } CRegKey files; - if (files.Create(paint, _T("Recent File List")) == ERROR_SUCCESS) + if (files.Create(paint, L"Recent File List") == ERROR_SUCCESS) { WCHAR szName[64]; for (INT iFile = 0; iFile < MAX_RECENT_FILES; ++iFile) @@ -213,45 +213,45 @@ void RegistrySettings::Store() } CRegKey text; - if (text.Create(paint, _T("Text")) == ERROR_SUCCESS) + if (text.Create(paint, L"Text") == ERROR_SUCCESS) { - text.SetDWORDValue(_T("Bold"), Bold); - text.SetDWORDValue(_T("Italic"), Italic); - text.SetDWORDValue(_T("Underline"), Underline); - text.SetDWORDValue(_T("CharSet"), CharSet); - text.SetDWORDValue(_T("PointSize"), PointSize); - text.SetDWORDValue(_T("PositionX"), FontsPositionX); - text.SetDWORDValue(_T("PositionY"), FontsPositionY); - text.SetDWORDValue(_T("ShowTextTool"), ShowTextTool); - text.SetStringValue(_T("TypeFaceName"), strFontName); + text.SetDWORDValue(L"Bold", Bold); + text.SetDWORDValue(L"Italic", Italic); + text.SetDWORDValue(L"Underline", Underline); + text.SetDWORDValue(L"CharSet", CharSet); + text.SetDWORDValue(L"PointSize", PointSize); + text.SetDWORDValue(L"PositionX", FontsPositionX); + text.SetDWORDValue(L"PositionY", FontsPositionY); + text.SetDWORDValue(L"ShowTextTool", ShowTextTool); + text.SetStringValue(L"TypeFaceName", strFontName); } CRegKey bar1; - if (bar1.Create(paint, _T("General-Bar1")) == ERROR_SUCCESS) + if (bar1.Create(paint, L"General-Bar1") == ERROR_SUCCESS) { - bar1.SetDWORDValue(_T("BarID"), Bar1ID); + bar1.SetDWORDValue(L"BarID", Bar1ID); } CRegKey bar2; - if (bar2.Create(paint, _T("General-Bar2")) == ERROR_SUCCESS) + if (bar2.Create(paint, L"General-Bar2") == ERROR_SUCCESS) { - bar2.SetDWORDValue(_T("BarID"), Bar2ID); + bar2.SetDWORDValue(L"BarID", Bar2ID); } CRegKey bar3; - if (bar3.Create(paint, _T("General-Bar3")) == ERROR_SUCCESS) + if (bar3.Create(paint, L"General-Bar3") == ERROR_SUCCESS) { - bar3.SetDWORDValue(_T("Visible"), ShowToolBox); + bar3.SetDWORDValue(L"Visible", ShowToolBox); } CRegKey bar4; - if (bar4.Create(paint, _T("General-Bar4")) == ERROR_SUCCESS) + if (bar4.Create(paint, L"General-Bar4") == ERROR_SUCCESS) { - bar4.SetDWORDValue(_T("Visible"), ShowPalette); + bar4.SetDWORDValue(L"Visible", ShowPalette); } } -void RegistrySettings::SetMostRecentFile(LPCTSTR szPathName) +void RegistrySettings::SetMostRecentFile(LPCWSTR szPathName) { // Register the file to the user's 'Recent' folder if (szPathName && szPathName[0]) @@ -265,7 +265,7 @@ void RegistrySettings::SetMostRecentFile(LPCTSTR szPathName) if (iFound >= 0) { - CString tmp = strFiles[i]; + CStringW tmp = strFiles[i]; strFiles[i] = strFiles[i - 1]; strFiles[i - 1] = tmp; } diff --git a/base/applications/mspaint/registry.h b/base/applications/mspaint/registry.h index d843c7b2be6..41b3a564594 100644 --- a/base/applications/mspaint/registry.h +++ b/base/applications/mspaint/registry.h @@ -28,9 +28,9 @@ public: DWORD UnitSetting; WINDOWPLACEMENT WindowPlacement; - CString strFiles[MAX_RECENT_FILES]; + CStringW strFiles[MAX_RECENT_FILES]; - CString strFontName; + CStringW strFontName; DWORD PointSize; DWORD Bold; DWORD Italic; @@ -61,9 +61,9 @@ public: STRETCHED }; - static void SetWallpaper(LPCTSTR szFileName, WallpaperStyle style); + static void SetWallpaper(LPCWSTR szFileName, WallpaperStyle style); void Load(INT nCmdShow); void Store(); - void SetMostRecentFile(LPCTSTR szPathName); + void SetMostRecentFile(LPCWSTR szPathName); }; diff --git a/base/applications/mspaint/selectionmodel.cpp b/base/applications/mspaint/selectionmodel.cpp index c66361da6e4..a9744ba2d61 100644 --- a/base/applications/mspaint/selectionmodel.cpp +++ b/base/applications/mspaint/selectionmodel.cpp @@ -139,7 +139,7 @@ void SelectionModel::DrawSelection(HDC hDCImage, COLORREF crBg, BOOL bBgTranspar return; BITMAP bm; - if (!GetObject(m_hbmColor, sizeof(BITMAP), &bm)) + if (!GetObjectW(m_hbmColor, sizeof(BITMAP), &bm)) return; COLORREF keyColor = (bBgTransparent ? crBg : CLR_INVALID); @@ -516,7 +516,7 @@ void SelectionModel::InvertSelection() TakeOff(); BITMAP bm; - ::GetObject(m_hbmColor, sizeof(bm), &bm); + ::GetObjectW(m_hbmColor, sizeof(bm), &bm); HDC hdc = ::CreateCompatibleDC(NULL); HGDIOBJ hbmOld = ::SelectObject(hdc, m_hbmColor); diff --git a/base/applications/mspaint/sizebox.cpp b/base/applications/mspaint/sizebox.cpp index a389fefb980..37a24cccec0 100644 --- a/base/applications/mspaint/sizebox.cpp +++ b/base/applications/mspaint/sizebox.cpp @@ -21,7 +21,7 @@ BOOL setCursorOnSizeBox(HITTEST hit) { if (HIT_UPPER_LEFT <= hit && hit <= HIT_LOWER_RIGHT) { - ::SetCursor(::LoadCursor(NULL, s_cursor_shapes[hit - HIT_UPPER_LEFT])); + ::SetCursor(::LoadCursorW(NULL, s_cursor_shapes[hit - HIT_UPPER_LEFT])); return TRUE; } return FALSE; diff --git a/base/applications/mspaint/textedit.cpp b/base/applications/mspaint/textedit.cpp index c20ca6bf005..981b32687d1 100644 --- a/base/applications/mspaint/textedit.cpp +++ b/base/applications/mspaint/textedit.cpp @@ -44,9 +44,9 @@ void CTextEditWindow::DrawGrip(HDC hDC, RECT& rc) drawSizeBoxes(hDC, &rc, TRUE, NULL); } -void CTextEditWindow::FixEditPos(LPCTSTR pszOldText) +void CTextEditWindow::FixEditPos(LPCWSTR pszOldText) { - CString szText; + CStringW szText; GetWindowText(szText); RECT rcParent; @@ -62,10 +62,10 @@ void CTextEditWindow::FixEditPos(LPCTSTR pszOldText) SelectObject(hDC, m_hFontZoomed); TEXTMETRIC tm; GetTextMetrics(hDC, &tm); - szText += TEXT("x"); // This is a trick to enable the g_ptEnd newlines + szText += L"x"; // This is a trick to enable the g_ptEnd newlines const UINT uFormat = DT_LEFT | DT_TOP | DT_EDITCONTROL | DT_NOPREFIX | DT_NOCLIP | DT_EXPANDTABS | DT_WORDBREAK; - DrawText(hDC, szText, -1, &rcText, uFormat | DT_CALCRECT); + DrawTextW(hDC, szText, -1, &rcText, uFormat | DT_CALCRECT); if (tm.tmDescent > 0) rcText.bottom += tm.tmDescent; ReleaseDC(hDC); @@ -91,7 +91,7 @@ LRESULT CTextEditWindow::OnChar(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& b if (wParam == VK_TAB) return 0; // FIXME: Tabs - CString szText; + CStringW szText; GetWindowText(szText); LRESULT ret = DefWindowProc(nMsg, wParam, lParam); @@ -108,7 +108,7 @@ LRESULT CTextEditWindow::OnKeyDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL return 0; } - CString szText; + CStringW szText; GetWindowText(szText); LRESULT ret = DefWindowProc(nMsg, wParam, lParam); @@ -135,7 +135,7 @@ LRESULT CTextEditWindow::OnEraseBkGnd(UINT nMsg, WPARAM wParam, LPARAM lParam, B FillRect(hDC, &rc, hbr); DeleteObject(hbr); } - SetTextColor(hDC, paletteModel.GetFgColor()); + ::SetTextColor(hDC, paletteModel.GetFgColor()); return TRUE; } @@ -196,7 +196,7 @@ LRESULT CTextEditWindow::OnSetCursor(UINT nMsg, WPARAM wParam, LPARAM lParam, BO UINT nHitTest = LOWORD(lParam); if (nHitTest == HTCAPTION) { - ::SetCursor(::LoadCursor(NULL, IDC_SIZEALL)); // Enable drag move + ::SetCursor(::LoadCursorW(NULL, (LPCWSTR)IDC_SIZEALL)); // Enable drag move return FALSE; } return DefWindowProc(nMsg, wParam, lParam); @@ -336,7 +336,7 @@ void CTextEditWindow::UpdateFont() m_hFontZoomed = NULL; } - LOGFONT lf; + LOGFONTW lf; ZeroMemory(&lf, sizeof(lf)); lf.lfCharSet = DEFAULT_CHARSET; // registrySettings.CharSet; // Ignore lf.lfWeight = (registrySettings.Bold ? FW_BOLD : FW_NORMAL); @@ -493,7 +493,7 @@ LRESULT CTextEditWindow::OnSizing(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& LRESULT CTextEditWindow::OnMouseWheel(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { - return ::SendMessage(GetParent(), nMsg, wParam, lParam); + return ::SendMessageW(GetParent(), nMsg, wParam, lParam); } LRESULT CTextEditWindow::OnCut(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) diff --git a/base/applications/mspaint/textedit.h b/base/applications/mspaint/textedit.h index 884d83e8b23..081632e8a31 100644 --- a/base/applications/mspaint/textedit.h +++ b/base/applications/mspaint/textedit.h @@ -17,7 +17,7 @@ public: HWND Create(HWND hwndParent); void DoFillBack(HWND hwnd, HDC hDC); - void FixEditPos(LPCTSTR pszOldText); + void FixEditPos(LPCWSTR pszOldText); void InvalidateEditRect(); void UpdateFont(); BOOL GetEditRect(LPRECT prc) const; diff --git a/base/applications/mspaint/toolbox.cpp b/base/applications/mspaint/toolbox.cpp index 891093f3f77..85216d366af 100644 --- a/base/applications/mspaint/toolbox.cpp +++ b/base/applications/mspaint/toolbox.cpp @@ -20,12 +20,12 @@ CPaintToolBar::ToolBarWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam { // We have to detect clicking on toolbar even if no change of pressed button POINT pt = { GET_X_LPARAM(lParam), GET_Y_LPARAM(lParam) }; - INT index = (INT)::SendMessage(hwnd, TB_HITTEST, 0, (LPARAM)&pt); + INT index = (INT)::SendMessageW(hwnd, TB_HITTEST, 0, (LPARAM)&pt); if (index >= 0) { TBBUTTON button; - if (::SendMessage(hwnd, TB_GETBUTTON, index, (LPARAM)&button)) - ::PostMessage(::GetParent(hwnd), WM_COMMAND, button.idCommand, 0); + if (::SendMessageW(hwnd, TB_GETBUTTON, index, (LPARAM)&button)) + ::PostMessageW(::GetParent(hwnd), WM_COMMAND, button.idCommand, 0); } } return ::CallWindowProc(oldWndProc, hwnd, uMsg, wParam, lParam); @@ -42,26 +42,26 @@ BOOL CPaintToolBar::DoCreate(HWND hwndParent) }; DWORD style = WS_CHILD | WS_VISIBLE | CCS_NOPARENTALIGN | CCS_VERT | CCS_NORESIZE | TBSTYLE_TOOLTIPS | TBSTYLE_FLAT; - if (!CWindow::Create(TOOLBARCLASSNAME, hwndParent, toolbarPos, NULL, style)) + if (!CWindow::Create(TOOLBARCLASSNAMEW, hwndParent, toolbarPos, NULL, style)) return FALSE; HIMAGELIST hImageList = ImageList_Create(16, 16, ILC_COLOR24 | ILC_MASK, 16, 0); SendMessage(TB_SETIMAGELIST, 0, (LPARAM)hImageList); - HBITMAP hbmIcons = (HBITMAP)::LoadImage(g_hinstExe, MAKEINTRESOURCE(IDB_TOOLBARICONS), - IMAGE_BITMAP, 256, 16, 0); + HBITMAP hbmIcons = (HBITMAP)::LoadImageW(g_hinstExe, MAKEINTRESOURCEW(IDB_TOOLBARICONS), + IMAGE_BITMAP, 256, 16, 0); ImageList_AddMasked(hImageList, hbmIcons, RGB(255, 0, 255)); ::DeleteObject(hbmIcons); SendMessage(TB_BUTTONSTRUCTSIZE, sizeof(TBBUTTON), 0); - TCHAR szToolTip[30]; + WCHAR szToolTip[30]; TBBUTTON tbbutton; ZeroMemory(&tbbutton, sizeof(tbbutton)); tbbutton.fsStyle = TBSTYLE_CHECKGROUP; for (INT i = 0; i < NUM_TOOLS; i++) { - ::LoadString(g_hinstExe, IDS_TOOLTIP1 + i, szToolTip, _countof(szToolTip)); + ::LoadStringW(g_hinstExe, IDS_TOOLTIP1 + i, szToolTip, _countof(szToolTip)); tbbutton.iString = (INT_PTR)szToolTip; tbbutton.fsState = TBSTATE_ENABLED | ((i % 2 == 1) ? TBSTATE_WRAP : 0); tbbutton.idCommand = ID_FREESEL + i; diff --git a/base/applications/mspaint/toolbox.h b/base/applications/mspaint/toolbox.h index 291032c1fcf..aa450fd2e64 100644 --- a/base/applications/mspaint/toolbox.h +++ b/base/applications/mspaint/toolbox.h @@ -24,7 +24,7 @@ public: class CToolBox : public CWindowImpl<CToolBox> { public: - DECLARE_WND_CLASS_EX(_T("ToolBox"), CS_DBLCLKS, COLOR_BTNFACE) + DECLARE_WND_CLASS_EX(L"ToolBox", CS_DBLCLKS, COLOR_BTNFACE) BEGIN_MSG_MAP(CToolBox) MESSAGE_HANDLER(WM_CREATE, OnCreate) diff --git a/base/applications/mspaint/toolsettings.cpp b/base/applications/mspaint/toolsettings.cpp index 745f2afe3e0..e8bd61f1b7e 100644 --- a/base/applications/mspaint/toolsettings.cpp +++ b/base/applications/mspaint/toolsettings.cpp @@ -284,10 +284,10 @@ VOID CToolSettingsWindow::drawBox(HDC hdc, LPCRECT prc) LRESULT CToolSettingsWindow::OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { /* preloading the draw transparent/nontransparent icons for later use */ - m_hNontranspIcon = (HICON)LoadImage(g_hinstExe, MAKEINTRESOURCE(IDI_NONTRANSPARENT), - IMAGE_ICON, CX_TRANS_ICON, CY_TRANS_ICON, LR_DEFAULTCOLOR); - m_hTranspIcon = (HICON)LoadImage(g_hinstExe, MAKEINTRESOURCE(IDI_TRANSPARENT), - IMAGE_ICON, CX_TRANS_ICON, CY_TRANS_ICON, LR_DEFAULTCOLOR); + m_hNontranspIcon = (HICON)LoadImageW(g_hinstExe, MAKEINTRESOURCEW(IDI_NONTRANSPARENT), + IMAGE_ICON, CX_TRANS_ICON, CY_TRANS_ICON, LR_DEFAULTCOLOR); + m_hTranspIcon = (HICON)LoadImageW(g_hinstExe, MAKEINTRESOURCEW(IDI_TRANSPARENT), + IMAGE_ICON, CX_TRANS_ICON, CY_TRANS_ICON, LR_DEFAULTCOLOR); RECT trackbarZoomPos, rect2; calculateTwoBoxes(trackbarZoomPos, rect2); @@ -313,13 +313,13 @@ LRESULT CToolSettingsWindow::OnVScroll(UINT nMsg, WPARAM wParam, LPARAM lParam, INT zoomRate = toolsModel.GetZoom(); - CString strZoom; + CStringW strZoom; if (zoomRate % 10 == 0) - strZoom.Format(_T("%d%%"), zoomRate / 10); + strZoom.Format(L"%d%%", zoomRate / 10); else - strZoom.Format(_T("%d.%d%%"), zoomRate / 10, zoomRate % 10); + strZoom.Format(L"%d.%d%%", zoomRate / 10, zoomRate % 10); - ::SendMessage(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)(LPCTSTR)strZoom); + ::SendMessageW(g_hStatusBar, SB_SETTEXT, 1, (LPARAM)(LPCWSTR)strZoom); OnToolsModelZoomChanged(nMsg, wParam, lParam, bHandled); return 0; diff --git a/base/applications/mspaint/toolsettings.h b/base/applications/mspaint/toolsettings.h index b6cc0482083..7155d87ae6b 100644 --- a/base/applications/mspaint/toolsettings.h +++ b/base/applications/mspaint/toolsettings.h @@ -10,7 +10,7 @@ class CToolSettingsWindow : public CWindowImpl<CToolSettingsWindow> { public: - DECLARE_WND_CLASS_EX(_T("ToolSettings"), CS_DBLCLKS, COLOR_BTNFACE) + DECLARE_WND_CLASS_EX(L"ToolSettings", CS_DBLCLKS, COLOR_BTNFACE) BEGIN_MSG_MAP(CToolSettingsWindow) MESSAGE_HANDLER(WM_CREATE, OnCreate) diff --git a/base/applications/mspaint/winproc.cpp b/base/applications/mspaint/winproc.cpp index 3beb34c290d..b7d825f1b01 100644 --- a/base/applications/mspaint/winproc.cpp +++ b/base/applications/mspaint/winproc.cpp @@ -144,11 +144,11 @@ void CMainWindow::InsertSelectionFromHBITMAP(HBITMAP bitmap, HWND window) if (g_askBeforeEnlarging) { - TCHAR programname[20]; - TCHAR shouldEnlargePromptText[100]; + WCHAR programname[20]; + WCHAR shouldEnlargePromptText[100]; - LoadString(g_hinstExe, IDS_PROGRAMNAME, programname, _countof(programname)); - LoadString(g_hinstExe, IDS_ENLARGEPROMPTTEXT, shouldEnlargePromptText, _countof(shouldEnlargePromptText)); + ::LoadStringW(g_hinstExe, IDS_PROGRAMNAME, programname, _countof(programname)); + ::LoadStringW(g_hinstExe, IDS_ENLARGEPROMPTTEXT, shouldEnlargePromptText, _countof(shouldEnlargePromptText)); switch (MessageBox(shouldEnlargePromptText, programname, MB_YESNOCANCEL | MB_ICONQUESTION)) { @@ -233,7 +233,7 @@ LRESULT CMainWindow::OnMouseWheel(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& LRESULT CMainWindow::OnDropFiles(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { - TCHAR droppedfile[MAX_PATH]; + WCHAR droppedfile[MAX_PATH]; HDROP hDrop = (HDROP)wParam; DragQueryFile(hDrop, 0, droppedfile, _countof(droppedfile)); @@ -247,14 +247,14 @@ LRESULT CMainWindow::OnDropFiles(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& LRESULT CMainWindow::OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHandled) { // Loading and setting the window menu from resource - m_hMenu = ::LoadMenu(g_hinstExe, MAKEINTRESOURCE(ID_MENU)); + m_hMenu = ::LoadMenuW(g_hinstExe, MAKEINTRESOURCEW(ID_MENU)); SetMenu(m_hMenu); // Create the status bar DWORD style = SBARS_SIZEGRIP | WS_CHILD | (registrySettings.ShowStatusBar ? WS_VISIBLE : 0); - g_hStatusBar = ::CreateWindowEx(0, STATUSCLASSNAME, NULL, style, 0, 0, 0, 0, m_hWnd, - NULL, g_hinstExe, NULL); - ::SendMessage(g_hStatusBar, SB_SETMINHEIGHT, 21, 0); + g_hStatusBar = ::CreateWindowExW(0, STATUSCLASSNAME, NULL, style, 0, 0, 0, 0, m_hWnd, + NULL, g_hinstExe, NULL); + ::SendMessageW(g_hStatusBar, SB_SETMINHEIGHT, 21, 0); // Create the tool box toolBoxContainer.DoCreate(m_hWnd); @@ -276,8 +276,8 @@ LRESULT CMainWindow::OnCreate(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHa } // Set icon - SendMessage(WM_SETICON, ICON_BIG, (LPARAM) LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDI_APPICON))); - SendMessage(WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDI_APPICON))); + SendMessage(WM_SETICON, ICON_BIG, (LPARAM)::LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDI_APPICON))); + SendMessage(WM_SETICON, ICON_SMALL, (LPARAM)::LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDI_APPICON))); return 0; } @@ -314,10 +314,10 @@ BOOL CMainWindow::ConfirmSave() if (imageModel.IsImageSaved()) return TRUE; - CString strProgramName; + CStringW strProgramName; strProgramName.LoadString(IDS_PROGRAMNAME); - CString strSavePromptText; + CStringW strSavePromptText; strSavePromptText.Format(IDS_SAVEPROMPTTEXT, PathFindFileName(g_szFileName)); switch (MessageBox(strSavePromptText, strProgramName, MB_YESNOCANCEL | MB_ICONQUESTION)) @@ -345,11 +345,11 @@ LRESULT CMainWindow::OnClose(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHan void CMainWindow::ProcessFileMenu(HMENU hPopupMenu) { - LPCTSTR dotext = PathFindExtensionW(g_szFileName); + LPCWSTR dotext = PathFindExtensionW(g_szFileName); BOOL isBMP = FALSE; - if (_tcsicmp(dotext, _T(".bmp")) == 0 || - _tcsicmp(dotext, _T(".dib")) == 0 || - _tcsicmp(dotext, _T(".rle")) == 0) + if (_wcsicmp(dotext, L".bmp") == 0 || + _wcsicmp(dotext, L".dib") == 0 || + _wcsicmp(dotext, L".rle") == 0) { isBMP = TRUE; } @@ -371,7 +371,7 @@ void CMainWindow::ProcessFileMenu(HMENU hPopupMenu) for (INT iItem = 0; iItem < MAX_RECENT_FILES; ++iItem) { - CString& strFile = registrySettings.strFiles[iItem]; + CStringW& strFile = registrySettings.strFiles[iItem]; if (strFile.IsEmpty()) break; @@ -379,7 +379,7 @@ void CMainWindow::ProcessFileMenu(HMENU hPopupMenu) #define MAX_RECENT_PATHNAME_DISPLAY 30 CPath pathFile(strFile); pathFile.CompactPathEx(MAX_RECENT_PATHNAME_DISPLAY); - assert(_tcslen((LPCTSTR)pathFile) <= MAX_RECENT_PATHNAME_DISPLAY); + assert(wcslen((LPCWSTR)pathFile) <= MAX_RECENT_PATHNAME_DISPLAY); // Add an accelerator (by '&') to the item number for quick access WCHAR szText[4 + MAX_RECENT_PATHNAME_DISPLAY + 1]; @@ -489,8 +489,8 @@ LRESULT CMainWindow::OnSize(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bHand int test[] = { LOWORD(lParam) - 260, LOWORD(lParam) - 140, LOWORD(lParam) - 20 }; if (::IsWindow(g_hStatusBar)) { - ::SendMessage(g_hStatusBar, WM_SIZE, 0, 0); - ::SendMessage(g_hStatusBar, SB_SETPARTS, 3, (LPARAM)&test); + ::SendMessageW(g_hStatusBar, WM_SIZE, 0, 0); + ::SendMessageW(g_hStatusBar, SB_SETPARTS, 3, (LPARAM)&test); } alignChildrenToMainWindow(); return 0; @@ -516,7 +516,7 @@ LRESULT CMainWindow::OnKeyDown(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH if (canvasWindow.m_hWnd == hwndCapture || fullscreenWindow.m_hWnd == hwndCapture) { - ::SendMessage(hwndCapture, nMsg, wParam, lParam); + ::SendMessageW(hwndCapture, nMsg, wParam, lParam); } } else if (selectionModel.m_bShow) @@ -551,7 +551,7 @@ LRESULT CMainWindow::OnSysColorChange(UINT nMsg, WPARAM wParam, LPARAM lParam, B { /* Redirect message to common controls */ HWND hToolbar = FindWindowEx(toolBoxContainer.m_hWnd, NULL, TOOLBARCLASSNAME, NULL); - SendMessage(hToolbar, WM_SYSCOLORCHANGE, 0, 0); + ::SendMessageW(hToolbar, WM_SYSCOLORCHANGE, 0, 0); return 0; } @@ -569,12 +569,11 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH { case IDM_HELPINFO: { - TCHAR infotitle[100]; - TCHAR infotext[200]; - LoadString(g_hinstExe, IDS_INFOTITLE, infotitle, _countof(infotitle)); - LoadString(g_hinstExe, IDS_INFOTEXT, infotext, _countof(infotext)); - ShellAbout(m_hWnd, infotitle, infotext, - LoadIcon(g_hinstExe, MAKEINTRESOURCE(IDI_APPICON))); + WCHAR infotitle[100], infotext[200]; + ::LoadStringW(g_hinstExe, IDS_INFOTITLE, infotitle, _countof(infotitle)); + ::LoadStringW(g_hinstExe, IDS_INFOTEXT, infotext, _countof(infotext)); + ::ShellAboutW(m_hWnd, infotitle, infotext, + LoadIconW(g_hinstExe, MAKEINTRESOURCEW(IDI_APPICON))); break; } case IDM_HELPHELPTOPICS: @@ -591,7 +590,7 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH break; case IDM_FILEOPEN: { - TCHAR szFileName[MAX_LONG_PATH] = _T(""); + WCHAR szFileName[MAX_LONG_PATH] = L""; if (ConfirmSave() && GetOpenFileName(szFileName, _countof(szFileName))) { DoLoadImageFile(m_hWnd, szFileName, TRUE); @@ -628,7 +627,7 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH pd.nMaxPage = 0xffff; if (PrintDlg(&pd) == TRUE) { - BitBlt(pd.hDC, 0, 0, imageModel.GetWidth(), imageModel.GetHeight(), imageModel.GetDC(), 0, 0, SRCCOPY); + ::BitBlt(pd.hDC, 0, 0, imageModel.GetWidth(), imageModel.GetHeight(), imageModel.GetDC(), 0, 0, SRCCOPY); DeleteDC(pd.hDC); } if (pd.hDevMode) @@ -795,7 +794,7 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH // Failed to paste { - CString strText, strTitle; + CStringW strText, strTitle; strText.LoadString(IDS_CANTPASTE); strTitle.LoadString(IDS_PROGRAMNAME); MessageBox(strText, strTitle, MB_ICONINFORMATION); @@ -833,7 +832,7 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH break; } HWND hToolbar = FindWindowEx(toolBoxContainer.m_hWnd, NULL, TOOLBARCLASSNAME, NULL); - SendMessage(hToolbar, TB_CHECKBUTTON, ID_RECTSEL, MAKELPARAM(TRUE, 0)); + ::SendMessageW(hToolbar, TB_CHECKBUTTON, ID_RECTSEL, MAKELPARAM(TRUE, 0)); toolsModel.selectAll(); canvasWindow.Invalidate(TRUE); break; @@ -841,7 +840,7 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH case IDM_EDITCOPYTO: { WCHAR szFileName[MAX_LONG_PATH]; - LoadStringW(g_hinstExe, IDS_DEFAULTFILENAME, szFileName, _countof(szFileName)); + ::LoadStringW(g_hinstExe, IDS_DEFAULTFILENAME, szFileName, _countof(szFileName)); if (GetSaveFileName(szFileName, _countof(szFileName))) { HBITMAP hbmSelection = selectionModel.GetSelectionContents(); @@ -948,8 +947,8 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH CWaitCursor waitCursor; if (attributesDialog.m_bBlackAndWhite && !imageModel.IsBlackAndWhite()) { - CString strText(MAKEINTRESOURCE(IDS_LOSECOLOR)); - CString strTitle(MAKEINTRESOURCE(IDS_PROGRAMNAME)); + CStringW strText(MAKEINTRESOURCEW(IDS_LOSECOLOR)); + CStringW strTitle(MAKEINTRESOURCEW(IDS_PROGRAMNAME)); INT id = MessageBox(strText, strTitle, MB_ICONINFORMATION | MB_YESNOCANCEL); if (id != IDYES) break; diff --git a/base/applications/mspaint/winproc.h b/base/applications/mspaint/winproc.h index fc2861b228c..8f3595bcacb 100644 --- a/base/applications/mspaint/winproc.h +++ b/base/applications/mspaint/winproc.h @@ -11,7 +11,7 @@ class CMainWindow : public CWindowImpl<CMainWindow> { public: - DECLARE_WND_CLASS_EX(_T("MSPaintApp"), CS_DBLCLKS, COLOR_BTNFACE) + DECLARE_WND_CLASS_EX(L"MSPaintApp", CS_DBLCLKS, COLOR_BTNFACE) BEGIN_MSG_MAP(CMainWindow) MESSAGE_HANDLER(WM_DROPFILES, OnDropFiles) @@ -30,8 +30,8 @@ public: CMainWindow() : m_hMenu(NULL) { } HWND DoCreate(); - BOOL GetOpenFileName(IN OUT LPTSTR pszFile, INT cchMaxFile); - BOOL GetSaveFileName(IN OUT LPTSTR pszFile, INT cchMaxFile); + BOOL GetOpenFileName(IN OUT LPWSTR pszFile, INT cchMaxFile); + BOOL GetSaveFileName(IN OUT LPWSTR pszFile, INT cchMaxFile); BOOL ChooseColor(IN OUT COLORREF *prgbColor); VOID TrackPopupMenu(POINT ptScreen, INT iSubMenu); BOOL CanUndo() const;
1 year, 1 month
1
0
0
0
[reactos] 01/01: [IMM32] Sort imm32.spec
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d7e1bd27054fe93074759…
commit d7e1bd27054fe93074759594020cd1b41394b226 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sat Nov 4 05:59:53 2023 +0900 Commit: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> CommitDate: Sat Nov 4 05:59:53 2023 +0900 [IMM32] Sort imm32.spec CORE-19268 --- dll/win32/imm32/imm32.spec | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/dll/win32/imm32/imm32.spec b/dll/win32/imm32/imm32.spec index eee84f6487e..8173e1e975c 100644 --- a/dll/win32/imm32/imm32.spec +++ b/dll/win32/imm32/imm32.spec @@ -1,16 +1,16 @@ @ stdcall CtfAImmActivate(ptr) @ stdcall CtfAImmDeactivate(long) @ stdcall CtfAImmIsIME(ptr) +@ stdcall CtfImmDispatchDefImeMessage(ptr long ptr ptr) +@ stdcall CtfImmGetGuidAtom(ptr long ptr) +@ stdcall CtfImmHideToolbarWnd() @ stdcall CtfImmIsCiceroEnabled() @ stdcall CtfImmIsCiceroStartedInThread() +@ stdcall CtfImmIsGuidMapEnable(ptr) @ stdcall CtfImmIsTextFrameServiceDisabled() -@ stdcall CtfImmTIMActivate(ptr) @ stdcall CtfImmRestoreToolbarWnd(ptr long) -@ stdcall CtfImmHideToolbarWnd() -@ stdcall CtfImmDispatchDefImeMessage(ptr long ptr ptr) -@ stdcall CtfImmIsGuidMapEnable(ptr) -@ stdcall CtfImmGetGuidAtom(ptr long ptr) @ stdcall CtfImmSetAppCompatFlags(long) +@ stdcall CtfImmTIMActivate(ptr) @ stdcall ImmActivateLayout(ptr) @ stdcall ImmAssociateContext(ptr ptr) @ stdcall ImmAssociateContextEx(ptr ptr long)
1 year, 1 month
1
0
0
0
[reactos] 01/01: [IMM32][SDK] Implement software keyboard, Part 1 (#5865)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=4aa1bcb72b247b41a18b9…
commit 4aa1bcb72b247b41a18b971cecdcb6cc3e785d1c Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sat Nov 4 05:58:17 2023 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Sat Nov 4 05:58:17 2023 +0900 [IMM32][SDK] Implement software keyboard, Part 1 (#5865) - Add dll/win32/imm32/softkbd.c source file. - Half-implement ImmCreateSoftKeyboard function. - Move ImmShowSoftKeyboard, and ImmDestroySoftKeyboard functions. - Modify ImmCreateSoftKeyboard prototype. CORE-19268 --- dll/win32/imm32/CMakeLists.txt | 1 + dll/win32/imm32/imm.c | 30 ----- dll/win32/imm32/imm32.spec | 2 +- dll/win32/imm32/softkbd.c | 298 +++++++++++++++++++++++++++++++++++++++++ sdk/include/psdk/imm.h | 19 ++- 5 files changed, 316 insertions(+), 34 deletions(-) diff --git a/dll/win32/imm32/CMakeLists.txt b/dll/win32/imm32/CMakeLists.txt index ba1f56641c4..d5b2ea12af4 100644 --- a/dll/win32/imm32/CMakeLists.txt +++ b/dll/win32/imm32/CMakeLists.txt @@ -16,6 +16,7 @@ list(APPEND SOURCE imm.c keymsg.c regword.c + softkbd.c utils.c win3.c ${CMAKE_CURRENT_BINARY_DIR}/imm32_stubs.c diff --git a/dll/win32/imm32/imm.c b/dll/win32/imm32/imm.c index 40f686e44f0..39d4cd3b1ef 100644 --- a/dll/win32/imm32/imm.c +++ b/dll/win32/imm32/imm.c @@ -1103,36 +1103,6 @@ BOOL WINAPI ImmReleaseContext(HWND hWnd, HIMC hIMC) return TRUE; // Do nothing. This is correct. } -/*********************************************************************** - * ImmCreateSoftKeyboard(IMM32.@) - */ -HWND WINAPI ImmCreateSoftKeyboard(UINT uType, UINT hOwner, int x, int y) -{ - FIXME("(%d, %d, %d, %d): stub\n", uType, hOwner, x, y); - SetLastError(ERROR_CALL_NOT_IMPLEMENTED); - return 0; -} - -/*********************************************************************** - * ImmDestroySoftKeyboard(IMM32.@) - */ -BOOL WINAPI ImmDestroySoftKeyboard(HWND hSoftWnd) -{ - TRACE("(%p)\n", hSoftWnd); - return DestroyWindow(hSoftWnd); -} - -/*********************************************************************** - * ImmShowSoftKeyboard(IMM32.@) - */ -BOOL WINAPI ImmShowSoftKeyboard(HWND hSoftWnd, int nCmdShow) -{ - TRACE("(%p, %d)\n", hSoftWnd, nCmdShow); - if (hSoftWnd) - return ShowWindow(hSoftWnd, nCmdShow); - return FALSE; -} - /*********************************************************************** * ImmDisableTextFrameService(IMM32.@) */ diff --git a/dll/win32/imm32/imm32.spec b/dll/win32/imm32/imm32.spec index 3a706be14b4..eee84f6487e 100644 --- a/dll/win32/imm32/imm32.spec +++ b/dll/win32/imm32/imm32.spec @@ -19,7 +19,7 @@ @ stdcall ImmConfigureIMEW(ptr ptr long ptr) @ stdcall ImmCreateContext() @ stdcall ImmCreateIMCC(long) -@ stdcall ImmCreateSoftKeyboard(long long long long) +@ stdcall ImmCreateSoftKeyboard(long ptr long long) @ stdcall ImmDestroyContext(ptr) @ stdcall ImmDestroyIMCC(ptr) @ stdcall ImmDestroySoftKeyboard(ptr) diff --git a/dll/win32/imm32/softkbd.c b/dll/win32/imm32/softkbd.c new file mode 100644 index 00000000000..551331ffe40 --- /dev/null +++ b/dll/win32/imm32/softkbd.c @@ -0,0 +1,298 @@ +/* + * PROJECT: ReactOS IMM32 + * LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later
) + * PURPOSE: Implementing IMM Software Keyboard + * COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> + */ + +#include "precomp.h" + +WINE_DEFAULT_DEBUG_CHANNEL(imm); + +static UINT s_uScanCode[256]; +static RECT s_rcWorkArea; +static POINT s_ptRaiseEdge; +static LOGFONTW s_lfSKT1Font; +static BOOL s_bWannaInitSoftKBD = TRUE; + +static VOID +Imm32GetAllMonitorSize(_Out_ LPRECT prcWork) +{ + if (GetSystemMetrics(SM_CMONITORS) == 1) + { + SystemParametersInfoW(SPI_GETWORKAREA, 0, prcWork, 0); + return; + } + + prcWork->left = GetSystemMetrics(SM_XVIRTUALSCREEN); + prcWork->top = GetSystemMetrics(SM_YVIRTUALSCREEN); + prcWork->right = prcWork->left + GetSystemMetrics(SM_CXVIRTUALSCREEN); + prcWork->bottom = prcWork->top + GetSystemMetrics(SM_CYVIRTUALSCREEN); +} + +static BOOL +Imm32GetNearestMonitorSize( + _In_ HWND hwnd, + _Out_ LPRECT prcWork) +{ + HMONITOR hMonitor; + MONITORINFO mi; + + if (GetSystemMetrics(SM_CMONITORS) == 1) + { + Imm32GetAllMonitorSize(prcWork); + return TRUE; + } + + hMonitor = MonitorFromWindow(hwnd, MONITOR_DEFAULTTONEAREST); + if (!hMonitor) + return FALSE; + + ZeroMemory(&mi, sizeof(mi)); + mi.cbSize = sizeof(mi); + GetMonitorInfoW(hMonitor, &mi); + + *prcWork = mi.rcWork; + return TRUE; +} + +/* Software keyboard window procedure (Traditional Chinese) */ +static LRESULT CALLBACK +SKWndProcT1(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + switch (uMsg) + { + case WM_CREATE: + { + FIXME("stub\n"); + return -1; + } + + default: + { + return DefWindowProcW(hwnd, uMsg, wParam, lParam); + } + } + return 0; +} + +/* Software keyboard window procedure (Simplified Chinese) */ +static LRESULT CALLBACK +SKWndProcC1(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + switch (uMsg) + { + case WM_CREATE: + { + FIXME("stub\n"); + return -1; + } + + default: + { + return DefWindowProcW(hwnd, uMsg, wParam, lParam); + } + } + return 0; +} + +static BOOL +Imm32RegisterSoftKeyboard(_In_ UINT uType) +{ + LPCWSTR pszClass; + WNDCLASSEXW wcx; + + if (uType == 1) + pszClass = L"SoftKBDClsT1"; + else if (uType == 2) + pszClass = L"SoftKBDClsC1"; + else + return FALSE; + + if (GetClassInfoExW(ghImm32Inst, pszClass, &wcx)) + return TRUE; + + ZeroMemory(&wcx, sizeof(wcx)); + wcx.cbSize = sizeof(wcx); + wcx.style = CS_IME; + wcx.cbWndExtra = sizeof(LONG_PTR); + wcx.hIcon = LoadIconW(NULL, (LPCWSTR)IDI_APPLICATION); + wcx.hInstance = ghImm32Inst; + wcx.hCursor = LoadCursorW(NULL, (LPCWSTR)IDC_SIZEALL); + wcx.lpszClassName = pszClass; + + if (uType == 1) + { + wcx.lpfnWndProc = SKWndProcT1; + wcx.hbrBackground = (HBRUSH)GetStockObject(NULL_BRUSH); + } + else + { + wcx.lpfnWndProc = SKWndProcC1; + wcx.hbrBackground = (HBRUSH)GetStockObject(LTGRAY_BRUSH); + } + + return !!RegisterClassExW(&wcx); +} + +static VOID +Imm32GetSKT1TextMetric(_Out_ LPTEXTMETRICW lptm) +{ + HDC hDC; + HFONT hFont; + SIZE size; + HGDIOBJ hFontOld; + WCHAR szText[2] = { 0x894E, 0 }; + + hDC = GetDC(NULL); + + ZeroMemory(&s_lfSKT1Font, sizeof(s_lfSKT1Font)); + s_lfSKT1Font.lfHeight = -12; + s_lfSKT1Font.lfWeight = FW_NORMAL; + s_lfSKT1Font.lfCharSet = CHINESEBIG5_CHARSET; + s_lfSKT1Font.lfOutPrecision = OUT_TT_ONLY_PRECIS; + s_lfSKT1Font.lfClipPrecision = CLIP_DEFAULT_PRECIS; + s_lfSKT1Font.lfQuality = PROOF_QUALITY; + s_lfSKT1Font.lfPitchAndFamily = 49; + hFont = CreateFontIndirectW(&s_lfSKT1Font); + + hFontOld = SelectObject(hDC, hFont); + + GetTextMetricsW(hDC, lptm); + + if (GetTextExtentPoint32W(hDC, szText, 1, &size) && lptm->tmMaxCharWidth < size.cx ) + lptm->tmMaxCharWidth = size.cx; + + DeleteObject(SelectObject(hDC, hFontOld)); + ReleaseDC(NULL, hDC); +} + +static VOID +Imm32GetSoftKeyboardDimension( + _In_ UINT uType, + _Out_ LPINT pcx, + _Out_ LPINT pcy) +{ + INT cxEdge, cyEdge; + TEXTMETRICW tm; + + if (uType == 1) + { + Imm32GetSKT1TextMetric(&tm); + *pcx = 15 * tm.tmMaxCharWidth + 2 * s_ptRaiseEdge.x + 139; + *pcy = 5 * tm.tmHeight + 2 * s_ptRaiseEdge.y + 58; + } + else + { + cxEdge = GetSystemMetrics(SM_CXEDGE); + cyEdge = GetSystemMetrics(SM_CYEDGE); + *pcx = 2 * (GetSystemMetrics(SM_CXBORDER) + cxEdge) + 348; + *pcy = 2 * (GetSystemMetrics(SM_CYBORDER) + cyEdge) + 136; + } +} + +/*********************************************************************** + * ImmCreateSoftKeyboard (IMM32.@) + * + * @see
https://katahiromz.web.fc2.com/colony3rd/imehackerz/en/ImmCreateSoftKeyboar…
+ */ +HWND WINAPI +ImmCreateSoftKeyboard( + _In_ UINT uType, + _In_ HWND hwndParent, + _In_ INT x, + _In_ INT y) +{ + HKL hKL; + PIMEDPI pImeDpi; + DWORD dwUICaps, style = (WS_POPUP | WS_DISABLED); + UINT i; + INT xSoftKBD, ySoftKBD, cxSoftKBD, cySoftKBD; + HWND hwndSoftKBD; + + TRACE("(%u, %p, %d, %d)\n", uType, hwndParent, x, y); + + if (uType != 1 && uType != 2) + return 0; + + hKL = GetKeyboardLayout(0); + pImeDpi = ImmLockImeDpi(hKL); + if (!pImeDpi) + return NULL; + + dwUICaps = pImeDpi->ImeInfo.fdwUICaps; + ImmUnlockImeDpi(pImeDpi); + + if (!(dwUICaps & UI_CAP_SOFTKBD)) + return NULL; + + if (s_bWannaInitSoftKBD) + { + if (!Imm32GetNearestMonitorSize(hwndParent, &s_rcWorkArea)) + return NULL; + + for (i = 0; i < 0xFF; ++i) + s_uScanCode[i] = MapVirtualKeyW(i, 0); + + s_ptRaiseEdge.x = GetSystemMetrics(SM_CXBORDER) + GetSystemMetrics(SM_CXEDGE); + s_ptRaiseEdge.y = GetSystemMetrics(SM_CYBORDER) + GetSystemMetrics(SM_CYEDGE); + + s_bWannaInitSoftKBD = FALSE; + } + + if (!Imm32RegisterSoftKeyboard(uType)) + return NULL; + + Imm32GetSoftKeyboardDimension(uType, &cxSoftKBD, &cySoftKBD); + + xSoftKBD = max(s_rcWorkArea.left, min(x, s_rcWorkArea.right - cxSoftKBD)); + ySoftKBD = max(s_rcWorkArea.top, min(y, s_rcWorkArea.bottom - cySoftKBD)); + + if (uType == 1) /* Traditional Chinese */ + { + hwndSoftKBD = CreateWindowExW(0, + L"SoftKBDClsT1", NULL, style, + xSoftKBD, ySoftKBD, cxSoftKBD, cySoftKBD, + hwndParent, NULL, ghImm32Inst, NULL); + } + else /* Simplified Chinese (uType == 2) */ + { + style |= WS_BORDER; + hwndSoftKBD = CreateWindowExW(WS_EX_WINDOWEDGE | WS_EX_DLGMODALFRAME, + L"SoftKBDClsC1", NULL, style, + xSoftKBD, ySoftKBD, cxSoftKBD, cySoftKBD, + hwndParent, NULL, ghImm32Inst, NULL); + } + + ShowWindow(hwndSoftKBD, SW_HIDE); + UpdateWindow(hwndSoftKBD); + + return hwndSoftKBD; +} + +/*********************************************************************** + * ImmShowSoftKeyboard (IMM32.@) + * + * @see
https://katahiromz.web.fc2.com/colony3rd/imehackerz/en/ImmShowSoftKeyboard.…
+ */ +BOOL WINAPI +ImmShowSoftKeyboard( + _In_ HWND hwndSoftKBD, + _In_ INT nCmdShow) +{ + TRACE("(%p, %d)\n", hwndSoftKBD, nCmdShow); + return hwndSoftKBD && ShowWindow(hwndSoftKBD, nCmdShow); +} + +/*********************************************************************** + * ImmDestroySoftKeyboard (IMM32.@) + * + * @see
https://katahiromz.web.fc2.com/colony3rd/imehackerz/en/ImmDestroySoftKeyboa…
+ */ +BOOL WINAPI +ImmDestroySoftKeyboard( + _In_ HWND hwndSoftKBD) +{ + TRACE("(%p)\n", hwndSoftKBD); + return DestroyWindow(hwndSoftKBD); +} diff --git a/sdk/include/psdk/imm.h b/sdk/include/psdk/imm.h index 95ac099d2e3..9ec9e3cfb18 100644 --- a/sdk/include/psdk/imm.h +++ b/sdk/include/psdk/imm.h @@ -253,9 +253,22 @@ LRESULT WINAPI ImmRequestMessageA(HIMC, WPARAM, LPARAM); LRESULT WINAPI ImmRequestMessageW(HIMC, WPARAM, LPARAM); #define ImmRequestMessage WINELIB_NAME_AW(ImmRequestMessage); BOOL WINAPI ImmTranslateMessage(HWND, UINT, WPARAM, LPARAM); -HWND WINAPI ImmCreateSoftKeyboard(UINT, UINT, int, int); -BOOL WINAPI ImmDestroySoftKeyboard(HWND); -BOOL WINAPI ImmShowSoftKeyboard(HWND, int); + +HWND WINAPI +ImmCreateSoftKeyboard( + _In_ UINT uType, + _In_ HWND hwndParent, + _In_ INT x, + _In_ INT y); + +BOOL WINAPI +ImmShowSoftKeyboard( + _In_ HWND hwndSoftKBD, + _In_ INT nCmdShow); + +BOOL WINAPI +ImmDestroySoftKeyboard( + _In_ HWND hwndSoftKBD); BOOL WINAPI ImeInquire(LPIMEINFO, LPWSTR, LPCWSTR lpszOptions); BOOL WINAPI ImeConfigure (HKL, HWND, DWORD, LPVOID);
1 year, 1 month
1
0
0
0
[reactos] 01/01: [MSPAINT] Fix Copy-To-File feature (#5877)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d7ece626cbda18c8d76b9…
commit d7ece626cbda18c8d76b93a3d0f5dfa049646a35 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sat Nov 4 05:56:10 2023 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Sat Nov 4 05:56:10 2023 +0900 [MSPAINT] Fix Copy-To-File feature (#5877) The Copy-To-File feature had some bugs that the user couldn't save. - Modify SelectionModel::GetSelectionContents. - Delete SelectionModel::CopyBitmap, SelectionModel::LockBitmap, and SelectionModel::UnlockBitmap functions. CORE-19186 --- base/applications/mspaint/dialogs.cpp | 6 ++--- base/applications/mspaint/main.cpp | 15 ++++++----- base/applications/mspaint/precomp.h | 1 + base/applications/mspaint/registry.cpp | 6 ++--- base/applications/mspaint/selectionmodel.cpp | 35 +++++++----------------- base/applications/mspaint/selectionmodel.h | 5 +--- base/applications/mspaint/textedit.cpp | 2 +- base/applications/mspaint/winproc.cpp | 40 +++++++++++++++++----------- 8 files changed, 51 insertions(+), 59 deletions(-) diff --git a/base/applications/mspaint/dialogs.cpp b/base/applications/mspaint/dialogs.cpp index faaf5d3fbfa..c56eaaf5f49 100644 --- a/base/applications/mspaint/dialogs.cpp +++ b/base/applications/mspaint/dialogs.cpp @@ -361,10 +361,10 @@ void CFontsDialog::InitFontSizes() HWND hwndSizes = GetDlgItem(IDD_FONTSSIZES); ComboBox_ResetContent(hwndSizes); - TCHAR szText[16]; + WCHAR szText[16]; for (UINT i = 0; i < _countof(s_sizes); ++i) { - wsprintf(szText, TEXT("%d"), s_sizes[i]); + StringCchPrintfW(szText, _countof(szText), L"%d", s_sizes[i]); INT iItem = ComboBox_AddString(hwndSizes, szText); if (s_sizes[i] == (INT)registrySettings.PointSize) ComboBox_SetCurSel(hwndSizes, iItem); @@ -372,7 +372,7 @@ void CFontsDialog::InitFontSizes() if (ComboBox_GetCurSel(hwndSizes) == CB_ERR) { - wsprintf(szText, TEXT("%d"), (INT)registrySettings.PointSize); + StringCchPrintfW(szText, _countof(szText), L"%d", (INT)registrySettings.PointSize); ::SetWindowText(hwndSizes, szText); } } diff --git a/base/applications/mspaint/main.cpp b/base/applications/mspaint/main.cpp index 63db53f02de..0f133cbe485 100644 --- a/base/applications/mspaint/main.cpp +++ b/base/applications/mspaint/main.cpp @@ -7,6 +7,7 @@ #include "precomp.h" +#include <dlgs.h> #include <mapi.h> POINT g_ptStart, g_ptEnd; @@ -55,7 +56,7 @@ FileExtFromFilter(LPTSTR pExt, OPENFILENAME *pOFN) CharLower(pExt); return TRUE; } - pch += lstrlen(pch) + 1; + pch += wcslen(pch) + 1; } return FALSE; } @@ -66,6 +67,7 @@ OFNHookProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { HWND hParent; OFNOTIFY *pon; + WCHAR Path[MAX_PATH]; switch (uMsg) { case WM_NOTIFY: @@ -73,11 +75,10 @@ OFNHookProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) if (pon->hdr.code == CDN_TYPECHANGE) { hParent = GetParent(hwnd); - TCHAR Path[MAX_PATH]; - SendMessage(hParent, CDM_GETFILEPATH, _countof(Path), (LPARAM)Path); - FileExtFromFilter(PathFindExtension(Path), pon->lpOFN); - SendMessage(hParent, CDM_SETCONTROLTEXT, 0x047c, (LPARAM)PathFindFileName(Path)); - lstrcpyn(pon->lpOFN->lpstrFile, Path, pon->lpOFN->nMaxFile); + SendMessageW(hParent, CDM_GETFILEPATH, _countof(Path), (LPARAM)Path); + FileExtFromFilter(PathFindExtensionW(Path), pon->lpOFN); + SendMessageW(hParent, CDM_SETCONTROLTEXT, cmb13, (LPARAM)PathFindFileNameW(Path)); + StringCchCopyW(pon->lpOFN->lpstrFile, pon->lpOFN->nMaxFile, Path); } break; } @@ -251,7 +252,7 @@ BOOL CMainWindow::GetSaveFileName(IN OUT LPTSTR pszFile, INT cchMaxFile) if (*pchDotExt == UNICODE_NULL) { // Choose PNG - wcscat(pszFile, L".png"); + StringCchCatW(pszFile, cchMaxFile, L".png"); for (INT i = 0; i < aguidFileTypesE.GetSize(); ++i) { if (aguidFileTypesE[i] == Gdiplus::ImageFormatPNG) diff --git a/base/applications/mspaint/precomp.h b/base/applications/mspaint/precomp.h index a24f1a3b654..6f22eb69e8d 100644 --- a/base/applications/mspaint/precomp.h +++ b/base/applications/mspaint/precomp.h @@ -25,6 +25,7 @@ #include <math.h> #include <shellapi.h> #include <htmlhelp.h> +#include <strsafe.h> #include "atlimagedx.h" #include <debug.h> diff --git a/base/applications/mspaint/registry.cpp b/base/applications/mspaint/registry.cpp index bdaf7a7cd17..07778117ae8 100644 --- a/base/applications/mspaint/registry.cpp +++ b/base/applications/mspaint/registry.cpp @@ -123,7 +123,7 @@ void RegistrySettings::Load(INT nCmdShow) TCHAR szName[64]; for (INT i = 0; i < MAX_RECENT_FILES; ++i) { - wsprintf(szName, _T("File%u"), i + 1); + StringCchPrintfW(szName, _countof(szName), L"File%u", i + 1); ReadString(files, szName, strFiles[i]); } } @@ -204,10 +204,10 @@ void RegistrySettings::Store() CRegKey files; if (files.Create(paint, _T("Recent File List")) == ERROR_SUCCESS) { - TCHAR szName[64]; + WCHAR szName[64]; for (INT iFile = 0; iFile < MAX_RECENT_FILES; ++iFile) { - wsprintf(szName, _T("File%u"), iFile + 1); + StringCchPrintfW(szName, _countof(szName), L"File%u", iFile + 1); files.SetStringValue(szName, strFiles[iFile]); } } diff --git a/base/applications/mspaint/selectionmodel.cpp b/base/applications/mspaint/selectionmodel.cpp index e7263fa4e1f..c66361da6e4 100644 --- a/base/applications/mspaint/selectionmodel.cpp +++ b/base/applications/mspaint/selectionmodel.cpp @@ -152,16 +152,19 @@ void SelectionModel::DrawSelection(HDC hDCImage, COLORREF crBg, BOOL bBgTranspar DeleteDC(hMemDC); } -void SelectionModel::GetSelectionContents(HDC hDCImage) +HBITMAP SelectionModel::GetSelectionContents() { - ClearColorImage(); + if (m_hbmColor) + return CopyDIBImage(m_hbmColor, m_rc.Width(), m_rc.Height()); HDC hMemDC = ::CreateCompatibleDC(NULL); - m_hbmColor = CreateColorDIB(m_rc.Width(), m_rc.Height(), RGB(255, 255, 255)); - HGDIOBJ hbmOld = ::SelectObject(hMemDC, m_hbmColor); - ::BitBlt(hMemDC, 0, 0, m_rc.Width(), m_rc.Height(), hDCImage, m_rc.left, m_rc.top, SRCCOPY); + HBITMAP hBitmap = CreateColorDIB(m_rc.Width(), m_rc.Height(), RGB(255, 255, 255)); + HGDIOBJ hbmOld = ::SelectObject(hMemDC, hBitmap); + ::BitBlt(hMemDC, 0, 0, m_rc.Width(), m_rc.Height(), imageModel.GetDC(), m_rc.left, m_rc.top, SRCCOPY); ::SelectObject(hMemDC, hbmOld); ::DeleteDC(hMemDC); + + return hBitmap; } BOOL SelectionModel::IsLanded() const @@ -178,7 +181,8 @@ BOOL SelectionModel::TakeOff() m_rgbBack = paletteModel.GetBgColor(); // Get the contents of the selection area - GetSelectionContents(imageModel.GetDC()); + ClearColorImage(); + m_hbmColor = GetSelectionContents(); // RectSel doesn't need the mask image if (toolsModel.GetActiveTool() == TOOL_RECTSEL) @@ -406,13 +410,6 @@ void SelectionModel::StretchSkew(int nStretchPercentX, int nStretchPercentY, int NotifyContentChanged(); } -HBITMAP SelectionModel::CopyBitmap() -{ - if (m_hbmColor == NULL) - GetSelectionContents(imageModel.GetDC()); - return CopyDIBImage(m_hbmColor); -} - int SelectionModel::PtStackSize() const { return m_iPtSP; @@ -545,18 +542,6 @@ void SelectionModel::SwapWidthAndHeight() m_rc.bottom = m_rc.top + cx; } -HBITMAP SelectionModel::LockBitmap() -{ - HBITMAP hbm = m_hbmColor; - m_hbmColor = NULL; - return hbm; -} - -void SelectionModel::UnlockBitmap(HBITMAP hbmLocked) -{ - m_hbmColor = hbmLocked; -} - void SelectionModel::StretchSelection(BOOL bShrink) { if (!m_bShow) diff --git a/base/applications/mspaint/selectionmodel.h b/base/applications/mspaint/selectionmodel.h index 308952a6e67..e66b2bff0cc 100644 --- a/base/applications/mspaint/selectionmodel.h +++ b/base/applications/mspaint/selectionmodel.h @@ -40,10 +40,7 @@ public: void HideSelection(); void DeleteSelection(); - HBITMAP CopyBitmap(); - HBITMAP LockBitmap(); - void UnlockBitmap(HBITMAP hbmLocked); - void GetSelectionContents(HDC hDCImage); + HBITMAP GetSelectionContents(); void DrawFramePoly(HDC hDCImage); void DrawBackground(HDC hDCImage); void DrawBackgroundPoly(HDC hDCImage, COLORREF crBg); diff --git a/base/applications/mspaint/textedit.cpp b/base/applications/mspaint/textedit.cpp index 5261da63a0e..c20ca6bf005 100644 --- a/base/applications/mspaint/textedit.cpp +++ b/base/applications/mspaint/textedit.cpp @@ -342,7 +342,7 @@ void CTextEditWindow::UpdateFont() lf.lfWeight = (registrySettings.Bold ? FW_BOLD : FW_NORMAL); lf.lfItalic = (BYTE)registrySettings.Italic; lf.lfUnderline = (BYTE)registrySettings.Underline; - lstrcpyn(lf.lfFaceName, registrySettings.strFontName, _countof(lf.lfFaceName)); + StringCchCopyW(lf.lfFaceName, _countof(lf.lfFaceName), registrySettings.strFontName); HDC hdc = GetDC(); if (hdc) diff --git a/base/applications/mspaint/winproc.cpp b/base/applications/mspaint/winproc.cpp index c1cbff31b8c..3beb34c290d 100644 --- a/base/applications/mspaint/winproc.cpp +++ b/base/applications/mspaint/winproc.cpp @@ -29,7 +29,7 @@ static HWND DoHtmlHelpW(HWND hwndCaller, LPCWSTR pszFile, UINT uCommand, DWORD_P { // The function loads the system library, not local GetSystemDirectoryW(szPath, _countof(szPath)); - wcscat(szPath, L"\\hhctrl.ocx"); + StringCchCatW(szPath, _countof(szPath), L"\\hhctrl.ocx"); s_hHHCTRL_OCX = LoadLibraryW(szPath); if (s_hHHCTRL_OCX) s_pHtmlHelpW = (FN_HtmlHelpW)GetProcAddress(s_hHHCTRL_OCX, "HtmlHelpW"); @@ -382,8 +382,8 @@ void CMainWindow::ProcessFileMenu(HMENU hPopupMenu) assert(_tcslen((LPCTSTR)pathFile) <= MAX_RECENT_PATHNAME_DISPLAY); // Add an accelerator (by '&') to the item number for quick access - TCHAR szText[4 + MAX_RECENT_PATHNAME_DISPLAY + 1]; - wsprintf(szText, _T("&%u %s"), iItem + 1, (LPCTSTR)pathFile); + WCHAR szText[4 + MAX_RECENT_PATHNAME_DISPLAY + 1]; + StringCchPrintfW(szText, _countof(szText), L"&%u %s", iItem + 1, (LPCWSTR)pathFile); INT iMenuItem = (cMenuItems - 2) + iItem; InsertMenu(hPopupMenu, iMenuItem, MF_BYPOSITION | MF_STRING, IDM_FILE1 + iItem, szText); @@ -720,14 +720,13 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH selectionModel.TakeOff(); { - HBITMAP hbmLocked = selectionModel.LockBitmap(); - if (hbmLocked) - { - HGLOBAL hGlobal = BitmapToClipboardDIB(hbmLocked); - if (hGlobal) - ::SetClipboardData(CF_DIB, hGlobal); - selectionModel.UnlockBitmap(hbmLocked); - } + HBITMAP hbmCopy = selectionModel.GetSelectionContents(); + HGLOBAL hGlobal = BitmapToClipboardDIB(hbmCopy); + if (hGlobal) + ::SetClipboardData(CF_DIB, hGlobal); + else + ShowOutOfMemory(); + ::DeleteObject(hbmCopy); } CloseClipboard(); @@ -841,12 +840,18 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH } case IDM_EDITCOPYTO: { - WCHAR szFileName[MAX_LONG_PATH] = L"*.png"; + WCHAR szFileName[MAX_LONG_PATH]; + LoadStringW(g_hinstExe, IDS_DEFAULTFILENAME, szFileName, _countof(szFileName)); if (GetSaveFileName(szFileName, _countof(szFileName))) { - HBITMAP hbmLocked = selectionModel.LockBitmap(); - SaveDIBToFile(hbmLocked, szFileName, FALSE); - selectionModel.UnlockBitmap(hbmLocked); + HBITMAP hbmSelection = selectionModel.GetSelectionContents(); + if (!hbmSelection) + { + ShowOutOfMemory(); + break; + } + SaveDIBToFile(hbmSelection, szFileName, FALSE); + DeleteObject(hbmSelection); } break; } @@ -982,9 +987,12 @@ LRESULT CMainWindow::OnCommand(UINT nMsg, WPARAM wParam, LPARAM lParam, BOOL& bH toolsModel.SetBackgroundTransparent(!toolsModel.IsBackgroundTransparent()); break; case IDM_IMAGECROP: - imageModel.PushImageForUndo(selectionModel.CopyBitmap()); + { + HBITMAP hbmCopy = selectionModel.GetSelectionContents(); + imageModel.PushImageForUndo(hbmCopy); selectionModel.HideSelection(); break; + } case IDM_VIEWTOOLBOX: registrySettings.ShowToolBox = !toolBoxContainer.IsWindowVisible(); toolBoxContainer.ShowWindow(registrySettings.ShowToolBox ? SW_SHOWNOACTIVATE : SW_HIDE);
1 year, 1 month
1
0
0
0
← Newer
1
...
23
24
25
26
27
28
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
Results per page:
10
25
50
100
200