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
January 2024
----- 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
17 participants
181 discussions
Start a n
N
ew thread
[reactos] 01/01: [MSUTB][SDK] Add InitFromReg (#6425)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c1dfd580ab6900eb72550…
commit c1dfd580ab6900eb725502d2125ff42028dbcb1f Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed Jan 31 20:32:21 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Wed Jan 31 20:32:21 2024 +0900 [MSUTB][SDK] Add InitFromReg (#6425) Supporting Language Bar... JIRA issue: CORE-19363 - Add many global variables to add UTB settings. - Add IsSkipRedrawHKL, IsBiDiLocalizedSystem, InitSkipRedrawHKLArray helper functions. - Add InitFromReg helper function to load the settings from registry. - Add CicRegKey::EnumValue method. --- dll/win32/msutb/msutb.cpp | 291 +++++++++++++++++++++++++++++++++--- sdk/include/reactos/cicero/cicreg.h | 13 ++ 2 files changed, 287 insertions(+), 17 deletions(-) diff --git a/dll/win32/msutb/msutb.cpp b/dll/win32/msutb/msutb.cpp index 26816ecb962..1a8ee45cc03 100644 --- a/dll/win32/msutb/msutb.cpp +++ b/dll/win32/msutb/msutb.cpp @@ -16,7 +16,42 @@ DWORD g_dwOSInfo = 0; CRITICAL_SECTION g_cs; LONG g_DllRefCount = 0; +BOOL g_bShowTipbar = TRUE; +BOOL g_bShowDebugMenu = FALSE; +BOOL g_bNewLook = TRUE; +BOOL g_bIntelliSense = FALSE; +BOOL g_bShowCloseMenu = FALSE; +UINT g_uTimeOutNonIntentional = 60 * 1000; +UINT g_uTimeOutIntentional = 10 * 60 * 1000; +UINT g_uTimeOutMax = 60 * 60 * 1000; +BOOL g_bShowMinimizedBalloon = TRUE; +POINT g_ptTipbar = { -1, -1 }; +BOOL g_bExcludeCaptionButtons = TRUE; +BOOL g_bShowShadow = FALSE; +BOOL g_fTaskbarTheme = TRUE; +BOOL g_fVertical = FALSE; +UINT g_uTimerElapseSTUBSTART = 100; +UINT g_uTimerElapseSTUBEND = 2 * 1000; +UINT g_uTimerElapseBACKTOALPHA = 3 * 1000; +UINT g_uTimerElapseONTHREADITEMCHANGE = 200; +UINT g_uTimerElapseSETWINDOWPOS = 100; +UINT g_uTimerElapseONUPDATECALLED = 50; +UINT g_uTimerElapseSYSCOLORCHANGED = 20; +UINT g_uTimerElapseDISPLAYCHANGE = 20; +UINT g_uTimerElapseUPDATEUI = 70; +UINT g_uTimerElapseSHOWWINDOW = 50; +UINT g_uTimerElapseMOVETOTRAY = 50; +UINT g_uTimerElapseTRAYWNDONDELAYMSG = 50; UINT g_uTimerElapseDOACCDEFAULTACTION = 200; +UINT g_uTimerElapseENSUREFOCUS = 50; +BOOL g_bShowDeskBand = FALSE; +UINT g_uTimerElapseSHOWDESKBAND = 3 * 1000; +BOOL g_fPolicyDisableCloseButton = FALSE; +BOOL g_fPolicyEnableLanguagebarInFullscreen = FALSE; +DWORD g_dwWndStyle = 0; +DWORD g_dwMenuStyle = 0; +DWORD g_dwChildWndStyle = 0; +BOOL g_fRTL = FALSE; #define TIMER_ID_DOACCDEFAULTACTION 11 @@ -45,6 +80,76 @@ class CButtonIconItem; CTipbarWnd *g_pTipbarWnd = NULL; +CicArray<HKL> *g_prghklSkipRedrawing = NULL; + +BOOL IsSkipRedrawHKL(HKL hSkipKL) +{ + if (LOWORD(hSkipKL) == MAKELANGID(LANG_JAPANESE, SUBLANG_DEFAULT)) + return FALSE; // Japanese HKL will be skipped + if (!g_prghklSkipRedrawing) + return FALSE; + + for (size_t iItem = 0; iItem < g_prghklSkipRedrawing->size(); ++iItem) + { + if ((*g_prghklSkipRedrawing)[iItem] == hSkipKL) + return TRUE; // To be skipped + } + + return FALSE; // To be not skipped +} + +BOOL IsBiDiLocalizedSystem(void) +{ + LOCALESIGNATURE Sig; + LANGID LangID = ::GetUserDefaultUILanguage(); + if (!LangID) + return FALSE; + + INT size = sizeof(Sig) / sizeof(WCHAR); + if (!::GetLocaleInfoW(LangID, LOCALE_FONTSIGNATURE, (LPWSTR)&Sig, size)) + return FALSE; + return (Sig.lsUsb[3] & 0x8000000) != 0; +} + +void InitSkipRedrawHKLArray(void) +{ + g_prghklSkipRedrawing = new(cicNoThrow) CicArray<HKL>(); + if (!g_prghklSkipRedrawing) + return; + + g_prghklSkipRedrawing->Add((HKL)UlongToHandle(0xE0010411)); // Japanese IME will be skipped + + CicRegKey regKey; + LSTATUS error = regKey.Open(HKEY_LOCAL_MACHINE, + TEXT("SOFTWARE\\Microsoft\\CTF\\MSUTB\\SkipRedrawHKL")); + if (error != ERROR_SUCCESS) + return; + + TCHAR szValueName[256]; + for (DWORD dwIndex = 0; ; ++dwIndex) + { + error = regKey.EnumValue(dwIndex, szValueName, _countof(szValueName)); + if (error != ERROR_SUCCESS) + break; + + if (szValueName[0] == TEXT('0') && + (szValueName[1] == TEXT('x') || szValueName[1] == TEXT('X'))) + { + HKL hKL = (HKL)UlongToHandle(_tcstoul(szValueName, NULL, 16)); + g_prghklSkipRedrawing->Add(hKL); // This hKL will be skipped + } + } +} + +void UninitSkipRedrawHKLArray(void) +{ + if (g_prghklSkipRedrawing) + { + delete g_prghklSkipRedrawing; + g_prghklSkipRedrawing = NULL; + } +} + HRESULT GetGlobalCompartment(REFGUID rguid, ITfCompartment **ppComp) { ITfCompartmentMgr *pCompMgr = NULL; @@ -123,6 +228,166 @@ void DoCloseLangbar(void) ::RegDeleteValue(regKey, TEXT("ctfmon.exe")); } +BOOL InitFromReg(void) +{ + DWORD dwValue; + LSTATUS error; + + CicRegKey regKey1; + error = regKey1.Open(HKEY_CURRENT_USER, TEXT("SOFTWARE\\Microsoft\\CTF\\")); + if (error == ERROR_SUCCESS) + { + error = regKey1.QueryDword(TEXT("ShowTipbar"), &dwValue); + if (error == ERROR_SUCCESS) + g_bShowTipbar = !!dwValue; + } + + CicRegKey regKey2; + error = regKey2.Open(HKEY_CURRENT_USER, TEXT("SOFTWARE\\Microsoft\\CTF\\MSUTB\\")); + if (error == ERROR_SUCCESS) + { + error = regKey2.QueryDword(TEXT("ShowDebugMenu"), &dwValue); + if (error == ERROR_SUCCESS) + g_bShowDebugMenu = !!dwValue; + error = regKey2.QueryDword(TEXT("NewLook"), &dwValue); + if (error == ERROR_SUCCESS) + g_bNewLook = !!dwValue; + error = regKey2.QueryDword(TEXT("IntelliSense"), &dwValue); + if (error == ERROR_SUCCESS) + g_bIntelliSense = !!dwValue; + error = regKey2.QueryDword(TEXT("ShowCloseMenu"), &dwValue); + if (error == ERROR_SUCCESS) + g_bShowCloseMenu = !!dwValue; + error = regKey2.QueryDword(TEXT("TimeOutNonIntentional"), &dwValue); + if (error == ERROR_SUCCESS) + g_uTimeOutNonIntentional = 1000 * dwValue; + error = regKey2.QueryDword(TEXT("TimeOutIntentional"), &dwValue); + if (error == ERROR_SUCCESS) + { + g_uTimeOutIntentional = 1000 * dwValue; + g_uTimeOutMax = 6000 * dwValue; + } + error = regKey2.QueryDword(TEXT("ShowMinimizedBalloon"), &dwValue); + if (error == ERROR_SUCCESS) + g_bShowMinimizedBalloon = !!dwValue; + error = regKey2.QueryDword(TEXT("Left"), &dwValue); + if (error == ERROR_SUCCESS) + g_ptTipbar.x = dwValue; + error = regKey2.QueryDword(TEXT("Top"), &dwValue); + if (error == ERROR_SUCCESS) + g_ptTipbar.y = dwValue; + error = regKey2.QueryDword(TEXT("ExcludeCaptionButtons"), &dwValue); + if (error == ERROR_SUCCESS) + g_bExcludeCaptionButtons = !!dwValue; + error = regKey2.QueryDword(TEXT("ShowShadow"), &dwValue); + if (error == ERROR_SUCCESS) + g_bShowShadow = !!dwValue; + error = regKey2.QueryDword(TEXT("TaskbarTheme"), &dwValue); + if (error == ERROR_SUCCESS) + g_fTaskbarTheme = !!dwValue; + error = regKey2.QueryDword(TEXT("Vertical"), &dwValue); + if (error == ERROR_SUCCESS) + g_fVertical = !!dwValue; + error = regKey2.QueryDword(TEXT("TimerElapseSTUBSTART"), &dwValue); + if (error == ERROR_SUCCESS) + g_uTimerElapseSTUBSTART = dwValue; + error = regKey2.QueryDword(TEXT("TimerElapseSTUBEND"), &dwValue); + if (error == ERROR_SUCCESS) + g_uTimerElapseSTUBEND = dwValue; + error = regKey2.QueryDword(TEXT("TimerElapseBACKTOALPHA"), &dwValue); + if (error == ERROR_SUCCESS) + g_uTimerElapseBACKTOALPHA = dwValue; + error = regKey2.QueryDword(TEXT("TimerElapseONTHREADITEMCHANGE"), &dwValue); + if (error == ERROR_SUCCESS) + g_uTimerElapseONTHREADITEMCHANGE = dwValue; + error = regKey2.QueryDword(TEXT("TimerElapseSETWINDOWPOS"), &dwValue); + if (error == ERROR_SUCCESS) + g_uTimerElapseSETWINDOWPOS = dwValue; + error = regKey2.QueryDword(TEXT("TimerElapseONUPDATECALLED"), &dwValue); + if (error == ERROR_SUCCESS) + g_uTimerElapseONUPDATECALLED = dwValue; + error = regKey2.QueryDword(TEXT("TimerElapseSYSCOLORCHANGED"), &dwValue); + if (error == ERROR_SUCCESS) + g_uTimerElapseSYSCOLORCHANGED = dwValue; + error = regKey2.QueryDword(TEXT("TimerElapseDISPLAYCHANGE"), &dwValue); + if (error == ERROR_SUCCESS) + g_uTimerElapseDISPLAYCHANGE = dwValue; + error = regKey2.QueryDword(TEXT("TimerElapseUPDATEUI"), &dwValue); + if (error == ERROR_SUCCESS) + g_uTimerElapseUPDATEUI = dwValue; + error = regKey2.QueryDword(TEXT("TimerElapseSHOWWINDOW"), &dwValue); + if (error == ERROR_SUCCESS) + g_uTimerElapseSHOWWINDOW = dwValue; + error = regKey2.QueryDword(TEXT("TimerElapseMOVETOTRAY"), &dwValue); + if (error == ERROR_SUCCESS) + g_uTimerElapseMOVETOTRAY = dwValue; + error = regKey2.QueryDword(TEXT("TimerElapseTRAYWNDONDELAYMSG"), &dwValue); + if (error == ERROR_SUCCESS) + g_uTimerElapseTRAYWNDONDELAYMSG = dwValue; + error = regKey2.QueryDword(TEXT("TimerElapseDOACCDEFAULTACTION"), &dwValue); + if (error == ERROR_SUCCESS) + g_uTimerElapseDOACCDEFAULTACTION = dwValue; + error = regKey2.QueryDword(TEXT("TimerElapseENSUREFOCUS"), &dwValue); + if (error == ERROR_SUCCESS) + g_uTimerElapseENSUREFOCUS = dwValue; + error = regKey2.QueryDword(TEXT("ShowDeskBand"), &dwValue); + if (error == ERROR_SUCCESS) + g_bShowDeskBand = !!dwValue; + error = regKey2.QueryDword(TEXT("TimerElapseSHOWWDESKBAND"), &dwValue); + if (error == ERROR_SUCCESS) + g_uTimerElapseSHOWDESKBAND = dwValue; + } + + CicRegKey regKey3; + error = regKey3.Open(HKEY_CURRENT_USER, TEXT("SOFTWARE\\Policies\\Microsoft\\MSCTF")); + if (error == ERROR_SUCCESS) + { + error = regKey3.QueryDword(TEXT("DisableCloseButton"), &dwValue); + if (error == ERROR_SUCCESS) + g_fPolicyDisableCloseButton = !!dwValue; + } + + CicRegKey regKey4; + error = regKey4.Open(HKEY_LOCAL_MACHINE, TEXT("SOFTWARE\\Policies\\Microsoft\\MSCTF")); + if (error == ERROR_SUCCESS) + { + error = regKey4.QueryDword(TEXT("EnableLanguagebarInFullscreen"), &dwValue); + if (error == ERROR_SUCCESS) + g_fPolicyEnableLanguagebarInFullscreen = !!dwValue; + } + + InitSkipRedrawHKLArray(); + + if (g_bNewLook) + { + g_dwWndStyle = UIF_WINDOW_ENABLETHEMED | UIF_WINDOW_WORKAREA | UIF_WINDOW_TOOLTIP | + UIF_WINDOW_TOOLWINDOW | UIF_WINDOW_TOPMOST; + if (g_bShowShadow) + g_dwWndStyle |= UIF_WINDOW_SHADOW; + g_dwMenuStyle = 0x10000000 | UIF_WINDOW_MONITOR | UIF_WINDOW_SHADOW | + UIF_WINDOW_TOOLWINDOW | UIF_WINDOW_TOPMOST; + } + else + { + g_dwWndStyle = UIF_WINDOW_WORKAREA | UIF_WINDOW_TOOLTIP | UIF_WINDOW_DLGFRAME | + UIF_WINDOW_TOPMOST; + g_dwMenuStyle = UIF_WINDOW_MONITOR | UIF_WINDOW_DLGFRAME | UIF_WINDOW_TOPMOST; + } + + g_dwChildWndStyle = + UIF_WINDOW_ENABLETHEMED | UIF_WINDOW_NOMOUSEMSG | UIF_WINDOW_TOOLTIP | UIF_WINDOW_CHILD; + + if (IsBiDiLocalizedSystem()) + { + g_dwWndStyle |= UIF_WINDOW_LAYOUTRTL; + g_dwChildWndStyle |= UIF_WINDOW_LAYOUTRTL; + g_dwMenuStyle |= UIF_WINDOW_LAYOUTRTL; + g_fRTL = TRUE; + } + + return TRUE; +} + /***********************************************************************/ class CUTBLangBarDlg @@ -487,7 +752,10 @@ public: CTrayIconWnd(); ~CTrayIconWnd(); - BOOL RegisterClass(); + static BOOL RegisterClass(); + static CTrayIconWnd *GetThis(HWND hWnd); + static void SetThis(HWND hWnd, LPCREATESTRUCT pCS); + HWND CreateWnd(); void DestroyWnd(); @@ -502,9 +770,6 @@ public: HWND GetNotifyWnd(); BOOL OnIconMessage(UINT uMsg, WPARAM wParam, LPARAM lParam); - static CTrayIconWnd *GetThis(HWND hWnd); - static void SetThis(HWND hWnd, LPCREATESTRUCT pCS); - void CallOnDelayMsg(); }; @@ -2188,9 +2453,7 @@ STDAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) return gModule.DllGetClassObject(rclsid, riid, ppv); } -/** - * @implemented - */ +/// @implemented HRESULT APIENTRY MsUtbCoCreateInstance( REFCLSID rclsid, @@ -2206,9 +2469,7 @@ MsUtbCoCreateInstance( return cicRealCoCreateInstance(rclsid, pUnkOuter, dwClsContext, iid, ppv); } -/** - * @unimplemented - */ +/// @implemented BOOL ProcessAttach(HINSTANCE hinstDLL) { ::InitializeCriticalSectionAndSpinCount(&g_cs, 0); @@ -2220,7 +2481,7 @@ BOOL ProcessAttach(HINSTANCE hinstDLL) TFInitLib(MsUtbCoCreateInstance); cicInitUIFLib(); - //CTrayIconWnd::RegisterClassW(); //FIXME + CTrayIconWnd::RegisterClass(); g_wmTaskbarCreated = RegisterWindowMessageW(L"TaskbarCreated"); @@ -2230,9 +2491,7 @@ BOOL ProcessAttach(HINSTANCE hinstDLL) return TRUE; } -/** - * @implemented - */ +/// @implemented VOID ProcessDetach(HINSTANCE hinstDLL) { cicDoneUIFLib(); @@ -2241,9 +2500,7 @@ VOID ProcessDetach(HINSTANCE hinstDLL) gModule.Term(); } -/** - * @implemented - */ +/// @implemented EXTERN_C BOOL WINAPI DllMain( _In_ HINSTANCE hinstDLL, diff --git a/sdk/include/reactos/cicero/cicreg.h b/sdk/include/reactos/cicero/cicreg.h index ec3718da046..b5a99658a15 100644 --- a/sdk/include/reactos/cicero/cicreg.h +++ b/sdk/include/reactos/cicero/cicreg.h @@ -65,6 +65,8 @@ public: } LSTATUS RecurseDeleteKey(LPCTSTR lpSubKey); + + LSTATUS EnumValue(DWORD dwIndex, LPTSTR lpValueName, DWORD cchValueName); }; /******************************************************************************/ @@ -162,3 +164,14 @@ CicRegKey::RecurseDeleteKey(LPCTSTR lpSubKey) return DeleteSubKey(lpSubKey); } + +inline LSTATUS +CicRegKey::EnumValue(DWORD dwIndex, LPTSTR lpValueName, DWORD cchValueName) +{ + DWORD dwSaveLen = cchValueName; + LSTATUS error = ::RegEnumValue(m_hKey, dwIndex, lpValueName, &cchValueName, + NULL, NULL, NULL, NULL); + if (dwSaveLen) + lpValueName[error == ERROR_SUCCESS ? dwSaveLen - 1 : 0] = 0; + return error; +}
10 months, 4 weeks
1
0
0
0
[reactos] 01/01: [MSCTF][MSUTB][SDK] Add CTrayIconWnd and CMainIconItem (#6424)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=5e4fe2cf4036499038ebd…
commit 5e4fe2cf4036499038ebdb0f33bbf64536545323 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed Jan 31 16:52:02 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Wed Jan 31 16:52:02 2024 +0900 [MSCTF][MSUTB][SDK] Add CTrayIconWnd and CMainIconItem (#6424) Supporting Language Bar... JIRA issue: CORE-19363 - Add CTrayIconWnd, CMainIconItem, and CButtonIconItem classes. - Modify msctf.spec for TF_GetLangIcon function. - Add main icon IDI_MAINICON ("res/earth.ico"). --- dll/win32/msctf/msctf.spec | 2 +- dll/win32/msutb/lang/en-US.rc | 2 + dll/win32/msutb/msutb.cpp | 459 ++++++++++++++++++++++++++++++++++-- dll/win32/msutb/msutb.rc | 2 + dll/win32/msutb/precomp.h | 1 + dll/win32/msutb/res/earth.ico | Bin 0 -> 22382 bytes dll/win32/msutb/resource.h | 4 + sdk/include/psdk/msctf.idl | 1 + sdk/include/reactos/cicero/cicutb.h | 4 + 9 files changed, 455 insertions(+), 20 deletions(-) diff --git a/dll/win32/msctf/msctf.spec b/dll/win32/msctf/msctf.spec index 569f8701e8b..52288129e1c 100644 --- a/dll/win32/msctf/msctf.spec +++ b/dll/win32/msctf/msctf.spec @@ -18,7 +18,7 @@ @ stdcall -stub TF_DllDetachInOther() @ stdcall -stub TF_GetGlobalCompartment(ptr) @ stub TF_GetInputScope -@ stub TF_GetLangIcon +@ stdcall -stub TF_GetLangIcon(long ptr long) @ stub TF_GetMlngHKL @ stub TF_GetMlngIconIndex @ stub TF_GetThreadFlags diff --git a/dll/win32/msutb/lang/en-US.rc b/dll/win32/msutb/lang/en-US.rc index 98a9ea10f96..3c3a7a579dd 100644 --- a/dll/win32/msutb/lang/en-US.rc +++ b/dll/win32/msutb/lang/en-US.rc @@ -16,6 +16,8 @@ BEGIN IDS_IGNORE "&Ignore" IDS_YES "&Yes" IDS_NO "&No" + + IDS_RESTORELANGBAR "Restore Language Bar" IDS_MENUWND "Menu Window" IDS_LEFTCLICK "Left Click" END diff --git a/dll/win32/msutb/msutb.cpp b/dll/win32/msutb/msutb.cpp index 9a4a96e8553..26816ecb962 100644 --- a/dll/win32/msutb/msutb.cpp +++ b/dll/win32/msutb/msutb.cpp @@ -16,6 +16,10 @@ DWORD g_dwOSInfo = 0; CRITICAL_SECTION g_cs; LONG g_DllRefCount = 0; +UINT g_uTimerElapseDOACCDEFAULTACTION = 200; + +#define TIMER_ID_DOACCDEFAULTACTION 11 + EXTERN_C void __cxa_pure_virtual(void) { ERR("__cxa_pure_virtual\n"); @@ -34,6 +38,12 @@ CMsUtbModule gModule; class CCicLibMenuItem; class CTipbarAccItem; class CUTBMenuItem; +class CMainIconItem; +class CTrayIconItem; +class CTipbarWnd; +class CButtonIconItem; + +CTipbarWnd *g_pTipbarWnd = NULL; HRESULT GetGlobalCompartment(REFGUID rguid, ITfCompartment **ppComp) { @@ -98,9 +108,8 @@ void DoCloseLangbar(void) if (pLangBarMgr) { - hr = pLangBarMgr->ShowFloating(8); + hr = pLangBarMgr->ShowFloating(TF_SFT_HIDDEN); pLangBarMgr->Release(); - pLangBarMgr = NULL; } if (SUCCEEDED(hr)) @@ -453,9 +462,50 @@ public: class CTrayIconWnd { +protected: + DWORD m_dwUnknown20; + BOOL m_bBusy; + UINT m_uCallbackMessage; + UINT m_uMsg; + HWND m_hWnd; + DWORD m_dwUnknown21[2]; + HWND m_hTrayWnd; + HWND m_hNotifyWnd; + DWORD m_dwTrayWndThreadId; + DWORD m_dwUnknown22; + HWND m_hwndProgman; + DWORD m_dwProgmanThreadId; + CMainIconItem *m_pMainIconItem; + CicArray<CButtonIconItem*> m_Items; + UINT m_uCallbackMsg; + UINT m_uNotifyIconID; + + static BOOL CALLBACK EnumChildWndProc(HWND hWnd, LPARAM lParam); + static LRESULT CALLBACK _WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); + public: - //FIXME - HWND GetNotifyWnd() { return NULL; }; + CTrayIconWnd(); + ~CTrayIconWnd(); + + BOOL RegisterClass(); + HWND CreateWnd(); + void DestroyWnd(); + + BOOL SetMainIcon(HKL hKL); + BOOL SetIcon(REFGUID rguid, DWORD dwUnknown24, HICON hIcon, LPCWSTR psz); + + void RemoveAllIcon(DWORD dwFlags); + void RemoveUnusedIcons(int unknown); + + CButtonIconItem *FindIconItem(REFGUID rguid); + BOOL FindTrayEtc(); + HWND GetNotifyWnd(); + BOOL OnIconMessage(UINT uMsg, WPARAM wParam, LPARAM lParam); + + static CTrayIconWnd *GetThis(HWND hWnd); + static void SetThis(HWND hWnd, LPCREATESTRUCT pCS); + + void CallOnDelayMsg(); }; /***********************************************************************/ @@ -469,20 +519,50 @@ protected: DWORD m_dwIconAddOrModify; BOOL m_bIconAdded; CTrayIconWnd *m_pTrayIconWnd; - DWORD m_dw; + DWORD m_dwUnknown25; GUID m_guid; RECT m_rcMenu; POINT m_ptCursor; + friend class CTrayIconWnd; +public: CTrayIconItem(CTrayIconWnd *pTrayIconWnd); + virtual ~CTrayIconItem() { } BOOL _Init(HWND hWnd, UINT uCallbackMessage, UINT uNotifyIconID, const GUID& rguid); BOOL UpdateMenuRectPoint(); BOOL RemoveIcon(); - STDMETHOD_(BOOL, SetIcon)(HICON hIcon, LPCTSTR pszTip); - STDMETHOD_(LRESULT, OnMsg)(WPARAM wParam, LPARAM lParam) { return 0; }; - STDMETHOD_(LRESULT, OnDelayMsg)(LPARAM lParam) { return 0; }; + STDMETHOD_(BOOL, SetIcon)(HICON hIcon, LPCWSTR pszTip); + STDMETHOD_(BOOL, OnMsg)(WPARAM wParam, LPARAM lParam) { return FALSE; }; + STDMETHOD_(BOOL, OnDelayMsg)(UINT uMsg) { return 0; }; +}; + +/***********************************************************************/ + +class CButtonIconItem : public CTrayIconItem +{ +protected: + DWORD m_dwUnknown24; + HKL m_hKL; + friend class CTrayIconWnd; + +public: + CButtonIconItem(CTrayIconWnd *pWnd, DWORD dwUnknown24); + + STDMETHOD_(BOOL, OnMsg)(WPARAM wParam, LPARAM lParam) override; + STDMETHOD_(BOOL, OnDelayMsg)(UINT uMsg) override; +}; + +/***********************************************************************/ + +class CMainIconItem : public CButtonIconItem +{ +public: + CMainIconItem(CTrayIconWnd *pWnd); + + BOOL Init(HWND hWnd); + STDMETHOD_(BOOL, OnDelayMsg)(UINT uMsg) override; }; /*********************************************************************** @@ -780,7 +860,7 @@ STDMETHODIMP CCicLibMenu::AddMenuItem( pSubMenu->AddRef(); } - *m_MenuItems.Append(1) = pMenuItem; + m_MenuItems.Add(pMenuItem); return S_OK; } @@ -1429,8 +1509,8 @@ BOOL CUTBMenuWnd::StartDoAccDefaultActionTimer(CUTBMenuItem *pTarget) if (::IsWindow(m_hWnd)) { - ::KillTimer(m_hWnd, 11); - ::SetTimer(m_hWnd, 11, 200, NULL); + ::KillTimer(m_hWnd, TIMER_ID_DOACCDEFAULTACTION); + ::SetTimer(m_hWnd, TIMER_ID_DOACCDEFAULTACTION, g_uTimerElapseDOACCDEFAULTACTION, NULL); } return TRUE; @@ -1525,9 +1605,9 @@ CUTBMenuWnd::OnShowWindow(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) STDMETHODIMP_(void) CUTBMenuWnd::OnTimer(WPARAM wParam) { - if (wParam == 11) + if (wParam == TIMER_ID_DOACCDEFAULTACTION) { - ::KillTimer(m_hWnd, 11); + ::KillTimer(m_hWnd, TIMER_ID_DOACCDEFAULTACTION); if (m_pAccessible && m_nMenuWndID) { m_pAccessible->DoDefaultActionReal(m_nMenuWndID); @@ -1633,10 +1713,10 @@ BOOL CTrayIconItem::RemoveIcon() { if (m_dwIconAddOrModify == NIM_MODIFY) { - NOTIFYICONDATA NotifyIcon = { sizeof(NotifyIcon), m_hWnd, m_uNotifyIconID }; + NOTIFYICONDATAW NotifyIcon = { sizeof(NotifyIcon), m_hWnd, m_uNotifyIconID }; NotifyIcon.uFlags = NIF_ICON | NIF_MESSAGE | NIF_TIP; NotifyIcon.uCallbackMessage = m_uCallbackMessage; - ::Shell_NotifyIcon(NIM_DELETE, &NotifyIcon); + ::Shell_NotifyIconW(NIM_DELETE, &NotifyIcon); } m_dwIconAddOrModify = NIM_ADD; @@ -1644,22 +1724,22 @@ BOOL CTrayIconItem::RemoveIcon() return TRUE; } -BOOL CTrayIconItem::SetIcon(HICON hIcon, LPCTSTR pszTip) +BOOL CTrayIconItem::SetIcon(HICON hIcon, LPCWSTR pszTip) { if (!hIcon) return FALSE; - NOTIFYICONDATA NotifyIcon = { sizeof(NotifyIcon), m_hWnd, m_uNotifyIconID }; + NOTIFYICONDATAW NotifyIcon = { sizeof(NotifyIcon), m_hWnd, m_uNotifyIconID }; NotifyIcon.uFlags = NIF_ICON | NIF_MESSAGE; NotifyIcon.uCallbackMessage = m_uCallbackMessage; NotifyIcon.hIcon = hIcon; if (pszTip) { NotifyIcon.uFlags |= NIF_TIP; - StringCchCopy(NotifyIcon.szTip, _countof(NotifyIcon.szTip), pszTip); + StringCchCopyW(NotifyIcon.szTip, _countof(NotifyIcon.szTip), pszTip); } - ::Shell_NotifyIcon(m_dwIconAddOrModify, &NotifyIcon); + ::Shell_NotifyIconW(m_dwIconAddOrModify, &NotifyIcon); m_dwIconAddOrModify = NIM_MODIFY; m_bIconAdded = NIM_MODIFY; @@ -1676,6 +1756,347 @@ BOOL CTrayIconItem::UpdateMenuRectPoint() return TRUE; } +/*********************************************************************** + * CButtonIconItem + */ + +CButtonIconItem::CButtonIconItem(CTrayIconWnd *pWnd, DWORD dwUnknown24) + : CTrayIconItem(pWnd) +{ + m_dwUnknown24 = dwUnknown24; +} + +/// @unimplemented +STDMETHODIMP_(BOOL) CButtonIconItem::OnMsg(WPARAM wParam, LPARAM lParam) +{ + switch (lParam) + { + case WM_LBUTTONDOWN: + case WM_RBUTTONDOWN: + case WM_LBUTTONDBLCLK: + case WM_RBUTTONDBLCLK: + break; + default: + return TRUE; + } + + //FIXME + return TRUE; +} + +/// @unimplemented +STDMETHODIMP_(BOOL) CButtonIconItem::OnDelayMsg(UINT uMsg) +{ + //FIXME + return FALSE; +} + +/*********************************************************************** + * CMainIconItem + */ + +CMainIconItem::CMainIconItem(CTrayIconWnd *pWnd) + : CButtonIconItem(pWnd, 1) +{ +} + +BOOL CMainIconItem::Init(HWND hWnd) +{ + return CTrayIconItem::_Init(hWnd, WM_USER, 0, GUID_LBI_TRAYMAIN); +} + +/// @unimplemented +STDMETHODIMP_(BOOL) CMainIconItem::OnDelayMsg(UINT uMsg) +{ + if (!CButtonIconItem::OnDelayMsg(uMsg)) + return 0; + + if (uMsg == WM_LBUTTONDBLCLK) + { + //FIXME + //if (g_pTipbarWnd->m_dwUnknown20) + // g_pTipbarWnd->m_pLangBarMgr->ShowFloating(TF_SFT_SHOWNORMAL); + } + else if (uMsg == WM_LBUTTONDOWN || uMsg == WM_RBUTTONDOWN) + { + //FIXME + //g_pTipbarWnd->ShowContextMenu(m_ptCursor, &m_rcClient, uMsg == WM_RBUTTONDOWN); + } + return TRUE; +} + +/*********************************************************************** + * CTrayIconWnd + */ + +CTrayIconWnd::CTrayIconWnd() +{ + m_uCallbackMsg = WM_USER + 0x1000; + m_uNotifyIconID = 0x1000; +} + +CTrayIconWnd::~CTrayIconWnd() +{ + for (size_t iItem = 0; iItem < m_Items.size(); ++iItem) + { + auto& pItem = m_Items[iItem]; + if (pItem) + { + delete pItem; + pItem = NULL; + } + } +} + +void CTrayIconWnd::CallOnDelayMsg() +{ + for (size_t iItem = 0; iItem < m_Items.size(); ++iItem) + { + auto pItem = m_Items[iItem]; + if (pItem && m_uCallbackMessage == pItem->m_uCallbackMessage) + { + pItem->OnDelayMsg(m_uMsg); + break; + } + } +} + +HWND CTrayIconWnd::CreateWnd() +{ + m_hWnd = ::CreateWindowEx(0, TEXT("CTrayIconWndClass"), NULL, WS_DISABLED, + 0, 0, 0, 0, NULL, NULL, g_hInst, this); + FindTrayEtc(); + + m_pMainIconItem = new(cicNoThrow) CMainIconItem(this); + if (m_pMainIconItem) + { + m_pMainIconItem->Init(m_hWnd); + m_Items.Add(m_pMainIconItem); + } + + return m_hWnd; +} + +void CTrayIconWnd::DestroyWnd() +{ + ::DestroyWindow(m_hWnd); + m_hWnd = NULL; +} + +BOOL CALLBACK CTrayIconWnd::EnumChildWndProc(HWND hWnd, LPARAM lParam) +{ + CTrayIconWnd *pWnd = (CTrayIconWnd *)lParam; + + TCHAR ClassName[60]; + ::GetClassName(hWnd, ClassName, _countof(ClassName)); + if (lstrcmp(ClassName, TEXT("TrayNotifyWnd")) != 0) + return TRUE; + + pWnd->m_hNotifyWnd = hWnd; + return FALSE; +} + +CButtonIconItem *CTrayIconWnd::FindIconItem(REFGUID rguid) +{ + for (size_t iItem = 0; iItem < m_Items.size(); ++iItem) + { + auto pItem = m_Items[iItem]; + if (IsEqualGUID(rguid, pItem->m_guid)) + return pItem; + } + return NULL; +} + +BOOL CTrayIconWnd::FindTrayEtc() +{ + m_hTrayWnd = ::FindWindow(TEXT("Shell_TrayWnd"), NULL); + if (!m_hTrayWnd) + return FALSE; + + ::EnumChildWindows(m_hTrayWnd, EnumChildWndProc, (LPARAM)this); + if (!m_hNotifyWnd) + return FALSE; + m_dwTrayWndThreadId = ::GetWindowThreadProcessId(m_hTrayWnd, NULL); + m_hwndProgman = FindWindow(TEXT("Progman"), NULL); + m_dwProgmanThreadId = ::GetWindowThreadProcessId(m_hwndProgman, NULL); + return TRUE; +} + +HWND CTrayIconWnd::GetNotifyWnd() +{ + if (!::IsWindow(m_hNotifyWnd)) + FindTrayEtc(); + return m_hNotifyWnd; +} + +/// @unimplemented +BOOL CTrayIconWnd::OnIconMessage(UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + //FIXME + //if (g_pTipbarWnd) + // g_pTipbarWnd->AttachFocusThread(); + + for (size_t iItem = 0; iItem < m_Items.size(); ++iItem) + { + auto pItem = m_Items[iItem]; + if (pItem) + { + if (uMsg == pItem->m_uCallbackMessage) + { + pItem->OnMsg(wParam, lParam); + return TRUE; + } + } + } + return FALSE; +} + +BOOL CTrayIconWnd::RegisterClass() +{ + WNDCLASSEX wc = { sizeof(wc) }; + wc.style = CS_HREDRAW | CS_VREDRAW; + wc.hInstance = g_hInst; + wc.hCursor = ::LoadCursor(NULL, (LPCTSTR)IDC_ARROW); + wc.lpfnWndProc = CTrayIconWnd::_WndProc; + wc.lpszClassName = TEXT("CTrayIconWndClass"); + ::RegisterClassEx(&wc); + return TRUE; +} + +void CTrayIconWnd::RemoveAllIcon(DWORD dwFlags) +{ + for (size_t iItem = 0; iItem < m_Items.size(); ++iItem) + { + auto pItem = m_Items[iItem]; + if (dwFlags & 0x1) + { + if (IsEqualGUID(pItem->m_guid, GUID_LBI_INATITEM) || + IsEqualGUID(pItem->m_guid, GUID_LBI_CTRL)) + { + continue; + } + } + + if (dwFlags & 0x2) + { + if (IsEqualGUID(pItem->m_guid, GUID_TFCAT_TIP_KEYBOARD)) + continue; + } + + if (pItem->m_uNotifyIconID < 0x1000) + continue; + + pItem->RemoveIcon(); + } +} + +/// @unimplemented +void CTrayIconWnd::RemoveUnusedIcons(int unknown) +{ + //FIXME +} + +BOOL CTrayIconWnd::SetIcon(REFGUID rguid, DWORD dwUnknown24, HICON hIcon, LPCWSTR psz) +{ + CButtonIconItem *pItem = FindIconItem(rguid); + if (!pItem) + { + if (!hIcon) + return FALSE; + pItem = new(cicNoThrow) CButtonIconItem(this, dwUnknown24); + if (!pItem) + return FALSE; + + pItem->_Init(m_hWnd, m_uCallbackMsg, m_uNotifyIconID, rguid); + m_uCallbackMsg += 2; + ++m_uNotifyIconID; + m_Items.Add(pItem); + } + + if (!hIcon) + return pItem->RemoveIcon(); + + return pItem->SetIcon(hIcon, psz); +} + +BOOL CTrayIconWnd::SetMainIcon(HKL hKL) +{ + if (!hKL) + { + m_pMainIconItem->RemoveIcon(); + m_pMainIconItem->m_hKL = NULL; + return TRUE; + } + + if (hKL != m_pMainIconItem->m_hKL) + { + WCHAR szText[64]; + HICON hIcon = TF_GetLangIcon(LOWORD(hKL), szText, _countof(szText)); + if (hIcon) + { + m_pMainIconItem->SetIcon(hIcon, szText); + ::DestroyIcon(hIcon); + } + else + { + ::LoadStringW(g_hInst, IDS_RESTORELANGBAR, szText, _countof(szText)); + hIcon = ::LoadIconW(g_hInst, MAKEINTRESOURCEW(IDI_MAINICON)); + m_pMainIconItem->SetIcon(hIcon, szText); + } + + m_pMainIconItem->m_hKL = hKL; + } + + return TRUE; +} + +CTrayIconWnd *CTrayIconWnd::GetThis(HWND hWnd) +{ + return (CTrayIconWnd *)::GetWindowLongPtr(hWnd, GWL_USERDATA); +} + +void CTrayIconWnd::SetThis(HWND hWnd, LPCREATESTRUCT pCS) +{ + if (pCS) + ::SetWindowLongPtr(hWnd, GWL_USERDATA, (LONG_PTR)pCS->lpCreateParams); + else + ::SetWindowLongPtr(hWnd, GWL_USERDATA, 0); +} + +LRESULT CALLBACK +CTrayIconWnd::_WndProc(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + CTrayIconWnd *pThis; + switch (uMsg) + { + case WM_CREATE: + CTrayIconWnd::SetThis(hWnd, (LPCREATESTRUCT)lParam); + break; + case WM_DESTROY: + ::SetWindowLongPtr(hWnd, GWL_USERDATA, 0); + break; + case WM_TIMER: + if (wParam == 100) + { + ::KillTimer(hWnd, 100); + pThis = CTrayIconWnd::GetThis(hWnd); + if (pThis) + pThis->CallOnDelayMsg(); + } + break; + default: + { + if (uMsg < WM_USER) + return ::DefWindowProc(hWnd, uMsg, wParam, lParam); + pThis = CTrayIconWnd::GetThis(hWnd); + if (pThis && pThis->OnIconMessage(uMsg, wParam, lParam)) + break; + return ::DefWindowProc(hWnd, uMsg, wParam, lParam); + } + } + return 0; +} + /*********************************************************************** * GetLibTls (MSUTB.@) * diff --git a/dll/win32/msutb/msutb.rc b/dll/win32/msutb/msutb.rc index 21964d264da..82ae823ce07 100644 --- a/dll/win32/msutb/msutb.rc +++ b/dll/win32/msutb/msutb.rc @@ -20,6 +20,8 @@ LANGUAGE LANG_NEUTRAL, SUBLANG_NEUTRAL #include <reactos/manifest_hosted.rc> +IDI_MAINICON ICON "res/earth.ico" + /* UTF-8 */ #pragma code_page(65001) diff --git a/dll/win32/msutb/precomp.h b/dll/win32/msutb/precomp.h index d198ded03f1..05b2a826e27 100644 --- a/dll/win32/msutb/precomp.h +++ b/dll/win32/msutb/precomp.h @@ -20,6 +20,7 @@ #include <cguid.h> #include <msctf.h> #include <ctffunc.h> +#include <ctfutb.h> #include <shlwapi.h> #include <atlbase.h> #include <atlcom.h> diff --git a/dll/win32/msutb/res/earth.ico b/dll/win32/msutb/res/earth.ico new file mode 100644 index 00000000000..7d47171f990 Binary files /dev/null and b/dll/win32/msutb/res/earth.ico differ diff --git a/dll/win32/msutb/resource.h b/dll/win32/msutb/resource.h index 6808bd02597..c3abc6b696c 100644 --- a/dll/win32/msutb/resource.h +++ b/dll/win32/msutb/resource.h @@ -7,6 +7,10 @@ #define IDS_IGNORE 104 #define IDS_YES 105 #define IDS_NO 106 + +#define IDI_MAINICON 100 + +#define IDS_RESTORELANGBAR 308 #define IDS_MENUWND 322 #define IDS_LEFTCLICK 323 diff --git a/sdk/include/psdk/msctf.idl b/sdk/include/psdk/msctf.idl index 60219b328e0..c9cc9908474 100644 --- a/sdk/include/psdk/msctf.idl +++ b/sdk/include/psdk/msctf.idl @@ -43,6 +43,7 @@ cpp_quote("EXTERN_C HRESULT WINAPI TF_InvalidAssemblyListCacheIfExist(VOID);") cpp_quote("EXTERN_C HRESULT WINAPI TF_DllDetachInOther(VOID);") cpp_quote("EXTERN_C HRESULT WINAPI TF_CreateCategoryMgr(ITfCategoryMgr **ppcat);") cpp_quote("EXTERN_C HRESULT WINAPI TF_CreateDisplayAttributeMgr(ITfDisplayAttributeMgr **ppdam);") +cpp_quote("EXTERN_C HICON WINAPI TF_GetLangIcon(LANGID LangID, LPWSTR pszText, INT cchText);") cpp_quote("EXTERN_C const GUID GUID_PROP_TEXTOWNER;") cpp_quote("EXTERN_C const GUID GUID_PROP_ATTRIBUTE;") diff --git a/sdk/include/reactos/cicero/cicutb.h b/sdk/include/reactos/cicero/cicutb.h index 9c0ff831530..916b0c4befb 100644 --- a/sdk/include/reactos/cicero/cicutb.h +++ b/sdk/include/reactos/cicero/cicutb.h @@ -8,6 +8,10 @@ #pragma once DEFINE_GUID(GUID_COMPARTMENT_SPEECH_OPENCLOSE, 0x544D6A63, 0xE2E8, 0x4752, 0xBB, 0xD1, 0x00, 0x09, 0x60, 0xBC, 0xA0, 0x83); +DEFINE_GUID(GUID_LBI_TRAYMAIN, 0xE0B724E9, 0x6F76, 0x45F7, 0xB4, 0xC1, 0xB1, 0xC0, 0xFA, 0xBC, 0xE2, 0x3E); +DEFINE_GUID(GUID_LBI_INATITEM, 0xCDBC683A, 0x55CE, 0x4717, 0xBA, 0xC0, 0x50, 0xBF, 0x44, 0xA3, 0x27, 0x0C); +DEFINE_GUID(GUID_LBI_CTRL, 0x58C99D96, 0x2F9B, 0x42CE, 0x91, 0xBE, 0x37, 0xEF, 0x18, 0x60, 0xF8, 0x82); +DEFINE_GUID(GUID_TFCAT_TIP_KEYBOARD, 0x34745C63, 0xB2F0, 0x4784, 0x8B, 0x67, 0x5E, 0x12, 0xC8, 0x70, 0x1A, 0x31); EXTERN_C LPVOID WINAPI GetLibTls(VOID); EXTERN_C BOOL WINAPI GetPopupTipbar(HWND hWnd, BOOL fWinLogon);
10 months, 4 weeks
1
0
0
0
[reactos] 01/01: [MSUTB][SDK] Implement DoCloseLangbar (#6423)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=131153743504a3c290d5c…
commit 131153743504a3c290d5cf724d9c5123017dc0a5 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Wed Jan 31 12:21:09 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Wed Jan 31 12:21:09 2024 +0900 [MSUTB][SDK] Implement DoCloseLangbar (#6423) Supporting Language Bar... JIRA issue: CORE-19363 - Implement GetGlobalCompartment function. - Implement GetGlobalCompartmentDWORD and SetGlobalCompartmentDWORD helper functions. - Implement TurnOffSpeechIfItsOn and DoCloseLangbar functions. --- dll/win32/msutb/msutb.cpp | 85 ++++++++++++++++++++++++++++++++++--- dll/win32/msutb/precomp.h | 1 + sdk/include/reactos/cicero/cicutb.h | 2 + 3 files changed, 82 insertions(+), 6 deletions(-) diff --git a/dll/win32/msutb/msutb.cpp b/dll/win32/msutb/msutb.cpp index d6344a59a0c..9a4a96e8553 100644 --- a/dll/win32/msutb/msutb.cpp +++ b/dll/win32/msutb/msutb.cpp @@ -35,6 +35,85 @@ class CCicLibMenuItem; class CTipbarAccItem; class CUTBMenuItem; +HRESULT GetGlobalCompartment(REFGUID rguid, ITfCompartment **ppComp) +{ + ITfCompartmentMgr *pCompMgr = NULL; + HRESULT hr = TF_GetGlobalCompartment(&pCompMgr); + if (FAILED(hr)) + return hr; + + if (!pCompMgr) + return E_FAIL; + + hr = pCompMgr->GetCompartment(rguid, ppComp); + pCompMgr->Release(); + return hr; +} + +HRESULT GetGlobalCompartmentDWORD(REFGUID rguid, LPDWORD pdwValue) +{ + *pdwValue = 0; + ITfCompartment *pComp; + HRESULT hr = GetGlobalCompartment(rguid, &pComp); + if (SUCCEEDED(hr)) + { + VARIANT vari; + hr = pComp->GetValue(&vari); + if (hr == S_OK) + *pdwValue = V_I4(&vari); + pComp->Release(); + } + return hr; +} + +HRESULT SetGlobalCompartmentDWORD(REFGUID rguid, DWORD dwValue) +{ + VARIANT vari; + ITfCompartment *pComp; + HRESULT hr = GetGlobalCompartment(rguid, &pComp); + if (SUCCEEDED(hr)) + { + V_VT(&vari) = VT_I4; + V_I4(&vari) = dwValue; + hr = pComp->SetValue(0, &vari); + pComp->Release(); + } + return hr; +} + +void TurnOffSpeechIfItsOn(void) +{ + DWORD dwValue = 0; + HRESULT hr = GetGlobalCompartmentDWORD(GUID_COMPARTMENT_SPEECH_OPENCLOSE, &dwValue); + if (SUCCEEDED(hr) && dwValue) + SetGlobalCompartmentDWORD(GUID_COMPARTMENT_SPEECH_OPENCLOSE, 0); +} + +void DoCloseLangbar(void) +{ + ITfLangBarMgr *pLangBarMgr = NULL; + HRESULT hr = TF_CreateLangBarMgr(&pLangBarMgr); + if (FAILED(hr)) + return; + + if (pLangBarMgr) + { + hr = pLangBarMgr->ShowFloating(8); + pLangBarMgr->Release(); + pLangBarMgr = NULL; + } + + if (SUCCEEDED(hr)) + TurnOffSpeechIfItsOn(); + + CicRegKey regKey; + LSTATUS error = regKey.Open(HKEY_CURRENT_USER, + TEXT("Software\\Microsoft\\Windows\\CurrentVersion\\Run"), + KEY_ALL_ACCESS); + if (error == ERROR_SUCCESS) + ::RegDeleteValue(regKey, TEXT("ctfmon.exe")); +} + /***********************************************************************/ class CUTBLangBarDlg @@ -511,12 +590,6 @@ STDMETHODIMP_(BOOL) CUTBCloseLangBarDlg::DoModal(HWND hDlg) return TRUE; } -/// @unimplemented -void DoCloseLangbar(void) -{ - //FIXME -} - STDMETHODIMP_(BOOL) CUTBCloseLangBarDlg::OnCommand(HWND hDlg, WPARAM wParam, LPARAM lParam) { switch (LOWORD(wParam)) diff --git a/dll/win32/msutb/precomp.h b/dll/win32/msutb/precomp.h index 8bc4c4140a9..d198ded03f1 100644 --- a/dll/win32/msutb/precomp.h +++ b/dll/win32/msutb/precomp.h @@ -28,6 +28,7 @@ #include "resource.h" #include <cicero/cicreg.h> +#include <cicero/cicutb.h> #include <cicero/cicuif.h> #include <wine/debug.h> diff --git a/sdk/include/reactos/cicero/cicutb.h b/sdk/include/reactos/cicero/cicutb.h index 1865cbdaf7c..9c0ff831530 100644 --- a/sdk/include/reactos/cicero/cicutb.h +++ b/sdk/include/reactos/cicero/cicutb.h @@ -7,6 +7,8 @@ #pragma once +DEFINE_GUID(GUID_COMPARTMENT_SPEECH_OPENCLOSE, 0x544D6A63, 0xE2E8, 0x4752, 0xBB, 0xD1, 0x00, 0x09, 0x60, 0xBC, 0xA0, 0x83); + EXTERN_C LPVOID WINAPI GetLibTls(VOID); EXTERN_C BOOL WINAPI GetPopupTipbar(HWND hWnd, BOOL fWinLogon); EXTERN_C HRESULT WINAPI SetRegisterLangBand(BOOL bRegister);
10 months, 4 weeks
1
0
0
0
[reactos] 01/01: [MSUTB][SDK] Add Language Bar dialogs (#6422)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=934cd46df59bdc2bbd0b4…
commit 934cd46df59bdc2bbd0b4e52282b498b56310a50 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Tue Jan 30 15:38:53 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Tue Jan 30 15:38:53 2024 +0900 [MSUTB][SDK] Add Language Bar dialogs (#6422) Supporting Language Bar... JIRA issue: CORE-19363 - Add IDD_CLOSELANGBAR and IDD_MINIMIZELANGBAR resource dialogs. - Implement CUTBLangBarDlg class. - Implement CUTBCloseLangBarDlg and CUTBMinimizeLangBarDlg classes. --- dll/win32/msutb/lang/en-US.rc | 21 +++ dll/win32/msutb/msutb.cpp | 277 ++++++++++++++++++++++++++++++++++++ dll/win32/msutb/precomp.h | 1 + dll/win32/msutb/resource.h | 6 + sdk/include/reactos/cicero/cicuif.h | 2 +- 5 files changed, 306 insertions(+), 1 deletion(-) diff --git a/dll/win32/msutb/lang/en-US.rc b/dll/win32/msutb/lang/en-US.rc index c45c6e28438..98a9ea10f96 100644 --- a/dll/win32/msutb/lang/en-US.rc +++ b/dll/win32/msutb/lang/en-US.rc @@ -19,3 +19,24 @@ BEGIN IDS_MENUWND "Menu Window" IDS_LEFTCLICK "Left Click" END + +IDD_CLOSELANGBAR DIALOGEX 0, 0, 200, 105 +CAPTION "Language Bar" +STYLE WS_POPUPWINDOW | WS_CAPTION | DS_MODALFRAME +FONT 8, "MS Shell Dlg" +{ + LTEXT "You have closed Language Bar.\r\n\r\nTo use Language Bar later, check ""Show Language Bar on the desktop"" in Language Bar Settings dialog, which you can find within Regional and Language Options control panel.", -1, 5, 5, 190, 60 + AUTOCHECKBOX "&Don't show me this message again", IDC_CLOSELANGBAR_CHECK, 5, 70, 145, 10 + DEFPUSHBUTTON "OK", IDOK, 80, 85, 55, 15 + PUSHBUTTON "Cancel", IDCANCEL, 140, 85, 55, 15 +} + +IDD_MINIMIZELANGBAR DIALOGEX 0, 0, 205, 84 +CAPTION "Language Bar" +STYLE WS_POPUPWINDOW | WS_CAPTION | DS_MODALFRAME +FONT 8, "MS Shell Dlg" +{ + LTEXT "You have minimized Language Bar. To restore it, just click Language Bar icon (near the clock) and choose ""Restore Language Bar"" from the pop-up menu.", -1, 5, 5, 190, 50 + AUTOCHECKBOX "Don't show me this message again", IDC_MINIMIZELANGBAR_CHECK, 5, 65, 125, 10 + DEFPUSHBUTTON "OK", IDOK, 140, 65, 60, 15 +} diff --git a/dll/win32/msutb/msutb.cpp b/dll/win32/msutb/msutb.cpp index 615e7c47450..d6344a59a0c 100644 --- a/dll/win32/msutb/msutb.cpp +++ b/dll/win32/msutb/msutb.cpp @@ -37,6 +37,68 @@ class CUTBMenuItem; /***********************************************************************/ +class CUTBLangBarDlg +{ +protected: + LPTSTR m_pszDialogName; + LONG m_cRefs; + +public: + CUTBLangBarDlg() { } + virtual ~CUTBLangBarDlg() { } + + static CUTBLangBarDlg *GetThis(HWND hDlg); + static void SetThis(HWND hDlg, CUTBLangBarDlg *pThis); + static DWORD WINAPI s_ThreadProc(LPVOID pParam); + static INT_PTR CALLBACK DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam); + + BOOL StartThread(); + LONG _Release(); + + STDMETHOD_(BOOL, DoModal)(HWND hDlg) = 0; + STDMETHOD_(BOOL, OnCommand)(HWND hDlg, WPARAM wParam, LPARAM lParam) = 0; + STDMETHOD_(BOOL, IsDlgShown)() = 0; + STDMETHOD_(void, SetDlgShown)(BOOL bShown) = 0; + STDMETHOD_(BOOL, ThreadProc)(); +}; + +/***********************************************************************/ + +class CUTBCloseLangBarDlg : public CUTBLangBarDlg +{ +public: + CUTBCloseLangBarDlg(); + + static BOOL s_bIsDlgShown; + + STDMETHOD_(BOOL, DoModal)(HWND hDlg) override; + STDMETHOD_(BOOL, OnCommand)(HWND hDlg, WPARAM wParam, LPARAM lParam) override; + STDMETHOD_(BOOL, IsDlgShown)() override; + STDMETHOD_(void, SetDlgShown)(BOOL bShown) override; +}; + +BOOL CUTBCloseLangBarDlg::s_bIsDlgShown = FALSE; + +/***********************************************************************/ + +class CUTBMinimizeLangBarDlg : public CUTBLangBarDlg +{ +public: + CUTBMinimizeLangBarDlg(); + + static BOOL s_bIsDlgShown; + + STDMETHOD_(BOOL, DoModal)(HWND hDlg) override; + STDMETHOD_(BOOL, OnCommand)(HWND hDlg, WPARAM wParam, LPARAM lParam) override; + STDMETHOD_(BOOL, IsDlgShown)() override; + STDMETHOD_(void, SetDlgShown)(BOOL bShown) override; + STDMETHOD_(BOOL, ThreadProc)() override; +}; + +BOOL CUTBMinimizeLangBarDlg::s_bIsDlgShown = FALSE; + +/***********************************************************************/ + class CCicLibMenu : public ITfMenu { protected: @@ -344,6 +406,221 @@ protected: STDMETHOD_(LRESULT, OnDelayMsg)(LPARAM lParam) { return 0; }; }; +/*********************************************************************** + * CUTBLangBarDlg + */ + +CUTBLangBarDlg *CUTBLangBarDlg::GetThis(HWND hDlg) +{ + return (CUTBLangBarDlg*)::GetWindowLongPtr(hDlg, DWLP_USER); +} + +void CUTBLangBarDlg::SetThis(HWND hDlg, CUTBLangBarDlg *pThis) +{ + ::SetWindowLongPtr(hDlg, DWLP_USER, (LONG_PTR)pThis); +} + +DWORD WINAPI CUTBLangBarDlg::s_ThreadProc(LPVOID pParam) +{ + return ((CUTBLangBarDlg *)pParam)->ThreadProc(); +} + +BOOL CUTBLangBarDlg::StartThread() +{ + if (IsDlgShown()) + return FALSE; + + SetDlgShown(TRUE); + + DWORD dwThreadId; + HANDLE hThread = ::CreateThread(NULL, 0, s_ThreadProc, this, 0, &dwThreadId); + if (!hThread) + { + SetDlgShown(FALSE); + return TRUE; + } + + ++m_cRefs; + ::CloseHandle(hThread); + return TRUE; +} + +LONG CUTBLangBarDlg::_Release() +{ + if (--m_cRefs == 0) + { + delete this; + return 0; + } + return m_cRefs; +} + +STDMETHODIMP_(BOOL) CUTBLangBarDlg::ThreadProc() +{ + extern HINSTANCE g_hInst; + ::DialogBoxParam(g_hInst, m_pszDialogName, NULL, DlgProc, (LPARAM)this); + SetDlgShown(FALSE); + _Release(); + return TRUE; +} + +INT_PTR CALLBACK +CUTBLangBarDlg::DlgProc(HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + if (uMsg == WM_INITDIALOG) + { + SetThis(hDlg, (CUTBLangBarDlg *)lParam); + ::ShowWindow(hDlg, SW_RESTORE); + ::UpdateWindow(hDlg); + return TRUE; + } + + if (uMsg == WM_COMMAND) + { + CUTBLangBarDlg *pThis = CUTBLangBarDlg::GetThis(hDlg); + pThis->OnCommand(hDlg, wParam, lParam); + return TRUE; + } + + return FALSE; +} + +/*********************************************************************** + * CUTBCloseLangBarDlg + */ + +CUTBCloseLangBarDlg::CUTBCloseLangBarDlg() +{ + m_cRefs = 1; + m_pszDialogName = MAKEINTRESOURCE(IDD_CLOSELANGBAR); +} + +STDMETHODIMP_(BOOL) CUTBCloseLangBarDlg::DoModal(HWND hDlg) +{ + CicRegKey regKey; + LSTATUS error; + DWORD dwValue = FALSE; + error = regKey.Open(HKEY_CURRENT_USER, TEXT("SOFTWARE\\Microsoft\\CTF\\MSUTB\\")); + if (error == ERROR_SUCCESS) + regKey.QueryDword(TEXT("DontShowCloseLangBarDlg"), &dwValue); + + if (dwValue) + return FALSE; + + StartThread(); + return TRUE; +} + +/// @unimplemented +void DoCloseLangbar(void) +{ + //FIXME +} + +STDMETHODIMP_(BOOL) CUTBCloseLangBarDlg::OnCommand(HWND hDlg, WPARAM wParam, LPARAM lParam) +{ + switch (LOWORD(wParam)) + { + case IDOK: + DoCloseLangbar(); + if (::IsDlgButtonChecked(hDlg, IDC_CLOSELANGBAR_CHECK)) + { + CicRegKey regKey; + LSTATUS error; + error = regKey.Create(HKEY_CURRENT_USER, TEXT("SOFTWARE\\Microsoft\\CTF\\MSUTB\\")); + if (error == ERROR_SUCCESS) + regKey.SetDword(TEXT("DontShowCloseLangBarDlg"), TRUE); + } + ::EndDialog(hDlg, TRUE); + break; + + case IDCANCEL: + ::EndDialog(hDlg, FALSE); + break; + + default: + return FALSE; + } + return TRUE; +} + +STDMETHODIMP_(BOOL) CUTBCloseLangBarDlg::IsDlgShown() +{ + return s_bIsDlgShown; +} + +STDMETHODIMP_(void) CUTBCloseLangBarDlg::SetDlgShown(BOOL bShown) +{ + s_bIsDlgShown = bShown; +} + +/*********************************************************************** + * CUTBMinimizeLangBarDlg + */ + +CUTBMinimizeLangBarDlg::CUTBMinimizeLangBarDlg() +{ + m_cRefs = 1; + m_pszDialogName = MAKEINTRESOURCE(IDD_MINIMIZELANGBAR); +} + +STDMETHODIMP_(BOOL) CUTBMinimizeLangBarDlg::DoModal(HWND hDlg) +{ + CicRegKey regKey; + LSTATUS error; + + DWORD dwValue = FALSE; + error = regKey.Open(HKEY_CURRENT_USER, TEXT("SOFTWARE\\Microsoft\\CTF\\MSUTB\\")); + if (error == ERROR_SUCCESS) + regKey.QueryDword(TEXT("DontShowMinimizeLangBarDlg"), &dwValue); + + if (dwValue) + return FALSE; + + StartThread(); + return TRUE; +} + +STDMETHODIMP_(BOOL) CUTBMinimizeLangBarDlg::OnCommand(HWND hDlg, WPARAM wParam, LPARAM lParam) +{ + switch (LOWORD(wParam)) + { + case IDOK: + if (::IsDlgButtonChecked(hDlg, IDC_MINIMIZELANGBAR_CHECK)) + { + LSTATUS error; + CicRegKey regKey; + error = regKey.Create(HKEY_CURRENT_USER, TEXT("SOFTWARE\\Microsoft\\CTF\\MSUTB\\")); + if (error == ERROR_SUCCESS) + regKey.SetDword(TEXT("DontShowMinimizeLangBarDlg"), TRUE); + } + ::EndDialog(hDlg, TRUE); + break; + case IDCANCEL: + ::EndDialog(hDlg, FALSE); + break; + default: + return FALSE; + } + return TRUE; +} + +STDMETHODIMP_(BOOL) CUTBMinimizeLangBarDlg::IsDlgShown() +{ + return s_bIsDlgShown; +} + +STDMETHODIMP_(void) CUTBMinimizeLangBarDlg::SetDlgShown(BOOL bShown) +{ + s_bIsDlgShown = bShown; +} + +STDMETHODIMP_(BOOL) CUTBMinimizeLangBarDlg::ThreadProc() +{ + ::Sleep(700); + return CUTBLangBarDlg::ThreadProc(); +} + /*********************************************************************** * CCicLibMenu */ diff --git a/dll/win32/msutb/precomp.h b/dll/win32/msutb/precomp.h index 2f3ca726f7b..8bc4c4140a9 100644 --- a/dll/win32/msutb/precomp.h +++ b/dll/win32/msutb/precomp.h @@ -27,6 +27,7 @@ #undef STATUS_NO_MEMORY #include "resource.h" +#include <cicero/cicreg.h> #include <cicero/cicuif.h> #include <wine/debug.h> diff --git a/dll/win32/msutb/resource.h b/dll/win32/msutb/resource.h index 65532689e47..6808bd02597 100644 --- a/dll/win32/msutb/resource.h +++ b/dll/win32/msutb/resource.h @@ -9,3 +9,9 @@ #define IDS_NO 106 #define IDS_MENUWND 322 #define IDS_LEFTCLICK 323 + +#define IDD_CLOSELANGBAR 1001 +#define IDD_MINIMIZELANGBAR 1004 + +#define IDC_CLOSELANGBAR_CHECK 1002 +#define IDC_MINIMIZELANGBAR_CHECK 1002 diff --git a/sdk/include/reactos/cicero/cicuif.h b/sdk/include/reactos/cicero/cicuif.h index 218587d3296..996f48230c6 100644 --- a/sdk/include/reactos/cicero/cicuif.h +++ b/sdk/include/reactos/cicero/cicuif.h @@ -5180,7 +5180,7 @@ CUIFBalloonWindow::AddButton(UINT nCommandId) #ifdef IDS_OK extern HINSTANCE g_hInst; WCHAR szText[64]; - ::LoadStringW(g_hInst, IDS_OK + nCommandId, szText, _countof(szText)); + ::LoadStringW(g_hInst, IDS_OK + (nCommandId - IDOK), szText, _countof(szText)); pszText = szText; #else switch (nCommandId)
10 months, 4 weeks
1
0
0
0
[reactos] 01/01: [MSUTB][SDK] Add CUTBMenuWnd and CUTBMenuItem (#6420)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=1001b59a06ae73f39a5dc…
commit 1001b59a06ae73f39a5dc779e8ba81c06bd2389d Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Mon Jan 29 18:38:59 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Mon Jan 29 18:38:59 2024 +0900 [MSUTB][SDK] Add CUTBMenuWnd and CUTBMenuItem (#6420) Supporting Language Bar... JIRA issue: CORE-19363 - Implement CUTBMenuWnd and CUTBMenuItem classes. - Add IDS_MENUWND and IDS_LEFTCLICK resource strings. --- dll/win32/msutb/lang/en-US.rc | 2 + dll/win32/msutb/msutb.cpp | 294 +++++++++++++++++++++++++++++++++++- dll/win32/msutb/precomp.h | 4 +- dll/win32/msutb/resource.h | 2 + sdk/include/reactos/cicero/cicuif.h | 48 +++--- 5 files changed, 317 insertions(+), 33 deletions(-) diff --git a/dll/win32/msutb/lang/en-US.rc b/dll/win32/msutb/lang/en-US.rc index 646ca61f2c1..c45c6e28438 100644 --- a/dll/win32/msutb/lang/en-US.rc +++ b/dll/win32/msutb/lang/en-US.rc @@ -16,4 +16,6 @@ BEGIN IDS_IGNORE "&Ignore" IDS_YES "&Yes" IDS_NO "&No" + IDS_MENUWND "Menu Window" + IDS_LEFTCLICK "Left Click" END diff --git a/dll/win32/msutb/msutb.cpp b/dll/win32/msutb/msutb.cpp index 6ab8eb45b21..615e7c47450 100644 --- a/dll/win32/msutb/msutb.cpp +++ b/dll/win32/msutb/msutb.cpp @@ -33,6 +33,7 @@ CMsUtbModule gModule; class CCicLibMenuItem; class CTipbarAccItem; +class CUTBMenuItem; /***********************************************************************/ @@ -100,6 +101,7 @@ protected: BOOL m_bInitialized; CicArray<CTipbarAccItem*> m_AccItems; LONG m_cSelection; + friend class CUTBMenuWnd; public: CTipbarAccessible(CTipbarAccItem *pItem); @@ -206,9 +208,9 @@ public: { return NULL; } - STDMETHOD(DoAccDefaultAction)() + STDMETHOD_(BOOL, DoAccDefaultAction)() { - return S_OK; + return FALSE; } STDMETHOD_(BOOL, DoAccDefaultActionReal)() { @@ -218,6 +220,96 @@ public: /***********************************************************************/ +class CTipbarCoInitialize +{ +public: + BOOL m_bCoInit; + + CTipbarCoInitialize() : m_bCoInit(FALSE) { } + ~CTipbarCoInitialize() { CoUninit(); } + + HRESULT EnsureCoInit() + { + if (m_bCoInit) + return S_OK; + HRESULT hr = ::CoInitialize(NULL); + if (FAILED(hr)) + return hr; + m_bCoInit = TRUE; + return S_OK; + } + + void CoUninit() + { + if (m_bCoInit) + { + ::CoUninitialize(); + m_bCoInit = FALSE; + } + } +}; + +/***********************************************************************/ + +class CUTBMenuWnd : public CTipbarAccItem, public CUIFMenu +{ +protected: + CTipbarCoInitialize m_coInit; + CTipbarAccessible *m_pAccessible; + UINT m_nMenuWndID; + friend class CUTBMenuItem; + +public: + CUTBMenuWnd(HINSTANCE hInst, DWORD style, DWORD dwUnknown14); + + BOOL StartDoAccDefaultActionTimer(CUTBMenuItem *pTarget); + + CTipbarAccItem* GetAccItem() + { + return static_cast<CTipbarAccItem*>(this); + } + CUIFMenu* GetMenu() + { + return static_cast<CUIFMenu*>(this); + } + + STDMETHOD_(BSTR, GetAccName)() override; + STDMETHOD_(INT, GetAccRole)() override; + STDMETHOD_(void, Initialize)() override; + STDMETHOD_(void, OnCreate)(HWND hWnd) override; + STDMETHOD_(void, OnDestroy)(HWND hWnd) override; + STDMETHOD_(HRESULT, OnGetObject)(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) override; + STDMETHOD_(LRESULT, OnShowWindow)(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) override; + STDMETHOD_(void, OnTimer)(WPARAM wParam) override; +}; + +/***********************************************************************/ + +class CUTBMenuItem : public CTipbarAccItem, public CUIFMenuItem +{ +protected: + CUTBMenuWnd *m_pMenuWnd; + friend class CUTBMenuWnd; + +public: + CUTBMenuItem(CUTBMenuWnd *pMenuWnd); + ~CUTBMenuItem() override; + + CUIFMenuItem* GetMenuItem() + { + return static_cast<CUIFMenuItem*>(this); + } + + STDMETHOD_(BOOL, DoAccDefaultAction)() override; + STDMETHOD_(BOOL, DoAccDefaultActionReal)() override; + STDMETHOD_(BSTR, GetAccDefaultAction)() override; + STDMETHOD_(void, GetAccLocation)(LPRECT lprc) override; + STDMETHOD_(BSTR, GetAccName)() override; + STDMETHOD_(INT, GetAccRole)() override; +}; + +/***********************************************************************/ + class CTrayIconWnd { public: @@ -954,7 +1046,7 @@ STDMETHODIMP CTipbarAccessible::accDoDefaultAction(VARIANT varID) CTipbarAccItem *pItem = AccItemFromID(V_I4(&varID)); if (!pItem) return DISP_E_MEMBERNOTFOUND; - return pItem->DoAccDefaultAction() == 0; + return (pItem->DoAccDefaultAction() ? S_OK : S_FALSE); } STDMETHODIMP CTipbarAccessible::put_accName(VARIANT varID, BSTR name) @@ -967,6 +1059,202 @@ STDMETHODIMP CTipbarAccessible::put_accValue(VARIANT varID, BSTR value) return S_FALSE; } +/*********************************************************************** + * CUTBMenuWnd + */ + +CUTBMenuWnd::CUTBMenuWnd(HINSTANCE hInst, DWORD style, DWORD dwUnknown14) + : CUIFMenu(hInst, style, dwUnknown14) +{ +} + +BOOL CUTBMenuWnd::StartDoAccDefaultActionTimer(CUTBMenuItem *pTarget) +{ + if (!m_pAccessible) + return FALSE; + + m_nMenuWndID = m_pAccessible->GetIDOfItem(pTarget); + if (!m_nMenuWndID || m_nMenuWndID == (UINT)-1) + return FALSE; + + if (::IsWindow(m_hWnd)) + { + ::KillTimer(m_hWnd, 11); + ::SetTimer(m_hWnd, 11, 200, NULL); + } + + return TRUE; +} + +STDMETHODIMP_(BSTR) CUTBMenuWnd::GetAccName() +{ + WCHAR szText[64]; + LoadStringW(g_hInst, IDS_MENUWND, szText, _countof(szText)); + return ::SysAllocString(szText); +} + +STDMETHODIMP_(INT) CUTBMenuWnd::GetAccRole() +{ + return 9; +} + +STDMETHODIMP_(void) CUTBMenuWnd::Initialize() +{ + CTipbarAccessible *pAccessible = new(cicNoThrow) CTipbarAccessible(GetAccItem()); + if (pAccessible) + m_pAccessible = pAccessible; + + return CUIFObject::Initialize(); +} + +STDMETHODIMP_(void) CUTBMenuWnd::OnCreate(HWND hWnd) +{ + if (m_pAccessible) + m_pAccessible->SetWindow(hWnd); +} + +STDMETHODIMP_(void) CUTBMenuWnd::OnDestroy(HWND hWnd) +{ + if (m_pAccessible) + { + m_pAccessible->NotifyWinEvent(EVENT_OBJECT_DESTROY, GetAccItem()); + m_pAccessible->ClearAccItems(); + m_pAccessible->Release(); + m_pAccessible = NULL; + } + m_coInit.CoUninit(); +} + +STDMETHODIMP_(HRESULT) +CUTBMenuWnd::OnGetObject(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + if (lParam != -4) + return S_OK; + + if (!m_pAccessible) + return E_OUTOFMEMORY; + + if (m_pAccessible->m_bInitialized) + return m_pAccessible->CreateRefToAccObj(wParam); + + if (SUCCEEDED(m_coInit.EnsureCoInit())) + { + HRESULT hr = m_pAccessible->Initialize(); + if (FAILED(hr)) + { + m_pAccessible->Release(); + m_pAccessible = NULL; + return hr; + } + + m_pAccessible->NotifyWinEvent(EVENT_OBJECT_CREATE, GetAccItem()); + return m_pAccessible->CreateRefToAccObj(wParam); + } + + return S_OK; +} + +STDMETHODIMP_(LRESULT) +CUTBMenuWnd::OnShowWindow(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) +{ + if (m_pAccessible) + { + if (wParam) + { + m_pAccessible->NotifyWinEvent(EVENT_OBJECT_SHOW, GetAccItem()); + m_pAccessible->NotifyWinEvent(EVENT_OBJECT_FOCUS, GetAccItem()); + } + else + { + m_pAccessible->NotifyWinEvent(EVENT_OBJECT_HIDE, GetAccItem()); + } + } + + return ::DefWindowProc(hWnd, uMsg, wParam, lParam); +} + +STDMETHODIMP_(void) CUTBMenuWnd::OnTimer(WPARAM wParam) +{ + if (wParam == 11) + { + ::KillTimer(m_hWnd, 11); + if (m_pAccessible && m_nMenuWndID) + { + m_pAccessible->DoDefaultActionReal(m_nMenuWndID); + m_nMenuWndID = 0; + } + } +} + +/*********************************************************************** + * CUTBMenuItem + */ + +CUTBMenuItem::CUTBMenuItem(CUTBMenuWnd *pMenuWnd) + : CUIFMenuItem(pMenuWnd ? pMenuWnd->GetMenu() : NULL) +{ + m_pMenuWnd = pMenuWnd; +} + +CUTBMenuItem::~CUTBMenuItem() +{ + if (m_hbmColor) + { + ::DeleteObject(m_hbmColor); + m_hbmColor = NULL; + } + if (m_hbmMask) + { + ::DeleteObject(m_hbmMask); + m_hbmMask = NULL; + } +} + +STDMETHODIMP_(BOOL) CUTBMenuItem::DoAccDefaultAction() +{ + if (!m_pMenuWnd) + return FALSE; + + m_pMenuWnd->StartDoAccDefaultActionTimer(this); + return TRUE; +} + +STDMETHODIMP_(BOOL) CUTBMenuItem::DoAccDefaultActionReal() +{ + if (!m_pSubMenu) + OnLButtonUp(0, 0); + else + ShowSubPopup(); + return TRUE; +} + +STDMETHODIMP_(BSTR) CUTBMenuItem::GetAccDefaultAction() +{ + WCHAR szText[64]; + ::LoadStringW(g_hInst, IDS_LEFTCLICK, szText, _countof(szText)); + return ::SysAllocString(szText); +} + +STDMETHODIMP_(void) CUTBMenuItem::GetAccLocation(LPRECT lprc) +{ + GetRect(lprc); + ::ClientToScreen(m_pMenuWnd->m_hWnd, (LPPOINT)lprc); + ::ClientToScreen(m_pMenuWnd->m_hWnd, (LPPOINT)&lprc->right); +} + +STDMETHODIMP_(BSTR) CUTBMenuItem::GetAccName() +{ + return ::SysAllocString(m_pszMenuItemLeft); +} + +/// @unimplemented +STDMETHODIMP_(INT) CUTBMenuItem::GetAccRole() +{ + if (FALSE) //FIXME + return 21; + return 12; +} + /*********************************************************************** * CTrayIconItem */ diff --git a/dll/win32/msutb/precomp.h b/dll/win32/msutb/precomp.h index 7e880a30d57..2f3ca726f7b 100644 --- a/dll/win32/msutb/precomp.h +++ b/dll/win32/msutb/precomp.h @@ -25,8 +25,8 @@ #include <atlcom.h> #include <strsafe.h> #undef STATUS_NO_MEMORY + +#include "resource.h" #include <cicero/cicuif.h> #include <wine/debug.h> - -#include "resource.h" diff --git a/dll/win32/msutb/resource.h b/dll/win32/msutb/resource.h index c91662cb293..65532689e47 100644 --- a/dll/win32/msutb/resource.h +++ b/dll/win32/msutb/resource.h @@ -7,3 +7,5 @@ #define IDS_IGNORE 104 #define IDS_YES 105 #define IDS_NO 106 +#define IDS_MENUWND 322 +#define IDS_LEFTCLICK 323 diff --git a/sdk/include/reactos/cicero/cicuif.h b/sdk/include/reactos/cicero/cicuif.h index b4715f93263..218587d3296 100644 --- a/sdk/include/reactos/cicero/cicuif.h +++ b/sdk/include/reactos/cicero/cicuif.h @@ -617,8 +617,8 @@ public: STDMETHOD_(LRESULT, OnSettingChange)(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); STDMETHOD_(LRESULT, OnDisplayChange)(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { return 0; } - STDMETHOD_(LRESULT, OnGetObject)(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) - { return 0; } + STDMETHOD_(HRESULT, OnGetObject)(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) + { return S_OK; } STDMETHOD_(LRESULT, WindowProc)(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam); STDMETHOD_(BOOL, OnEraseBkGnd)(HWND hWnd, UINT uMsg, WPARAM wParam, LPARAM lParam) { return FALSE; } @@ -786,7 +786,7 @@ protected: void DrawUnderline(HDC hDC, INT xText, INT yText, HBRUSH hbr); public: - CUIFMenuItem(CUIFMenu *pMenu, BOOL bDisabled); + CUIFMenuItem(CUIFMenu *pMenu, BOOL bDisabled = FALSE); ~CUIFMenuItem() override; BOOL Init(UINT nMenuItemID, LPCWSTR pszText); @@ -2484,7 +2484,6 @@ inline BOOL cicGetIconBitmaps(HICON hIcon, HBITMAP *hbm1, HBITMAP *hbm2, const S if (!CUIFBitmapDC::s_fInitBitmapDCs) return NULL; - LONG cx, cy; SIZE size; if (pSize) { @@ -2496,8 +2495,8 @@ inline BOOL cicGetIconBitmaps(HICON hIcon, HBITMAP *hbm1, HBITMAP *hbm2, const S return FALSE; } - CUIFBitmapDC::s_phdcSrc->SetDIB(cx, cy, 1, 32); - CUIFBitmapDC::s_phdcMask->SetBitmap(cx, cy, 1, 1); + CUIFBitmapDC::s_phdcSrc->SetDIB(size.cx, size.cy, 1, 32); + CUIFBitmapDC::s_phdcMask->SetBitmap(size.cx, size.cy, 1, 1); RECT rc = { 0, 0, size.cx, size.cy }; ::FillRect(*CUIFBitmapDC::s_phdcSrc, &rc, (HBRUSH)GetStockObject(BLACK_BRUSH)); @@ -5177,31 +5176,24 @@ CUIFBalloonWindow::AddButton(UINT nCommandId) pButton->Initialize(); pButton->m_nCommandID = nCommandId; - LPCWSTR pszText; // FIXME: Use resource strings + LPCWSTR pszText; +#ifdef IDS_OK + extern HINSTANCE g_hInst; + WCHAR szText[64]; + ::LoadStringW(g_hInst, IDS_OK + nCommandId, szText, _countof(szText)); + pszText = szText; +#else switch (nCommandId) { - case IDOK: - pszText = L"OK"; - break; - case IDCANCEL: - pszText = L"Cancel"; - break; - case IDABORT: - pszText = L"&Abort"; - break; - case IDRETRY: - pszText = L"&Retry"; - break; - case IDIGNORE: - pszText = L"&Ignore"; - break; - case IDYES: - pszText = L"&Yes"; - break; - default: - pszText = L"&No"; - break; + case IDOK: pszText = L"OK"; break; + case IDCANCEL: pszText = L"Cancel"; break; + case IDABORT: pszText = L"&Abort"; break; + case IDRETRY: pszText = L"&Retry"; break; + case IDIGNORE: pszText = L"&Ignore"; break; + case IDYES: pszText = L"&Yes"; break; + default: pszText = L"&No"; break; } +#endif pButton->SetText(pszText);
11 months
1
0
0
0
[reactos] 01/01: [MSUTB] Add CTipbarAccessible (#6417)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=c0020b68219c438d47f80…
commit c0020b68219c438d47f80f9580d82710ab514f26 Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sun Jan 28 11:35:44 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Sun Jan 28 11:35:44 2024 +0900 [MSUTB] Add CTipbarAccessible (#6417) Supporting Language Bar... JIRA issue: CORE-19363 - Implement CTipbarAccessible class. - Add delay link to oleacc.dll. --- dll/win32/msutb/CMakeLists.txt | 2 +- dll/win32/msutb/msutb.cpp | 628 ++++++++++++++++++++++++++++++++++++++++- dll/win32/msutb/precomp.h | 1 + 3 files changed, 619 insertions(+), 12 deletions(-) diff --git a/dll/win32/msutb/CMakeLists.txt b/dll/win32/msutb/CMakeLists.txt index dd79a30d8c5..978742390a4 100644 --- a/dll/win32/msutb/CMakeLists.txt +++ b/dll/win32/msutb/CMakeLists.txt @@ -15,5 +15,5 @@ set_module_type(msutb win32dll) add_dependencies(msutb msctf psdk) target_link_libraries(msutb wine uuid atl_classes) add_importlibs(msutb user32 gdi32 advapi32 msvcrt kernel32 ntdll) -add_delay_importlibs(msutb comctl32 msctf ole32 oleaut32 shell32) +add_delay_importlibs(msutb comctl32 msctf ole32 oleacc oleaut32 shell32) add_cd_file(TARGET msutb DESTINATION reactos/system32 FOR all) diff --git a/dll/win32/msutb/msutb.cpp b/dll/win32/msutb/msutb.cpp index 605fc6130d4..6ab8eb45b21 100644 --- a/dll/win32/msutb/msutb.cpp +++ b/dll/win32/msutb/msutb.cpp @@ -2,7 +2,7 @@ * PROJECT: ReactOS msutb.dll * LICENSE: LGPL-2.1-or-later (
https://spdx.org/licenses/LGPL-2.1-or-later
) * PURPOSE: Language Bar (Tipbar) - * COPYRIGHT: Copyright 2023 Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> + * COPYRIGHT: Copyright 2023-2024 Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> */ #include "precomp.h" @@ -14,6 +14,7 @@ UINT g_wmTaskbarCreated = 0; UINT g_uACP = CP_ACP; DWORD g_dwOSInfo = 0; CRITICAL_SECTION g_cs; +LONG g_DllRefCount = 0; EXTERN_C void __cxa_pure_virtual(void) { @@ -31,12 +32,13 @@ END_OBJECT_MAP() CMsUtbModule gModule; class CCicLibMenuItem; +class CTipbarAccItem; /***********************************************************************/ class CCicLibMenu : public ITfMenu { -public: +protected: CicArray<CCicLibMenuItem*> m_MenuItems; LONG m_cRefs; @@ -63,7 +65,7 @@ public: class CCicLibMenuItem { -public: +protected: DWORD m_uId; DWORD m_dwFlags; HBITMAP m_hbmp; @@ -88,6 +90,92 @@ public: /***********************************************************************/ +class CTipbarAccessible : public IAccessible +{ +protected: + LONG m_cRefs; + HWND m_hWnd; + IAccessible *m_pStdAccessible; + ITypeInfo *m_pTypeInfo; + BOOL m_bInitialized; + CicArray<CTipbarAccItem*> m_AccItems; + LONG m_cSelection; + +public: + CTipbarAccessible(CTipbarAccItem *pItem); + virtual ~CTipbarAccessible(); + + HRESULT Initialize(); + + BOOL AddAccItem(CTipbarAccItem *pItem); + HRESULT RemoveAccItem(CTipbarAccItem *pItem); + void ClearAccItems(); + CTipbarAccItem *AccItemFromID(INT iItem); + INT GetIDOfItem(CTipbarAccItem *pTarget); + + LONG_PTR CreateRefToAccObj(WPARAM wParam); + BOOL DoDefaultActionReal(INT nID); + void NotifyWinEvent(DWORD event, CTipbarAccItem *pItem); + void SetWindow(HWND hWnd); + + // IUnknown methods + STDMETHOD(QueryInterface)(REFIID riid, void **ppvObject); + STDMETHOD_(ULONG, AddRef)(); + STDMETHOD_(ULONG, Release)(); + + // IDispatch methods + STDMETHOD(GetTypeInfoCount)(UINT *pctinfo); + STDMETHOD(GetTypeInfo)( + UINT iTInfo, + LCID lcid, + ITypeInfo **ppTInfo); + STDMETHOD(GetIDsOfNames)( + REFIID riid, + LPOLESTR *rgszNames, + UINT cNames, + LCID lcid, + DISPID *rgDispId); + STDMETHOD(Invoke)( + DISPID dispIdMember, + REFIID riid, + LCID lcid, + WORD wFlags, + DISPPARAMS *pDispParams, + VARIANT *pVarResult, + EXCEPINFO *pExcepInfo, + UINT *puArgErr); + + // IAccessible methods + STDMETHOD(get_accParent)(IDispatch **ppdispParent); + STDMETHOD(get_accChildCount)(LONG *pcountChildren); + STDMETHOD(get_accChild)(VARIANT varChildID, IDispatch **ppdispChild); + STDMETHOD(get_accName)(VARIANT varID, BSTR *pszName); + STDMETHOD(get_accValue)(VARIANT varID, BSTR *pszValue); + STDMETHOD(get_accDescription)(VARIANT varID, BSTR *description); + STDMETHOD(get_accRole)(VARIANT varID, VARIANT *role); + STDMETHOD(get_accState)(VARIANT varID, VARIANT *state); + STDMETHOD(get_accHelp)(VARIANT varID, BSTR *help); + STDMETHOD(get_accHelpTopic)(BSTR *helpfile, VARIANT varID, LONG *pidTopic); + STDMETHOD(get_accKeyboardShortcut)(VARIANT varID, BSTR *shortcut); + STDMETHOD(get_accFocus)(VARIANT *pvarID); + STDMETHOD(get_accSelection)(VARIANT *pvarID); + STDMETHOD(get_accDefaultAction)(VARIANT varID, BSTR *action); + STDMETHOD(accSelect)(LONG flagsSelect, VARIANT varID); + STDMETHOD(accLocation)( + LONG *left, + LONG *top, + LONG *width, + LONG *height, + VARIANT varID); + STDMETHOD(accNavigate)(LONG dir, VARIANT varStart, VARIANT *pvarEnd); + STDMETHOD(accHitTest)(LONG left, LONG top, VARIANT *pvarID); + STDMETHOD(accDoDefaultAction)(VARIANT varID); + STDMETHOD(put_accName)(VARIANT varID, BSTR name); + STDMETHOD(put_accValue)(VARIANT varID, BSTR value); +}; + +/***********************************************************************/ + class CTipbarAccItem { public: @@ -98,9 +186,9 @@ public: { return SysAllocString(L""); } - STDMETHOD(UnknownMethod1)() // FIXME: Name + STDMETHOD_(BSTR, GetAccValue)() { - return S_OK; + return NULL; } STDMETHOD_(INT, GetAccRole)() { @@ -114,17 +202,17 @@ public: { *lprc = { 0, 0, 0, 0 }; } - STDMETHOD(UnknownMethod2)() // FIXME: Name + STDMETHOD_(BSTR, GetAccDefaultAction)() { - return S_OK; + return NULL; } - STDMETHOD(UnknownMethod3)() // FIXME: Name + STDMETHOD(DoAccDefaultAction)() { return S_OK; } - STDMETHOD(UnknownMethod4)() // FIXME: Name + STDMETHOD_(BOOL, DoAccDefaultActionReal)() { - return S_OK; + return FALSE; } }; @@ -361,6 +449,524 @@ HBITMAP CCicLibMenuItem::CreateBitmap(HANDLE hBitmap) return hbmMem; } +/*********************************************************************** + * CTipbarAccessible + */ + +CTipbarAccessible::CTipbarAccessible(CTipbarAccItem *pItem) +{ + m_cRefs = 1; + m_hWnd = NULL; + m_pTypeInfo = NULL; + m_pStdAccessible = NULL; + m_bInitialized = FALSE; + m_cSelection = 1; + m_AccItems.Add(pItem); + ++g_DllRefCount; +} + +CTipbarAccessible::~CTipbarAccessible() +{ + m_pTypeInfo = m_pTypeInfo; + if (m_pTypeInfo) + { + m_pTypeInfo->Release(); + m_pTypeInfo = NULL; + } + if (m_pStdAccessible) + { + m_pStdAccessible->Release(); + m_pStdAccessible = NULL; + } + --g_DllRefCount; +} + +HRESULT CTipbarAccessible::Initialize() +{ + m_bInitialized = TRUE; + + HRESULT hr = ::CreateStdAccessibleObject(m_hWnd, OBJID_CLIENT, IID_IAccessible, + (void **)&m_pStdAccessible); + if (FAILED(hr)) + return hr; + + ITypeLib *pTypeLib; + hr = ::LoadRegTypeLib(LIBID_Accessibility, 1, 0, 0, &pTypeLib); + if (FAILED(hr)) + hr = ::LoadTypeLib(L"OLEACC.DLL", &pTypeLib); + + if (SUCCEEDED(hr)) + { + hr = pTypeLib->GetTypeInfoOfGuid(IID_IAccessible, &m_pTypeInfo); + pTypeLib->Release(); + } + + return hr; +} + +BOOL CTipbarAccessible::AddAccItem(CTipbarAccItem *pItem) +{ + return m_AccItems.Add(pItem); +} + +HRESULT CTipbarAccessible::RemoveAccItem(CTipbarAccItem *pItem) +{ + for (size_t iItem = 0; iItem < m_AccItems.size(); ++iItem) + { + if (m_AccItems[iItem] == pItem) + { + m_AccItems.Remove(iItem, 1); + break; + } + } + return S_OK; +} + +void CTipbarAccessible::ClearAccItems() +{ + m_AccItems.clear(); +} + +CTipbarAccItem *CTipbarAccessible::AccItemFromID(INT iItem) +{ + if (iItem < 0 || (INT)m_AccItems.size() <= iItem) + return NULL; + return m_AccItems[iItem]; +} + +INT CTipbarAccessible::GetIDOfItem(CTipbarAccItem *pTarget) +{ + for (size_t iItem = 0; iItem < m_AccItems.size(); ++iItem) + { + if (pTarget == m_AccItems[iItem]) + return (INT)iItem; + } + return -1; +} + +LONG_PTR CTipbarAccessible::CreateRefToAccObj(WPARAM wParam) +{ + return ::LresultFromObject(IID_IAccessible, wParam, this); +} + +BOOL CTipbarAccessible::DoDefaultActionReal(INT nID) +{ + CTipbarAccItem *pItem = AccItemFromID(nID); + if (!pItem) + return FALSE; + return pItem->DoAccDefaultActionReal(); +} + +void CTipbarAccessible::NotifyWinEvent(DWORD event, CTipbarAccItem *pItem) +{ + INT nID = GetIDOfItem(pItem); + if (nID < 0) + return; + + ::NotifyWinEvent(event, m_hWnd, -4, nID); +} + +void CTipbarAccessible::SetWindow(HWND hWnd) +{ + m_hWnd = hWnd; +} + +STDMETHODIMP CTipbarAccessible::QueryInterface( + REFIID riid, + void **ppvObject) +{ + if (IsEqualIID(riid, IID_IUnknown) || + IsEqualIID(riid, IID_IDispatch) || + IsEqualIID(riid, IID_IAccessible)) + { + *ppvObject = this; + AddRef(); + return S_OK; + } + return E_NOINTERFACE; +} + +STDMETHODIMP_(ULONG) CTipbarAccessible::AddRef() +{ + return ::InterlockedIncrement(&m_cRefs); +} + +STDMETHODIMP_(ULONG) CTipbarAccessible::Release() +{ + LONG count = ::InterlockedDecrement(&m_cRefs); + if (count == 0) + { + delete this; + return 0; + } + return count; +} + +STDMETHODIMP CTipbarAccessible::GetTypeInfoCount(UINT *pctinfo) +{ + if (!pctinfo) + return E_INVALIDARG; + *pctinfo = (m_pTypeInfo == NULL); + return S_OK; +} + +STDMETHODIMP CTipbarAccessible::GetTypeInfo( + UINT iTInfo, + LCID lcid, + ITypeInfo **ppTInfo) +{ + if (!ppTInfo) + return E_INVALIDARG; + *ppTInfo = NULL; + if (iTInfo != 0) + return TYPE_E_ELEMENTNOTFOUND; + if (!m_pTypeInfo) + return E_NOTIMPL; + *ppTInfo = m_pTypeInfo; + m_pTypeInfo->AddRef(); + return S_OK; +} + +STDMETHODIMP CTipbarAccessible::GetIDsOfNames( + REFIID riid, + LPOLESTR *rgszNames, + UINT cNames, + LCID lcid, + DISPID *rgDispId) +{ + if (!m_pTypeInfo) + return E_NOTIMPL; + return m_pTypeInfo->GetIDsOfNames(rgszNames, cNames, rgDispId); +} + +STDMETHODIMP CTipbarAccessible::Invoke( + DISPID dispIdMember, + REFIID riid, + LCID lcid, + WORD wFlags, + DISPPARAMS *pDispParams, + VARIANT *pVarResult, + EXCEPINFO *pExcepInfo, + UINT *puArgErr) +{ + if (!m_pTypeInfo) + return E_NOTIMPL; + return m_pTypeInfo->Invoke(this, + dispIdMember, + wFlags, + pDispParams, + pVarResult, + pExcepInfo, + puArgErr); +} + +STDMETHODIMP CTipbarAccessible::get_accParent(IDispatch **ppdispParent) +{ + return m_pStdAccessible->get_accParent(ppdispParent); +} + +STDMETHODIMP CTipbarAccessible::get_accChildCount(LONG *pcountChildren) +{ + if (!pcountChildren) + return E_INVALIDARG; + INT cItems = (INT)m_AccItems.size(); + if (!cItems) + return E_FAIL; + *pcountChildren = cItems - 1; + return S_OK; +} + +STDMETHODIMP CTipbarAccessible::get_accChild( + VARIANT varChildID, + IDispatch **ppdispChild) +{ + if (!ppdispChild) + return E_INVALIDARG; + *ppdispChild = NULL; + return S_FALSE; +} + +STDMETHODIMP CTipbarAccessible::get_accName( + VARIANT varID, + BSTR *pszName) +{ + if (!pszName) + return E_INVALIDARG; + CTipbarAccItem *pItem = AccItemFromID(V_I4(&varID)); + if (!pItem) + return E_INVALIDARG; + *pszName = pItem->GetAccName(); + if (!*pszName) + return DISP_E_MEMBERNOTFOUND; + return S_OK; +} + +STDMETHODIMP CTipbarAccessible::get_accValue( + VARIANT varID, + BSTR *pszValue) +{ + if (!pszValue) + return E_INVALIDARG; + CTipbarAccItem *pItem = AccItemFromID(V_I4(&varID)); + if (!pItem) + return E_INVALIDARG; + *pszValue = pItem->GetAccValue(); + if (!*pszValue) + return DISP_E_MEMBERNOTFOUND; + return S_OK; +} + +STDMETHODIMP CTipbarAccessible::get_accDescription( + VARIANT varID, + BSTR *description) +{ + if (!description) + return E_INVALIDARG; + return m_pStdAccessible->get_accDescription(varID, description); +} + +STDMETHODIMP CTipbarAccessible::get_accRole( + VARIANT varID, + VARIANT *role) +{ + if (!role) + return E_INVALIDARG; + CTipbarAccItem *pItem = AccItemFromID(V_I4(&varID)); + if (!pItem) + return E_INVALIDARG; + V_VT(role) = VT_I4; + V_I4(role) = pItem->GetAccRole(); + return S_OK; +} + +STDMETHODIMP CTipbarAccessible::get_accState( + VARIANT varID, + VARIANT *state) +{ + if (!state) + return E_INVALIDARG; + CTipbarAccItem *pItem = AccItemFromID(V_I4(&varID)); + if (!pItem) + return E_INVALIDARG; + V_VT(state) = VT_I4; + V_I4(state) = pItem->GetAccState(); + return S_OK; +} + +STDMETHODIMP CTipbarAccessible::get_accHelp(VARIANT varID, BSTR *help) +{ + return DISP_E_MEMBERNOTFOUND; +} + +STDMETHODIMP CTipbarAccessible::get_accHelpTopic( + BSTR *helpfile, + VARIANT varID, + LONG *pidTopic) +{ + return DISP_E_MEMBERNOTFOUND; +} + +STDMETHODIMP CTipbarAccessible::get_accKeyboardShortcut(VARIANT varID, BSTR *shortcut) +{ + return DISP_E_MEMBERNOTFOUND; +} + +STDMETHODIMP CTipbarAccessible::get_accFocus(VARIANT *pvarID) +{ + if (!pvarID) + return E_INVALIDARG; + V_VT(pvarID) = VT_EMPTY; + return S_FALSE; +} + +STDMETHODIMP CTipbarAccessible::get_accSelection(VARIANT *pvarID) +{ + if (!pvarID) + return E_INVALIDARG; + + V_VT(pvarID) = VT_EMPTY; + + INT cItems = (INT)m_AccItems.size(); + if (cItems < m_cSelection) + return S_FALSE; + + if (cItems > m_cSelection) + { + V_VT(pvarID) = VT_I4; + V_I4(pvarID) = m_cSelection; + } + + return S_OK; +} + +STDMETHODIMP CTipbarAccessible::get_accDefaultAction( + VARIANT varID, + BSTR *action) +{ + if (!action) + return E_INVALIDARG; + *action = NULL; + + if (V_VT(&varID) != VT_I4) + return E_INVALIDARG; + + CTipbarAccItem *pItem = AccItemFromID(V_I4(&varID)); + if (!pItem) + return DISP_E_MEMBERNOTFOUND; + *action = pItem->GetAccDefaultAction(); + if (!*action) + return S_FALSE; + return S_OK; +} + +STDMETHODIMP CTipbarAccessible::accSelect( + LONG flagsSelect, + VARIANT varID) +{ + if ((flagsSelect & SELFLAG_ADDSELECTION) && (flagsSelect & SELFLAG_REMOVESELECTION)) + return E_INVALIDARG; + if (flagsSelect & (SELFLAG_TAKEFOCUS | SELFLAG_ADDSELECTION | SELFLAG_EXTENDSELECTION)) + return S_FALSE; + if (flagsSelect & SELFLAG_REMOVESELECTION) + return S_OK; + if (V_VT(&varID) != VT_I4) + return E_INVALIDARG; + if (flagsSelect & SELFLAG_TAKESELECTION) + { + m_cSelection = V_I4(&varID); + return S_OK; + } + return S_FALSE; +} + +STDMETHODIMP CTipbarAccessible::accLocation( + LONG *left, + LONG *top, + LONG *width, + LONG *height, + VARIANT varID) +{ + if (!left || !top || !width || !height) + return E_INVALIDARG; + + if (!V_I4(&varID)) + return m_pStdAccessible->accLocation(left, top, width, height, varID); + + RECT rc; + CTipbarAccItem *pItem = AccItemFromID(V_I4(&varID)); + pItem->GetAccLocation(&rc); + + *left = rc.left; + *top = rc.top; + *width = rc.right - rc.left; + *height = rc.bottom - rc.top; + return S_OK; +} + +STDMETHODIMP CTipbarAccessible::accNavigate( + LONG dir, + VARIANT varStart, + VARIANT *pvarEnd) +{ + if (m_AccItems.size() <= 1) + { + V_VT(pvarEnd) = VT_EMPTY; + return S_OK; + } + + switch (dir) + { + case NAVDIR_UP: + case NAVDIR_LEFT: + case NAVDIR_PREVIOUS: + V_VT(pvarEnd) = VT_I4; + V_I4(pvarEnd) = V_I4(&varStart) - 1; + if (V_I4(&varStart) - 1 <= 0) + V_I4(pvarEnd) = (INT)(m_AccItems.size() - 1); + return S_OK; + + case NAVDIR_DOWN: + case NAVDIR_RIGHT: + case NAVDIR_NEXT: + V_VT(pvarEnd) = VT_I4; + V_I4(pvarEnd) = V_I4(&varStart) + 1; + if ((INT)m_AccItems.size() <= V_I4(&varStart) + 1) + V_I4(pvarEnd) = 1; + return S_OK; + + case NAVDIR_FIRSTCHILD: + V_VT(pvarEnd) = VT_I4; + V_I4(pvarEnd) = 1; + return S_OK; + + case NAVDIR_LASTCHILD: + V_VT(pvarEnd) = VT_I4; + V_I4(pvarEnd) = (INT)(m_AccItems.size() - 1); + return S_OK; + + default: + break; + } + + V_VT(pvarEnd) = VT_EMPTY; + return S_OK; +} + +STDMETHODIMP CTipbarAccessible::accHitTest(LONG left, LONG top, VARIANT *pvarID) +{ + if (!pvarID) + return E_INVALIDARG; + POINT Point = { left, top }; + RECT Rect; + ::ScreenToClient(m_hWnd, &Point); + ::GetClientRect(m_hWnd, &Rect); + + if (!::PtInRect(&Rect, Point)) + { + V_VT(pvarID) = VT_EMPTY; + return S_OK; + } + + V_VT(pvarID) = VT_I4; + V_I4(pvarID) = 0; + + for (size_t iItem = 1; iItem < m_AccItems.size(); ++iItem) + { + CTipbarAccItem *pItem = m_AccItems[iItem]; + if (pItem) + { + pItem->GetAccLocation(&Rect); + if (::PtInRect(&Rect, Point)) + { + V_I4(pvarID) = iItem; + break; + } + } + } + + return S_OK; +} + +STDMETHODIMP CTipbarAccessible::accDoDefaultAction(VARIANT varID) +{ + if (V_VT(&varID) != VT_I4) + return E_INVALIDARG; + CTipbarAccItem *pItem = AccItemFromID(V_I4(&varID)); + if (!pItem) + return DISP_E_MEMBERNOTFOUND; + return pItem->DoAccDefaultAction() == 0; +} + +STDMETHODIMP CTipbarAccessible::put_accName(VARIANT varID, BSTR name) +{ + return S_FALSE; +} + +STDMETHODIMP CTipbarAccessible::put_accValue(VARIANT varID, BSTR value) +{ + return S_FALSE; +} + /*********************************************************************** * CTrayIconItem */ @@ -509,7 +1115,7 @@ STDAPI DllUnregisterServer(VOID) STDAPI DllCanUnloadNow(VOID) { TRACE("()\n"); - return gModule.DllCanUnloadNow(); + return gModule.DllCanUnloadNow() && (g_DllRefCount == 0); } /*********************************************************************** diff --git a/dll/win32/msutb/precomp.h b/dll/win32/msutb/precomp.h index d4579a7511b..7e880a30d57 100644 --- a/dll/win32/msutb/precomp.h +++ b/dll/win32/msutb/precomp.h @@ -14,6 +14,7 @@ #define INITGUID #include <windows.h> +#include <oleacc.h> #include <imm.h> #include <ddk/immdev.h> #include <cguid.h>
11 months
1
0
0
0
[reactos] 01/01: [DESK][SHELL32] Improve French (fr-FR) translation
by Stanislav Motylkov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=b50dfbcee48b34f4255f5…
commit b50dfbcee48b34f4255f56931f1ebfb28e857006 Author: Stanislav Motylkov <x86corez(a)gmail.com> AuthorDate: Sat Jan 27 15:06:12 2024 +0300 Commit: Stanislav Motylkov <x86corez(a)gmail.com> CommitDate: Sat Jan 27 15:06:12 2024 +0300 [DESK][SHELL32] Improve French (fr-FR) translation Make "My Network Places" translation consistent. Fix suggested by Hermès Bélusca-Maïto. --- dll/cpl/desk/lang/fr-FR.rc | 2 +- dll/win32/shell32/lang/fr-FR.rc | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/dll/cpl/desk/lang/fr-FR.rc b/dll/cpl/desk/lang/fr-FR.rc index c2431b54b87..9f2fc9dd55e 100644 --- a/dll/cpl/desk/lang/fr-FR.rc +++ b/dll/cpl/desk/lang/fr-FR.rc @@ -162,7 +162,7 @@ BEGIN GROUPBOX "Icônes du Bureau", IDC_STATIC, 6, 4, 212, 40 CONTROL "&Mes documents", IDC_ICONS_MYDOCS, "button", BS_AUTOCHECKBOX | WS_TABSTOP, 14, 14, 100, 12 - CONTROL "&Favoris réseau", IDC_ICONS_MYNET, "button", + CONTROL "Mon &réseau", IDC_ICONS_MYNET, "button", BS_AUTOCHECKBOX | WS_TABSTOP, 116, 14, 100, 12 CONTROL "P&oste de travail", IDC_ICONS_MYCOMP, "button", BS_AUTOCHECKBOX | WS_TABSTOP, 14, 28, 100, 12 diff --git a/dll/win32/shell32/lang/fr-FR.rc b/dll/win32/shell32/lang/fr-FR.rc index 240305a6654..0a4e63adbb4 100644 --- a/dll/win32/shell32/lang/fr-FR.rc +++ b/dll/win32/shell32/lang/fr-FR.rc @@ -886,7 +886,7 @@ BEGIN IDS_COMMON_PICTURES "Documents\\Mes images" IDS_COMMON_VIDEO "Documents\\Mes vidéos" IDS_CDBURN_AREA "Local Settings\\Application Data\\Microsoft\\CD Burning" - IDS_NETWORKPLACE "Mes emplacements réseau" + IDS_NETWORKPLACE "Mon réseau" IDS_NEWFOLDER "Nouveau dossier" IDS_NEWITEMFORMAT "New %s" @@ -989,7 +989,7 @@ BEGIN IDS_OBJECTS_SELECTED "%d objet(s) sélectionné(s)" IDS_TITLE_MYCOMP "Poste de travail" - IDS_TITLE_MYNET "Mes emplacements réseau" + IDS_TITLE_MYNET "Mon réseau" IDS_TITLE_BIN_1 "Corbeille (pleine)" IDS_TITLE_BIN_0 "Corbeille (vide)"
11 months
1
0
0
0
[reactos] 01/01: [MSUTB] Add CTipbarAccItem (#6415)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=883863fa509d4dbd35cc0…
commit 883863fa509d4dbd35cc062990395512e12a659b Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sat Jan 27 19:25:17 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Sat Jan 27 19:25:17 2024 +0900 [MSUTB] Add CTipbarAccItem (#6415) Supporting Language Bar... JIRA issue: CORE-19363 Half-implement CTipbarAccItem class. --- dll/win32/msutb/msutb.cpp | 42 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/dll/win32/msutb/msutb.cpp b/dll/win32/msutb/msutb.cpp index 1283165d078..605fc6130d4 100644 --- a/dll/win32/msutb/msutb.cpp +++ b/dll/win32/msutb/msutb.cpp @@ -88,6 +88,48 @@ public: /***********************************************************************/ +class CTipbarAccItem +{ +public: + CTipbarAccItem() { } + virtual ~CTipbarAccItem() { } + + STDMETHOD_(BSTR, GetAccName)() + { + return SysAllocString(L""); + } + STDMETHOD(UnknownMethod1)() // FIXME: Name + { + return S_OK; + } + STDMETHOD_(INT, GetAccRole)() + { + return 10; + } + STDMETHOD_(INT, GetAccState)() + { + return 256; + } + STDMETHOD_(void, GetAccLocation)(LPRECT lprc) + { + *lprc = { 0, 0, 0, 0 }; + } + STDMETHOD(UnknownMethod2)() // FIXME: Name + { + return S_OK; + } + STDMETHOD(UnknownMethod3)() // FIXME: Name + { + return S_OK; + } + STDMETHOD(UnknownMethod4)() // FIXME: Name + { + return S_OK; + } +}; + +/***********************************************************************/ + class CTrayIconWnd { public:
11 months
1
0
0
0
[reactos] 01/01: [MSUTB] Add CCicLibMenu and CCicLibMenuItem (#6414)
by Katayama Hirofumi MZ
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=d6caac30567dfee433d1c…
commit d6caac30567dfee433d1c5ef8dce182b4106e97f Author: Katayama Hirofumi MZ <katayama.hirofumi.mz(a)gmail.com> AuthorDate: Sat Jan 27 14:06:25 2024 +0900 Commit: GitHub <noreply(a)github.com> CommitDate: Sat Jan 27 14:06:25 2024 +0900 [MSUTB] Add CCicLibMenu and CCicLibMenuItem (#6414) Supporting Language Bar... JIRA issue: CORE-19363 - Implement CCicLibMenu and CCicLibMenuItem classes. --- dll/win32/msutb/msutb.cpp | 253 ++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 253 insertions(+) diff --git a/dll/win32/msutb/msutb.cpp b/dll/win32/msutb/msutb.cpp index ec7e1ea24cb..1283165d078 100644 --- a/dll/win32/msutb/msutb.cpp +++ b/dll/win32/msutb/msutb.cpp @@ -30,6 +30,62 @@ END_OBJECT_MAP() CMsUtbModule gModule; +class CCicLibMenuItem; + +/***********************************************************************/ + +class CCicLibMenu : public ITfMenu +{ +public: + CicArray<CCicLibMenuItem*> m_MenuItems; + LONG m_cRefs; + +public: + CCicLibMenu(); + virtual ~CCicLibMenu(); + + STDMETHOD(QueryInterface)(REFIID riid, LPVOID *ppvObj) override; + STDMETHOD_(ULONG, AddRef)() override; + STDMETHOD_(ULONG, Release)() override; + STDMETHOD(AddMenuItem)( + UINT uId, + DWORD dwFlags, + HBITMAP hbmp, + HBITMAP hbmpMask, + const WCHAR *pch, + ULONG cch, + ITfMenu **ppSubMenu) override; + STDMETHOD_(CCicLibMenu*, CreateSubMenu)(); + STDMETHOD_(CCicLibMenuItem*, CreateMenuItem)(); +}; + +/***********************************************************************/ + +class CCicLibMenuItem +{ +public: + DWORD m_uId; + DWORD m_dwFlags; + HBITMAP m_hbmp; + HBITMAP m_hbmpMask; + BSTR m_bstrText; + ITfMenu *m_pMenu; + +public: + CCicLibMenuItem(); + virtual ~CCicLibMenuItem(); + + BOOL Init( + UINT uId, + DWORD dwFlags, + HBITMAP hbmp, + HBITMAP hbmpMask, + const WCHAR *pch, + ULONG cch, + ITfMenu *pMenu); + HBITMAP CreateBitmap(HANDLE hBitmap); +}; + /***********************************************************************/ class CTrayIconWnd @@ -66,6 +122,203 @@ protected: STDMETHOD_(LRESULT, OnDelayMsg)(LPARAM lParam) { return 0; }; }; +/*********************************************************************** + * CCicLibMenu + */ + +CCicLibMenu::CCicLibMenu() : m_cRefs(1) +{ +} + +CCicLibMenu::~CCicLibMenu() +{ + for (size_t iItem = 0; iItem < m_MenuItems.size(); ++iItem) + { + delete m_MenuItems[iItem]; + m_MenuItems[iItem] = NULL; + } +} + +STDMETHODIMP CCicLibMenu::QueryInterface(REFIID riid, LPVOID *ppvObj) +{ + if (IsEqualIID(riid, IID_IUnknown) || IsEqualIID(riid, IID_ITfMenu)) + { + *ppvObj = this; + AddRef(); + return S_OK; + } + return E_NOINTERFACE; +} + +STDMETHODIMP_(ULONG) CCicLibMenu::AddRef() +{ + return ++m_cRefs; +} + +STDMETHODIMP_(ULONG) CCicLibMenu::Release() +{ + if (--m_cRefs == 0) + { + delete this; + return 0; + } + return m_cRefs; +} + +STDMETHODIMP_(CCicLibMenu*) CCicLibMenu::CreateSubMenu() +{ + return new(cicNoThrow) CCicLibMenu(); +} + +STDMETHODIMP_(CCicLibMenuItem*) CCicLibMenu::CreateMenuItem() +{ + return new(cicNoThrow) CCicLibMenuItem(); +} + +STDMETHODIMP CCicLibMenu::AddMenuItem( + UINT uId, + DWORD dwFlags, + HBITMAP hbmp, + HBITMAP hbmpMask, + const WCHAR *pch, + ULONG cch, + ITfMenu **ppSubMenu) +{ + if (ppSubMenu) + *ppSubMenu = NULL; + + CCicLibMenu *pSubMenu = NULL; + if (dwFlags & TF_LBMENUF_SUBMENU) + { + if (!ppSubMenu) + return E_INVALIDARG; + pSubMenu = CreateSubMenu(); + } + + CCicLibMenuItem *pMenuItem = CreateMenuItem(); + if (!pMenuItem) + return E_OUTOFMEMORY; + + if (!pMenuItem->Init(uId, dwFlags, hbmp, hbmpMask, pch, cch, pSubMenu)) + return E_FAIL; + + if (ppSubMenu && pSubMenu) + { + *ppSubMenu = pSubMenu; + pSubMenu->AddRef(); + } + + *m_MenuItems.Append(1) = pMenuItem; + return S_OK; +} + +/*********************************************************************** + * CCicLibMenuItem + */ + +CCicLibMenuItem::CCicLibMenuItem() +{ + m_uId = 0; + m_dwFlags = 0; + m_hbmp = NULL; + m_hbmpMask = NULL; + m_bstrText = NULL; + m_pMenu = NULL; +} + +CCicLibMenuItem::~CCicLibMenuItem() +{ + if (m_pMenu) + { + m_pMenu->Release(); + m_pMenu = NULL; + } + + if (m_hbmp) + { + ::DeleteObject(m_hbmp); + m_hbmp = NULL; + } + + if (m_hbmpMask) + { + ::DeleteObject(m_hbmpMask); + m_hbmpMask = NULL; + } + + ::SysFreeString(m_bstrText); + m_bstrText = NULL; +} + +BOOL CCicLibMenuItem::Init( + UINT uId, + DWORD dwFlags, + HBITMAP hbmp, + HBITMAP hbmpMask, + const WCHAR *pch, + ULONG cch, + ITfMenu *pMenu) +{ + m_uId = uId; + m_dwFlags = dwFlags; + m_bstrText = ::SysAllocStringLen(pch, cch); + if (!m_bstrText && cch) + return FALSE; + + m_pMenu = pMenu; + m_hbmp = CreateBitmap(hbmp); + m_hbmpMask = CreateBitmap(hbmpMask); + if (hbmp) + ::DeleteObject(hbmp); + if (hbmpMask) + ::DeleteObject(hbmpMask); + + return TRUE; +} + +HBITMAP CCicLibMenuItem::CreateBitmap(HANDLE hBitmap) +{ + if (!hBitmap) + return NULL; + + HDC hDC = ::CreateDC(TEXT("DISPLAY"), NULL, NULL, NULL); + if (!hDC) + return NULL; + + HBITMAP hbmMem = NULL; + + BITMAP bm; + ::GetObject(hBitmap, sizeof(bm), &bm); + + HGDIOBJ hbmOld1 = NULL; + HDC hdcMem1 = ::CreateCompatibleDC(hDC); + if (hdcMem1) + hbmOld1 = ::SelectObject(hdcMem1, hBitmap); + + HGDIOBJ hbmOld2 = NULL; + HDC hdcMem2 = ::CreateCompatibleDC(hDC); + if (hdcMem2) + { + hbmMem = ::CreateCompatibleBitmap(hDC, bm.bmWidth, bm.bmHeight); + hbmOld2 = ::SelectObject(hdcMem2, hbmMem); + } + + ::BitBlt(hdcMem2, 0, 0, bm.bmWidth, bm.bmHeight, hdcMem1, 0, 0, SRCCOPY); + + if (hbmOld1) + ::SelectObject(hdcMem1, hbmOld1); + if (hbmOld2) + ::SelectObject(hdcMem2, hbmOld2); + + ::DeleteDC(hDC); + if (hdcMem1) + ::DeleteDC(hdcMem1); + if (hdcMem2) + ::DeleteDC(hdcMem2); + + return hbmMem; +} + /*********************************************************************** * CTrayIconItem */
11 months
1
0
0
0
[reactos] 04/04: [REGEDIT] edit.c: Display bus number as signed (it can be -1)
by Stanislav Motylkov
https://git.reactos.org/?p=reactos.git;a=commitdiff;h=deee8aaec17fe841054cd…
commit deee8aaec17fe841054cd5e8d4936e0279a3f47d Author: Stanislav Motylkov <x86corez(a)gmail.com> AuthorDate: Fri Jan 26 01:18:20 2024 +0300 Commit: Stanislav Motylkov <x86corez(a)gmail.com> CommitDate: Fri Jan 26 01:18:20 2024 +0300 [REGEDIT] edit.c: Display bus number as signed (it can be -1) --- base/applications/regedit/edit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/base/applications/regedit/edit.c b/base/applications/regedit/edit.c index ebcf410f67c..786eefc11b3 100644 --- a/base/applications/regedit/edit.c +++ b/base/applications/regedit/edit.c @@ -800,7 +800,7 @@ ParseResources(HWND hwnd) SetDlgItemTextW(hwnd, IDC_INTERFACETYPE, buffer); /* Busnumber */ - SetDlgItemInt(hwnd, IDC_BUSNUMBER, (UINT)pFullDescriptor->BusNumber, FALSE); + SetDlgItemInt(hwnd, IDC_BUSNUMBER, (UINT)pFullDescriptor->BusNumber, TRUE); /* Version */ SetDlgItemInt(hwnd, IDC_VERSION, (UINT)pPartialResourceList->Version, FALSE); @@ -1383,7 +1383,7 @@ AddRequirementsToList(HWND hwndDlg, HWND hwnd) GetInterfaceType(requirementsValueData->InterfaceType, buffer, 80); SetDlgItemTextW(hwndDlg, IDC_REQINTERFACETYPE, buffer); - SetDlgItemInt(hwndDlg, IDC_REQBUSNUMBER, (UINT)requirementsValueData->BusNumber, FALSE); + SetDlgItemInt(hwndDlg, IDC_REQBUSNUMBER, (UINT)requirementsValueData->BusNumber, TRUE); SetDlgItemInt(hwndDlg, IDC_REQSLOTNUMBER, (UINT)requirementsValueData->SlotNumber, FALSE); }
11 months
1
0
0
0
← Newer
1
2
3
4
...
19
Older →
Jump to page:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
Results per page:
10
25
50
100
200