From c5113a88d46799d050ab4f96b874f7ef46289494 Mon Sep 17 00:00:00 2001 From: Sanwer Date: Fri, 5 Nov 2021 14:04:38 +0800 Subject: [PATCH 1/4] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E9=A1=B9=E7=9B=AE?= =?UTF-8?q?=E4=BE=9D=E8=B5=96=E9=85=8D=E7=BD=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DuiLib.sln | 15 +++++++++++++++ DuiLib/DuiLib.vcxproj | 2 +- 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/DuiLib.sln b/DuiLib.sln index 2a16a36..30bbbef 100644 --- a/DuiLib.sln +++ b/DuiLib.sln @@ -6,12 +6,21 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Demos", "Demos", "{D01B5755-53F2-4929-B69C-75C99D151E6F}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "BDWallPaper", "Demos\bdwallpaper\BDWallPaper.vcxproj", "{565089A1-60C0-4281-99D7-A459E7354EEF}" + ProjectSection(ProjectDependencies) = postProject + {E106ACD7-4E53-4AEE-942B-D0DD426DB34E} = {E106ACD7-4E53-4AEE-942B-D0DD426DB34E} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "GameBox", "Demos\gamebox\GameBox.vcxproj", "{3EF9795D-3509-4664-8E73-8D315CC0B944}" + ProjectSection(ProjectDependencies) = postProject + {E106ACD7-4E53-4AEE-942B-D0DD426DB34E} = {E106ACD7-4E53-4AEE-942B-D0DD426DB34E} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "transwnd", "Demos\transwnd\transwnd.vcxproj", "{2C0EADA2-111E-4D58-B171-B1C896D7A0DE}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "XLGameBox", "Demos\xlgamebox\XLGameBox.vcxproj", "{0278E09B-92AA-4C18-ACB5-EEDF958395B1}" + ProjectSection(ProjectDependencies) = postProject + {E106ACD7-4E53-4AEE-942B-D0DD426DB34E} = {E106ACD7-4E53-4AEE-942B-D0DD426DB34E} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ADMonSetup", "Demos\ADMonSetup\ADMonSetup.vcxproj", "{46E0954B-D9BE-48D6-8573-10B4F41E0171}" ProjectSection(ProjectDependencies) = postProject @@ -19,6 +28,9 @@ Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "ADMonSetup", "Demos\ADMonSe EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AnimationWindow", "Demos\animationWindow\Desktop.vcxproj", "{56926B91-317D-4797-BB17-9A5558291743}" + ProjectSection(ProjectDependencies) = postProject + {E106ACD7-4E53-4AEE-942B-D0DD426DB34E} = {E106ACD7-4E53-4AEE-942B-D0DD426DB34E} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "UIFeatureEffect", "Demos\animationWindow\UiFeatureEffect\UIFeatureEffect.vcxproj", "{F641AB85-61BE-46D7-9656-5E930D1167E4}" EndProject @@ -35,6 +47,9 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Help", "Help", "{7BD7470A-9 EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "HiDPITest", "Demos\HiDPITest\HiDPITest.vcxproj", "{79D7FD72-256A-4C8A-A81D-E301B3C37B2C}" + ProjectSection(ProjectDependencies) = postProject + {E106ACD7-4E53-4AEE-942B-D0DD426DB34E} = {E106ACD7-4E53-4AEE-942B-D0DD426DB34E} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "TroyBrowser", "Demos\TroyBrowser\TroyBrowser.vcxproj", "{54393194-0DDC-47E9-96E9-0D3D87466403}" EndProject diff --git a/DuiLib/DuiLib.vcxproj b/DuiLib/DuiLib.vcxproj index 473c1f5..6b6e573 100644 --- a/DuiLib/DuiLib.vcxproj +++ b/DuiLib/DuiLib.vcxproj @@ -1,5 +1,5 @@  - + DebugA -- Gitee From 860f594fcc26cf47e6fa78997f796bee927cb1b0 Mon Sep 17 00:00:00 2001 From: Sanwer Date: Fri, 5 Nov 2021 14:05:38 +0800 Subject: [PATCH 2/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0ZIP=E8=B5=84=E6=BA=90?= =?UTF-8?q?=E7=9B=B4=E6=8E=A5=E5=8A=A0=E8=BD=BD=E5=87=BD=E6=95=B0SetResour?= =?UTF-8?q?ceZip(LPCTSTR=20lpResourceName,=20LPCTSTR=20lpResourceType);?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DuiLib/Core/UIManager.cpp | 20 ++++++++++++++++++-- DuiLib/Core/UIManager.h | 5 +++-- 2 files changed, 21 insertions(+), 4 deletions(-) diff --git a/DuiLib/Core/UIManager.cpp b/DuiLib/Core/UIManager.cpp index 3ac1a37..f8b2472 100644 --- a/DuiLib/Core/UIManager.cpp +++ b/DuiLib/Core/UIManager.cpp @@ -514,6 +514,22 @@ namespace DuiLib { } } + void CPaintManagerUI::SetResourceZip(LPCTSTR lpResourceName, LPCTSTR lpResourceType) + { + HRSRC hResource = ::FindResource(GetResourceDll(), lpResourceName, lpResourceType); + if( hResource != NULL ) { + DWORD dwSize = 0; + HGLOBAL hGlobal = ::LoadResource(GetResourceDll(), hResource); + if( hGlobal != NULL ) { + dwSize = ::SizeofResource(GetResourceDll(), hResource); + if( dwSize > 0 ) { + SetResourceZip((LPBYTE)::LockResource(hGlobal), dwSize); + } + } + ::FreeResource(hResource); + } + } + void CPaintManagerUI::SetResourceType(int nType) { m_nResType = nType; @@ -1058,8 +1074,8 @@ namespace DuiLib { SetPainting(true); bool bNeedSizeMsg = false; - DWORD dwWidth = rcClient.right - rcClient.left; - DWORD dwHeight = rcClient.bottom - rcClient.top; + LONG dwWidth = rcClient.right - rcClient.left; + LONG dwHeight = rcClient.bottom - rcClient.top; SetPainting(true); if( m_bUpdateNeeded ) { diff --git a/DuiLib/Core/UIManager.h b/DuiLib/Core/UIManager.h index ddf3edb..39154c1 100644 --- a/DuiLib/Core/UIManager.h +++ b/DuiLib/Core/UIManager.h @@ -52,7 +52,7 @@ namespace DuiLib { UIEVENT_SETCURSOR, UIEVENT_TIMER, UIEVENT__LAST, - }; + }UIEVENT; ///////////////////////////////////////////////////////////////////////////////////// @@ -64,7 +64,7 @@ namespace DuiLib { UIMSG_SET_DPI, // DPI WM_MENUCLICK, // ˵Ϣ UIMSG_USER = WM_USER + 100, // ԶϢ - }; + }UIMSG; ///////////////////////////////////////////////////////////////////////////////////// // @@ -290,6 +290,7 @@ namespace DuiLib { static void SetResourcePath(LPCTSTR pStrPath); static void SetResourceZip(LPVOID pVoid, unsigned int len, LPCTSTR password = NULL); static void SetResourceZip(LPCTSTR pstrZip, bool bCachedResourceZip = false, LPCTSTR password = NULL); + static void SetResourceZip(LPCTSTR lpResourceName, LPCTSTR lpResourceType); static void SetResourceType(int nType); static int GetResourceType(); static bool GetHSL(short* H, short* S, short* L); -- Gitee From a082bd9c80ae9c8fb03ef517e62eee7f87a61ca8 Mon Sep 17 00:00:00 2001 From: Sanwer Date: Fri, 5 Nov 2021 14:39:57 +0800 Subject: [PATCH 3/4] =?UTF-8?q?=E5=A2=9E=E5=8A=A0=E7=B1=BBCStdArray?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DuiLib/Utils/Utils.h | 141 ++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 140 insertions(+), 1 deletion(-) diff --git a/DuiLib/Utils/Utils.h b/DuiLib/Utils/Utils.h index ccbd669..94774ee 100644 --- a/DuiLib/Utils/Utils.h +++ b/DuiLib/Utils/Utils.h @@ -99,6 +99,145 @@ namespace DuiLib int m_nAllocated; }; + ///////////////////////////////////////////////////////////////////////////////////// + // + template + class UILIB_API CStdArray + { + public: + CStdArray(int iPreallocSize = 0) + { + m_pData = NULL; + m_nCount = 0; + m_nAllocated = iPreallocSize; + if (iPreallocSize > 0) { + m_pData = static_cast(malloc(iPreallocSize * sizeof(T))); + } + } + + CStdArray(const CStdArray& src) + { + m_pData = NULL; + m_nCount = 0; + m_nAllocated = 0; + for (int i = 0; i < src.GetSize(); i++) { + Add(src.GetAt(i)); + } + } + + ~CStdArray() + { + if (m_pData != NULL) free(m_pData); + } + + void Empty() + { + if (m_pData != NULL) free(m_pData); + m_pData = NULL; + m_nCount = m_nAllocated = 0; + } + + void Resize(int iSize) + { + Empty(); + m_pData = static_cast(malloc(iSize * sizeof(T))); + ::ZeroMemory(m_pData, iSize * sizeof(T)); + m_nAllocated = iSize; + m_nCount = iSize; + } + + bool IsEmpty() const + { + return m_nCount == 0; + } + + int Find(T pData) const + { + for (int i = 0; i < m_nCount; i++) if (m_pData[i] == pData) return i; + return -1; + } + + bool Add(T pData) + { + if (++m_nCount >= m_nAllocated) { + int nAllocated = m_nAllocated * 2; + if (nAllocated == 0) nAllocated = 11; + T* ppData = static_cast(realloc(m_pData, nAllocated * sizeof(T))); + if (ppData != NULL) { + m_nAllocated = nAllocated; + m_pData = ppData; + } + else { + --m_nCount; + return false; + } + } + m_pData[m_nCount - 1] = pData; + return true; + } + + bool SetAt(int iIndex, T pData) + { + if (iIndex < 0 || iIndex >= m_nCount) return false; + m_pData[iIndex] = pData; + return true; + } + + bool InsertAt(int iIndex, T pData) + { + if (iIndex == m_nCount) return Add(pData); + if (iIndex < 0 || iIndex > m_nCount) return false; + if (++m_nCount >= m_nAllocated) { + int nAllocated = m_nAllocated * 2; + if (nAllocated == 0) nAllocated = 11; + T* pData = static_cast(realloc(m_pData, nAllocated * sizeof(T))); + if (pData != NULL) { + m_nAllocated = nAllocated; + m_pData = pData; + } + else { + --m_nCount; + return false; + } + } + memmove(&m_pData[iIndex + 1], &m_pData[iIndex], (m_nCount - iIndex - 1) * sizeof(T)); + m_pData[iIndex] = pData; + return true; + } + + bool Remove(int iIndex) + { + if (iIndex < 0 || iIndex >= m_nCount) return false; + if (iIndex < --m_nCount) ::CopyMemory(m_pData + iIndex, m_pData + iIndex + 1, (m_nCount - iIndex) * sizeof(T)); + return true; + } + + int GetSize() const + { + return m_nCount; + } + + T* GetData() + { + return m_pData; + } + + T GetAt(int iIndex) const + { + if (iIndex < 0 || iIndex >= m_nCount) return NULL; + return m_pData[iIndex]; + } + + T operator[] (int iIndex) const + { + return m_pData[iIndex]; + } + + protected: + T* m_pData; + int m_nCount; + int m_nAllocated; + }; ///////////////////////////////////////////////////////////////////////////////////// // @@ -215,7 +354,7 @@ namespace DuiLib } vResults.push_back(text); return vResults; -} + } ///////////////////////////////////////////////////////////////////////////////////// // -- Gitee From 1b1a3d3e65b860b9eb30fe6a965d1492a60318d9 Mon Sep 17 00:00:00 2001 From: Sanwer Date: Fri, 5 Nov 2021 14:41:11 +0800 Subject: [PATCH 4/4] =?UTF-8?q?=E5=85=BC=E5=AE=B9=E6=80=A7=E6=9B=B4?= =?UTF-8?q?=E6=96=B0=EF=BC=8C=E4=BC=98=E5=8C=96=E4=BA=86=E4=B8=80=E4=BA=9B?= =?UTF-8?q?=E7=BC=96=E8=AF=91=E8=AD=A6=E5=91=8A=E9=A1=B9=E7=AD=89?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- DuiLib/Control/UIAnimation.cpp | 4 +- DuiLib/Control/UIEdit.cpp | 2 +- DuiLib/Control/UIFadeButton.cpp | 2 +- DuiLib/Control/UIHotKey.cpp | 4 +- DuiLib/Control/UIIPAddress.cpp | 2 +- DuiLib/Control/UIList.cpp | 30 ++++++------ DuiLib/Control/UIList.h | 4 +- DuiLib/Control/UIListEx.cpp | 12 ++--- DuiLib/Control/UIListEx.h | 2 +- DuiLib/Control/UIProgress.cpp | 4 +- DuiLib/Control/UIRing.cpp | 2 +- DuiLib/Control/UIScrollBar.cpp | 67 +++++++++++++------------- DuiLib/Control/UISlider.cpp | 10 ++-- DuiLib/Control/UIText.cpp | 4 +- DuiLib/Core/UIBase.cpp | 9 ++-- DuiLib/Core/UIControl.cpp | 20 ++++---- DuiLib/Core/UIMarkup.cpp | 10 ++-- DuiLib/Core/UIRender.cpp | 36 +++++++------- DuiLib/Layout/UIAnimationTabLayout.cpp | 2 +- DuiLib/Layout/UIHorizontalLayout.cpp | 2 +- DuiLib/Layout/UIVerticalLayout.cpp | 2 +- DuiLib/Utils/UIShadow.cpp | 4 +- 22 files changed, 117 insertions(+), 117 deletions(-) diff --git a/DuiLib/Control/UIAnimation.cpp b/DuiLib/Control/UIAnimation.cpp index 2ff7154..84f43c5 100644 --- a/DuiLib/Control/UIAnimation.cpp +++ b/DuiLib/Control/UIAnimation.cpp @@ -71,7 +71,7 @@ namespace DuiLib { } else { - int nCount = m_pImp->m_arAnimations.size(); + size_t nCount = m_pImp->m_arAnimations.size(); for(int i=0; im_arAnimations[i]; @@ -166,7 +166,7 @@ namespace DuiLib { CAnimationData* CUIAnimation::GetAnimationDataByID(int nAnimationID) { CAnimationData* pRet = NULL; - int nCount = m_pImp->m_arAnimations.size(); + size_t nCount = m_pImp->m_arAnimations.size(); for(int i=0; im_arAnimations[i]->m_nAnimationID == nAnimationID) diff --git a/DuiLib/Control/UIEdit.cpp b/DuiLib/Control/UIEdit.cpp index 9777e94..11398f9 100644 --- a/DuiLib/Control/UIEdit.cpp +++ b/DuiLib/Control/UIEdit.cpp @@ -277,7 +277,7 @@ namespace DuiLib if( event.Type == UIEVENT_SETCURSOR && IsEnabled() ) { - ::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_IBEAM))); + ::SetCursor(::LoadCursor(NULL, IDC_IBEAM)); return; } if( event.Type == UIEVENT_WINDOWSIZE ) diff --git a/DuiLib/Control/UIFadeButton.cpp b/DuiLib/Control/UIFadeButton.cpp index f4e6d0e..91f3f27 100644 --- a/DuiLib/Control/UIFadeButton.cpp +++ b/DuiLib/Control/UIFadeButton.cpp @@ -35,7 +35,7 @@ namespace DuiLib { void CFadeButtonUI::DoEvent(TEventUI& event) { if( event.Type == UIEVENT_TIMER ) { - OnTimer( event.wParam ); + OnTimer((int)event.wParam); } else if(IsEnabled()) { if( event.Type == UIEVENT_MOUSEENTER && !IsAnimationRunning( FADE_IN_ID ) ) diff --git a/DuiLib/Control/UIHotKey.cpp b/DuiLib/Control/UIHotKey.cpp index eec5438..366fc06 100644 --- a/DuiLib/Control/UIHotKey.cpp +++ b/DuiLib/Control/UIHotKey.cpp @@ -147,7 +147,7 @@ namespace DuiLib{ DWORD CHotKeyWnd::GetHotKey() const { ASSERT(::IsWindow(m_hWnd)); - return (::SendMessage(m_hWnd, HKM_GETHOTKEY, 0, 0L)); + return ((DWORD)::SendMessage(m_hWnd, HKM_GETHOTKEY, 0, 0L)); } void CHotKeyWnd::GetHotKey(WORD &wVirtualKeyCode, WORD &wModifiers) const @@ -269,7 +269,7 @@ namespace DuiLib{ if( event.Type == UIEVENT_SETCURSOR && IsEnabled() ) { - ::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_IBEAM))); + ::SetCursor(::LoadCursor(NULL, IDC_IBEAM)); return; } if( event.Type == UIEVENT_WINDOWSIZE ) diff --git a/DuiLib/Control/UIIPAddress.cpp b/DuiLib/Control/UIIPAddress.cpp index bf8f419..52314e2 100644 --- a/DuiLib/Control/UIIPAddress.cpp +++ b/DuiLib/Control/UIIPAddress.cpp @@ -234,7 +234,7 @@ namespace DuiLib if( event.Type == UIEVENT_SETCURSOR && IsEnabled() ) { - ::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_IBEAM))); + ::SetCursor(::LoadCursor(NULL, IDC_IBEAM)); return; } if( event.Type == UIEVENT_WINDOWSIZE ) diff --git a/DuiLib/Control/UIList.cpp b/DuiLib/Control/UIList.cpp index f35c8fd..d8c25fd 100644 --- a/DuiLib/Control/UIList.cpp +++ b/DuiLib/Control/UIList.cpp @@ -450,7 +450,7 @@ namespace DuiLib { // жǷϷб if (iIndex < 0) return false; // Ѿѡ - int aIndex = m_aSelItems.Find((LPVOID)iIndex); + int aIndex = m_aSelItems.Find(iIndex); if (aIndex != -1) return true; // ѡǰб CControlUI* pControl = GetItemAt(iIndex); @@ -462,7 +462,7 @@ namespace DuiLib { } int iLastSel = m_iCurSel; m_iCurSel = iIndex; - m_aSelItems.Add((LPVOID)iIndex); + m_aSelItems.Add(iIndex); EnsureVisible(iIndex); if (bTakeFocus) pControl->SetFocus(); @@ -501,7 +501,7 @@ namespace DuiLib { // ѡж if ((GetKeyState(VK_CONTROL) & 0x8000)) { - int aIndex = m_aSelItems.Find((LPVOID)iIndex); + int aIndex = m_aSelItems.Find(iIndex); if (aIndex != -1) { if (!pListItem->SelectMulti(false)) return false; if (m_iCurSel == iIndex) m_iCurSel = -1; @@ -511,7 +511,7 @@ namespace DuiLib { if (!pListItem->SelectMulti(true)) return false; m_iCurSel = iIndex; - m_aSelItems.Add((LPVOID)iIndex); + m_aSelItems.Add(iIndex); EnsureVisible(iIndex); if (bTakeFocus) pControl->SetFocus(); if (m_pManager != NULL) { @@ -536,7 +536,7 @@ namespace DuiLib { IListItemUI* pSelListItem = static_cast(pSelControl->GetInterface(_T("ListItem"))); if (pSelListItem == NULL) continue; if (!pSelListItem->SelectMulti(true)) continue; - m_aSelItems.Add((LPVOID)index); + m_aSelItems.Add(index); } m_iCurSel = iIndex; @@ -550,7 +550,7 @@ namespace DuiLib { if (!pListItem->SelectMulti(true)) return false; m_iCurSel = iIndex; - m_aSelItems.Add((LPVOID)iIndex); + m_aSelItems.Add(iIndex); EnsureVisible(iIndex); if (bTakeFocus) pControl->SetFocus(); if (m_pManager != NULL) { @@ -594,7 +594,7 @@ namespace DuiLib { if (!pControl->IsEnabled()) return false; IListItemUI* pListItem = static_cast(pControl->GetInterface(_T("ListItem"))); if (pListItem == NULL) return false; - int aIndex = m_aSelItems.Find((LPVOID)iIndex); + int aIndex = m_aSelItems.Find(iIndex); if (aIndex < 0) return false; if (!pListItem->SelectMulti(false)) return false; if (m_iCurSel == iIndex) m_iCurSel = -1; @@ -613,9 +613,9 @@ namespace DuiLib { IListItemUI* pListItem = static_cast(pControl->GetInterface(_T("ListItem"))); if (pListItem == NULL) continue; if (!pListItem->SelectMulti(true)) continue; - int aIndex = m_aSelItems.Find((LPVOID)i); + int aIndex = m_aSelItems.Find(i); if (aIndex < 0) { - m_aSelItems.Add((LPVOID)i); + m_aSelItems.Add(i); } m_iCurSel = i; } @@ -649,7 +649,7 @@ namespace DuiLib { if (nItem < 0) { return (int)m_aSelItems.GetAt(0); } - int aIndex = m_aSelItems.Find((LPVOID)nItem); + int aIndex = m_aSelItems.Find(nItem); if (aIndex < 0) return -1; if (aIndex + 1 > m_aSelItems.GetSize() - 1) return -1; @@ -1966,7 +1966,7 @@ namespace DuiLib { else rcSeparator.right += 4; if (IsEnabled() && m_bDragable && ::PtInRect(&rcSeparator, event.ptMouse)) { - ::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZEWE))); + ::SetCursor(::LoadCursor(NULL, IDC_SIZEWE)); return; } } @@ -2544,7 +2544,7 @@ namespace DuiLib { TListInfoUI* pInfo = m_pOwner->GetListInfo(); if( iIndex < 0 || iIndex >= pInfo->nColumns || m_aTextColors.GetSize() <= 0 ) return pInfo->dwTextColor; - DWORD dwColor = (DWORD)m_aTextColors.GetAt(iIndex); + DWORD dwColor = m_aTextColors.GetAt(iIndex); return dwColor; } @@ -2554,8 +2554,8 @@ namespace DuiLib { TListInfoUI* pInfo = m_pOwner->GetListInfo(); if( iIndex < 0 || iIndex >= pInfo->nColumns ) return; - while( m_aTextColors.GetSize() < pInfo->nColumns ) { m_aTextColors.Add((LPVOID)pInfo->dwTextColor); } - m_aTextColors.SetAt(iIndex, (LPVOID)dwTextColor); + while (m_aTextColors.GetSize() < pInfo->nColumns) { m_aTextColors.Add(pInfo->dwTextColor); } + m_aTextColors.SetAt(iIndex, dwTextColor); Invalidate(); } @@ -2584,7 +2584,7 @@ namespace DuiLib { if (event.Type == UIEVENT_SETCURSOR) { for (int i = 0; i < m_nLinks; i++) { if (::PtInRect(&m_rcLinks[i], event.ptMouse)) { - ::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_HAND))); + ::SetCursor(::LoadCursor(NULL, IDC_HAND)); return; } } diff --git a/DuiLib/Control/UIList.h b/DuiLib/Control/UIList.h index 8e79422..b854e79 100644 --- a/DuiLib/Control/UIList.h +++ b/DuiLib/Control/UIList.h @@ -242,7 +242,7 @@ namespace DuiLib { bool m_bMultiSel; int m_iCurSel; int m_iFirstSel; - CStdPtrArray m_aSelItems; + CStdArray m_aSelItems; int m_iCurSelActivate; // ˫ int m_iExpandedItem; IListCallbackUI* m_pCallback; @@ -470,7 +470,7 @@ namespace DuiLib { int m_nHoverLink; IListUI* m_pOwner; CStdPtrArray m_aTexts; - CStdPtrArray m_aTextColors; + CStdArray m_aTextColors; }; ///////////////////////////////////////////////////////////////////////////////////// diff --git a/DuiLib/Control/UIListEx.cpp b/DuiLib/Control/UIListEx.cpp index faa39a0..366e84f 100644 --- a/DuiLib/Control/UIListEx.cpp +++ b/DuiLib/Control/UIListEx.cpp @@ -134,7 +134,7 @@ namespace DuiLib { CListTextExtElementUI* pLItem = static_cast(p->GetInterface(_T("ListTextExElement"))); if (pLItem != NULL && pLItem == msg.pSender) { - OnListItemChecked(LOWORD(msg.wParam), HIWORD(msg.wParam), msg.lParam); + OnListItemChecked(LOWORD(msg.wParam), HIWORD(msg.wParam), (BOOL)msg.lParam); break; } } @@ -168,8 +168,8 @@ namespace DuiLib { else if (_tcsicmp(strName, _T("ListEx_Combo")) == 0 && m_pComboBoxUI && m_nRow >= 0 && m_nColum >= 0) { int iCurSel, iOldSel; - iCurSel = msg.wParam; - iOldSel = msg.lParam; + iCurSel = (int)msg.wParam; + iOldSel = (int)msg.lParam; if(_tcsicmp(msg.sType, DUI_MSGTYPE_SETFOCUS) == 0) { @@ -392,7 +392,7 @@ namespace DuiLib { else return 0; } - void CListContainerHeaderItemUI::SetEnabled(BOOL bEnable) + void CListContainerHeaderItemUI::SetEnabled(bool bEnable) { CContainerUI::SetEnabled(bEnable); if( !IsEnabled() ) { @@ -745,7 +745,7 @@ namespace DuiLib { else rcSeparator.right+=4; if( IsEnabled() && m_bDragable && ::PtInRect(&rcSeparator, event.ptMouse) ) { - ::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZEWE))); + ::SetCursor(::LoadCursor(NULL, IDC_SIZEWE)); return; } } @@ -1139,7 +1139,7 @@ Label_ForeImage: if( event.Type == UIEVENT_SETCURSOR ) { for( int i = 0; i < m_nLinks; i++ ) { if( ::PtInRect(&m_rcLinks[i], event.ptMouse) ) { - ::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_HAND))); + ::SetCursor(::LoadCursor(NULL, IDC_HAND)); return; } } diff --git a/DuiLib/Control/UIListEx.h b/DuiLib/Control/UIListEx.h index f2c057f..18af0b2 100644 --- a/DuiLib/Control/UIListEx.h +++ b/DuiLib/Control/UIListEx.h @@ -83,7 +83,7 @@ namespace DuiLib { LPVOID GetInterface(LPCTSTR pstrName); UINT GetControlFlags() const; - void SetEnabled(BOOL bEnable = TRUE); + void SetEnabled(bool bEnable = true); BOOL IsDragable() const; void SetDragable(BOOL bDragable); diff --git a/DuiLib/Control/UIProgress.cpp b/DuiLib/Control/UIProgress.cpp index 3d40439..ca277f9 100644 --- a/DuiLib/Control/UIProgress.cpp +++ b/DuiLib/Control/UIProgress.cpp @@ -122,11 +122,11 @@ namespace DuiLib RECT rc = {0}; if( m_bHorizontal ) { - rc.right = (m_nValue - m_nMin) * (m_rcItem.right - m_rcItem.left) * 1.0f / (m_nMax - m_nMin); + rc.right = (LONG)((m_nValue - m_nMin) * (m_rcItem.right - m_rcItem.left) * 1.0f / (m_nMax - m_nMin)); rc.bottom = m_rcItem.bottom - m_rcItem.top; } else { - rc.top = (m_rcItem.bottom - m_rcItem.top) * (m_nMax - m_nValue) * 1.0f / (m_nMax - m_nMin); + rc.top = (LONG)((m_rcItem.bottom - m_rcItem.top) * (m_nMax - m_nValue) * 1.0f / (m_nMax - m_nMin)); rc.right = m_rcItem.right - m_rcItem.left; rc.bottom = m_rcItem.bottom - m_rcItem.top; } diff --git a/DuiLib/Control/UIRing.cpp b/DuiLib/Control/UIRing.cpp index 8512ac4..e96dcc3 100644 --- a/DuiLib/Control/UIRing.cpp +++ b/DuiLib/Control/UIRing.cpp @@ -51,7 +51,7 @@ namespace DuiLib RECT rcItem = m_rcItem; int iWidth = rcItem.right - rcItem.left; int iHeight = rcItem.bottom - rcItem.top; - Gdiplus::PointF centerPos(rcItem.left + iWidth/2, rcItem.top + iHeight/2); + Gdiplus::PointF centerPos((Gdiplus::REAL)(rcItem.left + iWidth / 2), (Gdiplus::REAL)(rcItem.top + iHeight / 2)); Gdiplus::Graphics graphics(hDC); graphics.TranslateTransform(centerPos.X,centerPos.Y); diff --git a/DuiLib/Control/UIScrollBar.cpp b/DuiLib/Control/UIScrollBar.cpp index b917684..4ff6be5 100644 --- a/DuiLib/Control/UIScrollBar.cpp +++ b/DuiLib/Control/UIScrollBar.cpp @@ -91,7 +91,7 @@ namespace DuiLib int CScrollBarUI::GetScrollRange() const { - return m_nRange; + return (int)m_nRange; } void CScrollBarUI::SetScrollRange(int nRange) @@ -106,7 +106,7 @@ namespace DuiLib int CScrollBarUI::GetScrollPos() const { - return m_nScrollPos; + return (int)m_nScrollPos; } void CScrollBarUI::SetScrollPos(int nPos) @@ -409,10 +409,10 @@ namespace DuiLib m_rcThumb.top = rc.top; m_rcThumb.bottom = rc.top + cxyFixed.cy; if( m_nRange > 0 ) { - int cxThumb = cx * (rc.right - rc.left) / (m_nRange + rc.right - rc.left); + int cxThumb = (int)(cx * (rc.right - rc.left) / (m_nRange + rc.right - rc.left)); if( cxThumb < cxyFixed.cy ) cxThumb = cxyFixed.cy; - m_rcThumb.left = m_nScrollPos * (cx - cxThumb) / m_nRange + m_rcButton1.right; + m_rcThumb.left = (LONG)(m_nScrollPos * (cx - cxThumb) / m_nRange + m_rcButton1.right); m_rcThumb.right = m_rcThumb.left + cxThumb; if( m_rcThumb.right > m_rcButton2.left ) { m_rcThumb.left = m_rcButton2.left - cxThumb; @@ -482,10 +482,10 @@ namespace DuiLib m_rcThumb.left = rc.left; m_rcThumb.right = rc.left + cxyFixed.cx; if( m_nRange > 0 ) { - int cyThumb = cy * (rc.bottom - rc.top) / (m_nRange + rc.bottom - rc.top); + int cyThumb = (int)(cy * (rc.bottom - rc.top) / (m_nRange + rc.bottom - rc.top)); if( cyThumb < cxyFixed.cx ) cyThumb = cxyFixed.cx; - m_rcThumb.top = (m_nScrollPos * 1.0f / m_nRange) * (cy - cyThumb) + m_rcButton1.bottom; + m_rcThumb.top = (LONG)((m_nScrollPos * 1.0f / m_nRange) * (cy - cyThumb) + m_rcButton1.bottom); m_rcThumb.bottom = m_rcThumb.top + cyThumb; if( m_rcThumb.bottom > m_rcButton2.top ) { m_rcThumb.top = m_rcButton2.top - cyThumb; @@ -554,50 +554,49 @@ namespace DuiLib m_uButton1State |= UISTATE_PUSHED; if( !m_bHorizontal ) { if( m_pOwner != NULL ) m_pOwner->LineUp(); - else SetScrollPos(m_nScrollPos - m_nLineSize); + else SetScrollPos((int)(m_nScrollPos - m_nLineSize)); } else { - if( m_pOwner != NULL ) m_pOwner->LineLeft(); - else SetScrollPos(m_nScrollPos - m_nLineSize); + if (m_pOwner != NULL) m_pOwner->LineLeft(); + else SetScrollPos((int)(m_nScrollPos - m_nLineSize)); } } else if( ::PtInRect(&m_rcButton2, event.ptMouse) ) { m_uButton2State |= UISTATE_PUSHED; if( !m_bHorizontal ) { - if( m_pOwner != NULL ) m_pOwner->LineDown(); - else SetScrollPos(m_nScrollPos + m_nLineSize); + if (m_pOwner != NULL) m_pOwner->LineDown(); + else SetScrollPos((int)(m_nScrollPos + m_nLineSize)); } else { - if( m_pOwner != NULL ) m_pOwner->LineRight(); - else SetScrollPos(m_nScrollPos + m_nLineSize); + if (m_pOwner != NULL) m_pOwner->LineRight(); + else SetScrollPos((int)(m_nScrollPos + m_nLineSize)); } } else if( ::PtInRect(&m_rcThumb, event.ptMouse) ) { m_uThumbState |= UISTATE_CAPTURED | UISTATE_PUSHED; m_ptLastMouse = event.ptMouse; - m_nLastScrollPos = m_nScrollPos; - + m_nLastScrollPos = (int)m_nScrollPos; m_pManager->SetTimer(this, DEFAULT_TIMERID, 50U); } else { if( !m_bHorizontal ) { if( event.ptMouse.y < m_rcThumb.top ) { - if( m_pOwner != NULL ) m_pOwner->PageUp(); - else SetScrollPos(m_nScrollPos + m_rcItem.top - m_rcItem.bottom); + if (m_pOwner != NULL) m_pOwner->PageUp(); + else SetScrollPos((int)(m_nScrollPos + m_rcItem.top - m_rcItem.bottom)); } else if ( event.ptMouse.y > m_rcThumb.bottom ){ - if( m_pOwner != NULL ) m_pOwner->PageDown(); - else SetScrollPos(m_nScrollPos - m_rcItem.top + m_rcItem.bottom); + if (m_pOwner != NULL) m_pOwner->PageDown(); + else SetScrollPos((int)(m_nScrollPos - m_rcItem.top + m_rcItem.bottom)); } } else { if( event.ptMouse.x < m_rcThumb.left ) { - if( m_pOwner != NULL ) m_pOwner->PageLeft(); - else SetScrollPos(m_nScrollPos + m_rcItem.left - m_rcItem.right); + if (m_pOwner != NULL) m_pOwner->PageLeft(); + else SetScrollPos((int)(m_nScrollPos + m_rcItem.left - m_rcItem.right)); } else if ( event.ptMouse.x > m_rcThumb.right ){ - if( m_pOwner != NULL ) m_pOwner->PageRight(); - else SetScrollPos(m_nScrollPos - m_rcItem.left + m_rcItem.right); + if (m_pOwner != NULL) m_pOwner->PageRight(); + else SetScrollPos((int)(m_nScrollPos - m_rcItem.left + m_rcItem.right)); } } } @@ -634,7 +633,7 @@ namespace DuiLib if(GetShowButton2()) nBtnSize += m_cxyFixed.cx; int vRange = m_rcItem.bottom - m_rcItem.top - (m_rcThumb.bottom - m_rcThumb.top) - nBtnSize; if (vRange != 0){ - m_nLastScrollOffset = fMouseRange / abs(vRange); + m_nLastScrollOffset = (int)(fMouseRange / abs(vRange)); } } else { @@ -643,7 +642,7 @@ namespace DuiLib if(GetShowButton1()) nBtnSize += m_cxyFixed.cy; if(GetShowButton2()) nBtnSize += m_cxyFixed.cy; int hRange = m_rcItem.right - m_rcItem.left - m_rcThumb.right + m_rcThumb.left - nBtnSize; - if (hRange != 0) m_nLastScrollOffset = fMouseRange / abs(hRange); + if (hRange != 0) m_nLastScrollOffset = (int)(fMouseRange / abs(hRange)); } } else { @@ -687,22 +686,22 @@ namespace DuiLib if( m_nScrollRepeatDelay <= 5 ) return; if( !m_bHorizontal ) { if( m_pOwner != NULL ) m_pOwner->LineUp(); - else SetScrollPos(m_nScrollPos - m_nLineSize); + else SetScrollPos((int)(m_nScrollPos - m_nLineSize)); } else { if( m_pOwner != NULL ) m_pOwner->LineLeft(); - else SetScrollPos(m_nScrollPos - m_nLineSize); + else SetScrollPos((int)(m_nScrollPos - m_nLineSize)); } } else if( (m_uButton2State & UISTATE_PUSHED) != 0 ) { if( m_nScrollRepeatDelay <= 5 ) return; if( !m_bHorizontal ) { if( m_pOwner != NULL ) m_pOwner->LineDown(); - else SetScrollPos(m_nScrollPos + m_nLineSize); + else SetScrollPos((int)(m_nScrollPos + m_nLineSize)); } else { if( m_pOwner != NULL ) m_pOwner->LineRight(); - else SetScrollPos(m_nScrollPos + m_nLineSize); + else SetScrollPos((int)(m_nScrollPos + m_nLineSize)); } } else { @@ -717,17 +716,17 @@ namespace DuiLib } else if ( pt.y > m_rcThumb.bottom ){ if( m_pOwner != NULL ) m_pOwner->PageDown(); - else SetScrollPos(m_nScrollPos - m_rcItem.top + m_rcItem.bottom); + else SetScrollPos((int)(m_nScrollPos - m_rcItem.top + m_rcItem.bottom)); } } else { if( pt.x < m_rcThumb.left ) { - if( m_pOwner != NULL ) m_pOwner->PageLeft(); - else SetScrollPos(m_nScrollPos + m_rcItem.left - m_rcItem.right); + if( m_pOwner != NULL ) m_pOwner->PageLeft(); + else SetScrollPos((int)(m_nScrollPos + m_rcItem.left - m_rcItem.right)); } else if ( pt.x > m_rcThumb.right ){ - if( m_pOwner != NULL ) m_pOwner->PageRight(); - else SetScrollPos(m_nScrollPos - m_rcItem.left + m_rcItem.right); + if( m_pOwner != NULL ) m_pOwner->PageRight(); + else SetScrollPos((int)(m_nScrollPos - m_rcItem.left + m_rcItem.right)); } } } diff --git a/DuiLib/Control/UISlider.cpp b/DuiLib/Control/UISlider.cpp index aa42e68..84deb2c 100644 --- a/DuiLib/Control/UISlider.cpp +++ b/DuiLib/Control/UISlider.cpp @@ -128,12 +128,12 @@ namespace DuiLib if( m_bHorizontal ) { if( event.ptMouse.x >= m_rcItem.right - m_szThumb.cx / 2 ) nValue = m_nMax; else if( event.ptMouse.x <= m_rcItem.left + m_szThumb.cx / 2 ) nValue = m_nMin; - else nValue = m_nMin + 1.0f * (m_nMax - m_nMin) * (event.ptMouse.x - m_rcItem.left - m_szThumb.cx / 2 ) / (m_rcItem.right - m_rcItem.left - m_szThumb.cx); + else nValue = (int)(m_nMin + 1.0f * (m_nMax - m_nMin) * (event.ptMouse.x - m_rcItem.left - m_szThumb.cx / 2) / (m_rcItem.right - m_rcItem.left - m_szThumb.cx)); } else { if( event.ptMouse.y >= m_rcItem.bottom - m_szThumb.cy / 2 ) nValue = m_nMin; else if( event.ptMouse.y <= m_rcItem.top + m_szThumb.cy / 2 ) nValue = m_nMax; - else nValue = m_nMin + 1.0f * (m_nMax - m_nMin) * (m_rcItem.bottom - event.ptMouse.y - m_szThumb.cy / 2 ) / (m_rcItem.bottom - m_rcItem.top - m_szThumb.cy); + else nValue = (int)(m_nMin + 1.0f * (m_nMax - m_nMin) * (m_rcItem.bottom - event.ptMouse.y - m_szThumb.cy / 2) / (m_rcItem.bottom - m_rcItem.top - m_szThumb.cy)); } if(m_nValue != nValue && nValue >= m_nMin && nValue <= m_nMax) { m_nValue = nValue; @@ -193,12 +193,12 @@ namespace DuiLib if( m_bHorizontal ) { if( event.ptMouse.x >= m_rcItem.right - m_szThumb.cx / 2 ) m_nValue = m_nMax; else if( event.ptMouse.x <= m_rcItem.left + m_szThumb.cx / 2 ) m_nValue = m_nMin; - else m_nValue = m_nMin + 1.0f * (m_nMax - m_nMin) * (event.ptMouse.x - m_rcItem.left - m_szThumb.cx / 2 ) / (m_rcItem.right - m_rcItem.left - m_szThumb.cx); + else m_nValue = (int)(m_nMin + 1.0f * (m_nMax - m_nMin) * (event.ptMouse.x - m_rcItem.left - m_szThumb.cx / 2) / (m_rcItem.right - m_rcItem.left - m_szThumb.cx)); } else { if( event.ptMouse.y >= m_rcItem.bottom - m_szThumb.cy / 2 ) m_nValue = m_nMin; else if( event.ptMouse.y <= m_rcItem.top + m_szThumb.cy / 2 ) m_nValue = m_nMax; - else m_nValue = m_nMin + 1.0f * (m_nMax - m_nMin) * (m_rcItem.bottom - event.ptMouse.y - m_szThumb.cy / 2 ) / (m_rcItem.bottom - m_rcItem.top - m_szThumb.cy); + else m_nValue = (int)(m_nMin + 1.0f * (m_nMax - m_nMin) * (m_rcItem.bottom - event.ptMouse.y - m_szThumb.cy / 2) / (m_rcItem.bottom - m_rcItem.top - m_szThumb.cy)); } if (m_bSendMove) { UpdateText(); @@ -223,7 +223,7 @@ namespace DuiLib { RECT rcThumb = GetThumbRect(); if( IsEnabled()) { - ::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_HAND))); + ::SetCursor(::LoadCursor(NULL, IDC_HAND)); return; } } diff --git a/DuiLib/Control/UIText.cpp b/DuiLib/Control/UIText.cpp index ea11e95..477ba71 100644 --- a/DuiLib/Control/UIText.cpp +++ b/DuiLib/Control/UIText.cpp @@ -51,7 +51,7 @@ namespace DuiLib if( event.Type == UIEVENT_SETCURSOR ) { for( int i = 0; i < m_nLinks; i++ ) { if( ::PtInRect(&m_rcLinks[i], event.ptMouse) ) { - ::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_HAND))); + ::SetCursor(::LoadCursor(NULL, IDC_HAND)); return; } } @@ -126,7 +126,7 @@ namespace DuiLib if (m_bAutoCalcWidth) { - m_cxyFixed.cx = MulDiv(cXY.cx, 100.0, GetManager()->GetDPIObj()->GetScale()); + m_cxyFixed.cx = MulDiv(cXY.cx, 100, GetManager()->GetDPIObj()->GetScale()); } return CControlUI::EstimateSize(szAvailable); diff --git a/DuiLib/Core/UIBase.cpp b/DuiLib/Core/UIBase.cpp index f124ef5..6e1b37b 100644 --- a/DuiLib/Core/UIBase.cpp +++ b/DuiLib/Core/UIBase.cpp @@ -29,7 +29,8 @@ void UILIB_API DUI__Trace(LPCTSTR pstrFormat, ...) LPCTSTR DUI__TraceMsg(UINT uMsg) { -#define MSGDEF(x) if(uMsg==x) return _T(#x) +#define MSGDEF(x) case x:return _T(#x) + switch (uMsg) { MSGDEF(WM_SETCURSOR); MSGDEF(WM_NCHITTEST); MSGDEF(WM_NCPAINT); @@ -72,7 +73,6 @@ LPCTSTR DUI__TraceMsg(UINT uMsg) MSGDEF(WM_SYSCHAR); MSGDEF(WM_VSCROLL); MSGDEF(WM_HSCROLL); - MSGDEF(WM_CHAR); MSGDEF(WM_SHOWWINDOW); MSGDEF(WM_PARENTNOTIFY); MSGDEF(WM_CREATE); @@ -84,6 +84,7 @@ LPCTSTR DUI__TraceMsg(UINT uMsg) MSGDEF(WM_GETICON); MSGDEF(WM_GETTEXT); MSGDEF(WM_GETTEXTLENGTH); + } static TCHAR szMsg[10]; ::wsprintf(szMsg, _T("0x%04X"), uMsg); return szMsg; @@ -314,7 +315,7 @@ UINT CWindowWnd::ShowModal() MSG msg = { 0 }; while( ::IsWindow(m_hWnd) && ::GetMessage(&msg, NULL, 0, 0) ) { if( msg.message == WM_CLOSE && msg.hwnd == m_hWnd ) { - nRet = msg.wParam; + nRet = (UINT)msg.wParam; ::EnableWindow(hWndParent, TRUE); ::SetFocus(hWndParent); } @@ -326,7 +327,7 @@ UINT CWindowWnd::ShowModal() } ::EnableWindow(hWndParent, TRUE); ::SetFocus(hWndParent); - if( msg.message == WM_QUIT ) ::PostQuitMessage(msg.wParam); + if (msg.message == WM_QUIT) ::PostQuitMessage((int)msg.wParam); return nRet; } diff --git a/DuiLib/Core/UIControl.cpp b/DuiLib/Core/UIControl.cpp index 89c6a88..612bf98 100644 --- a/DuiLib/Core/UIControl.cpp +++ b/DuiLib/Core/UIControl.cpp @@ -131,7 +131,7 @@ namespace DuiLib { if( m_sText == pstrText ) return; m_sText = pstrText; - // 解析xml换行符 + // xmlз m_sText.Replace(_T("{\\n}"), _T("\n")); Invalidate(); } @@ -837,7 +837,7 @@ namespace DuiLib { ::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(GetCursor()))); } else { - ::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_ARROW))); + ::SetCursor(::LoadCursor(NULL, IDC_ARROW)); } return; } @@ -939,7 +939,7 @@ namespace DuiLib { void CControlUI::SetAttribute(LPCTSTR pstrName, LPCTSTR pstrValue) { - // 样式表 + // ʽ if(m_pManager != NULL && _tcsicmp(pstrName, _T("style")) == 0) { LPCTSTR pStyle = m_pManager->GetStyle(pstrValue); if( pStyle != NULL) { @@ -947,7 +947,7 @@ namespace DuiLib { return; } } - // 属性 + // if( _tcsicmp(pstrName, _T("innerstyle")) == 0 ) { ApplyAttributeList(pstrValue); } @@ -965,7 +965,7 @@ namespace DuiLib { } else if( _tcsicmp(pstrName, _T("float")) == 0 ) { CDuiString nValue = pstrValue; - // 动态计算相对比例 + // ̬Ա if(nValue.Find(',') < 0) { SetFloat(_tcsicmp(pstrValue, _T("true")) == 0); } @@ -982,7 +982,7 @@ namespace DuiLib { } else if( _tcsicmp(pstrName, _T("floatalign")) == 0) { UINT uAlign = GetFloatAlign(); - // 解析文字属性 + // while( *pstrValue != _T('\0') ) { CDuiString sValue; while( *pstrValue == _T(',') || *pstrValue == _T(' ') ) pstrValue = ::CharNext(pstrValue); @@ -1150,7 +1150,7 @@ namespace DuiLib { CControlUI* CControlUI::ApplyAttributeList(LPCTSTR pstrValue) { - // 解析样式表 + // ʽ if(m_pManager != NULL) { LPCTSTR pStyle = m_pManager->GetStyle(pstrValue); if( pStyle != NULL) { @@ -1160,7 +1160,7 @@ namespace DuiLib { CDuiString sXmlData = pstrValue; sXmlData.Replace(_T("""), _T("\"")); LPCTSTR pstrList = sXmlData.GetData(); - // 解析样式属性 + // ʽ CDuiString sItem; CDuiString sValue; while( *pstrList != _T('\0') ) { @@ -1213,7 +1213,7 @@ namespace DuiLib { bool CControlUI::DoPaint(HDC hDC, const RECT& rcPaint, CControlUI* pStopControl) { - // 绘制循序:背景颜色->背景图->状态图->文本->边框 + // ѭ򣺱ɫ->ͼ->״̬ͼ->ı->߿ SIZE cxyBorderRound = GetBorderRound(); RECT rcBorderSize = GetBorderRectSize(); @@ -1296,7 +1296,7 @@ namespace DuiLib { RECT rcBorderSize = GetBorderRectSize(); if(m_dwBorderColor != 0 || m_dwFocusBorderColor != 0) { - //画圆角边框 + //ԲDZ߿ if(nBorderSize > 0 && ( cxyBorderRound.cx > 0 || cxyBorderRound.cy > 0 )) { if (IsFocused() && m_dwFocusBorderColor != 0) CRenderEngine::DrawRoundRect(hDC, m_rcItem, nBorderSize, cxyBorderRound.cx, cxyBorderRound.cy, GetAdjustColor(m_dwFocusBorderColor), m_nBorderStyle); diff --git a/DuiLib/Core/UIMarkup.cpp b/DuiLib/Core/UIMarkup.cpp index 940eb22..84d1518 100644 --- a/DuiLib/Core/UIMarkup.cpp +++ b/DuiLib/Core/UIMarkup.cpp @@ -169,7 +169,7 @@ void CMarkupNode::_MapAttributes() m_pOwner->_SkipWhitespace(pstr); if( *pstr++ != _T('\"') ) return; // if( *pstr != _T('\"') ) { pstr = ::CharNext(pstr); return; } - m_aAttributes[m_nAttributes++].iValue = pstr - m_pOwner->m_pstrXML; + m_aAttributes[m_nAttributes++].iValue = (ULONG)(pstr - m_pOwner->m_pstrXML); if( m_nAttributes >= MAX_XML_ATTRIBUTES ) return; pstr += _tcslen(pstr) + 1; } @@ -458,8 +458,8 @@ bool CMarkup::_Parse(LPTSTR& pstrText, ULONG iParent) // Fill out element structure XMLELEMENT* pEl = _ReserveElement(); ULONG iPos = pEl - m_pElements; - pEl->iStart = pstrText - m_pstrXML; - pEl->iParent = iParent; + pEl->iStart = (ULONG)(pstrText - m_pstrXML); + pEl->iParent = (ULONG)iParent; pEl->iNext = pEl->iChild = 0; if( iPrevious != 0 ) m_pElements[iPrevious].iNext = iPos; else if( iParent > 0 ) m_pElements[iParent].iChild = iPos; @@ -474,7 +474,7 @@ bool CMarkup::_Parse(LPTSTR& pstrText, ULONG iParent) _SkipWhitespace(pstrText); if( pstrText[0] == _T('/') && pstrText[1] == _T('>') ) { - pEl->iData = pstrText - m_pstrXML; + pEl->iData = (ULONG)(pstrText - m_pstrXML); *pstrText = _T('\0'); pstrText += 2; } @@ -482,7 +482,7 @@ bool CMarkup::_Parse(LPTSTR& pstrText, ULONG iParent) { if( *pstrText != _T('>') ) return _Failed(_T("Expected start-tag closing"), pstrText); // Parse node data - pEl->iData = ++pstrText - m_pstrXML; + pEl->iData = (ULONG)(++pstrText - m_pstrXML); LPTSTR pstrDest = pstrText; if( !_ParseData(pstrText, pstrDest, _T('<')) ) return false; // Determine type of next element diff --git a/DuiLib/Core/UIRender.cpp b/DuiLib/Core/UIRender.cpp index 65826e8..7263df0 100644 --- a/DuiLib/Core/UIRender.cpp +++ b/DuiLib/Core/UIRender.cpp @@ -1471,7 +1471,7 @@ namespace DuiLib { ::SelectObject(hDC, hOldPen); ::DeleteObject(hPen); #else - DrawRoundRectangle(hDC, rc.left, rc.top, rc.right - rc.left - 1, rc.bottom - rc.top - 1, width / 2, nSize, Gdiplus::Color(dwPenColor), false, Gdiplus::Color(dwPenColor)); + DrawRoundRectangle(hDC, (float)rc.left, (float)rc.top, (float)(rc.right - rc.left - 1), (float)(rc.bottom - rc.top - 1), (float)(width / 2), (float)nSize, Gdiplus::Color(dwPenColor), false, Gdiplus::Color(dwPenColor)); #endif } @@ -1634,8 +1634,8 @@ namespace DuiLib { bool bDraw = (uStyle & DT_CALCRECT) == 0; CStdPtrArray aFontArray(10); - CStdPtrArray aColorArray(10); - CStdPtrArray aPIndentArray(10); + CStdArray aColorArray(10); + CStdArray aPIndentArray(10); RECT rcClip = { 0 }; ::GetClipBox(hDC, &rcClip); @@ -1690,7 +1690,7 @@ namespace DuiLib { POINT pt = { rc.left, rc.top }; int iLinkIndex = 0; - int cyLine = pTm->tmHeight + pTm->tmExternalLeading + (int)aPIndentArray.GetAt(aPIndentArray.GetSize() - 1); + int cyLine = pTm->tmHeight + pTm->tmExternalLeading + aPIndentArray.GetAt(aPIndentArray.GetSize() - 1); int cyMinHeight = 0; int cxMaxWidth = 0; POINT ptLinkStart = { 0 }; @@ -1774,7 +1774,7 @@ namespace DuiLib { // if( ::PtInRect(&rc, ptMouse) ) // clrColor = pManager->GetDefaultLinkHoverFontColor(); //} - aColorArray.Add((LPVOID)clrColor); + aColorArray.Add(clrColor); ::SetTextColor(hDC, RGB(GetBValue(clrColor), GetGValue(clrColor), GetRValue(clrColor))); TFontInfo* pFontInfo = pDefFontInfo; if( aFontArray.GetSize() > 0 ) pFontInfo = (TFontInfo*)aFontArray.GetAt(aFontArray.GetSize() - 1); @@ -1785,7 +1785,7 @@ namespace DuiLib { aFontArray.Add(pFontInfo); pTm = &pFontInfo->tm; ::SelectObject(hDC, pFontInfo->hFont); - cyLine = MAX(cyLine, pTm->tmHeight + pTm->tmExternalLeading + (int)aPIndentArray.GetAt(aPIndentArray.GetSize() - 1)); + cyLine = MAX(cyLine, pTm->tmHeight + pTm->tmExternalLeading + aPIndentArray.GetAt(aPIndentArray.GetSize() - 1)); } ptLinkStart = pt; bInLink = true; @@ -1803,7 +1803,7 @@ namespace DuiLib { aFontArray.Add(pFontInfo); pTm = &pFontInfo->tm; ::SelectObject(hDC, pFontInfo->hFont); - cyLine = MAX(cyLine, pTm->tmHeight + pTm->tmExternalLeading + (int)aPIndentArray.GetAt(aPIndentArray.GetSize() - 1)); + cyLine = MAX(cyLine, pTm->tmHeight + pTm->tmExternalLeading + aPIndentArray.GetAt(aPIndentArray.GetSize() - 1)); } } break; @@ -1813,7 +1813,7 @@ namespace DuiLib { while( *pstrText > _T('\0') && *pstrText <= _T(' ') ) pstrText = ::CharNext(pstrText); if( *pstrText == _T('#')) pstrText++; DWORD clrColor = _tcstol(pstrText, const_cast(&pstrText), 16); - aColorArray.Add((LPVOID)clrColor); + aColorArray.Add(clrColor); ::SetTextColor(hDC, RGB(GetBValue(clrColor), GetGValue(clrColor), GetRValue(clrColor))); } break; @@ -1864,7 +1864,7 @@ namespace DuiLib { pTm = &pFontInfo->tm; ::SelectObject(hDC, pFontInfo->hFont); } - cyLine = MAX(cyLine, pTm->tmHeight + pTm->tmExternalLeading + (int)aPIndentArray.GetAt(aPIndentArray.GetSize() - 1)); + cyLine = MAX(cyLine, pTm->tmHeight + pTm->tmExternalLeading + aPIndentArray.GetAt(aPIndentArray.GetSize() - 1)); } break; case _T('i'): // Italic or Image @@ -1894,7 +1894,7 @@ namespace DuiLib { aFontArray.Add(pFontInfo); pTm = &pFontInfo->tm; ::SelectObject(hDC, pFontInfo->hFont); - cyLine = MAX(cyLine, pTm->tmHeight + pTm->tmExternalLeading + (int)aPIndentArray.GetAt(aPIndentArray.GetSize() - 1)); + cyLine = MAX(cyLine, pTm->tmHeight + pTm->tmExternalLeading + aPIndentArray.GetAt(aPIndentArray.GetSize() - 1)); } } else { @@ -1995,7 +1995,7 @@ namespace DuiLib { if( pt.x > rc.left ) bLineEnd = true; while( *pstrText > _T('\0') && *pstrText <= _T(' ') ) pstrText = ::CharNext(pstrText); int cyLineExtra = (int)_tcstol(pstrText, const_cast(&pstrText), 10); - aPIndentArray.Add((LPVOID)cyLineExtra); + aPIndentArray.Add(cyLineExtra); cyLine = MAX(cyLine, pTm->tmHeight + pTm->tmExternalLeading + cyLineExtra); } break; @@ -2027,7 +2027,7 @@ namespace DuiLib { aFontArray.Add(pFontInfo); pTm = &pFontInfo->tm; ::SelectObject(hDC, pFontInfo->hFont); - cyLine = MAX(cyLine, pTm->tmHeight + pTm->tmExternalLeading + (int)aPIndentArray.GetAt(aPIndentArray.GetSize() - 1)); + cyLine = MAX(cyLine, pTm->tmHeight + pTm->tmExternalLeading + aPIndentArray.GetAt(aPIndentArray.GetSize() - 1)); } } break; @@ -2065,7 +2065,7 @@ namespace DuiLib { pstrText++; aColorArray.Remove(aColorArray.GetSize() - 1); DWORD clrColor = dwTextColor; - if( aColorArray.GetSize() > 0 ) clrColor = (int)aColorArray.GetAt(aColorArray.GetSize() - 1); + if (aColorArray.GetSize() > 0) clrColor = aColorArray.GetAt(aColorArray.GetSize() - 1); ::SetTextColor(hDC, RGB(GetBValue(clrColor), GetGValue(clrColor), GetRValue(clrColor))); } break; @@ -2073,7 +2073,7 @@ namespace DuiLib { pstrText++; if( pt.x > rc.left ) bLineEnd = true; aPIndentArray.Remove(aPIndentArray.GetSize() - 1); - cyLine = MAX(cyLine, pTm->tmHeight + pTm->tmExternalLeading + (int)aPIndentArray.GetAt(aPIndentArray.GetSize() - 1)); + cyLine = MAX(cyLine, pTm->tmHeight + pTm->tmExternalLeading + aPIndentArray.GetAt(aPIndentArray.GetSize() - 1)); break; case _T('s'): { @@ -2093,7 +2093,7 @@ namespace DuiLib { } aColorArray.Remove(aColorArray.GetSize() - 1); DWORD clrColor = dwTextColor; - if( aColorArray.GetSize() > 0 ) clrColor = (int)aColorArray.GetAt(aColorArray.GetSize() - 1); + if (aColorArray.GetSize() > 0) clrColor = aColorArray.GetAt(aColorArray.GetSize() - 1); ::SetTextColor(hDC, RGB(GetBValue(clrColor), GetGValue(clrColor), GetRValue(clrColor))); bInLink = false; } @@ -2113,7 +2113,7 @@ namespace DuiLib { } pTm = &pFontInfo->tm; ::SelectObject(hDC, pFontInfo->hFont); - cyLine = MAX(cyLine, pTm->tmHeight + pTm->tmExternalLeading + (int)aPIndentArray.GetAt(aPIndentArray.GetSize() - 1)); + cyLine = MAX(cyLine, pTm->tmHeight + pTm->tmExternalLeading + aPIndentArray.GetAt(aPIndentArray.GetSize() - 1)); } break; } @@ -2252,7 +2252,7 @@ namespace DuiLib { bInSelected = bLineInSelected; DWORD clrColor = dwTextColor; - if( aColorArray.GetSize() > 0 ) clrColor = (int)aColorArray.GetAt(aColorArray.GetSize() - 1); + if (aColorArray.GetSize() > 0) clrColor = aColorArray.GetAt(aColorArray.GetSize() - 1); ::SetTextColor(hDC, RGB(GetBValue(clrColor), GetGValue(clrColor), GetRValue(clrColor))); TFontInfo* pFontInfo = (TFontInfo*)aFontArray.GetAt(aFontArray.GetSize() - 1); if( pFontInfo == NULL ) pFontInfo = pDefFontInfo; @@ -2397,7 +2397,7 @@ namespace DuiLib { if( pstrText == NULL || pManager == NULL ) return size; ::SetBkMode(hDC, TRANSPARENT); HFONT hOldFont = (HFONT)::SelectObject(hDC, pManager->GetFont(iFont)); - GetTextExtentPoint32(hDC, pstrText, _tcslen(pstrText) , &size); + GetTextExtentPoint32(hDC, pstrText, (int)_tcslen(pstrText), &size); ::SelectObject(hDC, hOldFont); return size; } diff --git a/DuiLib/Layout/UIAnimationTabLayout.cpp b/DuiLib/Layout/UIAnimationTabLayout.cpp index 4e44cee..c969054 100644 --- a/DuiLib/Layout/UIAnimationTabLayout.cpp +++ b/DuiLib/Layout/UIAnimationTabLayout.cpp @@ -82,7 +82,7 @@ namespace DuiLib { { if( event.Type == UIEVENT_TIMER ) { - OnTimer( event.wParam ); + OnTimer((int)event.wParam); } __super::DoEvent( event ); } diff --git a/DuiLib/Layout/UIHorizontalLayout.cpp b/DuiLib/Layout/UIHorizontalLayout.cpp index 1bf3e1d..8734c3d 100644 --- a/DuiLib/Layout/UIHorizontalLayout.cpp +++ b/DuiLib/Layout/UIHorizontalLayout.cpp @@ -318,7 +318,7 @@ namespace DuiLib { RECT rcSeparator = GetThumbRect(false); if( IsEnabled() && ::PtInRect(&rcSeparator, event.ptMouse) ) { - ::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZEWE))); + ::SetCursor(::LoadCursor(NULL, IDC_SIZEWE)); return; } } diff --git a/DuiLib/Layout/UIVerticalLayout.cpp b/DuiLib/Layout/UIVerticalLayout.cpp index 5e88717..af6527b 100644 --- a/DuiLib/Layout/UIVerticalLayout.cpp +++ b/DuiLib/Layout/UIVerticalLayout.cpp @@ -317,7 +317,7 @@ namespace DuiLib { RECT rcSeparator = GetThumbRect(false); if( IsEnabled() && ::PtInRect(&rcSeparator, event.ptMouse) ) { - ::SetCursor(::LoadCursor(NULL, MAKEINTRESOURCE(IDC_SIZENS))); + ::SetCursor(::LoadCursor(NULL, IDC_SIZENS)); return; } } diff --git a/DuiLib/Utils/UIShadow.cpp b/DuiLib/Utils/UIShadow.cpp index c53805b..946e42a 100644 --- a/DuiLib/Utils/UIShadow.cpp +++ b/DuiLib/Utils/UIShadow.cpp @@ -76,7 +76,7 @@ void CShadowUI::Create(CPaintManagerUI* pPaintManager) GetShadowMap()[hParentWnd] = this; // Determine the initial show state of shadow according to parent window's state - LONG lParentStyle = GetWindowLongPtr(hParentWnd, GWL_STYLE); + LONG lParentStyle = (LONG)GetWindowLongPtr(hParentWnd, GWL_STYLE); // Create the shadow window LONG styleValue = lParentStyle & WS_CAPTION; @@ -598,7 +598,7 @@ void CShadowUI::DisableShadow(bool bDisable) { } else { // Determine the initial show state of shadow according to parent window's state - LONG lParentStyle = GetWindowLongPtr(GetParent(m_hWnd), GWL_STYLE); + LONG lParentStyle = (LONG)GetWindowLongPtr(GetParent(m_hWnd), GWL_STYLE); if (!(WS_VISIBLE & lParentStyle)) // Parent invisible -- Gitee