diff --git a/DesktopEditor/common/Array.h b/DesktopEditor/common/Array.h index 00f2176542..3e35a5daf9 100644 --- a/DesktopEditor/common/Array.h +++ b/DesktopEditor/common/Array.h @@ -72,6 +72,32 @@ public: return TRUE; } + BOOL Add() + { + if (m_nSize == m_nAllocSize) + { + int nNewAllocSize = (m_nAllocSize == 0) ? 1 : (m_nSize * 2); + + T* newT = new T[nNewAllocSize]; + + if (NULL == newT) + return FALSE; + + m_nAllocSize = nNewAllocSize; + + if (m_nSize != 0) + { + for (int i = 0; i < m_nSize; ++i) + newT[i] = m_aT[i]; + } + + RELEASEARRAYOBJECTS(m_aT); + m_aT = newT; + } + + return TRUE; + } + BOOL Add(const T& t) { if (m_nSize == m_nAllocSize) @@ -108,6 +134,24 @@ public: m_nSize--; return TRUE; } + + BOOL RemoveAt(int nIndex, int nCount) + { + if (nIndex < 0 || nIndex >= m_nSize || nCount < 1) + return FALSE; + + if ((nIndex + nCount) > m_nSize) + nCount = m_nSize - nIndex; + + for (int i = 0; i < nCount; ++i) + m_aT[nIndex + i].~T(); + + if ((nIndex + nCount) != m_nSize) + memmove_s((void*)(m_aT + nIndex), (m_nSize - nIndex - nCount + 1) * sizeof(T), (void*)(m_aT + nIndex + nCount), (m_nSize - (nIndex + nCount)) * sizeof(T)); + m_nSize--; + return TRUE; + } + void RemoveAll() { if (m_aT != NULL) diff --git a/DesktopEditor/common/File.h b/DesktopEditor/common/File.h index 4350f69556..31c6bb66e3 100644 --- a/DesktopEditor/common/File.h +++ b/DesktopEditor/common/File.h @@ -289,7 +289,7 @@ namespace NSFile } } - lOutputCount = pCodesCur - pData; + lOutputCount = (LONG)(pCodesCur - pData); } static void GetUtf8StringFromUnicode_2bytes(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM = false) @@ -360,7 +360,7 @@ namespace NSFile } } - lOutputCount = pCodesCur - pData; + lOutputCount = (LONG)(pCodesCur - pData); } static void GetUtf8StringFromUnicode(const wchar_t* pUnicodes, LONG lCount, BYTE*& pData, LONG& lOutputCount, bool bIsBOM = false) diff --git a/DesktopEditor/common/Types.h b/DesktopEditor/common/Types.h index 8852e4afe3..22192eb0ad 100644 --- a/DesktopEditor/common/Types.h +++ b/DesktopEditor/common/Types.h @@ -39,6 +39,19 @@ typedef int INT; typedef unsigned int UINT, *PUINT; typedef wchar_t WCHAR; +#if (!defined (_MAC) && (!defined(MIDL_PASS) || defined(__midl)) && (!defined(_M_IX86) || (defined(_INTEGRAL_MAX_BITS) && _INTEGRAL_MAX_BITS >= 64))) +typedef __int64 T_LONG64; +typedef unsigned __int64 T_ULONG64; +#else +#if defined(_MAC) && defined(_MAC_INT_64) +typedef __int64 T_LONG64; +typedef unsigned __int64 T_ULONG64; +#else +typedef double T_LONG64; +typedef double T_ULONG64; +#endif //_MAC and int64 +#endif + #ifndef VOID typedef void VOID, *LPVOID; #endif diff --git a/DesktopEditor/graphics/aggplustypes.h b/DesktopEditor/graphics/aggplustypes.h index efb425d972..c1518916d8 100644 --- a/DesktopEditor/graphics/aggplustypes.h +++ b/DesktopEditor/graphics/aggplustypes.h @@ -93,6 +93,7 @@ public: typedef PointF_T PointF; typedef PointF_T Point; +typedef PointF_T PointD; template class RectF_T @@ -106,10 +107,10 @@ public: void GetLocation(PointF_T* point) const { point->X = X; point->Y = Y; } void GetSize(SizeF_T* size) const { size->Width = Width; size->Height = Height; } void GetBounds(RectF_T* rect) const { rect->X = X; rect->Y = Y; rect->Width = Width; rect->Height = Height; } - T GetLeft() const { return X; } - T GetTop() const { return Y; } - T GetRight() const { return X+Width; } - T GetBottom() const { return Y+Height; } + inline T GetLeft() const { return X; } + inline T GetTop() const { return Y; } + inline T GetRight() const { return X+Width; } + inline T GetBottom() const { return Y+Height; } BOOL IsEmptyArea() const { return (Width <= (T)REAL_EPSILON) || (Height <= (T)REAL_EPSILON); } BOOL Equals(const RectF_T & rect) const {