summaryrefslogtreecommitdiff
path: root/plugins/Modernb/hdr
diff options
context:
space:
mode:
authorKirill Volinsky <mataes2007@gmail.com>2012-05-18 22:10:43 +0000
committerKirill Volinsky <mataes2007@gmail.com>2012-05-18 22:10:43 +0000
commit725f68b6808a8a30778f58223fac75386f082785 (patch)
treeccba410760749d45139e5e78fd5e08f416ade1a0 /plugins/Modernb/hdr
parentf920ef497f3299ae24fe783ce03bdd93b419f764 (diff)
plugins folders renaming
git-svn-id: http://svn.miranda-ng.org/main/trunk@61 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Modernb/hdr')
-rw-r--r--plugins/Modernb/hdr/MString.h2304
-rw-r--r--plugins/Modernb/hdr/modern_awaymsg.h37
-rw-r--r--plugins/Modernb/hdr/modern_cache_funcs.h46
-rw-r--r--plugins/Modernb/hdr/modern_callproc.h128
-rw-r--r--plugins/Modernb/hdr/modern_clc.h523
-rw-r--r--plugins/Modernb/hdr/modern_clcpaint.h191
-rw-r--r--plugins/Modernb/hdr/modern_clist.h163
-rw-r--r--plugins/Modernb/hdr/modern_clui.h193
-rw-r--r--plugins/Modernb/hdr/modern_cluiframes.h150
-rw-r--r--plugins/Modernb/hdr/modern_commonheaders.h531
-rw-r--r--plugins/Modernb/hdr/modern_commonprototypes.h360
-rw-r--r--plugins/Modernb/hdr/modern_defsettings.h285
-rw-r--r--plugins/Modernb/hdr/modern_effectenum.h93
-rw-r--r--plugins/Modernb/hdr/modern_gettextasync.h5
-rw-r--r--plugins/Modernb/hdr/modern_global_structure.h93
-rw-r--r--plugins/Modernb/hdr/modern_image_array.h104
-rw-r--r--plugins/Modernb/hdr/modern_layered_window_engine.h51
-rw-r--r--plugins/Modernb/hdr/modern_log.h27
-rw-r--r--plugins/Modernb/hdr/modern_popup.h48
-rw-r--r--plugins/Modernb/hdr/modern_row.h86
-rw-r--r--plugins/Modernb/hdr/modern_rowheight_funcs.h70
-rw-r--r--plugins/Modernb/hdr/modern_skinengine.h148
-rw-r--r--plugins/Modernb/hdr/modern_skinned_profile.h245
-rw-r--r--plugins/Modernb/hdr/modern_skinselector.h88
-rw-r--r--plugins/Modernb/hdr/modern_static_clui.h251
-rw-r--r--plugins/Modernb/hdr/modern_static_cluiframes_service.h192
-rw-r--r--plugins/Modernb/hdr/modern_statusbar.h44
-rw-r--r--plugins/Modernb/hdr/modern_statusmodes.h43
-rw-r--r--plugins/Modernb/hdr/modern_sync.h98
-rw-r--r--plugins/Modernb/hdr/modern_tstring.h58
30 files changed, 6655 insertions, 0 deletions
diff --git a/plugins/Modernb/hdr/MString.h b/plugins/Modernb/hdr/MString.h
new file mode 100644
index 0000000000..28cbeebdcf
--- /dev/null
+++ b/plugins/Modernb/hdr/MString.h
@@ -0,0 +1,2304 @@
+#pragma once
+
+#include <string.h>
+#include <mbstring.h>
+#include <wchar.h>
+
+#ifdef __MINGW32__
+#include <limits.h>
+
+__inline size_t strnlen(const char *string, size_t maxlen)
+{
+ const char *end = (const char *)memchr ((const void *)string, '\0', maxlen);
+ return end ? (size_t) (end - string) : maxlen;
+}
+__inline size_t wcsnlen(const wchar_t *string, size_t maxlen)
+{
+ const wchar_t *end = wmemchr (string, L'\0', maxlen);
+ return end ? (size_t) (end - string) : maxlen;
+}
+
+/* FIXME: This may be wrong assumption about _AtlGetConversionACP */
+#define _AtlGetConversionACP() CP_THREAD_ACP
+/* FIXME: This is unsafe */
+#define memcpy_s(dest,size,src,count) memcpy(dest,src,count)
+/* FIXME: This is quite silly implementation of _mbsstr */
+#define _mbsstr(str,search) strstr((const char *)str,(const char *)search)
+#define __max(x,y) (((x)<(y))?(y):(x))
+#endif /* __MINGW32__ */
+
+struct CMStringData
+{
+ int nDataLength; // Length of currently used data in XCHARs (not including terminating null)
+ int nAllocLength; // Length of allocated data in XCHARs (not including terminating null)
+ long nRefs; // Reference count: negative == locked
+ // XCHAR data[nAllocLength+1] // A CStringData is always followed in memory by the actual array of character data
+ void* data();
+ void AddRef();
+ bool IsLocked() const;
+ bool IsShared() const;
+ void Lock();
+ void Release();
+ void Unlock();
+};
+
+class CNilMStringData : public CMStringData
+{
+public:
+ CNilMStringData();
+
+public:
+ wchar_t achNil[2];
+};
+
+template< typename BaseType = char >
+class ChTraitsBase
+{
+public:
+ typedef char XCHAR;
+ typedef LPSTR PXSTR;
+ typedef LPCSTR PCXSTR;
+ typedef wchar_t YCHAR;
+ typedef LPWSTR PYSTR;
+ typedef LPCWSTR PCYSTR;
+};
+
+template<>
+class ChTraitsBase< wchar_t >
+{
+public:
+ typedef wchar_t XCHAR;
+ typedef LPWSTR PXSTR;
+ typedef LPCWSTR PCXSTR;
+ typedef char YCHAR;
+ typedef LPSTR PYSTR;
+ typedef LPCSTR PCYSTR;
+};
+
+class CMBaseString
+{
+public:
+ static CMStringData* Allocate(int nChars, int nCharSize);
+ static void Free(CMStringData* pData);
+ static CMStringData* Realloc(CMStringData* pData, int nChars, int nCharSize);
+
+protected:
+ static CMStringData* GetNilString();
+ static CNilMStringData m_nil;
+};
+
+template< typename BaseType >
+class CMSimpleStringT : public CMBaseString
+{
+public:
+ typedef typename ChTraitsBase< BaseType >::XCHAR XCHAR;
+ typedef typename ChTraitsBase< BaseType >::PXSTR PXSTR;
+ typedef typename ChTraitsBase< BaseType >::PCXSTR PCXSTR;
+ typedef typename ChTraitsBase< BaseType >::YCHAR YCHAR;
+ typedef typename ChTraitsBase< BaseType >::PYSTR PYSTR;
+ typedef typename ChTraitsBase< BaseType >::PCYSTR PCYSTR;
+
+public:
+ explicit CMSimpleStringT()
+ {
+ CMStringData* pData = GetNilString();
+ Attach(pData);
+ }
+
+ CMSimpleStringT(const CMSimpleStringT& strSrc)
+ {
+ CMStringData* pSrcData = strSrc.GetData();
+ CMStringData* pNewData = CloneData( pSrcData );
+ Attach( pNewData );
+ }
+
+ CMSimpleStringT(PCXSTR pszSrc)
+ {
+ int nLength = StringLength( pszSrc );
+ CMStringData* pData = Allocate( nLength, sizeof( XCHAR ) );
+ if (pData != NULL)
+ {
+ Attach( pData );
+ SetLength( nLength );
+ CopyChars( m_pszData, nLength, pszSrc, nLength );
+ }
+ }
+ CMSimpleStringT(const XCHAR* pchSrc, int nLength)
+ {
+ CMStringData* pData = Allocate( nLength, sizeof( XCHAR ) );
+ if( pData != NULL )
+ {
+ Attach( pData );
+ SetLength( nLength );
+ CopyChars( m_pszData, nLength, pchSrc, nLength );
+ }
+ }
+ ~CMSimpleStringT()
+ {
+ CMStringData* pData = GetData();
+ pData->Release();
+ }
+
+ operator CMSimpleStringT<BaseType>&()
+ {
+ return *(CMSimpleStringT<BaseType>*)this;
+ }
+
+ CMSimpleStringT& operator=(const CMSimpleStringT& strSrc )
+ {
+ CMStringData* pSrcData = strSrc.GetData();
+ CMStringData* pOldData = GetData();
+ if( pSrcData != pOldData)
+ {
+ if( pOldData->IsLocked() )
+ SetString( strSrc.GetString(), strSrc.GetLength() );
+ else
+ {
+ CMStringData* pNewData = CloneData( pSrcData );
+ pOldData->Release();
+ Attach( pNewData );
+ }
+ }
+
+ return *this;
+ }
+
+ CMSimpleStringT& operator=(PCXSTR pszSrc)
+ {
+ SetString( pszSrc );
+ return *this;
+ }
+
+ CMSimpleStringT& operator+=( const CMSimpleStringT& strSrc )
+ {
+ Append( strSrc );
+
+ return *this;
+ }
+
+ CMSimpleStringT& operator+=( PCXSTR pszSrc )
+ {
+ Append( pszSrc );
+
+ return *this;
+ }
+ CMSimpleStringT& operator+=( char ch )
+ {
+ AppendChar(XCHAR(ch));
+
+ return *this;
+ }
+ CMSimpleStringT& operator+=( unsigned char ch )
+ {
+ AppendChar(XCHAR(ch));
+
+ return *this;
+ }
+ CMSimpleStringT& operator+=( wchar_t ch )
+ {
+ AppendChar(XCHAR(ch));
+
+ return *this;
+ }
+
+ XCHAR operator[]( int iChar ) const
+ {
+ return m_pszData[iChar];
+ }
+
+ operator PCXSTR() const
+ {
+ return m_pszData;
+ }
+
+ PCXSTR c_str() const
+ {
+ return m_pszData;
+ }
+
+ void Append( PCXSTR pszSrc )
+ {
+ Append( pszSrc, StringLength( pszSrc ) );
+ }
+ void Append( PCXSTR pszSrc, int nLength )
+ {
+ // See comment in SetString() about why we do this
+ UINT_PTR nOffset = pszSrc - GetString();
+
+ UINT nOldLength = GetLength();
+ if (nOldLength < 0)
+ {
+ // protects from underflow
+ nOldLength = 0;
+ }
+
+ //Make sure we don't read pass end of the terminating NULL
+ int nSrcLength = StringLength(pszSrc);
+ nLength = nLength > nSrcLength ? nSrcLength: nLength;
+
+ int nNewLength = nOldLength+nLength;
+ PXSTR pszBuffer = GetBuffer( nNewLength );
+ if( nOffset <= nOldLength )
+ {
+ pszSrc = pszBuffer+nOffset;
+ // No need to call CopyCharsOverlapped, since the destination is
+ // beyond the end of the original buffer
+ }
+ CopyChars( pszBuffer+nOldLength, nLength, pszSrc, nLength );
+ ReleaseBufferSetLength( nNewLength );
+ }
+ void AppendChar( XCHAR ch )
+ {
+ UINT nOldLength = GetLength();
+ int nNewLength = nOldLength+1;
+ PXSTR pszBuffer = GetBuffer( nNewLength );
+ pszBuffer[nOldLength] = ch;
+ ReleaseBufferSetLength( nNewLength );
+ }
+ void Append( const CMSimpleStringT& strSrc )
+ {
+ Append( strSrc.GetString(), strSrc.GetLength() );
+ }
+ void Empty()
+ {
+ CMStringData* pOldData = GetData();
+ if( pOldData->nDataLength == 0 )
+ return;
+
+ if( pOldData->IsLocked() )
+ {
+ // Don't reallocate a locked buffer that's shrinking
+ SetLength( 0 );
+ }
+ else
+ {
+ pOldData->Release();
+ CMStringData* pNewData = GetNilString();
+ Attach( pNewData );
+ }
+ }
+ void FreeExtra()
+ {
+ CMStringData* pOldData = GetData();
+ int nLength = pOldData->nDataLength;
+ if( pOldData->nAllocLength == nLength )
+ return;
+
+ if( !pOldData->IsLocked() ) // Don't reallocate a locked buffer that's shrinking
+ {
+ CMStringData* pNewData = Allocate( nLength, sizeof( XCHAR ) );
+ if( pNewData == NULL ) {
+ SetLength( nLength );
+ return;
+ }
+
+ CopyChars( PXSTR( pNewData->data() ), nLength, PCXSTR( pOldData->data() ), nLength );
+
+ pOldData->Release();
+ Attach( pNewData );
+ SetLength( nLength );
+ }
+ }
+
+ int GetAllocLength() const
+ {
+ return GetData()->nAllocLength;
+ }
+ XCHAR GetAt( int iChar ) const
+ {
+ return m_pszData[iChar];
+ }
+ PXSTR GetBuffer()
+ {
+ CMStringData* pData = GetData();
+ if( pData->IsShared() )
+ Fork( pData->nDataLength );
+
+ return m_pszData;
+ }
+ PXSTR GetBuffer( int nMinBufferLength )
+ {
+ return PrepareWrite( nMinBufferLength );
+ }
+ PXSTR GetBufferSetLength( int nLength )
+ {
+ PXSTR pszBuffer = GetBuffer( nLength );
+ SetLength( nLength );
+
+ return pszBuffer;
+ }
+ int GetLength() const
+ {
+ return GetData()->nDataLength;
+ }
+
+ PCXSTR GetString() const
+ {
+ return m_pszData;
+ }
+ bool IsEmpty() const
+ {
+ return GetLength() == 0;
+ }
+ PXSTR LockBuffer()
+ {
+ CMStringData* pData = GetData();
+ if( pData->IsShared() )
+ {
+ Fork( pData->nDataLength );
+ pData = GetData(); // Do it again, because the fork might have changed it
+ }
+ pData->Lock();
+
+ return m_pszData;
+ }
+ void UnlockBuffer()
+ {
+ CMStringData* pData = GetData();
+ pData->Unlock();
+ }
+ void Preallocate( int nLength )
+ {
+ PrepareWrite( nLength );
+ }
+ void ReleaseBuffer( int nNewLength = -1 )
+ {
+ if( nNewLength == -1 )
+ {
+ int nAlloc = GetData()->nAllocLength;
+ nNewLength = StringLengthN( m_pszData, nAlloc);
+ }
+ SetLength( nNewLength );
+ }
+ void ReleaseBufferSetLength( int nNewLength )
+ {
+ SetLength( nNewLength );
+ }
+ void Truncate( int nNewLength )
+ {
+ GetBuffer( nNewLength );
+ ReleaseBufferSetLength( nNewLength );
+ }
+ void SetAt( int iChar, XCHAR ch )
+ {
+ int nLength = GetLength();
+ PXSTR pszBuffer = GetBuffer();
+ pszBuffer[iChar] = ch;
+ ReleaseBufferSetLength( nLength );
+
+ }
+ void SetString( PCXSTR pszSrc )
+ {
+ SetString( pszSrc, StringLength( pszSrc ) );
+ }
+ void assign( PCXSTR pszSrc )
+ {
+ SetString( pszSrc, StringLength( pszSrc ) );
+ }
+ void SetString( PCXSTR pszSrc, int nLength )
+ {
+ if( nLength == 0 )
+ {
+ Empty();
+ }
+ else
+ {
+
+ UINT nOldLength = GetLength();
+ UINT_PTR nOffset = pszSrc - GetString();
+
+ PXSTR pszBuffer = GetBuffer( nLength );
+ if( nOffset <= nOldLength )
+ {
+ CopyCharsOverlapped( pszBuffer, GetAllocLength(),
+ pszBuffer+nOffset, nLength );
+ }
+ else
+ {
+ CopyChars( pszBuffer, GetAllocLength(), pszSrc, nLength );
+ }
+ ReleaseBufferSetLength( nLength );
+ }
+ }
+public:
+ friend CMSimpleStringT __stdcall operator+(const CMSimpleStringT& str1, const CMSimpleStringT& str2)
+ {
+ CMSimpleStringT s;
+
+ Concatenate( s, str1, str1.GetLength(), str2, str2.GetLength() );
+
+ return s;
+ }
+
+ friend CMSimpleStringT __stdcall operator+(const CMSimpleStringT& str1, PCXSTR psz2)
+ {
+ CMSimpleStringT s;
+
+ Concatenate( s, str1, str1.GetLength(), psz2, StringLength( psz2 ) );
+
+ return s;
+ }
+
+ friend CMSimpleStringT __stdcall operator+(PCXSTR psz1, const CMSimpleStringT& str2)
+ {
+ CMSimpleStringT s;
+
+ Concatenate( s, psz1, StringLength( psz1 ), str2, str2.GetLength() );
+
+ return s;
+ }
+
+ static void __stdcall CopyChars(XCHAR* pchDest, const XCHAR* pchSrc, int nChars )
+ {
+#pragma warning (push)
+#pragma warning(disable : 4996)
+ memcpy(pchDest, pchSrc, nChars * sizeof(XCHAR));
+#pragma warning (pop)
+ }
+ static void __stdcall CopyChars(XCHAR* pchDest, size_t nDestLen, const XCHAR* pchSrc, int nChars )
+ {
+ #if _MSC_VER >= 1400
+ memcpy_s(pchDest, nDestLen * sizeof(XCHAR), pchSrc, nChars * sizeof(XCHAR));
+ #else
+ memcpy(pchDest, pchSrc, nDestLen * sizeof(XCHAR));
+ #endif
+ }
+
+ static void __stdcall CopyCharsOverlapped(XCHAR* pchDest, const XCHAR* pchSrc, int nChars )
+ {
+#pragma warning (push)
+#pragma warning(disable : 4996)
+ memmove(pchDest, pchSrc, nChars * sizeof(XCHAR));
+#pragma warning (pop)
+ }
+ static void __stdcall CopyCharsOverlapped(XCHAR* pchDest, size_t nDestLen, const XCHAR* pchSrc, int nChars)
+ {
+ #if _MSC_VER >= 1400
+ memmove_s(pchDest, nDestLen * sizeof(XCHAR), pchSrc, nChars * sizeof(XCHAR));
+ #else
+ memmove(pchDest, pchSrc, nDestLen * sizeof(XCHAR));
+ #endif
+ }
+ static int __stdcall StringLength(const char* psz)
+ {
+ if (psz == NULL)
+ {
+ return(0);
+ }
+ return (int(strlen(psz)));
+ }
+ static int __stdcall StringLength(const wchar_t* psz)
+ {
+ if (psz == NULL)
+ return 0;
+
+ return int(wcslen(psz));
+ }
+ static int __stdcall StringLengthN(const char* psz, size_t sizeInXChar )
+ {
+ if( psz == NULL )
+ return 0;
+
+ return int( strnlen( psz, sizeInXChar ));
+ }
+ static int __stdcall StringLengthN(const wchar_t* psz, size_t sizeInXChar )
+ {
+ if( psz == NULL )
+ return 0;
+
+ return int( wcsnlen( psz, sizeInXChar ));
+ }
+protected:
+ static void __stdcall Concatenate(CMSimpleStringT& strResult, PCXSTR psz1, int nLength1, PCXSTR psz2, int nLength2)
+ {
+ int nNewLength = nLength1+nLength2;
+ PXSTR pszBuffer = strResult.GetBuffer(nNewLength);
+ CopyChars(pszBuffer, nLength1, psz1, nLength1 );
+ CopyChars(pszBuffer + nLength1, nLength2, psz2, nLength2);
+ strResult.ReleaseBufferSetLength(nNewLength);
+ }
+ // Implementation
+private:
+ void Attach(CMStringData* pData)
+ {
+ m_pszData = static_cast<PXSTR>(pData->data());
+ }
+ void Fork(int nLength)
+ {
+ CMStringData* pOldData = GetData();
+ int nOldLength = pOldData->nDataLength;
+ CMStringData* pNewData = Allocate(nLength, sizeof(XCHAR));
+ if (pNewData != NULL)
+ {
+ int nCharsToCopy = ((nOldLength < nLength) ? nOldLength : nLength)+1; // Copy '\0'
+ CopyChars( PXSTR( pNewData->data() ), nCharsToCopy, PCXSTR( pOldData->data() ), nCharsToCopy );
+ pNewData->nDataLength = nOldLength;
+ pOldData->Release();
+ Attach(pNewData);
+ }
+ }
+ CMStringData* GetData() const
+ {
+ return (reinterpret_cast<CMStringData *>(m_pszData) - 1);
+ }
+ PXSTR PrepareWrite( int nLength )
+ {
+ CMStringData* pOldData = GetData();
+ int nShared = 1 - pOldData->nRefs; // nShared < 0 means true, >= 0 means false
+ int nTooShort = pOldData->nAllocLength-nLength; // nTooShort < 0 means true, >= 0 means false
+ if ((nShared | nTooShort) < 0 ) // If either sign bit is set (i.e. either is less than zero), we need to copy data
+ PrepareWrite2(nLength);
+
+ return m_pszData;
+ }
+ void PrepareWrite2(int nLength)
+ {
+ CMStringData* pOldData = GetData();
+ if (pOldData->nDataLength > nLength)
+ nLength = pOldData->nDataLength;
+
+ if (pOldData->IsShared())
+ {
+ Fork(nLength);
+ }
+ else if (pOldData->nAllocLength < nLength)
+ {
+ // Grow exponentially, until we hit 1K.
+ int nNewLength = pOldData->nAllocLength;
+ if( nNewLength > 1024 )
+ nNewLength += 1024;
+ else
+ nNewLength *= 2;
+
+ if( nNewLength < nLength )
+ nNewLength = nLength;
+
+ Reallocate( nNewLength );
+ }
+ }
+ void Reallocate( int nLength )
+ {
+ CMStringData* pOldData = GetData();
+ if ( pOldData->nAllocLength >= nLength || nLength <= 0)
+ return;
+
+ CMStringData* pNewData = Realloc( pOldData, nLength, sizeof( XCHAR ) );
+ if( pNewData != NULL )
+ Attach( pNewData );
+ }
+
+ void SetLength( int nLength )
+ {
+ GetData()->nDataLength = nLength;
+ m_pszData[nLength] = 0;
+ }
+
+ static CMStringData* __stdcall CloneData(CMStringData* pData)
+ {
+ CMStringData* pNewData = NULL;
+
+ if (!pData->IsLocked()) {
+ pNewData = pData;
+ pNewData->AddRef();
+ }
+
+ return pNewData;
+ }
+
+public :
+ // typedef CStrBufT<BaseType> CStrBuf;
+private:
+ PXSTR m_pszData;
+};
+
+
+template< typename _CharType = char >
+class ChTraitsCRT : public ChTraitsBase< _CharType >
+{
+public:
+ static char* __stdcall CharNext( const char* p )
+ {
+ return reinterpret_cast< char* >( _mbsinc( reinterpret_cast< const unsigned char* >( p )));
+ }
+
+ static int __stdcall IsDigit( char ch )
+ {
+ return _ismbcdigit( ch );
+ }
+
+ static int __stdcall IsSpace( char ch )
+ {
+ return _ismbcspace( ch );
+ }
+
+ static int __stdcall StringCompare( LPCSTR pszA, LPCSTR pszB )
+ {
+ return _mbscmp( reinterpret_cast< const unsigned char* >( pszA ), reinterpret_cast< const unsigned char* >( pszB ));
+ }
+
+ static int __stdcall StringCompareIgnore( LPCSTR pszA, LPCSTR pszB )
+ {
+ return _mbsicmp( reinterpret_cast< const unsigned char* >( pszA ), reinterpret_cast< const unsigned char* >( pszB ));
+ }
+
+ static int __stdcall StringCollate( LPCSTR pszA, LPCSTR pszB )
+ {
+ return _mbscoll( reinterpret_cast< const unsigned char* >( pszA ), reinterpret_cast< const unsigned char* >( pszB ));
+ }
+
+ static int __stdcall StringCollateIgnore( LPCSTR pszA, LPCSTR pszB )
+ {
+ return _mbsicoll( reinterpret_cast< const unsigned char* >( pszA ), reinterpret_cast< const unsigned char* >( pszB ));
+ }
+
+ static LPCSTR __stdcall StringFindString( LPCSTR pszBlock, LPCSTR pszMatch )
+ {
+ return reinterpret_cast< LPCSTR >( _mbsstr( reinterpret_cast< const unsigned char* >( pszBlock ),
+ reinterpret_cast< const unsigned char* >( pszMatch )));
+ }
+
+ static LPSTR __stdcall StringFindString( LPSTR pszBlock, LPCSTR pszMatch )
+ {
+ return const_cast< LPSTR >( StringFindString( const_cast< LPCSTR >( pszBlock ), pszMatch ));
+ }
+
+ static LPCSTR __stdcall StringFindChar( LPCSTR pszBlock, char chMatch )
+ {
+ return reinterpret_cast< LPCSTR >( _mbschr( reinterpret_cast< const unsigned char* >( pszBlock ), (unsigned char)chMatch ));
+ }
+
+ static LPCSTR __stdcall StringFindCharRev( LPCSTR psz, char ch )
+ {
+ return reinterpret_cast< LPCSTR >( _mbsrchr( reinterpret_cast< const unsigned char* >( psz ), (unsigned char)ch ));
+ }
+
+ static LPCSTR __stdcall StringScanSet( LPCSTR pszBlock, LPCSTR pszMatch )
+ {
+ return reinterpret_cast< LPCSTR >( _mbspbrk( reinterpret_cast< const unsigned char* >( pszBlock ),
+ reinterpret_cast< const unsigned char* >( pszMatch )));
+ }
+
+ static int __stdcall StringSpanIncluding( LPCSTR pszBlock, LPCSTR pszSet )
+ {
+ return (int)_mbsspn( reinterpret_cast< const unsigned char* >( pszBlock ), reinterpret_cast< const unsigned char* >( pszSet ) );
+ }
+
+ static int __stdcall StringSpanExcluding( LPCSTR pszBlock, LPCSTR pszSet )
+ {
+ return (int)_mbscspn( reinterpret_cast< const unsigned char* >( pszBlock ), reinterpret_cast< const unsigned char* >( pszSet ) );
+ }
+
+ static LPSTR __stdcall StringUppercase( LPSTR psz )
+ {
+#pragma warning (push)
+#pragma warning(disable : 4996)
+ return reinterpret_cast< LPSTR >( _mbsupr( reinterpret_cast< unsigned char* >( psz ) ) );
+#pragma warning (pop)
+ }
+
+ static LPSTR __stdcall StringLowercase( LPSTR psz )
+ {
+#pragma warning (push)
+#pragma warning(disable : 4996)
+ return reinterpret_cast< LPSTR >( _mbslwr( reinterpret_cast< unsigned char* >( psz ) ) );
+#pragma warning (pop)
+ }
+
+ static LPSTR __stdcall StringUppercase( LPSTR psz, size_t size )
+ {
+ #if _MSC_VER >= 1400
+ _mbsupr_s(reinterpret_cast< unsigned char* >( psz ), size);
+ #else
+ _mbsupr(reinterpret_cast< unsigned char* >( psz ));
+ #endif
+ return psz;
+ }
+
+ static LPSTR __stdcall StringLowercase( LPSTR psz, size_t size )
+ {
+ #if _MSC_VER >= 1400
+ _mbslwr_s( reinterpret_cast< unsigned char* >( psz ), size );
+ #else
+ _mbsupr(reinterpret_cast< unsigned char* >( psz ));
+ #endif
+ return psz;
+ }
+
+ static LPSTR __stdcall StringReverse( LPSTR psz )
+ {
+ return reinterpret_cast< LPSTR >( _mbsrev( reinterpret_cast< unsigned char* >( psz ) ) );
+ }
+
+ static int __stdcall GetFormattedLength( LPCSTR pszFormat, va_list args );
+
+ static int __stdcall Format( LPSTR pszBuffer, LPCSTR pszFormat, va_list args )
+ {
+#pragma warning (push)
+#pragma warning(disable : 4996)
+ return vsprintf( pszBuffer, pszFormat, args );
+#pragma warning (pop)
+
+ }
+
+ static int __stdcall Format( LPSTR pszBuffer, size_t nlength, LPCSTR pszFormat, va_list args );
+
+ static int __stdcall GetBaseTypeLength( LPCSTR pszSrc )
+ {
+ // Returns required buffer length in XCHARs
+ return int( strlen( pszSrc ) );
+ }
+
+ static int __stdcall GetBaseTypeLength( LPCSTR pszSrc, int nLength )
+ {
+ (void)pszSrc;
+ // Returns required buffer length in XCHARs
+ return nLength;
+ }
+
+ static int __stdcall GetBaseTypeLength( LPCWSTR pszSource )
+ {
+ // Returns required buffer length in XCHARs
+ return ::WideCharToMultiByte( _AtlGetConversionACP(), 0, pszSource, -1, NULL, 0, NULL, NULL )-1;
+ }
+
+ static int __stdcall GetBaseTypeLength( LPCWSTR pszSource, int nLength )
+ {
+ // Returns required buffer length in XCHARs
+ return ::WideCharToMultiByte( _AtlGetConversionACP(), 0, pszSource, nLength, NULL, 0, NULL, NULL );
+ }
+
+ static void __stdcall ConvertToBaseType( LPSTR pszDest, int nDestLength, LPCSTR pszSrc, int nSrcLength = -1 )
+ {
+ if (nSrcLength == -1) { nSrcLength=1 + GetBaseTypeLength(pszSrc); }
+ // nLen is in XCHARs
+ memcpy_s( pszDest, nDestLength*sizeof( char ),
+ pszSrc, nSrcLength*sizeof( char ) );
+ }
+
+ static void __stdcall ConvertToBaseType( LPSTR pszDest, int nDestLength, LPCWSTR pszSrc, int nSrcLength = -1)
+ {
+ // nLen is in XCHARs
+ ::WideCharToMultiByte( _AtlGetConversionACP(), 0, pszSrc, nSrcLength, pszDest, nDestLength, NULL, NULL );
+ }
+
+ static void ConvertToOem( _CharType* pstrString)
+ {
+ BOOL fSuccess=::CharToOemA(pstrString, pstrString);
+ }
+
+ static void ConvertToAnsi( _CharType* pstrString)
+ {
+ BOOL fSuccess=::OemToCharA(pstrString, pstrString);
+ }
+
+ static void ConvertToOem( _CharType* pstrString, size_t size)
+ {
+ if(size>UINT_MAX)
+ {
+ return;
+ }
+ DWORD dwSize=static_cast<DWORD>(size);
+ BOOL fSuccess=::CharToOemBuffA(pstrString, pstrString, dwSize);
+ }
+
+ static void ConvertToAnsi( _CharType* pstrString, size_t size)
+ {
+ if(size>UINT_MAX)
+ return;
+
+ DWORD dwSize=static_cast<DWORD>(size);
+ BOOL fSuccess=::OemToCharBuffA(pstrString, pstrString, dwSize);
+ }
+
+ static void __stdcall FloodCharacters( char ch, int nLength, char* pch )
+ {
+ // nLength is in XCHARs
+ memset( pch, ch, nLength );
+ }
+
+ static BSTR __stdcall AllocSysString( const char* pchData, int nDataLength )
+ {
+ int nLen = ::MultiByteToWideChar( _AtlGetConversionACP(), 0, pchData, nDataLength, NULL, NULL );
+ BSTR bstr = ::SysAllocStringLen( NULL, nLen );
+ if( bstr != NULL )
+ ::MultiByteToWideChar( _AtlGetConversionACP(), 0, pchData, nDataLength, bstr, nLen );
+
+ return bstr;
+ }
+
+ static BOOL __stdcall ReAllocSysString( const char* pchData, BSTR* pbstr, int nDataLength )
+ {
+ int nLen = ::MultiByteToWideChar( _AtlGetConversionACP(), 0, pchData, nDataLength, NULL, NULL );
+ BOOL bSuccess = ::SysReAllocStringLen( pbstr, NULL, nLen );
+ if( bSuccess )
+ ::MultiByteToWideChar( _AtlGetConversionACP(), 0, pchData, nDataLength, *pbstr, nLen );
+
+ return bSuccess;
+ }
+
+ static int __stdcall SafeStringLen( LPCSTR psz )
+ {
+ // returns length in bytes
+ return (psz != NULL) ? int( strlen( psz ) ) : 0;
+ }
+
+ static int __stdcall SafeStringLen( LPCWSTR psz )
+ {
+ // returns length in wchar_ts
+ return (psz != NULL) ? int( wcslen( psz ) ) : 0;
+ }
+
+ static int __stdcall GetCharLen( const wchar_t* pch )
+ {
+ // returns char length
+ return 1;
+ }
+
+ static int __stdcall GetCharLen( const char* pch )
+ {
+ // returns char length
+ return int( _mbclen( reinterpret_cast< const unsigned char* >( pch ) ) );
+ }
+
+ static DWORD __stdcall GetEnvironmentVariable( LPCSTR pszVar, LPSTR pszBuffer, DWORD dwSize )
+ {
+ return ::GetEnvironmentVariableA( pszVar, pszBuffer, dwSize );
+ }
+};
+
+// specialization for wchar_t
+template<>
+class ChTraitsCRT< wchar_t > : public ChTraitsBase< wchar_t >
+{
+ static DWORD __stdcall _GetEnvironmentVariableW( LPCWSTR pszName, LPWSTR pszBuffer, DWORD nSize )
+ {
+ return ::GetEnvironmentVariableW( pszName, pszBuffer, nSize );
+ }
+
+public:
+ static LPWSTR __stdcall CharNext( LPCWSTR psz )
+ {
+ return const_cast< LPWSTR >( psz+1 );
+ }
+
+ static int __stdcall IsDigit( wchar_t ch )
+ {
+ return iswdigit( static_cast<unsigned short>(ch) );
+ }
+
+ static int __stdcall IsSpace( wchar_t ch )
+ {
+ return iswspace( static_cast<unsigned short>(ch) );
+ }
+
+ static int __stdcall StringCompare( LPCWSTR pszA, LPCWSTR pszB )
+ {
+ return wcscmp( pszA, pszB );
+ }
+
+ static int __stdcall StringCompareIgnore( LPCWSTR pszA, LPCWSTR pszB )
+ {
+ return _wcsicmp( pszA, pszB );
+ }
+
+ static int __stdcall StringCollate( LPCWSTR pszA, LPCWSTR pszB )
+ {
+ return wcscoll( pszA, pszB );
+ }
+
+ static int __stdcall StringCollateIgnore( LPCWSTR pszA, LPCWSTR pszB )
+ {
+ return _wcsicoll( pszA, pszB );
+ }
+
+ static LPCWSTR __stdcall StringFindString( LPCWSTR pszBlock, LPCWSTR pszMatch )
+ {
+ return wcsstr( pszBlock, pszMatch );
+ }
+
+ static LPWSTR __stdcall StringFindString( LPWSTR pszBlock, LPCWSTR pszMatch )
+ {
+ return const_cast< LPWSTR >( StringFindString( const_cast< LPCWSTR >( pszBlock ), pszMatch ));
+ }
+
+ static LPCWSTR __stdcall StringFindChar( LPCWSTR pszBlock, wchar_t chMatch )
+ {
+ return wcschr( pszBlock, chMatch );
+ }
+
+ static LPCWSTR __stdcall StringFindCharRev( LPCWSTR psz, wchar_t ch )
+ {
+ return wcsrchr( psz, ch );
+ }
+
+ static LPCWSTR __stdcall StringScanSet( LPCWSTR pszBlock, LPCWSTR pszMatch )
+ {
+ return wcspbrk( pszBlock, pszMatch );
+ }
+
+ static int __stdcall StringSpanIncluding( LPCWSTR pszBlock, LPCWSTR pszSet )
+ {
+ return (int)wcsspn( pszBlock, pszSet );
+ }
+
+ static int __stdcall StringSpanExcluding( LPCWSTR pszBlock, LPCWSTR pszSet )
+ {
+ return (int)wcscspn( pszBlock, pszSet );
+ }
+
+ static LPWSTR __stdcall StringUppercase( LPWSTR psz )
+ {
+#pragma warning (push)
+#pragma warning(disable : 4996)
+ return _wcsupr( psz );
+#pragma warning (pop)
+ }
+
+ static LPWSTR __stdcall StringLowercase( LPWSTR psz )
+ {
+#pragma warning (push)
+#pragma warning(disable : 4996)
+ return _wcslwr( psz );
+#pragma warning (pop)
+ }
+
+ static LPWSTR __stdcall StringUppercase( LPWSTR psz, size_t size )
+ {
+ return _wcsupr( psz );
+ }
+
+ static LPWSTR __stdcall StringLowercase( LPWSTR psz, size_t size )
+ {
+ return _wcslwr( psz );
+ }
+
+ static LPWSTR __stdcall StringReverse( LPWSTR psz )
+ {
+ return _wcsrev( psz );
+ }
+
+ static int __stdcall GetFormattedLength( LPCWSTR pszFormat, va_list args);
+
+ static int __stdcall Format( LPWSTR pszBuffer, LPCWSTR pszFormat, va_list args)
+ {
+#pragma warning (push)
+#pragma warning(disable : 4996)
+ return vswprintf( pszBuffer, pszFormat, args );
+#pragma warning (pop)
+ }
+
+ static int __stdcall Format( LPWSTR pszBuffer, size_t nLength, LPCWSTR pszFormat, va_list args);
+
+ static int __stdcall GetBaseTypeLength( LPCSTR pszSrc )
+ {
+ // Returns required buffer size in wchar_ts
+ return ::MultiByteToWideChar( CP_ACP, 0, pszSrc, -1, NULL, 0 )-1;
+ }
+
+ static int __stdcall GetBaseTypeLength( LPCSTR pszSrc, int nLength )
+ {
+ // Returns required buffer size in wchar_ts
+ return ::MultiByteToWideChar( CP_ACP, 0, pszSrc, nLength, NULL, 0 );
+ }
+
+ static int __stdcall GetBaseTypeLength( LPCWSTR pszSrc )
+ {
+ // Returns required buffer size in wchar_ts
+ return (int)wcslen( pszSrc );
+ }
+
+ static int __stdcall GetBaseTypeLength( LPCWSTR pszSrc, int nLength )
+ {
+ (void)pszSrc;
+ // Returns required buffer size in wchar_ts
+ return nLength;
+ }
+
+ static void __stdcall ConvertToBaseType( LPWSTR pszDest, int nDestLength, LPCSTR pszSrc, int nSrcLength = -1)
+ {
+ // nLen is in wchar_ts
+ ::MultiByteToWideChar( CP_ACP, 0, pszSrc, nSrcLength, pszDest, nDestLength );
+ }
+
+ static void __stdcall ConvertToBaseType( LPWSTR pszDest, int nDestLength, LPCWSTR pszSrc, int nSrcLength = -1 )
+ {
+ if (nSrcLength == -1) { nSrcLength=1 + GetBaseTypeLength(pszSrc); }
+ // nLen is in wchar_ts
+ #if _MSC_VER >= 1400
+ wmemcpy_s(pszDest, nDestLength, pszSrc, nSrcLength);
+ #else
+ wmemcpy(pszDest, pszSrc, nDestLength);
+ #endif
+ }
+
+ static void __stdcall FloodCharacters( wchar_t ch, int nLength, LPWSTR psz )
+ {
+ // nLength is in XCHARs
+ for( int i = 0; i < nLength; i++ )
+ {
+ psz[i] = ch;
+ }
+ }
+
+ static BSTR __stdcall AllocSysString( const wchar_t* pchData, int nDataLength )
+ {
+ return ::SysAllocStringLen( pchData, nDataLength );
+ }
+
+ static BOOL __stdcall ReAllocSysString( const wchar_t* pchData, BSTR* pbstr, int nDataLength )
+ {
+ return ::SysReAllocStringLen( pbstr, pchData, nDataLength );
+ }
+
+ static int __stdcall SafeStringLen( LPCSTR psz )
+ {
+ // returns length in bytes
+ return (psz != NULL) ? (int)strlen( psz ) : 0;
+ }
+
+ static int __stdcall SafeStringLen( LPCWSTR psz )
+ {
+ // returns length in wchar_ts
+ return (psz != NULL) ? (int)wcslen( psz ) : 0;
+ }
+
+ static int __stdcall GetCharLen( const wchar_t* pch )
+ {
+ (void)pch;
+ // returns char length
+ return 1;
+ }
+
+ static int __stdcall GetCharLen( const char* pch )
+ {
+ // returns char length
+ return (int)( _mbclen( reinterpret_cast< const unsigned char* >( pch ) ) );
+ }
+
+ static DWORD __stdcall GetEnvironmentVariable( LPCWSTR pszVar, LPWSTR pszBuffer, DWORD dwSize )
+ {
+ return _GetEnvironmentVariableW( pszVar, pszBuffer, dwSize );
+ }
+
+ static void __stdcall ConvertToOem( LPWSTR /*psz*/ )
+ {
+ }
+
+ static void __stdcall ConvertToAnsi( LPWSTR /*psz*/ )
+ {
+ }
+
+ static void __stdcall ConvertToOem( LPWSTR /*psz*/, size_t )
+ {
+ }
+
+ static void __stdcall ConvertToAnsi( LPWSTR /*psz*/, size_t )
+ {
+ }
+};
+
+template< typename BaseType, class StringTraits >
+class CMStringT : public CMSimpleStringT< BaseType >
+{
+public:
+ typedef CMSimpleStringT< BaseType> CThisSimpleString;
+ typedef typename CThisSimpleString::XCHAR XCHAR;
+ typedef typename CThisSimpleString::PXSTR PXSTR;
+ typedef typename CThisSimpleString::PCXSTR PCXSTR;
+ typedef typename CThisSimpleString::YCHAR YCHAR;
+ typedef typename CThisSimpleString::PYSTR PYSTR;
+ typedef typename CThisSimpleString::PCYSTR PCYSTR;
+
+public:
+ CMStringT() : CThisSimpleString()
+ {
+ }
+
+ static void __stdcall Construct( CMStringT* pString )
+ {
+ new( pString ) CMStringT;
+ }
+
+ // Copy constructor
+ CMStringT( const CMStringT& strSrc ) :
+ CThisSimpleString( strSrc )
+ {
+ }
+
+ CMStringT( const XCHAR* pszSrc ) :
+ CThisSimpleString()
+ {
+ // nDestLength is in XCHARs
+ *this = pszSrc;
+ }
+
+ CMStringT( const YCHAR* pszSrc ) :
+ CThisSimpleString()
+ {
+ *this = pszSrc;
+ }
+
+
+ CMStringT( const unsigned char* pszSrc ) :
+ CThisSimpleString()
+ {
+ *this = reinterpret_cast< const char* >( pszSrc );
+ }
+
+ CMStringT( char ch, int nLength = 1 ) :
+ CThisSimpleString()
+ {
+ if( nLength > 0 )
+ {
+ PXSTR pszBuffer = this->GetBuffer( nLength );
+ StringTraits::FloodCharacters( XCHAR( ch ), nLength, pszBuffer );
+ this->ReleaseBufferSetLength( nLength );
+ }
+ }
+
+ CMStringT( wchar_t ch, int nLength = 1 ) :
+ CThisSimpleString()
+ {
+ if( nLength > 0 )
+ {
+ //Convert ch to the BaseType
+ wchar_t pszCh[2] = { ch , 0 };
+ int nBaseTypeCharLen = 1;
+
+ if(ch != L'\0')
+ {
+ nBaseTypeCharLen = StringTraits::GetBaseTypeLength(pszCh);
+ }
+
+ XCHAR *buffBaseTypeChar = new XCHAR[nBaseTypeCharLen+1];
+ StringTraits::ConvertToBaseType( buffBaseTypeChar, nBaseTypeCharLen+1, pszCh, 1 );
+ //Allocate enough characters in String and flood (replicate) with the (converted character)*nLength
+ PXSTR pszBuffer = this->GetBuffer( nLength*nBaseTypeCharLen );
+ if (nBaseTypeCharLen == 1)
+ { //Optimization for a common case - wide char translates to 1 ansi/wide char.
+ StringTraits::FloodCharacters( buffBaseTypeChar[0], nLength, pszBuffer );
+ } else
+ {
+ XCHAR* p=pszBuffer;
+ for (int i=0 ; i < nLength ;++i)
+ {
+ for (int j=0 ; j < nBaseTypeCharLen ;++j)
+ {
+ *p=buffBaseTypeChar[j];
+ ++p;
+ }
+ }
+ }
+ this->ReleaseBufferSetLength( nLength*nBaseTypeCharLen );
+ delete [] buffBaseTypeChar;
+ }
+ }
+
+ CMStringT( const XCHAR* pch, int nLength ) :
+ CThisSimpleString( pch, nLength )
+ {
+ }
+
+ CMStringT( const YCHAR* pch, int nLength ) :
+ CThisSimpleString()
+ {
+ if( nLength > 0 )
+ {
+ int nDestLength = StringTraits::GetBaseTypeLength( pch, nLength );
+ PXSTR pszBuffer = this->GetBuffer( nDestLength );
+ StringTraits::ConvertToBaseType( pszBuffer, nDestLength, pch, nLength );
+ this->ReleaseBufferSetLength( nDestLength );
+ }
+ }
+
+ // Destructor
+ ~CMStringT()
+ {
+ }
+
+ // Assignment operators
+ CMStringT& operator=( const CMStringT& strSrc )
+ {
+ CThisSimpleString::operator=( strSrc );
+
+ return *this;
+ }
+
+ CMStringT& operator=( PCXSTR pszSrc )
+ {
+ CThisSimpleString::operator=( pszSrc );
+
+ return *this;
+ }
+
+ CMStringT& operator=( PCYSTR pszSrc )
+ {
+ // nDestLength is in XCHARs
+ int nDestLength = (pszSrc != NULL) ? StringTraits::GetBaseTypeLength( pszSrc ) : 0;
+ if( nDestLength > 0 )
+ {
+ PXSTR pszBuffer = this->GetBuffer( nDestLength );
+ StringTraits::ConvertToBaseType( pszBuffer, nDestLength, pszSrc);
+ this->ReleaseBufferSetLength( nDestLength );
+ }
+ else
+ {
+ this->Empty();
+ }
+
+ return *this;
+ }
+
+ CMStringT& operator=( const unsigned char* pszSrc )
+ {
+ return operator=( reinterpret_cast< const char* >( pszSrc ));
+ }
+
+ CMStringT& operator=( char ch )
+ {
+ char ach[2] = { ch, 0 };
+
+ return operator=( ach );
+ }
+
+ CMStringT& operator=( wchar_t ch )
+ {
+ wchar_t ach[2] = { ch, 0 };
+
+ return operator=( ach );
+ }
+
+// CMStringT& operator=( const VARIANT& var );
+
+ CMStringT& operator+=( const CMStringT& str )
+ {
+ CThisSimpleString::operator+=( str );
+ return *this;
+ }
+
+ CMStringT& operator+=( const CThisSimpleString& str )
+ {
+ CThisSimpleString::operator+=( str );
+ return *this;
+ }
+
+ CMStringT& operator+=( PCXSTR pszSrc )
+ {
+ CThisSimpleString::operator+=( pszSrc );
+ return *this;
+ }
+// template< int t_nSize >
+// CMStringT& operator+=( const CStaticString< XCHAR, t_nSize >& strSrc )
+// {
+// CThisSimpleString::operator+=( strSrc );
+//
+// return *this;
+// }
+ CMStringT& operator+=( PCYSTR pszSrc )
+ {
+ CMStringT str( pszSrc );
+
+ return operator+=( str );
+ }
+
+ CMStringT& operator+=( char ch )
+ {
+ CThisSimpleString::operator+=( ch );
+
+ return *this;
+ }
+
+ CMStringT& operator+=( unsigned char ch )
+ {
+ CThisSimpleString::operator+=( ch );
+
+ return *this;
+ }
+
+ CMStringT& operator+=( wchar_t ch )
+ {
+ CThisSimpleString::operator+=( ch );
+
+ return *this;
+ }
+
+ // Comparison
+
+ int Compare( PCXSTR psz ) const
+ {
+ return StringTraits::StringCompare( this->GetString(), psz );
+ }
+
+ int CompareNoCase( PCXSTR psz ) const
+ {
+ return StringTraits::StringCompareIgnore( this->GetString(), psz );
+ }
+
+ int Collate( PCXSTR psz ) const
+ {
+ return StringTraits::StringCollate( this->GetString(), psz );
+ }
+
+ int CollateNoCase( PCXSTR psz ) const
+ {
+ return StringTraits::StringCollateIgnore( this->GetString(), psz );
+ }
+
+ // Advanced manipulation
+
+ // Delete 'nCount' characters, starting at index 'iIndex'
+ int Delete( int iIndex, int nCount = 1 )
+ {
+ if( iIndex < 0 )
+ iIndex = 0;
+
+ if( nCount < 0 )
+ nCount = 0;
+
+ int nLength = this->GetLength();
+ if( nCount + iIndex > nLength )
+ {
+ nCount = nLength-iIndex;
+ }
+ if( nCount > 0 )
+ {
+ int nNewLength = nLength-nCount;
+ int nXCHARsToCopy = nLength-(iIndex+nCount)+1;
+ PXSTR pszBuffer = this->GetBuffer();
+ #if _MSC_VER >= 1400
+ memmove_s( pszBuffer+iIndex, nXCHARsToCopy*sizeof( XCHAR ), pszBuffer+iIndex+nCount, nXCHARsToCopy*sizeof( XCHAR ) );
+ #else
+ memmove( pszBuffer+iIndex, pszBuffer+iIndex+nCount, nXCHARsToCopy*sizeof( XCHAR ));
+ #endif
+ this->ReleaseBufferSetLength( nNewLength );
+ }
+
+ return this->GetLength();
+ }
+
+ // Insert character 'ch' before index 'iIndex'
+ int Insert( int iIndex, XCHAR ch )
+ {
+ if( iIndex < 0 )
+ iIndex = 0;
+
+ if( iIndex > this->GetLength() )
+ iIndex = this->GetLength();
+
+ int nNewLength = this->GetLength()+1;
+
+ PXSTR pszBuffer = this->GetBuffer( nNewLength );
+
+ // move existing bytes down
+ #if _MSC_VER >= 1400
+ memmove_s( pszBuffer+iIndex+1, (nNewLength-iIndex)*sizeof( XCHAR ), pszBuffer+iIndex, (nNewLength-iIndex)*sizeof( XCHAR ) );
+ #else
+ memmove( pszBuffer+iIndex+1, pszBuffer+iIndex, (nNewLength-iIndex)*sizeof( XCHAR ) );
+ #endif
+ pszBuffer[iIndex] = ch;
+
+ this->ReleaseBufferSetLength( nNewLength );
+ return nNewLength;
+ }
+
+ // Insert string 'psz' before index 'iIndex'
+ int Insert( int iIndex, PCXSTR psz )
+ {
+ if( iIndex < 0 )
+ iIndex = 0;
+
+ if( iIndex > this->GetLength() )
+ {
+ iIndex = this->GetLength();
+ }
+
+ // nInsertLength and nNewLength are in XCHARs
+ int nInsertLength = StringTraits::SafeStringLen( psz );
+ int nNewLength = this->GetLength();
+ if( nInsertLength > 0 )
+ {
+ nNewLength += nInsertLength;
+
+ PXSTR pszBuffer = this->GetBuffer( nNewLength );
+ // move existing bytes down
+ #if _MSC_VER >= 1400
+ memmove_s( pszBuffer+iIndex+nInsertLength, (nNewLength-iIndex-nInsertLength+1)*sizeof( XCHAR ), pszBuffer+iIndex, (nNewLength-iIndex-nInsertLength+1)*sizeof( XCHAR ) );
+ memcpy_s( pszBuffer+iIndex, nInsertLength*sizeof( XCHAR ), psz, nInsertLength*sizeof( XCHAR ));
+ #else
+ memmove( pszBuffer+iIndex+nInsertLength, pszBuffer+iIndex, (nNewLength-iIndex-nInsertLength+1)*sizeof( XCHAR ) );
+ memcpy( pszBuffer+iIndex, psz, nInsertLength*sizeof( XCHAR ));
+ #endif
+ this->ReleaseBufferSetLength( nNewLength );
+ }
+
+ return nNewLength;
+ }
+
+ // Replace all occurrences of character 'chOld' with character 'chNew'
+ int Replace( XCHAR chOld, XCHAR chNew )
+ {
+ int nCount = 0;
+
+ // short-circuit the nop case
+ if( chOld != chNew )
+ {
+ // otherwise modify each character that matches in the string
+ bool bCopied = false;
+ PXSTR pszBuffer = const_cast< PXSTR >( this->GetString() ); // We don't actually write to pszBuffer until we've called GetBuffer().
+
+ int nLength = this->GetLength();
+ int iChar = 0;
+ while( iChar < nLength )
+ {
+ // replace instances of the specified character only
+ if( pszBuffer[iChar] == chOld )
+ {
+ if( !bCopied )
+ {
+ bCopied = true;
+ pszBuffer = this->GetBuffer( nLength );
+ }
+ pszBuffer[iChar] = chNew;
+ nCount++;
+ }
+ iChar = int( StringTraits::CharNext( pszBuffer+iChar )-pszBuffer );
+ }
+ if( bCopied )
+ {
+ this->ReleaseBufferSetLength( nLength );
+ }
+ }
+
+ return nCount;
+ }
+
+ // Replace all occurrences of string 'pszOld' with string 'pszNew'
+ int Replace( PCXSTR pszOld, PCXSTR pszNew )
+ {
+ // can't have empty or NULL lpszOld
+
+ // nSourceLen is in XCHARs
+ int nSourceLen = StringTraits::SafeStringLen( pszOld );
+ if( nSourceLen == 0 )
+ return 0;
+ // nReplacementLen is in XCHARs
+ int nReplacementLen = StringTraits::SafeStringLen( pszNew );
+
+ // loop once to figure out the size of the result string
+ int nCount = 0;
+ {
+ PCXSTR pszStart = this->GetString();
+ PCXSTR pszEnd = pszStart+this->GetLength();
+ while( pszStart < pszEnd )
+ {
+ PCXSTR pszTarget;
+ while( (pszTarget = StringTraits::StringFindString( pszStart, pszOld ) ) != NULL)
+ {
+ nCount++;
+ pszStart = pszTarget+nSourceLen;
+ }
+ pszStart += StringTraits::SafeStringLen( pszStart )+1;
+ }
+ }
+
+ // if any changes were made, make them
+ if( nCount > 0 )
+ {
+ // if the buffer is too small, just
+ // allocate a new buffer (slow but sure)
+ int nOldLength = this->GetLength();
+ int nNewLength = nOldLength+(nReplacementLen-nSourceLen)*nCount;
+
+ PXSTR pszBuffer = this->GetBuffer( __max( nNewLength, nOldLength ) );
+
+ PXSTR pszStart = pszBuffer;
+ PXSTR pszEnd = pszStart+nOldLength;
+
+ // loop again to actually do the work
+ while( pszStart < pszEnd )
+ {
+ PXSTR pszTarget;
+ while( (pszTarget = StringTraits::StringFindString( pszStart, pszOld ) ) != NULL )
+ {
+ int nBalance = nOldLength-int(pszTarget-pszBuffer+nSourceLen);
+ memmove_s( pszTarget+nReplacementLen, nBalance*sizeof( XCHAR ),
+ pszTarget+nSourceLen, nBalance*sizeof( XCHAR ) );
+ memcpy_s( pszTarget, nReplacementLen*sizeof( XCHAR ),
+ pszNew, nReplacementLen*sizeof( XCHAR ) );
+ pszStart = pszTarget+nReplacementLen;
+ pszTarget[nReplacementLen+nBalance] = 0;
+ nOldLength += (nReplacementLen-nSourceLen);
+ }
+ pszStart += StringTraits::SafeStringLen( pszStart )+1;
+ }
+ this->ReleaseBufferSetLength( nNewLength );
+ }
+
+ return nCount;
+ }
+
+ // Remove all occurrences of character 'chRemove'
+ int Remove( XCHAR chRemove )
+ {
+ int nLength = this->GetLength();
+ PXSTR pszBuffer = this->GetBuffer( nLength );
+
+ PXSTR pszSource = pszBuffer;
+ PXSTR pszDest = pszBuffer;
+ PXSTR pszEnd = pszBuffer+nLength;
+
+ while( pszSource < pszEnd )
+ {
+ PXSTR pszNewSource = StringTraits::CharNext( pszSource );
+ if( *pszSource != chRemove )
+ {
+ // Copy the source to the destination. Remember to copy all bytes of an MBCS character
+ // Copy the source to the destination. Remember to copy all bytes of an MBCS character
+ size_t NewSourceGap = (pszNewSource-pszSource);
+ PXSTR pszNewDest = pszDest + NewSourceGap;
+ size_t i = 0;
+ for (i = 0; pszDest != pszNewDest && i < NewSourceGap; i++)
+ {
+ *pszDest = *pszSource;
+ pszSource++;
+ pszDest++;
+ }
+ }
+ pszSource = pszNewSource;
+ }
+ *pszDest = 0;
+ int nCount = int( pszSource-pszDest );
+ this->ReleaseBufferSetLength( nLength-nCount );
+
+ return nCount;
+ }
+
+ CMStringT Tokenize( PCXSTR pszTokens, int& iStart ) const
+ {
+ if( (pszTokens == NULL) || (*pszTokens == (XCHAR)0) )
+ {
+ if (iStart < this->GetLength())
+ return CMStringT( this->GetString()+iStart );
+ }
+ else
+ {
+ PCXSTR pszPlace = this->GetString()+iStart;
+ PCXSTR pszEnd = this->GetString()+this->GetLength();
+ if( pszPlace < pszEnd )
+ {
+ int nIncluding = StringTraits::StringSpanIncluding( pszPlace, pszTokens );
+
+ if( (pszPlace+nIncluding) < pszEnd )
+ {
+ pszPlace += nIncluding;
+ int nExcluding = StringTraits::StringSpanExcluding( pszPlace, pszTokens );
+
+ int iFrom = iStart+nIncluding;
+ int nUntil = nExcluding;
+ iStart = iFrom+nUntil+1;
+
+ return Mid( iFrom, nUntil );
+ }
+ }
+ }
+
+ // return empty string, done tokenizing
+ iStart = -1;
+
+ return CMStringT();
+ }
+
+ // find routines
+
+ // Find the first occurrence of character 'ch', starting at index 'iStart'
+ int Find( XCHAR ch, int iStart = 0 ) const
+ {
+ // nLength is in XCHARs
+ int nLength = this->GetLength();
+ if( iStart < 0 || iStart >= nLength)
+ return -1;
+
+ // find first single character
+ PCXSTR psz = StringTraits::StringFindChar( this->GetString()+iStart, ch );
+
+ // return -1 if not found and index otherwise
+ return (psz == NULL) ? -1 : int( psz-this->GetString());
+ }
+
+ // look for a specific sub-string
+
+ // Find the first occurrence of string 'pszSub', starting at index 'iStart'
+ int Find( PCXSTR pszSub, int iStart = 0 ) const
+ {
+ // iStart is in XCHARs
+ if(pszSub == NULL)
+ return -1;
+
+ // nLength is in XCHARs
+ int nLength = this->GetLength();
+ if( iStart < 0 || iStart > nLength )
+ return -1;
+
+ // find first matching substring
+ PCXSTR psz = StringTraits::StringFindString( this->GetString()+iStart, pszSub );
+
+ // return -1 for not found, distance from beginning otherwise
+ return (psz == NULL) ? -1 : int( psz-this->GetString());
+ }
+
+ // Find the first occurrence of any of the characters in string 'pszCharSet'
+ int FindOneOf( PCXSTR pszCharSet ) const
+ {
+ PCXSTR psz = StringTraits::StringScanSet( this->GetString(), pszCharSet );
+ return (psz == NULL) ? -1 : int( psz-this->GetString());
+ }
+
+ // Find the last occurrence of character 'ch'
+ int ReverseFind( XCHAR ch ) const
+ {
+ // find last single character
+ PCXSTR psz = StringTraits::StringFindCharRev( this->GetString(), ch );
+
+ // return -1 if not found, distance from beginning otherwise
+ return (psz == NULL) ? -1 : int( psz-this->GetString());
+ }
+
+ // manipulation
+
+ // Convert the string to uppercase
+ CMStringT& MakeUpper()
+ {
+ int nLength = this->GetLength();
+ PXSTR pszBuffer = this->GetBuffer( nLength );
+ StringTraits::StringUppercase( pszBuffer, nLength+1 );
+ this->ReleaseBufferSetLength( nLength );
+
+ return *this;
+ }
+
+ // Convert the string to lowercase
+ CMStringT& MakeLower()
+ {
+ int nLength = this->GetLength();
+ PXSTR pszBuffer = this->GetBuffer( nLength );
+ StringTraits::StringLowercase( pszBuffer, nLength+1 );
+ this->ReleaseBufferSetLength( nLength );
+
+ return *this;
+ }
+
+ // Reverse the string
+ CMStringT& MakeReverse()
+ {
+ int nLength = this->GetLength();
+ PXSTR pszBuffer = this->GetBuffer( nLength );
+ StringTraits::StringReverse( pszBuffer );
+ this->ReleaseBufferSetLength( nLength );
+
+ return *this;
+ }
+
+ // trimming
+
+ // Remove all trailing whitespace
+ CMStringT& TrimRight()
+ {
+ // find beginning of trailing spaces by starting
+ // at beginning (DBCS aware)
+
+ PCXSTR psz = this->GetString();
+ PCXSTR pszLast = NULL;
+
+ while( *psz != 0 )
+ {
+ if( StringTraits::IsSpace( *psz ) )
+ {
+ if( pszLast == NULL )
+ pszLast = psz;
+ }
+ else
+ {
+ pszLast = NULL;
+ }
+ psz = StringTraits::CharNext( psz );
+ }
+
+ if( pszLast != NULL )
+ {
+ // truncate at trailing space start
+ int iLast = int( pszLast-this->GetString() );
+
+ this->Truncate( iLast );
+ }
+
+ return *this;
+ }
+
+ // Remove all leading whitespace
+ CMStringT& TrimLeft()
+ {
+ // find first non-space character
+
+ PCXSTR psz = this->GetString();
+
+ while( StringTraits::IsSpace( *psz ) )
+ {
+ psz = StringTraits::CharNext( psz );
+ }
+
+ if( psz != this->GetString() )
+ {
+ // fix up data and length
+ int iFirst = int( psz-this->GetString() );
+ PXSTR pszBuffer = this->GetBuffer( this->GetLength() );
+ psz = pszBuffer+iFirst;
+ int nDataLength = this->GetLength()-iFirst;
+ memmove_s( pszBuffer, (this->GetLength()+1)*sizeof( XCHAR ),
+ psz, (nDataLength+1)*sizeof( XCHAR ) );
+ this->ReleaseBufferSetLength( nDataLength );
+ }
+
+ return *this;
+ }
+
+ // Remove all leading and trailing whitespace
+ CMStringT& Trim()
+ {
+ return TrimRight().TrimLeft();
+ }
+
+ // Remove all leading and trailing occurrences of character 'chTarget'
+ CMStringT& Trim( XCHAR chTarget )
+ {
+ return TrimRight( chTarget ).TrimLeft( chTarget );
+ }
+
+ // Remove all leading and trailing occurrences of any of the characters in the string 'pszTargets'
+ CMStringT& Trim( PCXSTR pszTargets )
+ {
+ return TrimRight( pszTargets ).TrimLeft( pszTargets );
+ }
+
+ // trimming anything (either side)
+
+ // Remove all trailing occurrences of character 'chTarget'
+ CMStringT& TrimRight( XCHAR chTarget )
+ {
+ // find beginning of trailing matches
+ // by starting at beginning (DBCS aware)
+
+ PCXSTR psz = this->GetString();
+ PCXSTR pszLast = NULL;
+
+ while( *psz != 0 )
+ {
+ if( *psz == chTarget )
+ {
+ if( pszLast == NULL )
+ {
+ pszLast = psz;
+ }
+ }
+ else
+ {
+ pszLast = NULL;
+ }
+ psz = StringTraits::CharNext( psz );
+ }
+
+ if( pszLast != NULL )
+ {
+ // truncate at left-most matching character
+ int iLast = int( pszLast-this->GetString() );
+ this->Truncate( iLast );
+ }
+
+ return *this;
+ }
+
+ // Remove all trailing occurrences of any of the characters in string 'pszTargets'
+ CMStringT& TrimRight( PCXSTR pszTargets )
+ {
+ // if we're not trimming anything, we're not doing any work
+ if( (pszTargets == NULL) || (*pszTargets == 0) )
+ {
+ return *this;
+ }
+
+ // find beginning of trailing matches
+ // by starting at beginning (DBCS aware)
+
+ PCXSTR psz = this->GetString();
+ PCXSTR pszLast = NULL;
+
+ while( *psz != 0 )
+ {
+ if( StringTraits::StringFindChar( pszTargets, *psz ) != NULL )
+ {
+ if( pszLast == NULL )
+ {
+ pszLast = psz;
+ }
+ }
+ else
+ {
+ pszLast = NULL;
+ }
+ psz = StringTraits::CharNext( psz );
+ }
+
+ if( pszLast != NULL )
+ {
+ // truncate at left-most matching character
+ int iLast = int( pszLast-this->GetString() );
+ this->Truncate( iLast );
+ }
+
+ return *this;
+ }
+
+ // Remove all leading occurrences of character 'chTarget'
+ CMStringT& TrimLeft( XCHAR chTarget )
+ {
+ // find first non-matching character
+ PCXSTR psz = this->GetString();
+
+ while( chTarget == *psz )
+ {
+ psz = StringTraits::CharNext( psz );
+ }
+
+ if( psz != this->GetString() )
+ {
+ // fix up data and length
+ int iFirst = int( psz-this->GetString() );
+ PXSTR pszBuffer = this->GetBuffer( this->GetLength() );
+ psz = pszBuffer+iFirst;
+ int nDataLength = this->GetLength()-iFirst;
+ memmove_s( pszBuffer, (this->GetLength()+1)*sizeof( XCHAR ),
+ psz, (nDataLength+1)*sizeof( XCHAR ) );
+ this->ReleaseBufferSetLength( nDataLength );
+ }
+
+ return *this;
+ }
+
+ // Remove all leading occurrences of any of the characters in string 'pszTargets'
+ CMStringT& TrimLeft( PCXSTR pszTargets )
+ {
+ // if we're not trimming anything, we're not doing any work
+ if( (pszTargets == NULL) || (*pszTargets == 0) )
+ {
+ return *this;
+ }
+
+ PCXSTR psz = this->GetString();
+ while( (*psz != 0) && (StringTraits::StringFindChar( pszTargets, *psz ) != NULL) )
+ {
+ psz = StringTraits::CharNext( psz );
+ }
+
+ if( psz != this->GetString() )
+ {
+ // fix up data and length
+ int iFirst = int( psz-this->GetString() );
+ PXSTR pszBuffer = this->GetBuffer( this->GetLength() );
+ psz = pszBuffer+iFirst;
+ int nDataLength = this->GetLength()-iFirst;
+ memmove_s( pszBuffer, (this->GetLength()+1)*sizeof( XCHAR ),
+ psz, (nDataLength+1)*sizeof( XCHAR ) );
+ this->ReleaseBufferSetLength( nDataLength );
+ }
+
+ return *this;
+ }
+
+ // Convert the string to the OEM character set
+ void AnsiToOem()
+ {
+ int nLength = this->GetLength();
+ PXSTR pszBuffer = this->GetBuffer( nLength );
+ StringTraits::ConvertToOem( pszBuffer, nLength+1 );
+ this->ReleaseBufferSetLength( nLength );
+ }
+
+ // Convert the string to the ANSI character set
+ void OemToAnsi()
+ {
+ int nLength = this->GetLength();
+ PXSTR pszBuffer = this->GetBuffer( nLength );
+ StringTraits::ConvertToAnsi( pszBuffer, nLength+1 );
+ this->ReleaseBufferSetLength( nLength );
+ }
+
+ // Very simple sub-string extraction
+
+ // Return the substring starting at index 'iFirst'
+ CMStringT Mid( int iFirst ) const
+ {
+ return Mid( iFirst, this->GetLength()-iFirst );
+ }
+
+ // Return the substring starting at index 'iFirst', with length 'nCount'
+ CMStringT Mid( int iFirst, int nCount ) const
+ {
+ // nCount is in XCHARs
+
+ // out-of-bounds requests return sensible things
+ if (iFirst < 0)
+ iFirst = 0;
+ if (nCount < 0)
+ nCount = 0;
+
+ if( (iFirst + nCount) > this->GetLength() )
+ nCount = this->GetLength()-iFirst;
+
+ if( iFirst > this->GetLength() )
+ nCount = 0;
+
+ // optimize case of returning entire string
+ if( (iFirst == 0) && ((iFirst+nCount) == this->GetLength()) )
+ return *this;
+
+ return CMStringT( this->GetString()+iFirst, nCount );
+ }
+
+ // Return the substring consisting of the rightmost 'nCount' characters
+ CMStringT Right( int nCount ) const
+ {
+ // nCount is in XCHARs
+ if (nCount < 0)
+ nCount = 0;
+
+ int nLength = this->GetLength();
+ if( nCount >= nLength )
+ {
+ return *this;
+ }
+
+ return CMStringT( this->GetString()+nLength-nCount, nCount );
+ }
+
+ // Return the substring consisting of the leftmost 'nCount' characters
+ CMStringT Left( int nCount ) const
+ {
+ // nCount is in XCHARs
+ if (nCount < 0)
+ nCount = 0;
+
+ int nLength = this->GetLength();
+ if( nCount >= nLength )
+ return *this;
+
+ return CMStringT( this->GetString(), nCount );
+ }
+
+ // Return the substring consisting of the leftmost characters in the set 'pszCharSet'
+ CMStringT SpanIncluding( PCXSTR pszCharSet ) const
+ {
+ return Left( StringTraits::StringSpanIncluding( this->GetString(), pszCharSet ));
+ }
+
+ // Return the substring consisting of the leftmost characters not in the set 'pszCharSet'
+ CMStringT SpanExcluding( PCXSTR pszCharSet ) const
+ {
+ return Left( StringTraits::StringSpanExcluding( this->GetString(), pszCharSet ));
+ }
+
+ // Format data using format string 'pszFormat'
+ void Format( PCXSTR pszFormat, ... );
+
+ // Append formatted data using format string 'pszFormat'
+ void AppendFormat( PCXSTR pszFormat, ... );
+
+ void AppendFormatV( PCXSTR pszFormat, va_list args )
+ {
+ int nCurrentLength = this->GetLength();
+ int nAppendLength = StringTraits::GetFormattedLength( pszFormat, args );
+ PXSTR pszBuffer = this->GetBuffer( nCurrentLength+nAppendLength );
+ StringTraits::Format( pszBuffer+nCurrentLength,
+ nAppendLength+1, pszFormat, args );
+ this->ReleaseBufferSetLength( nCurrentLength+nAppendLength );
+ }
+
+ void FormatV( PCXSTR pszFormat, va_list args )
+ {
+ int nLength = StringTraits::GetFormattedLength( pszFormat, args );
+ PXSTR pszBuffer = this->GetBuffer( nLength );
+ StringTraits::Format( pszBuffer, nLength+1, pszFormat, args );
+ this->ReleaseBufferSetLength( nLength );
+ }
+
+ // OLE BSTR support
+
+ // Allocate a BSTR containing a copy of the string
+ BSTR AllocSysString() const
+ {
+ BSTR bstrResult = StringTraits::AllocSysString( this->GetString(), this->GetLength() );
+ return bstrResult;
+ }
+
+ BSTR SetSysString( BSTR* pbstr ) const
+ {
+ StringTraits::ReAllocSysString( this->GetString(), pbstr, this->GetLength() );
+ return *pbstr;
+ }
+
+ // Set the string to the value of environment variable 'pszVar'
+ BOOL GetEnvironmentVariable( PCXSTR pszVar )
+ {
+ ULONG nLength = StringTraits::GetEnvironmentVariable( pszVar, NULL, 0 );
+ BOOL bRetVal = FALSE;
+
+ if( nLength == 0 )
+ {
+ this->Empty();
+ }
+ else
+ {
+ PXSTR pszBuffer = this->GetBuffer( nLength );
+ StringTraits::GetEnvironmentVariable( pszVar, pszBuffer, nLength );
+ this->ReleaseBuffer();
+ bRetVal = TRUE;
+ }
+
+ return bRetVal;
+ }
+
+ // Load the string from resource 'nID'
+ BOOL LoadString( UINT nID )
+ {
+ HINSTANCE hInst = StringTraits::FindStringResourceInstance( nID );
+ if( hInst == NULL )
+ return FALSE;
+
+ return LoadString( hInst, nID );
+ }
+
+ friend CMStringT __stdcall operator+( const CMStringT& str1, const CMStringT& str2 )
+ {
+ CMStringT strResult;
+
+ Concatenate( strResult, str1, str1.GetLength(), str2, str2.GetLength() );
+
+ return strResult;
+ }
+
+ friend CMStringT __stdcall operator+( const CMStringT& str1, PCXSTR psz2 )
+ {
+ CMStringT strResult;
+
+ Concatenate( strResult, str1, str1.GetLength(), psz2, StringLength( psz2 ) );
+
+ return strResult;
+ }
+
+ friend CMStringT __stdcall operator+( PCXSTR psz1, const CMStringT& str2 )
+ {
+ CMStringT strResult;
+
+ Concatenate( strResult, psz1, StringLength( psz1 ), str2, str2.GetLength() );
+
+ return strResult;
+ }
+
+ friend CMStringT __stdcall operator+( const CMStringT& str1, wchar_t ch2 )
+ {
+ CMStringT strResult;
+ XCHAR chTemp = XCHAR( ch2 );
+
+ Concatenate( strResult, str1, str1.GetLength(), &chTemp, 1 );
+
+ return strResult;
+ }
+
+ friend CMStringT __stdcall operator+( const CMStringT& str1, char ch2 )
+ {
+ CMStringT strResult;
+ XCHAR chTemp = XCHAR( ch2 );
+
+ Concatenate( strResult, str1, str1.GetLength(), &chTemp, 1 );
+
+ return strResult;
+ }
+
+ friend CMStringT __stdcall operator+( wchar_t ch1, const CMStringT& str2 )
+ {
+ CMStringT strResult;
+ XCHAR chTemp = XCHAR( ch1 );
+
+ Concatenate( strResult, &chTemp, 1, str2, str2.GetLength() );
+
+ return strResult;
+ }
+
+ friend CMStringT __stdcall operator+( char ch1, const CMStringT& str2 )
+ {
+ CMStringT strResult;
+ XCHAR chTemp = XCHAR( ch1 );
+
+ Concatenate( strResult, &chTemp, 1, str2, str2.GetLength() );
+
+ return strResult;
+ }
+
+ friend bool __stdcall operator==( const CMStringT& str1, const CMStringT& str2 )
+ {
+ return str1.Compare( str2 ) == 0;
+ }
+
+ friend bool __stdcall operator==( const CMStringT& str1, PCXSTR psz2 )
+ {
+ return str1.Compare( psz2 ) == 0;
+ }
+
+ friend bool __stdcall operator==( PCXSTR psz1, const CMStringT& str2 )
+ {
+ return str2.Compare( psz1 ) == 0;
+ }
+
+ friend bool __stdcall operator==( const CMStringT& str1, PCYSTR psz2 )
+ {
+ CMStringT str2( psz2 );
+
+ return str1 == str2;
+ }
+
+ friend bool __stdcall operator==( PCYSTR psz1, const CMStringT& str2 )
+ {
+ CMStringT str1( psz1 );
+
+ return str1 == str2;
+ }
+
+ friend bool __stdcall operator!=( const CMStringT& str1, const CMStringT& str2 )
+ {
+ return str1.Compare( str2 ) != 0;
+ }
+
+ friend bool __stdcall operator!=( const CMStringT& str1, PCXSTR psz2 )
+ {
+ return str1.Compare( psz2 ) != 0;
+ }
+
+ friend bool __stdcall operator!=( PCXSTR psz1, const CMStringT& str2 )
+ {
+ return str2.Compare( psz1 ) != 0;
+ }
+
+ friend bool __stdcall operator!=( const CMStringT& str1, PCYSTR psz2 )
+ {
+ CMStringT str2( psz2 );
+
+ return str1 != str2;
+ }
+
+ friend bool __stdcall operator!=( PCYSTR psz1, const CMStringT& str2 )
+ {
+ CMStringT str1( psz1 );
+
+ return str1 != str2;
+ }
+
+ friend bool __stdcall operator<( const CMStringT& str1, const CMStringT& str2 )
+ {
+ return str1.Compare( str2 ) < 0;
+ }
+
+ friend bool __stdcall operator<( const CMStringT& str1, PCXSTR psz2 )
+ {
+ return str1.Compare( psz2 ) < 0;
+ }
+
+ friend bool __stdcall operator<( PCXSTR psz1, const CMStringT& str2 )
+ {
+ return str2.Compare( psz1 ) > 0;
+ }
+
+ friend bool __stdcall operator>( const CMStringT& str1, const CMStringT& str2 )
+ {
+ return str1.Compare( str2 ) > 0;
+ }
+
+ friend bool __stdcall operator>( const CMStringT& str1, PCXSTR psz2 )
+ {
+ return str1.Compare( psz2 ) > 0;
+ }
+
+ friend bool __stdcall operator>( PCXSTR psz1, const CMStringT& str2 )
+ {
+ return str2.Compare( psz1 ) < 0;
+ }
+
+ friend bool __stdcall operator<=( const CMStringT& str1, const CMStringT& str2 )
+ {
+ return str1.Compare( str2 ) <= 0;
+ }
+
+ friend bool __stdcall operator<=( const CMStringT& str1, PCXSTR psz2 )
+ {
+ return str1.Compare( psz2 ) <= 0;
+ }
+
+ friend bool __stdcall operator<=( PCXSTR psz1, const CMStringT& str2 )
+ {
+ return str2.Compare( psz1 ) >= 0;
+ }
+
+ friend bool __stdcall operator>=( const CMStringT& str1, const CMStringT& str2 )
+ {
+ return str1.Compare( str2 ) >= 0;
+ }
+
+ friend bool __stdcall operator>=( const CMStringT& str1, PCXSTR psz2 )
+ {
+ return str1.Compare( psz2 ) >= 0;
+ }
+
+ friend bool __stdcall operator>=( PCXSTR psz1, const CMStringT& str2 )
+ {
+ return str2.Compare( psz1 ) <= 0;
+ }
+
+ friend bool __stdcall operator==( XCHAR ch1, const CMStringT& str2 )
+ {
+ return (str2.GetLength() == 1) && (str2[0] == ch1);
+ }
+
+ friend bool __stdcall operator==( const CMStringT& str1, XCHAR ch2 )
+ {
+ return (str1.GetLength() == 1) && (str1[0] == ch2);
+ }
+
+ friend bool __stdcall operator!=( XCHAR ch1, const CMStringT& str2 )
+ {
+ return (str2.GetLength() != 1) || (str2[0] != ch1);
+ }
+
+ friend bool __stdcall operator!=( const CMStringT& str1, XCHAR ch2 )
+ {
+ return (str1.GetLength() != 1) || (str1[0] != ch2);
+ }
+};
+
+template< typename BaseType, class StringTraits >
+inline void CMStringT<BaseType, StringTraits>::Format(PCXSTR pszFormat, ... )
+{
+ va_list argList;
+ va_start( argList, pszFormat );
+ FormatV( pszFormat, argList );
+ va_end( argList );
+}
+
+template< typename BaseType, class StringTraits >
+inline void CMStringT<BaseType, StringTraits>::AppendFormat(PCXSTR pszFormat, ... )
+{
+ va_list argList;
+ va_start( argList, pszFormat );
+ AppendFormatV( pszFormat, argList );
+ va_end( argList );
+}
+
+typedef CMStringT< wchar_t, ChTraitsCRT< wchar_t > > CMStringW;
+typedef CMStringT< char, ChTraitsCRT< char > > CMStringA;
+typedef CMStringT< TCHAR, ChTraitsCRT< TCHAR > > CMString;
diff --git a/plugins/Modernb/hdr/modern_awaymsg.h b/plugins/Modernb/hdr/modern_awaymsg.h
new file mode 100644
index 0000000000..ea51c6ddb2
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_awaymsg.h
@@ -0,0 +1,37 @@
+/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2008 Miranda ICQ/IM project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+*/
+
+/*
+* Author Artem Shpynov aka FYR
+* Copyright 2000-2008 Artem Shpynov
+*/
+
+#pragma once
+//////////////////////////////////////////////////////////////////////////
+// Module to Request Away Messages
+
+void InitAwayMsgModule();
+void UninitAwayMsgModule();
+void amRequestAwayMsg(HANDLE hContact);
+
diff --git a/plugins/Modernb/hdr/modern_cache_funcs.h b/plugins/Modernb/hdr/modern_cache_funcs.h
new file mode 100644
index 0000000000..1298536ca1
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_cache_funcs.h
@@ -0,0 +1,46 @@
+/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2008 Miranda ICQ/IM project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+Created by Pescuma
+
+*/
+#pragma once
+
+#ifndef __CACHE_FUNCS_H__
+# define __CACHE_FUNCS_H__
+
+#include "modern_clc.h"
+#include "modern_commonprototypes.h"
+
+void Cache_GetText(struct ClcData *dat, struct ClcContact *contact, BOOL forceRenew);
+void Cache_GetFirstLineText(struct ClcData *dat, struct ClcContact *contact);
+void Cache_GetSecondLineText(struct SHORTDATA *dat, PDNCE pdnce);
+void Cache_GetThirdLineText(struct SHORTDATA *dat, PDNCE pdnce);
+void Cache_GetAvatar(struct ClcData *dat, struct ClcContact *contact);
+void Cache_GetTimezone(struct ClcData *dat, HANDLE hContact);
+int Cache_GetLineText(PDNCE pdnce, int type, LPTSTR text, int text_size, TCHAR *variable_text, BOOL xstatus_has_priority,
+ BOOL show_status_if_no_away, BOOL show_listening_if_no_away, BOOL use_name_and_message_for_xstatus,
+ BOOL pdnce_time_show_only_if_different);
+
+void amRequestAwayMsg(HANDLE hContact);
+
+#endif // __CACHE_FUNCS_H__
diff --git a/plugins/Modernb/hdr/modern_callproc.h b/plugins/Modernb/hdr/modern_callproc.h
new file mode 100644
index 0000000000..e3c1df900d
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_callproc.h
@@ -0,0 +1,128 @@
+#ifndef modern_callproc_h__
+#define modern_callproc_h__
+
+namespace call {
+#include <windows.h>
+
+//////////////////////////////////////////////////////////////////////////
+// USE AS
+// ret = call::sync( proc, param1, param2 ... etc)
+//////////////////////////////////////////////////////////////////////////
+// internal realization
+enum ASYNC_T { ASYNC = 0, SYNC };
+int __ProcessCall( class __baseCall * pStorage, ASYNC_T async );
+
+class __baseCall { public: virtual int __DoCallStorageProc() =0; virtual ~__baseCall() {}; };
+template< class R > class _callParams0 : public __baseCall
+{
+public:
+ R(*_proc)();
+ _callParams0( R (*proc)() ) : _proc(proc){};
+ int __DoCallStorageProc() { return (int)_proc(); }
+};
+
+template<> class _callParams0<void> : public __baseCall
+{
+public:
+ void(*_proc)();
+ _callParams0( void (*proc)() ) : _proc(proc){};
+ int __DoCallStorageProc() { _proc(); return 0; }
+};
+
+template< class R, class A> class _callParams1 : public __baseCall
+{
+public:
+ R(*_proc)(A); A _a;
+ _callParams1( R(*proc)(A), A a) : _proc(proc), _a(a) {};
+ int __DoCallStorageProc() { return (int)_proc(_a); }
+};
+
+template<class A> class _callParams1<void, A> : public __baseCall
+{
+public:
+ void(*_proc)(A); A _a;
+ _callParams1( void(*proc)(A), A a) : _proc(proc), _a(a) {};
+ int __DoCallStorageProc() { _proc(_a); return 0; }
+};
+
+template< class R, class A, class B> class _callParams2 : public __baseCall
+{
+public:
+ R (*_proc)(A, B); A _a; B _b;
+ _callParams2( R (*proc)(A, B), A a, B b) : _proc(proc), _a(a), _b(b) {};
+ int __DoCallStorageProc() { return (int)_proc(_a, _b); }
+};
+
+template< class A, class B> class _callParams2<void, A, B> : public __baseCall
+{
+public:
+ void (*_proc)(A, B); A _a; B _b;
+ _callParams2( void (*proc)(A, B), A a, B b) : _proc(proc), _a(a), _b(b) {};
+ int __DoCallStorageProc() { _proc(_a, _b); return 0; }
+};
+
+template< class R, class A, class B, class C> class _callParams3 : public __baseCall
+{
+public:
+ R (*_proc)(A, B, C); A _a; B _b; C _c;
+ _callParams3( R (*proc)(A, B, C), A a, B b, C c ) : _proc(proc), _a(a), _b(b), _c(c) {};
+ int __DoCallStorageProc() { return (int)_proc(_a,_b,_c); }
+};
+
+template< class A, class B, class C> class _callParams3<void, A, B, C> : public __baseCall
+{
+public:
+ void (*_proc)(A, B, C); A _a; B _b; C _c;
+ _callParams3( void (*proc)(A, B, C), A a, B b, C c ) : _proc(proc), _a(a), _b(b), _c(c) {};
+ int __DoCallStorageProc() { _proc(_a,_b,_c); return 0;}
+};
+
+template < class R > R __DoCall( R(*__proc)(), ASYNC_T sync_mode )
+{
+ typedef _callParams0< R > callClass;
+ callClass * storage = new callClass( __proc );
+ return (R) call::__ProcessCall( storage, sync_mode );
+};
+
+template < class R, class A > R __DoCall( R(*__proc)( A ), A a, ASYNC_T sync_mode )
+{
+ typedef _callParams1< R, A > callClass;
+ callClass * storage = new callClass( __proc, a );
+ return (R)__ProcessCall( storage, sync_mode );
+};
+
+
+template < class R, class A, class B > R __DoCall( R(*__proc)( A, B ), A a, B b, ASYNC_T sync_mode )
+{
+ typedef _callParams2< R, A, B > callClass;
+ callClass * storage = new callClass( __proc, a, b);
+ return (R)__ProcessCall( storage, sync_mode );
+};
+
+
+template < class R, class A, class B, class C > R __DoCall( R(*__proc)( A, B, C ), A a, B b, C c, ASYNC_T sync_mode )
+{
+ typedef _callParams3< R, A, B, C > callClass;
+ callClass * storage = new callClass( __proc, a, b, c);
+ return (R)__ProcessCall( storage, sync_mode );
+};
+
+
+template < class R > R sync( R(*_proc)() )
+{ return __DoCall(_proc, SYNC); };
+template < class R, class A > R sync( R(*_proc)( A ), A a )
+{ return __DoCall(_proc, a, SYNC); };
+template < class R, class A, class B > R sync( R(*_proc)( A,B), A a, B b )
+{ return __DoCall(_proc, a, b, SYNC); };
+template < class R, class A, class B, class C > R sync( R(*_proc)( A,B,C ), A a, B b, C c)
+{ return __DoCall(_proc, a, b, c, SYNC); };
+template < class R > int async( R(*_proc)() )
+{ return __DoCall(_proc, ASYNC); };
+template < class R, class A > R async( R(*_proc)( A ), A a )
+{ return __DoCall(_proc, a, ASYNC); };
+template < class R, class A, class B > R async( R(*_proc)( A,B), A a, B b )
+{ return __DoCall(_proc, a, b, ASYNC); };
+template < class R, class A, class B, class C > R async( R(*_proc)( A,B,C ), A a, B b, C c)
+{ return __DoCall(_proc, a, b, c, ASYNC); };
+}; // namespace call
+#endif // modern_callproc_h__
diff --git a/plugins/Modernb/hdr/modern_clc.h b/plugins/Modernb/hdr/modern_clc.h
new file mode 100644
index 0000000000..773d34fb32
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_clc.h
@@ -0,0 +1,523 @@
+/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2008 Miranda ICQ/IM project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#pragma once
+
+#ifndef _CLC_H_
+#define _CLC_H_
+#include "modern_image_array.h"
+#include "../m_api/m_xpTheme.h"
+
+#include "modern_defsettings.h"
+#include "modern_clist.h"
+
+
+
+
+#define SETTING_TRAYICON_SINGLE 0
+#define SETTING_TRAYICON_CYCLE 1
+#define SETTING_TRAYICON_MULTI 2
+
+#define NIIF_INTERN_UNICODE 0x00000100
+
+#define SETTING_STATE_HIDDEN 0
+#define SETTING_STATE_MINIMIZED 1
+#define SETTING_STATE_NORMAL 2
+
+#define SETTING_BRINGTOFRONT_DEFAULT 0
+
+#define SETTING_AVATAR_OVERLAY_TYPE_NORMAL 0
+#define SETTING_AVATAR_OVERLAY_TYPE_PROTOCOL 1
+#define SETTING_AVATAR_OVERLAY_TYPE_CONTACT 2
+
+#define HCONTACT_ISGROUP 0x80000000
+#define HCONTACT_ISINFO 0xFFFF0000
+
+#define MAXEXTRACOLUMNS 16
+#define MAXSTATUSMSGLEN 256
+
+#define INTM_NAMECHANGED (WM_USER+10)
+#define INTM_ICONCHANGED (WM_USER+11)
+#define INTM_GROUPCHANGED (WM_USER+12)
+#define INTM_GROUPSCHANGED (WM_USER+13)
+#define INTM_CONTACTADDED (WM_USER+14)
+#define INTM_CONTACTDELETED (WM_USER+15)
+#define INTM_HIDDENCHANGED (WM_USER+16)
+#define INTM_INVALIDATE (WM_USER+17)
+#define INTM_APPARENTMODECHANGED (WM_USER+18)
+#define INTM_SETINFOTIPHOVERTIME (WM_USER+19)
+#define INTM_NOTONLISTCHANGED (WM_USER+20)
+#define INTM_RELOADOPTIONS (WM_USER+21)
+#define INTM_NAMEORDERCHANGED (WM_USER+22)
+#define INTM_IDLECHANGED (WM_USER+23)
+#define INTM_SCROLLBARCHANGED (WM_USER+24)
+#define INTM_PROTOCHANGED (WM_USER+25)
+#define INTM_STATUSMSGCHANGED (WM_USER+26)
+#define INTM_STATUSCHANGED (WM_USER+27)
+#define INTM_AVATARCHANGED (WM_USER+28)
+#define INTM_TIMEZONECHANGED (WM_USER+29)
+
+
+
+#define CLM_SETEXTRACOLUMNSSPACE (CLM_FIRST+73) //wParam=extra space between icons
+
+#define CLBF_TILEVTOROWHEIGHT 0x0100
+
+#define TIMERID_RENAME 10
+#define TIMERID_DRAGAUTOSCROLL 11
+#define TIMERID_INFOTIP 13
+#define TIMERID_REBUILDAFTER 14
+#define TIMERID_DELAYEDRESORTCLC 15
+#define TIMERID_SUBEXPAND 21
+#define TIMERID_INVALIDATE 22
+#define TIMERID_INVALIDATE_FULL 25
+#define TIMERID_RECALCSCROLLBAR 26
+
+#define TIMERID_FIRST TIMERID_RENAME
+#define TIMERID_LAST TIMERID_RECALCSCROLLBAR
+
+void clcSetDelayTimer( UINT_PTR uIDEvent, HWND hwnd, int nDelay = -1);
+
+#define FONTID_CONTACTS 0
+#define FONTID_INVIS 1
+#define FONTID_OFFLINE 2
+#define FONTID_NOTONLIST 3
+#define FONTID_OPENGROUPS 4
+#define FONTID_OPENGROUPCOUNTS 5
+#define FONTID_DIVIDERS 6
+#define FONTID_OFFINVIS 7
+#define FONTID_SECONDLINE 8
+#define FONTID_THIRDLINE 9
+#define FONTID_AWAY 10
+#define FONTID_DND 11
+#define FONTID_NA 12
+#define FONTID_OCCUPIED 13
+#define FONTID_CHAT 14
+#define FONTID_INVISIBLE 15
+#define FONTID_PHONE 16
+#define FONTID_LUNCH 17
+#define FONTID_CONTACT_TIME 18
+#define FONTID_CLOSEDGROUPS 19
+#define FONTID_CLOSEDGROUPCOUNTS 20
+#define FONTID_STATUSBAR_PROTONAME 21
+#define FONTID_EVENTAREA 22
+#define FONTID_VIEMODES 23
+#define FONTID_MODERN_MAX 23
+
+#define DROPTARGET_OUTSIDE 0
+#define DROPTARGET_ONSELF 1
+#define DROPTARGET_ONNOTHING 2
+#define DROPTARGET_ONGROUP 3
+#define DROPTARGET_ONCONTACT 4
+#define DROPTARGET_INSERTION 5
+#define DROPTARGET_ONMETACONTACT 6
+#define DROPTARGET_ONSUBCONTACT 7
+
+struct ClcGroup;
+
+#define CONTACTF_ONLINE 1
+#define CONTACTF_INVISTO 2
+#define CONTACTF_VISTO 4
+#define CONTACTF_NOTONLIST 8
+#define CONTACTF_CHECKED 16
+#define CONTACTF_IDLE 32
+//#define CONTACTF_STATUSMSG 64
+
+#define AVATAR_POS_DONT_HAVE -1
+#define AVATAR_POS_ANIMATED -2
+
+#define TEXT_PIECE_TYPE_TEXT 0
+#define TEXT_PIECE_TYPE_SMILEY 1
+
+#define DRAGSTAGE_NOTMOVED 0
+#define DRAGSTAGE_ACTIVE 1
+#define DRAGSTAGEM_STAGE 0x00FF
+#define DRAGSTAGEF_MAYBERENAME 0x8000
+#define DRAGSTAGEF_OUTSIDE 0x4000
+#define DRAGSTAGEF_SKIPRENAME 0x2000
+
+#define ITEM_AVATAR 0
+#define ITEM_ICON 1
+#define ITEM_TEXT 2
+#define ITEM_EXTRA_ICONS 3
+#define ITEM_CONTACT_TIME 4
+#define NUM_ITEM_TYPE 5
+
+#define TEXT_EMPTY -1
+#define TEXT_STATUS 0
+#define TEXT_NICKNAME 1
+#define TEXT_STATUS_MESSAGE 2
+#define TEXT_TEXT 3
+#define TEXT_CONTACT_TIME 4
+#define TEXT_LISTENING_TO 5
+
+#define TEXT_TEXT_MAX_LENGTH 1024
+
+
+#define IsHContactGroup(h) (((UINT_PTR)(h)^HCONTACT_ISGROUP)<(HCONTACT_ISGROUP^HCONTACT_ISINFO))
+#define IsHContactInfo(h) (((UINT_PTR)(h)&HCONTACT_ISINFO)==HCONTACT_ISINFO)
+#define IsHContactContact(h) (((UINT_PTR)(h)&HCONTACT_ISGROUP)==0)
+
+typedef struct tagClcContactTextPiece
+{
+ int type;
+ int len;
+ union
+ {
+ struct
+ {
+ int start_pos;
+ };
+ struct
+ {
+ HICON smiley;
+ int smiley_width;
+ int smiley_height;
+ };
+ };
+} ClcContactTextPiece;
+
+enum {
+ CIT_PAINT_END=0, //next items are invalids
+ CIT_AVATAR, // 1
+ CIT_ICON, // 2
+ CIT_TEXT, // 3 //the contact name or group name
+ CIT_SUBTEXT1, // 4 //the second line for contact or group counter for groups
+ CIT_SUBTEXT2, // 5
+ CIT_TIME, // 6
+ CIT_CHECKBOX, // 7
+ CIT_SELECTION, // 8
+ CIT_EXTRA=64 //use bit compare for extra icon, the mask &0x3F will return number of extra icon
+};
+
+
+typedef struct _tagContactItems
+{
+ BYTE itemType; //one of above CIT_ definitions
+ RECT itemRect;
+}tContactItems;
+
+struct ClcContact {
+ BYTE type;
+ BYTE flags;
+ union {
+ struct {
+ int iImage;
+ HANDLE hContact;
+ };
+ struct {
+ WORD groupId;
+ struct ClcGroup *group;
+ };
+ };
+ BYTE iExtraImage[MAXEXTRACOLUMNS];
+ TCHAR szText[120 - MAXEXTRACOLUMNS];
+ char * proto; // MS_PROTO_GETBASEPROTO
+
+ struct ClcContact *subcontacts;
+ BYTE SubAllocated;
+ BYTE SubExpanded;
+ BYTE isSubcontact;
+// int status;
+ BOOL image_is_special;
+ int avatar_pos;
+ struct avatarCacheEntry *avatar_data;
+ SIZE avatar_size;
+ CSmileyString ssText;
+
+
+ // For hittest
+ int pos_indent;
+ RECT pos_check;
+ RECT pos_avatar;
+ RECT pos_icon;
+ RECT pos_label;
+ RECT pos_rename_rect;
+ RECT pos_contact_time;
+ RECT pos_extra[MAXEXTRACOLUMNS];
+ DWORD lastPaintCounter;
+ BYTE bContactRate;
+
+ // For extended layout
+ BYTE ext_nItemsNum;
+ BOOL ext_fItemsValid;
+ tContactItems ext_mpItemsDesc[MAXEXTRACOLUMNS+10]; //up to 10 items
+
+ WORD iWideExtraImage[MAXEXTRACOLUMNS];
+
+
+};
+
+
+
+struct ClcModernFontInfo {
+ HFONT hFont;
+ int fontHeight,changed;
+ COLORREF colour;
+ BYTE effect;
+ COLORREF effectColour1;
+ COLORREF effectColour2;
+};
+
+struct ClcData {
+ struct ClcGroup list;
+ int max_row_height;
+
+ int yScroll;
+ int selection;
+ struct ClcFontInfo fontInfo[FONTID_MAX+1];
+ int scrollTime;
+ HIMAGELIST himlHighlight;
+ int groupIndent;
+ TCHAR szQuickSearch[128];
+ int iconXSpace;
+ HWND hwndRenameEdit;
+ COLORREF bkColour,selBkColour,selTextColour,hotTextColour,quickSearchColour;
+ int iDragItem,iInsertionMark;
+ int dragStage;
+ POINT ptDragStart;
+ int dragAutoScrolling;
+ int dragAutoScrollHeight;
+ int leftMargin;
+ int insertionMarkHitHeight;
+ HBITMAP hBmpBackground;
+ int backgroundBmpUse,bkChanged;
+ int iHotTrack;
+ int gammaCorrection;
+ DWORD greyoutFlags; //see m_clc.h
+ DWORD offlineModes;
+ DWORD exStyle;
+ POINT ptInfoTip;
+ int infoTipTimeout;
+ HANDLE hInfoTipItem;
+ HIMAGELIST himlExtraColumns;
+ int extraColumnsCount;
+ int extraColumnSpacing;
+ int checkboxSize;
+ int showSelAlways;
+ int showIdle;
+ int noVScrollbar;
+ int useWindowsColours;
+ int NeedResort;
+ SortedList lCLCContactsCache;
+ BYTE HiLightMode;
+ BYTE doubleClickExpand;
+ int MetaIgnoreEmptyExtra;
+ BYTE expandMeta;
+ BYTE IsMetaContactsEnabled;
+ time_t last_tick_time;
+ BOOL force_in_dialog;
+ int subIndent;
+ int rightMargin;
+ HBITMAP hMenuBackground;
+ DWORD MenuBkColor, MenuBkHiColor, MenuTextColor, MenuTextHiColor;
+ int MenuBmpUse;
+
+ // Row height
+ int *row_heights;
+ int row_heights_size;
+ int row_heights_allocated;
+
+ // Avatar cache
+ int use_avatar_service;
+ IMAGE_ARRAY_DATA avatar_cache;
+
+ // Row
+ int row_min_heigh;
+ int row_border;
+ int row_before_group_space;
+
+ BOOL row_variable_height;
+ BOOL row_align_left_items_to_left;
+ BOOL row_align_right_items_to_right;
+ int row_items[NUM_ITEM_TYPE];
+ BOOL row_hide_group_icon;
+ BYTE row_align_group_mode;
+
+ // Avatar
+ BOOL avatars_show;
+ BOOL avatars_draw_border;
+ COLORREF avatars_border_color;
+ BOOL avatars_round_corners;
+ BOOL avatars_use_custom_corner_size;
+ int avatars_custom_corner_size;
+ BOOL avatars_ignore_size_for_row_height;
+ BOOL avatars_draw_overlay;
+ int avatars_overlay_type;
+
+ int avatars_maxheight_size;
+ int avatars_maxwidth_size;
+
+ // Icon
+ BOOL icon_hide_on_avatar;
+ BOOL icon_draw_on_avatar_space;
+ BOOL icon_ignore_size_for_row_height;
+
+ // Contact time
+ BOOL contact_time_show;
+ BOOL contact_time_show_only_if_different;
+
+ // Text
+ BOOL text_rtl;
+ BOOL text_align_right;
+ BOOL text_replace_smileys;
+ BOOL text_resize_smileys;
+ int text_smiley_height;
+ BOOL text_use_protocol_smileys;
+ BOOL text_ignore_size_for_row_height;
+
+ // First line
+ BOOL first_line_draw_smileys;
+ BOOL first_line_append_nick;
+
+ // Second line
+ BOOL second_line_show;
+ int second_line_top_space;
+ BOOL second_line_draw_smileys;
+ int second_line_type;
+ TCHAR second_line_text[TEXT_TEXT_MAX_LENGTH];
+ BOOL second_line_xstatus_has_priority;
+ BOOL second_line_show_status_if_no_away;
+ BOOL second_line_show_listening_if_no_away;
+ BOOL second_line_use_name_and_message_for_xstatus;
+
+ // Third line
+ BOOL third_line_show;
+ int third_line_top_space;
+ BOOL third_line_draw_smileys;
+ int third_line_type;
+ TCHAR third_line_text[TEXT_TEXT_MAX_LENGTH];
+ BOOL third_line_xstatus_has_priority;
+ BOOL third_line_show_status_if_no_away;
+ BOOL third_line_show_listening_if_no_away;
+ BOOL third_line_use_name_and_message_for_xstatus;
+ struct ClcModernFontInfo fontModernInfo[FONTID_MODERN_MAX+1];
+ HWND hWnd;
+ BYTE menuOwnerType;
+ int menuOwnerID;
+ DWORD m_paintCouter; //range is enoght to 49 days if painting will occure each one millisecond
+ BYTE useMetaIcon;
+ BYTE drawOverlayedStatus;
+ int nInsertionLevel;
+
+ BYTE dbbMetaHideExtra;
+ BYTE dbbBlendInActiveState;
+ BYTE dbbBlend25;
+
+ XPTHANDLE hCheckBoxTheme;
+ BYTE bCompactMode;
+
+ HIMAGELIST himlWideExtraColumns;
+
+};
+
+struct SHORTDATA
+{
+ HWND hWnd;
+ BOOL contact_time_show_only_if_different;
+ int text_smiley_height;
+ BOOL text_replace_smileys;
+ BOOL text_use_protocol_smileys;
+
+ // Second line
+ BOOL second_line_show;
+ BOOL second_line_draw_smileys;
+ int second_line_type;
+ TCHAR second_line_text[TEXT_TEXT_MAX_LENGTH];
+ BOOL second_line_xstatus_has_priority;
+ BOOL second_line_show_status_if_no_away;
+ BOOL second_line_show_listening_if_no_away;
+ BOOL second_line_use_name_and_message_for_xstatus;
+
+ // Third line
+ BOOL third_line_show;
+ BOOL third_line_draw_smileys;
+ int third_line_type;
+ TCHAR third_line_text[TEXT_TEXT_MAX_LENGTH];
+ BOOL third_line_xstatus_has_priority;
+ BOOL third_line_show_status_if_no_away;
+ BOOL third_line_show_listening_if_no_away;
+ BOOL third_line_use_name_and_message_for_xstatus;
+};
+
+
+typedef struct tagOVERLAYICONINFO
+{
+ char *name;
+ char *description;
+ int id;
+ int listID;
+} OVERLAYICONINFO;
+
+//clc.c
+void ClcOptionsChanged(void);
+
+//clcidents.c
+int cliGetRowsPriorTo(struct ClcGroup *group,struct ClcGroup *subgroup,int contactIndex);
+int FindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,struct ClcContact **contact,struct ClcGroup **subgroup,int *isVisible, BOOL isIgnoreSubcontacts );
+int cliGetRowByIndex(struct ClcData *dat,int testindex,struct ClcContact **contact,struct ClcGroup **subgroup);
+HANDLE ContactToHItem(struct ClcContact *contact);
+HANDLE ContactToItemHandle(struct ClcContact *contact,DWORD *nmFlags);
+void ClearRowByIndexCache();
+
+//clcitems.c
+struct ClcGroup *cli_AddGroup(HWND hwnd,struct ClcData *dat,const TCHAR *szName,DWORD flags,int groupId,int calcTotalMembers);
+void cli_FreeGroup(struct ClcGroup *group);
+int cli_AddInfoItemToGroup(struct ClcGroup *group,int flags,const TCHAR *pszText);
+void cliRebuildEntireList(HWND hwnd,struct ClcData *dat);
+void cli_DeleteItemFromTree(HWND hwnd,HANDLE hItem);
+void cli_AddContactToTree(HWND hwnd,struct ClcData *dat,HANDLE hContact,int updateTotalCount,int checkHideOffline);
+void cli_SortCLC(HWND hwnd,struct ClcData *dat,int useInsertionSort);
+int GetNewSelection(struct ClcGroup *group,int selection, int direction);
+
+//clcmsgs.c
+LRESULT cli_ProcessExternalMessages(HWND hwnd,struct ClcData *dat,UINT msg,WPARAM wParam,LPARAM lParam);
+
+//clcutils.c
+void cliRecalcScrollBar(HWND hwnd,struct ClcData *dat);
+void cliBeginRenameSelection(HWND hwnd,struct ClcData *dat);
+int cliHitTest(HWND hwnd,struct ClcData *dat,int testx,int testy,struct ClcContact **contact,struct ClcGroup **group,DWORD *flags);
+void cliScrollTo(HWND hwnd,struct ClcData *dat,int desty,int noSmooth);
+int GetDropTargetInformation(HWND hwnd,struct ClcData *dat,POINT pt);
+void LoadCLCOptions(HWND hwnd,struct ClcData *dat);
+
+
+//clcpaint.c
+void CLCPaint_cliPaintClc(HWND hwnd,struct ClcData *dat,HDC hdc,RECT *rcPaint);
+
+//clcopts.c
+int ClcOptInit(WPARAM wParam,LPARAM lParam);
+DWORD GetDefaultExStyle(void);
+void GetFontSetting(int i,LOGFONT *lf,COLORREF *colour,BYTE *effect, COLORREF *eColour1,COLORREF *eColour2);
+
+//clistsettings.c
+TCHAR * GetContactDisplayNameW( HANDLE hContact, int mode );
+
+//groups.c
+TCHAR* GetGroupNameTS( int idx, DWORD* pdwFlags );
+int RenameGroupT(WPARAM groupID, LPARAM newName);
+
+int GetContactCachedStatus(HANDLE hContact);
+char *GetContactCachedProtocol(HANDLE hContact);
+
+#endif /* _CLC_H_ */
diff --git a/plugins/Modernb/hdr/modern_clcpaint.h b/plugins/Modernb/hdr/modern_clcpaint.h
new file mode 100644
index 0000000000..9c2a2d68d6
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_clcpaint.h
@@ -0,0 +1,191 @@
+#ifndef modern_clcpaint_h__
+#define modern_clcpaint_h__
+
+extern class CLCPaint g_clcPainter;
+class CLCPaint
+{
+
+public:
+ CLCPaint();
+ ~CLCPaint() {};
+
+ CLINTERFACE void cliPaintClc( HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint );
+ CLINTERFACE tPaintCallbackProc PaintCallbackProc( HWND hWnd, HDC hDC, RECT * rcPaint, HRGN rgn, DWORD dFlags, void * CallBackData );
+
+ BOOL IsForegroundWindow( HWND hWnd );
+ HFONT ChangeToFont( HDC hdc, struct ClcData *dat, int id, int *fontHeight );
+ int GetBasicFontID( struct ClcContact * contact );
+ void GetTextSize( SIZE *text_size, HDC hdcMem, RECT free_row_rc, TCHAR *szText, SortedList *plText, UINT uTextFormat, int smiley_height );
+ void AddParam( MODERNMASK * mpModernMask, DWORD dwParamHash, const char* szValue, DWORD dwValueHash );
+ BOOL CheckMiniMode( struct ClcData *dat, BOOL selected, BOOL hot );
+
+private:
+ static const int HORIZONTAL_SPACE;
+ static const int EXTRA_CHECKBOX_SPACE;
+ static const int EXTRA_SPACE;
+ static const int SELECTION_BORDER;
+ static const int MIN_TEXT_WIDTH;
+ static const int BUF2SIZE;
+
+ static const BYTE GIM_SELECTED_AFFECT;
+ static const BYTE GIM_HOT_AFFECT;
+ static const BYTE GIM_TEMP_AFFECT;
+ static const BYTE GIM_IDLE_AFFECT;
+ static const BYTE GIM_EXTRAICON_AFFECT;
+ static const BYTE GIM_STATUSICON_AFFECT;
+ static const BYTE GIM_AVATAR_AFFECT;
+
+ enum tagenumHASHINDEX
+ {
+ hi_Module=0,
+ hi_ID,
+ hi_Type,
+ hi_Open,
+ hi_IsEmpty,
+ hi_SubPos,
+ hi_Protocol,
+ hi_RootGroup,
+ hi_Status,
+ hi_HasAvatar,
+ hi_GroupPos,
+ hi_Selected,
+ hi_Hot,
+ hi_Odd,
+ hi_Indent,
+ hi_Index,
+ hi_Name,
+ hi_Group,
+ hi_True,
+ hi_False,
+ hi_ONLINE,
+ hi_AWAY,
+ hi_DND,
+ hi_NA,
+ hi_OCCUPIED,
+ hi_FREECHAT,
+ hi_INVISIBLE,
+ hi_OUTTOLUNCH,
+ hi_ONTHEPHONE,
+ hi_IDLE,
+ hi_OFFLINE,
+ hi_Row,
+ hi_CL,
+ hi_SubContact,
+ hi_MetaContact,
+ hi_Contact,
+ hi_Divider,
+ hi_Info,
+ hi_First_Single,
+ hi_First,
+ hi_Middle,
+ hi_Mid,
+ hi_Single,
+ hi_Last,
+ hi_Rate,
+ hi_None,
+ hi_Low,
+ hi_Medium,
+ hi_High,
+ hi_State,
+ hi_stActive,
+ hi_stInactive,
+ //ADD new item above here
+ hi_LastItem
+ } enumHASHINDEX;
+ static const char * HASHTEXT[hi_LastItem];
+ static DWORD HASH[hi_LastItem];
+
+
+
+ void _FillQuickHash();
+ void _SetHotTrackColour( HDC hdc, struct ClcData *dat );
+ int _GetStatusOnlineness( int status );
+ int _GetGeneralisedStatus();
+ int _GetRealStatus( struct ClcContact * pContact, int nStatus );
+ RECT _GetRectangle( struct ClcData *dat, RECT *row_rc, RECT *free_row_rc, int *left_pos, int *right_pos, BOOL left, int real_width, int width, int height, int horizontal_space );
+ void _DrawTextSmiley( HDC hdcMem, RECT * free_rc, SIZE * text_size, TCHAR *szText, int len, SortedList *plText, UINT uTextFormat, BOOL ResizeSizeSmiley );
+ void _AddParameter( MODERNMASK * mpModernMask, MASKPARAM * lpParam );
+ void _AddParamShort( MODERNMASK * mpModernMask, DWORD dwParamIndex, DWORD dwValueIndex );
+ void _FillParam( MASKPARAM * lpParam, DWORD dwParamHash, const char* szValue, DWORD dwValueHash );
+ MODERNMASK * _GetCLCContactRowBackModernMask( struct ClcGroup * group, struct ClcContact * Drawing, int indent, int index, BOOL selected, BOOL hottrack, struct ClcData * dat );
+ void _RTLRect( RECT *rect, int width, int offset );
+ void _PaintRowItemsEx( HWND hwnd, HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, RECT row_rc, RECT free_row_rc, int left_pos, int right_pos, int selected, int hottrack, RECT *rcPaint );
+ void _DrawStatusIcon( struct ClcContact * Drawing, struct ClcData *dat, int iImage, HDC hdcMem, int x, int y, int cx, int cy, DWORD colorbg, DWORD colorfg, int mode );
+ BOOL _DrawNonEnginedBackground( HWND hwnd, HDC hdcMem, RECT * rcPaint, RECT clRect, struct ClcData * dat );
+ void _PaintClc( HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint );
+ void _StoreItemPos( struct ClcContact *contact, int ItemType, RECT * rc );
+ void _CalcItemsPos( HWND hwnd, HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, RECT *in_row_rc, RECT *in_free_row_rc, int left_pos, int right_pos, int selected, int hottrack );
+ BOOL __IsVisible( RECT * firtRect, RECT * secondRect );
+ void _GetBlendMode( IN struct ClcData *dat, IN struct ClcContact * Drawing, IN BOOL selected, IN BOOL hottrack, IN BOOL bFlag, OUT COLORREF * OutColourFg, OUT int * OutMode );
+ void _DrawContactItems( HWND hwnd, HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, RECT *row_rc, RECT *free_row_rc, int left_pos, int right_pos, int selected, int hottrack, RECT *rcPaint );
+ void _PaintRowItems ( HWND hwnd, HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, RECT row_rc, RECT free_row_rc, int left_pos, int right_pos, int selected, int hottrack, RECT *rcPaint );
+
+ void _DrawContactAvatar ( HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, RECT *row_rc, int& selected, int& hottrack, RECT& text_rc, RECT * prcItem );
+ void _DrawContactIcon ( HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * prcItem );
+ void _DrawContactText ( HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * prcItem, UINT uTextFormat );
+ void _DrawContactSubText ( HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * prcItem, UINT uTextFormat, BYTE itemType );
+ void _DrawContactTime ( HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * prcItem );
+ void _DrawContactExtraIcon ( HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, int& selected, int& hottrack, RECT& text_rc, RECT * rc, int iImage );
+ void _DrawContactSelection ( HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, int& selected, int& hottrack, RECT *rcPaint, RECT * prcItem );
+ void _DrawContactLine ( HDC hdcMem, struct ClcData *dat, struct ClcContact *Drawing, RECT *free_row_rc, RECT *rcPaint, RECT& text_rc );
+
+ int _rcWidth( RECT *rc ) { return rc->right-rc->left; }
+ int _rcHeight( RECT *rc ) { return rc->bottom-rc->top; }
+
+private:
+ enum enDrawMode
+ {
+ DM_LAYERED = 1, // Draw normal skin on 32 bit with alpha layer
+ DM_NON_LAYERED = 2, // Draw skinnable, but does not take care about alpha
+ DM_CLASSIC = 4, // Old style draw for classic
+ DM_CONTROL = 8, // Draw as control according to windows color scheme
+ DM_FLOAT = 16, // Float mode
+ DM_GRAY = 32, // Grayed mode
+ DM_GREYALTERNATE = 64, // Gray odd lines
+ DM_DRAW_OFFSCREEN = DM_FLOAT | DM_CONTROL | DM_NON_LAYERED | DM_CLASSIC,
+
+ };
+
+ inline int _DetermineDrawMode( HWND hWnd, struct ClcData *dat );
+
+ struct _PaintContext
+ {
+ enum
+ { release_none = 0,
+ release_hdcmem2 = 1,
+ release_hdcmem = 2
+ };
+ HDC hdcMem;
+ HDC hdcMem2;
+
+ HBITMAP hBmpOsb2;
+ HBITMAP oldbmp2;
+
+ HBITMAP hBmpOsb;
+ HBITMAP oldbmp;
+
+ HBRUSH hBrushAlternateGrey;
+ COLORREF tmpbkcolour;
+ COLORREF tmpforecolour;
+
+ DWORD fRelease;
+ _PaintContext( HDC _hdcMem = NULL) :
+ hdcMem ( _hdcMem ), hdcMem2( NULL ),
+ hBmpOsb2( NULL ), oldbmp2( NULL ),
+ hBmpOsb( NULL ), oldbmp( NULL ),
+ hBrushAlternateGrey ( NULL ),
+ tmpbkcolour( 0 ), tmpforecolour( 0 ),
+ fRelease ( release_none ) {};
+ };
+ inline void _PreparePaintContext( HWND hWnd, struct ClcData * dat, HDC hdc, int paintMode, RECT& clRect, _PaintContext& pc );
+ inline void _DrawBackground( HWND hWnd, struct ClcData * dat, HDC hdc, int paintMode, RECT* rcPaint, RECT& clRect, _PaintContext& pc );
+ inline void _DrawLines( HWND hWnd, struct ClcData * dat, HDC hdc, int paintMode, RECT* rcPaint, RECT& clRect, _PaintContext& pc );
+ inline void _DrawInsertionMark( struct ClcData * dat, RECT& clRect, _PaintContext& pc );
+ inline void _CopyPaintToDest( HWND hWnd, struct ClcData * dat, HDC hdc, int paintMode, RECT* rcPaint, RECT& clRect, _PaintContext& pc );
+ inline void _FreePaintContext( _PaintContext& pc );
+
+ // void _PaintClcOld( HWND hwnd, struct ClcData *dat, HDC hdc, RECT *rcPaint );
+};
+
+
+#endif // modern_clcpaint_h__
diff --git a/plugins/Modernb/hdr/modern_clist.h b/plugins/Modernb/hdr/modern_clist.h
new file mode 100644
index 0000000000..1c1d34ee02
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_clist.h
@@ -0,0 +1,163 @@
+/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2008 Miranda ICQ/IM project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+#pragma once
+
+#ifndef _CLIST_H_
+#define _CLIST_H_
+
+void LoadContactTree(void);
+int ExtIconFromStatusMode(HANDLE hContact, const char *szProto,int status);
+HTREEITEM GetTreeItemByHContact(HANDLE hContact);
+void cli_ChangeContactIcon(HANDLE hContact,int iIcon,int add);
+int GetContactInfosForSort(HANDLE hContact,char **Proto,TCHAR **Name,int *Status);
+
+typedef HMONITOR ( WINAPI *pfnMyMonitorFromPoint )(POINT,DWORD);
+extern pfnMyMonitorFromPoint MyMonitorFromPoint;
+
+typedef HMONITOR( WINAPI *pfnMyMonitorFromWindow) (HWND, DWORD);
+extern pfnMyMonitorFromWindow MyMonitorFromWindow;
+
+typedef BOOL(WINAPI *pfnMyGetMonitorInfo) (HMONITOR, LPMONITORINFO);
+extern pfnMyGetMonitorInfo MyGetMonitorInfo;
+
+class CSmileyString
+{
+public:
+ SortedList* plText;
+ int iMaxSmileyHeight;
+
+ CSmileyString() : plText( NULL ), iMaxSmileyHeight( 0 ) {};
+ CSmileyString( const CSmileyString& ssIn )
+ {
+ _CopySmileyList( ssIn.plText );
+ iMaxSmileyHeight = ssIn.iMaxSmileyHeight;
+ }
+
+ CSmileyString& operator= ( const CSmileyString& ssIn )
+ {
+ DestroySmileyList();
+ _CopySmileyList( ssIn.plText );
+ iMaxSmileyHeight = ssIn.iMaxSmileyHeight;
+ return *this;
+ }
+
+ ~CSmileyString()
+ {
+ DestroySmileyList();
+ }
+
+ void ReplaceSmileys(struct SHORTDATA *dat, struct tag_DNCE * pdnce, TCHAR *szText, BOOL replace_smileys);
+
+ /** Destroy smiley list */
+ void DestroySmileyList();
+ /** Copy Smiley List */
+ void _CopySmileyList( SortedList *plInput );
+ void AddListeningToIcon(struct SHORTDATA *dat, struct tag_DNCE * pdnce, TCHAR *szText, BOOL replace_smileys);
+
+};
+
+struct tag_DNCE{
+ HANDLE m_cache_hContact;
+ TCHAR* m_cache_tcsName;
+#if defined( _UNICODE )
+ char* m_cache_szName;
+#endif
+ TCHAR* m_cache_tcsGroup;
+ int m_cache_nHidden;
+ int m_cache_nNoHiddenOffline;
+
+ char* m_cache_cszProto;
+ boolean m_cache_bProtoNotExists;
+ int m_cache_nStatus;
+ int m_cache_nHiddenSubcontact;
+
+ int i;
+ int ApparentMode;
+ int NotOnList;
+ int IdleTS;
+ void* ClcContact;
+ BYTE IsExpanded;
+ boolean isUnknown;
+
+ TCHAR * szSecondLineText;
+ CSmileyString ssSecondLine;
+
+ TCHAR * szThirdLineText;
+ CSmileyString ssThirdLine;
+
+ HANDLE hTimeZone;
+ DWORD dwLastMsgTime;
+};
+typedef tag_DNCE displayNameCacheEntry,*pdisplayNameCacheEntry, *PDNCE;
+
+
+
+typedef struct tagEXTRASLOTINFO
+{
+ union
+ {
+ TCHAR * ptszSlotName; // one of this string should be given
+ char * pszSlotName;
+ };
+ char * pszSlotID;
+ BOOL fUnicode;
+ BYTE iSlot; // the slot 10-16 are available, do not use
+} EXTRASLOTINFO;
+
+#define CLVM_FILTER_PROTOS 1
+#define CLVM_FILTER_GROUPS 2
+#define CLVM_FILTER_STATUS 4
+#define CLVM_FILTER_VARIABLES 8
+#define CLVM_STICKY_CONTACTS 16
+#define CLVM_FILTER_STICKYSTATUS 32
+#define CLVM_FILTER_LASTMSG 64
+#define CLVM_FILTER_LASTMSG_OLDERTHAN 128
+#define CLVM_FILTER_LASTMSG_NEWERTHAN 256
+
+#define CLVM_PROTOGROUP_OP 1
+#define CLVM_GROUPSTATUS_OP 2
+#define CLVM_AUTOCLEAR 4
+#define CLVM_INCLUDED_UNGROUPED 8
+#define CLVM_USELASTMSG 16
+
+#define CLVM_USEGROUPS 32
+#define CLVM_DONOTUSEGROUPS 64
+
+//changes the 'use groups' flag and call CLUI v0.8.0.16+
+//wParam=newValue
+//lParam=0
+//returns 0 on success, nonzero on failure
+//newValue is 0 to not use gruops, 1 to use groups
+//or -1 to toggle the value
+#define MS_CLIST_SETUSEGROUPS "CList/SetUseGroups"
+
+
+#if defined(_UNICODE)
+#define CLVM_MODULE "CLVM_W"
+#else
+#define CLVM_MODULE "CLVM"
+#endif
+
+#define GROUPF_SHOWOFFLINE 0x40
+
+#endif \ No newline at end of file
diff --git a/plugins/Modernb/hdr/modern_clui.h b/plugins/Modernb/hdr/modern_clui.h
new file mode 100644
index 0000000000..8f9c82797e
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_clui.h
@@ -0,0 +1,193 @@
+/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2008 Miranda ICQ/IM project,
+all portions of this codebase are copyrighted to the people
+
+listed in contributors.txt.
+
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+#ifndef modern_clui_h__
+#define modern_clui_h__
+
+#include "windowsX.h"
+#define HANDLE_MESSAGE( _message, _fn) \
+ case (_message): return This->_fn( (_message), (wParam), (lParam) )
+
+class CLUI
+{
+public:
+ static HWND m_hWnd;
+ static CLUI * m_pCLUI;
+ static BOOL m_fMainMenuInited;
+
+private:
+ CLUI(); // is protected use InitClui to initialize instead
+
+public:
+ ~CLUI();
+
+ static HRESULT InitClui() { m_pCLUI = new CLUI(); return S_OK; };
+ static HWND& ClcWnd() { return pcli->hwndContactTree; }
+ static HWND& CluiWnd() { return pcli->hwndContactList; }
+ static CLUI * GetClui() { return m_pCLUI; }
+ static BOOL IsMainMenuInited() { return CLUI::m_fMainMenuInited; }
+
+ CLINTERFACE void cliOnCreateClc();
+
+ EVENTHOOK( OnEvent_ModulesLoaded );
+ EVENTHOOK( OnEvent_ContactMenuPreBuild );
+ EVENTHOOK( OnEvent_DBSettingChanging );
+ EVENTHOOK( OnEvent_FontReload );
+
+ SERVICE( Service_ShowMainMenu );
+ SERVICE( Service_ShowStatusMenu );
+ SERVICE( Service_Menu_ShowContactAvatar );
+ SERVICE( Service_Menu_HideContactAvatar );
+
+ static LRESULT CALLBACK cli_ContactListWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
+ {
+ CLUI * This = m_pCLUI;
+ if ( !m_hWnd ) m_hWnd = hwnd;
+
+ BOOL bHandled = FALSE;
+ LRESULT lRes= This->PreProcessWndProc( msg, wParam, lParam, bHandled );
+ if ( bHandled ) return lRes;
+
+ switch ( msg )
+ {
+ HANDLE_MESSAGE( WM_NCCREATE, OnNcCreate );
+ HANDLE_MESSAGE( WM_CREATE, OnCreate );
+ HANDLE_MESSAGE( UM_CREATECLC, OnCreateClc );
+ HANDLE_MESSAGE( UM_SETALLEXTRAICONS, OnSetAllExtraIcons );
+ HANDLE_MESSAGE( WM_INITMENU, OnInitMenu );
+ HANDLE_MESSAGE( WM_SIZE, OnSizingMoving );
+ HANDLE_MESSAGE( WM_SIZING, OnSizingMoving );
+ HANDLE_MESSAGE( WM_MOVE, OnSizingMoving );
+ HANDLE_MESSAGE( WM_EXITSIZEMOVE, OnSizingMoving );
+ HANDLE_MESSAGE( WM_WINDOWPOSCHANGING, OnSizingMoving );
+ HANDLE_MESSAGE( WM_DISPLAYCHANGE, OnSizingMoving );
+ HANDLE_MESSAGE( WM_THEMECHANGED, OnThemeChanged );
+ HANDLE_MESSAGE( WM_DWMCOMPOSITIONCHANGED, OnDwmCompositionChanged );
+ HANDLE_MESSAGE( UM_SYNCCALL, OnSyncCall );
+ HANDLE_MESSAGE( UM_UPDATE, OnUpdate );
+ HANDLE_MESSAGE( WM_NCACTIVATE, OnNcPaint );
+ HANDLE_MESSAGE( WM_PRINT, OnNcPaint );
+ HANDLE_MESSAGE( WM_NCPAINT, OnNcPaint );
+ HANDLE_MESSAGE( WM_ERASEBKGND, OnEraseBkgnd );
+ HANDLE_MESSAGE( WM_PAINT, OnPaint );
+ HANDLE_MESSAGE( WM_LBUTTONDOWN, OnLButtonDown );
+ HANDLE_MESSAGE( WM_PARENTNOTIFY, OnParentNotify );
+ HANDLE_MESSAGE( WM_SETFOCUS, OnSetFocus );
+ HANDLE_MESSAGE( WM_TIMER, OnTimer );
+ HANDLE_MESSAGE( WM_ACTIVATE, OnActivate );
+ HANDLE_MESSAGE( WM_SETCURSOR, OnSetCursor );
+ HANDLE_MESSAGE( WM_MOUSEACTIVATE, OnMouseActivate );
+ HANDLE_MESSAGE( WM_NCLBUTTONDOWN, OnNcLButtonDown );
+ HANDLE_MESSAGE( WM_NCLBUTTONDBLCLK, OnNcLButtonDblClk );
+ HANDLE_MESSAGE( WM_NCHITTEST, OnNcHitTest );
+ HANDLE_MESSAGE( WM_SHOWWINDOW, OnShowWindow );
+ HANDLE_MESSAGE( WM_SYSCOMMAND, OnSysCommand );
+ HANDLE_MESSAGE( WM_KEYDOWN, OnKeyDown );
+ HANDLE_MESSAGE( WM_GETMINMAXINFO, OnGetMinMaxInfo );
+ HANDLE_MESSAGE( WM_MOVING, OnMoving );
+ HANDLE_MESSAGE( WM_NOTIFY, OnNotify );
+ HANDLE_MESSAGE( WM_CONTEXTMENU, OnContextMenu );
+ HANDLE_MESSAGE( WM_MEASUREITEM, OnMeasureItem );
+ HANDLE_MESSAGE( WM_DRAWITEM, OnDrawItem );
+ HANDLE_MESSAGE( WM_DESTROY, OnDestroy );
+ default:
+ return This->DefCluiWndProc( msg, wParam, lParam );
+ }
+ return FALSE;
+ }
+
+
+ //////////////////////////////////////////////////////////////////////////
+ // METHODS
+ //
+private:
+ HRESULT CreateCLC();
+ HRESULT FillAlphaChannel( HDC hDC, RECT* prcParent, BYTE bAlpha);
+ HRESULT SnappingToEdge( WINDOWPOS * lpWindowPos );
+ HRESULT LoadDllsRuntime();
+ HRESULT RegisterAvatarMenu(); // TODO move to CLC class
+ HRESULT CreateCluiFrames();
+ HRESULT CreateCLCWindow(const HWND parent);
+ HRESULT CreateUIFrames();
+
+ LRESULT DefCluiWndProc( UINT msg, WPARAM wParam, LPARAM lParam )
+ {
+ return corecli.pfnContactListWndProc( m_hWnd, msg, wParam, lParam );
+ }
+
+ // MessageMap
+ LRESULT PreProcessWndProc( UINT msg, WPARAM wParam, LPARAM lParam, BOOL& bHandled );
+ LRESULT OnSizingMoving( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnThemeChanged( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnDwmCompositionChanged( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnSyncCall( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnUpdate( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnInitMenu( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnNcPaint( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnEraseBkgnd( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnNcCreate( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnPaint( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnCreate( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnSetAllExtraIcons( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnCreateClc( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnLButtonDown( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnParentNotify( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnSetFocus( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnTimer( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnStatusBarUpdateTimer( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnAutoAlphaTimer( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnSmoothAlphaTransitionTimer( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnDelayedSizingTimer( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnBringOutTimer( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnBringInTimer( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnUpdateBringTimer( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnActivate( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnSetCursor( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnMouseActivate( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnNcLButtonDown( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnNcLButtonDblClk( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnNcHitTest( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnShowWindow( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnSysCommand( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnKeyDown( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnGetMinMaxInfo( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnMoving( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnNotify( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnNewContactNotify( NMCLISTCONTROL * pnmc );
+ LRESULT OnListRebuildNotify( NMCLISTCONTROL * pnmc );
+ LRESULT OnListSizeChangeNotify( NMCLISTCONTROL * pnmc );
+ LRESULT OnClickNotify( NMCLISTCONTROL * pnmc );
+ LRESULT OnContextMenu( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnMeasureItem( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnDrawItem( UINT msg, WPARAM wParam, LPARAM lParam );
+ LRESULT OnDestroy( UINT msg, WPARAM wParam, LPARAM lParam );
+
+protected:
+ HMODULE m_hDwmapiDll;
+ HMODULE m_hUserDll;
+
+ enum { SNAPTOEDGESENSIVITY = 30 };
+};
+
+#endif // modern_clui_h__ \ No newline at end of file
diff --git a/plugins/Modernb/hdr/modern_cluiframes.h b/plugins/Modernb/hdr/modern_cluiframes.h
new file mode 100644
index 0000000000..e2c1aade78
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_cluiframes.h
@@ -0,0 +1,150 @@
+/*
+Miranda ICQ: the free icq client for MS Windows
+Copyright (C) 2000-2 Richard Hughes, Roland Rabien & Tristan Van de Vreede
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#pragma once
+
+#ifndef _CLUIFRAMES_H_
+#define _CLUIFRAMES_H_
+
+#include "../m_api/m_skin_eng.h"
+
+int LoadCLUIFramesModule(void);
+int UnLoadCLUIFramesModule(void);
+int CLUIFramesGetMinHeight();
+int CLUIFramesOnClistResize(WPARAM wParam,LPARAM lParam);
+int CLUIFrames_GetTotalHeight();
+
+typedef struct tagProtocolData {
+ char *RealName;
+ int protopos;
+ boolean show;
+} ProtocolData;
+
+typedef struct
+{
+ int order;
+ int realpos;
+}SortData;
+
+
+
+
+//============
+#define CLUIFRAMESSETALIGN "CLUIFramesSetAlign"
+
+#define CLUIFRAMESSETALIGNALTOP "CLUIFramesSetAlignalTop"
+#define CLUIFRAMESSETALIGNALCLIENT "CLUIFramesSetAlignalClient"
+#define CLUIFRAMESSETALIGNALBOTTOM "CLUIFramesSetAlignalBottom"
+#define CLUIFRAMESSETFLOATING "Set_Floating"
+
+#define CLUIFRAMESMOVEUPDOWN "CLUIFramesMoveUpDown"
+#define CLUIFRAMESMOVEUP "CLUIFramesMoveUp"
+#define CLUIFRAMESMOVEDOWN "CLUIFramesMoveDown"
+
+typedef struct tagMenuHandles
+{
+ HANDLE MainMenuItem;
+ HANDLE MIVisible,MITitle,MITBVisible,MILock,MIColl,MIFloating,MIAlignRoot;
+ HANDLE MIAlignTop,MIAlignClient,MIAlignBottom;
+ HANDLE MIBorder;
+ HANDLE MIPosRoot;
+ HANDLE MIPosUp,MIPosDown;
+} FrameMenuHandles;
+
+typedef struct tagFrameTitleBar{
+ HWND hwnd;
+ HWND TitleBarbutt;
+ HWND hwndTip;
+
+ TCHAR* tbname;
+ TCHAR* tooltip;
+
+ char * sztbname;
+ char * sztooltip;
+
+ HMENU hmenu;
+ HICON hicon;
+
+ BOOLEAN ShowTitleBar;
+ BOOLEAN ShowTitleBarTip;
+ COLORREF BackColour;
+ COLORREF TextColour;
+ int oldstyles;
+ POINT oldpos;
+ RECT wndSize;
+} FrameTitleBar;
+
+typedef struct _DockOpt
+{
+ HWND hwndLeft;
+ HWND hwndRight;
+}
+DockOpt;
+typedef struct _tagFrameWnd{
+ int id;
+ HWND hWnd ;
+ RECT wndSize;
+ TCHAR * Name;
+ char * szName;
+ int align;
+ int height;
+ int dwFlags;
+ BOOLEAN Locked;
+ BOOLEAN visible;
+ BOOLEAN needhide;
+ BOOLEAN collapsed;
+ int prevvisframe;
+ int HeightWhenCollapsed;
+ FrameTitleBar TitleBar;
+ FrameMenuHandles MenuHandles;
+ int oldstyles;
+ BOOLEAN floating;
+ HWND ContainerWnd;
+ POINT FloatingPos;
+ POINT FloatingSize;
+ BOOLEAN minmaxenabled;
+ BOOLEAN UseBorder;
+ int order;
+ DockOpt dockOpt;
+ HWND OwnerWindow;
+ tPaintCallbackProc PaintCallbackProc;
+ sPaintRequest * PaintData;
+ BOOLEAN bQueued;
+ HRGN UpdateRgn;
+
+} FRAMEWND;
+
+#define OFFSET_PROTOPOS 200
+#define OFFSET_VISIBLE 400
+
+#define CLUIFrameSubContainerClassName _T("CLUIFrameSubContainer")
+#define CLUIFrameTitleBarClassName _T("CLUIFrameTitleBar")
+#define CLUIFrameModule "CLUIFrames"
+
+//integrated menu module
+#define MS_INT_MENUMEASUREITEM "CLUIFrames/IntMenuMeasureItem"
+#define MS_INT_MENUDRAWITEM "CLUIFrames/IntMenuDrawItem"
+#define MS_INT_MENUPROCESSCOMMAND "CLUIFrames/IntMenuProcessCommand"
+#define MS_INT_MODIFYMENUITEM "CLUIFrames/IntModifyMenuItem"
+
+#endif
+
+
+
+
diff --git a/plugins/Modernb/hdr/modern_commonheaders.h b/plugins/Modernb/hdr/modern_commonheaders.h
new file mode 100644
index 0000000000..9dda706e1a
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_commonheaders.h
@@ -0,0 +1,531 @@
+#ifndef commonheaders_h__
+#define commonheaders_h__
+
+/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2008 Miranda ICQ/IM project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+#pragma once
+#define MIRANDA_VER 0x0A00
+
+#define _WIN32_WINNT 0x0501
+
+#ifndef _WIN32_IE
+#define _WIN32_IE 0x0501
+#endif
+
+#ifndef DB_USEHELPERFUNCTIONS // to supress static inline db helpers
+#define DB_NOHELPERFUNCTIONS
+#endif
+
+#ifndef _CRT_SECURE_NO_WARNINGS
+#define _CRT_SECURE_NO_WARNINGS // to suppress secure warnings in VC2005
+#endif
+
+#ifndef _CRT_SECURE_NO_DEPRECATE // to suppress secure deprecate warnings in VC2005
+#define _CRT_SECURE_NO_DEPRECATE
+#endif
+
+#if defined (_DEBUG)
+#define TRACE(str) { log0(str); }
+#else
+ #define TRACE(str)
+#endif
+
+#if defined (_DEBUG)
+ #define TRACEVAR(str,n) { log1(str,n); }
+#else
+ #define TRACEVAR(str,n)
+#endif
+
+#if defined (_DEBUG)
+#define TRACET(str) OutputDebugString(str)
+#else
+#define TRACET(str)
+#endif
+
+#define SERVICE(serviceproc) static INT_PTR serviceproc(WPARAM wParam,LPARAM lParam)
+#define EVENTHOOK(eventhookproc) static int eventhookproc(WPARAM wParam,LPARAM lParam)
+#define CLINTERFACE static
+
+#define PLUGININTERFACE extern "C" __declspec( dllexport )
+#define UPDATER_PATH "http://miranda-im.org/download/details.php?action=viewfile&id=3684"
+
+#include "m_stdhdr.h"
+
+#include <windows.h>
+#include <commctrl.h>
+#include <uxtheme.h>
+#include <vssym32.h>
+#include <stdio.h>
+#include <time.h>
+#include <stddef.h>
+//#include <process.h>
+#include <io.h>
+#include <math.h>
+#include <string.h>
+#include <direct.h>
+#include <win2k.h>
+
+#include "modern_global_structure.h"
+
+#include <newpluginapi.h>
+#include <m_system.h>
+#include <m_system_cpp.h>
+#include <m_utils.h>
+
+#include <m_database.h>
+#include <m_langpack.h>
+#include <m_button.h>
+#include <m_options.h>
+#include <m_protosvc.h>
+#include <m_clist.h>
+#include <m_clistint.h>
+#include <m_skin.h>
+#include <m_contacts.h>
+#include <m_plugins.h>
+#include <m_avatars.h>
+#include <m_genmenu.h>
+#include <m_clui.h>
+#include <m_clc.h>
+#include <m_icolib.h>
+#include <m_userinfo.h>
+#include <m_addcontact.h>
+#include <m_fontservice.h>
+#include <m_file.h>
+#include <m_timezones.h>
+
+#include "modern_clc.h"
+#include "modern_clist.h"
+#include "modern_cluiframes.h"
+#include "m_cluiframes.h"
+#include "m_metacontacts.h"
+#include "../m_api/m_skin_eng.h"
+
+#include "modern_rowheight_funcs.h"
+#include "modern_cache_funcs.h"
+#include "modern_log.h"
+
+#include "richedit.h"
+#include "m_variables.h"
+
+#include "m_smileyadd.h"
+
+#include "../m_api/m_xpTheme.h"
+#include "m_toolbar.h"
+
+#include "../resource.h"
+
+#include "modern_layered_window_engine.h"
+
+// module name of MetaContacts plugin
+extern char *g_szMetaModuleName;
+
+//macros to free data and set it pointer to NULL
+#define mir_free_and_nill(x) {mir_free((void*)x); x=NULL;}
+// shared vars
+
+#define CLUI_FRAME_AUTOHIDENOTIFY 512
+#define CLUI_FRAME_SHOWALWAYS 1024
+
+
+//#define alloc(n) mir_alloc(n)
+
+#define MAX_REGS(_A_) (sizeof(_A_)/sizeof(_A_[0]))
+
+#ifndef CS_DROPSHADOW
+#define CS_DROPSHADOW 0x00020000
+#endif
+
+#define MENU_MIRANDAMENU 0xFFFF1234
+#define MENU_STATUSMENU 0xFFFF1235
+#define MENU_MINIMIZE 0xFFFF1236
+
+#define UM_CREATECLC (WM_USER+1)
+#define UM_SETALLEXTRAICONS (WM_USER+2)
+#define UM_UPDATE (WM_USER+50)
+#define UM_SYNCCALL (WM_USER+654)
+
+// Define constants for CLUI_SizingOnBorder SC_SIZE
+
+#define SCF_NONE 0
+#define SCF_LEFT 1
+#define SCF_RIGHT 2
+#define SCF_TOP 3
+#define SCF_BOTTOM 6
+
+
+extern char* __cdecl strstri( char *a, const char *b);
+extern BOOL __cdecl mir_bool_strcmpi(const char *a, const char *b);
+extern int __cdecl mir_strcmp (const char *a, const char *b);
+extern int __cdecl mir_strlen (const char *a);
+extern int __cdecl mir_strcmpi(const char *a, const char *b);
+extern int __cdecl mir_tstrcmpi(const TCHAR *a, const TCHAR *b);
+extern DWORD exceptFunction(LPEXCEPTION_POINTERS EP);
+
+extern HANDLE ModernHookEvent( char *EventID, MIRANDAHOOK HookProc );
+
+extern int ModernUnhookEvent(HANDLE hHook);
+extern int UnhookAll();
+
+#ifndef MYCMP
+#define MYCMP 1
+#define strcmp(a,b) mir_strcmp(a,b)
+#define strlen(a) mir_strlen(a)
+#endif
+
+// Register of plugin's user
+//
+// wParam = (WPARAM)szSetting - string that describes a user
+// format: Category/ModuleName,
+// eg: "Contact list background/CLUI",
+// "Status bar background/StatusBar"
+// lParam = (LPARAM)dwFlags
+//
+#define MS_BACKGROUNDCONFIG_REGISTER "ModernBkgrCfg/Register"
+
+//
+// Notification about changed background
+// wParam = ModuleName
+// lParam = 0
+#define ME_BACKGROUNDCONFIG_CHANGED "ModernBkgrCfg/Changed"
+
+
+
+HBITMAP ske_CreateDIB32(int cx, int cy);
+
+extern void InitDisplayNameCache(void);
+extern void FreeDisplayNameCache();
+extern int CLUI_ShowWindowMod(HWND hwnd, int cmd);
+
+#ifdef UNICODE
+ #define GSMDF_TCHAR_MY GSMDF_TCHAR|CNF_UNICODE
+#else
+ #define GSMDF_TCHAR_MY 0
+#endif
+
+#ifndef LWA_COLORKEY
+#define LWA_COLORKEY 0x00000001
+#endif
+
+#ifndef AC_SRC_ALPHA
+#define AC_SRC_ALPHA 0x01
+#endif
+
+//#ifdef _DEBUG
+//#define DeleteObject(a) DebugDeleteObject(a)
+//#endif
+
+#define strsetA(a,b) {if (a) mir_free_and_nill(a); a=mir_strdup(b);}
+#define strsetT(a,b) {if (a) mir_free_and_nill(a); a=mir_tstrdup(b);}
+
+extern void TRACE_ERROR();
+extern BOOL DebugDeleteObject(HGDIOBJ a);
+extern BOOL mod_DeleteDC(HDC hdc);
+extern BOOL ske_ResetTextEffect(HDC hdc);
+extern BOOL ske_SelectTextEffect(HDC hdc, BYTE EffectID, DWORD FirstColor, DWORD SecondColor);
+extern void IvalidateDisplayNameCache(DWORD mode);
+
+typedef BOOL (WINAPI *pfnTryEnterCriticalSection)( LPCRITICAL_SECTION );
+extern pfnTryEnterCriticalSection fnTryEnterCriticalSection;
+
+typedef BOOL (WINAPI *pfnGetScrollBarInfo)( HWND, LONG, PSCROLLBARINFO );
+extern pfnGetScrollBarInfo fnGetScrollBarInfo;
+
+typedef DWORD (WINAPI *pfnMsgWaitForMultipleObjectsEx)( DWORD, CONST HANDLE*, DWORD, DWORD, DWORD );
+extern pfnMsgWaitForMultipleObjectsEx fnMsgWaitForMultipleObjectsEx;
+
+typedef HWND (WINAPI *pfnGetAncestor)( HWND, UINT );
+extern pfnGetAncestor fnGetAncestor;
+HWND WINAPI MyGetAncestor( HWND, UINT );
+
+typedef BOOL (WINAPI *pfnGetMenuBarInfo)( HWND, LONG, LONG, PMENUBARINFO );
+extern pfnGetMenuBarInfo fnGetMenuBarInfo;
+
+void FreeAndNil( void **p );
+
+extern SortedList *clistCache;
+
+HICON LoadSmallIconShared(HINSTANCE hInstance, LPCTSTR lpIconName);
+HICON LoadSmallIcon(HINSTANCE hInstance, LPCTSTR lpIconName);
+BOOL DestroyIcon_protect(HICON icon);
+
+#ifndef ETDT_ENABLETAB
+#define ETDT_DISABLE 0x00000001
+#define ETDT_ENABLE 0x00000002
+#define ETDT_USETABTEXTURE 0x00000004
+#define ETDT_ENABLETAB (ETDT_ENABLE | ETDT_USETABTEXTURE)
+#endif
+
+
+
+#define TreeView_InsertItemA(hwnd, lpis) \
+ (HTREEITEM)SendMessageA((hwnd), TVM_INSERTITEMA, 0, (LPARAM)(LPTV_INSERTSTRUCTA)(lpis))
+
+#define TreeView_GetItemA(hwnd, pitem) \
+ (BOOL)SendMessageA((hwnd), TVM_GETITEMA, 0, (LPARAM)(TV_ITEM *)(pitem))
+
+enum
+{
+ STATE_DLL_LOADING = 0,
+ STATE_CLUI_LOADING,
+ STATE_NORMAL,
+ STATE_PREPEARETOEXIT,
+ STATE_EXITING
+};
+
+#define MirandaLoading() ((g_CluiData.bSTATE<STATE_NORMAL))
+#define MirandaExiting() ((g_CluiData.bSTATE>STATE_NORMAL))
+
+
+
+char * strdupn(const char * src, int len);
+
+#define SKINBUTTONCLASS _T("MirandaSkinButtonClass")
+
+#define SORTBY_NAME 0
+#define SORTBY_STATUS 1
+#define SORTBY_LASTMSG 2
+#define SORTBY_PROTO 3
+#define SORTBY_RATE 4
+#define SORTBY_NAME_LOCALE 5
+#define SORTBY_NOTHING 10
+
+#define DT_FORCENATIVERENDER 0x10000000
+
+#define _BOOL(a) (a != 0)
+
+/* modern_animated_avatars.c */
+int AniAva_InitModule(); // HAVE TO BE AFTER GDI+ INITIALIZED
+int AniAva_UnloadModule();
+int AniAva_UpdateOptions(); //reload options, //hot enable/disable engine
+
+int AniAva_AddAvatar(HANDLE hContact, TCHAR * szFilename, int width, int heigth); // adds avatars to be displayed
+int AniAva_SetAvatarPos(HANDLE hContact, RECT * rc, int overlayIdx, BYTE bAlpha); // update avatars pos
+int AniAva_InvalidateAvatarPositions(HANDLE hContact); // reset positions of avatars to be drawn (still be painted at same place)
+int AniAva_RemoveInvalidatedAvatars(); // all avatars without validated position will be stop painted and probably removed
+int AniAva_RemoveAvatar(HANDLE hContact); // remove avatar
+int AniAva_RedrawAllAvatars(BOOL updateZOrder); // request to repaint all
+void AniAva_UpdateParent();
+int AniAva_RenderAvatar( HANDLE hContact, HDC hdcMem, RECT * rc );
+
+
+#define CCI_NAME 1
+#define CCI_GROUP (1<<1)
+#define CCI_PROTO (1<<2)
+#define CCI_STATUS (1<<3)
+#define CCI_LINES (1<<4)
+#define CCI_HIDDEN (1<<4)
+#define CCI_NOHIDEOFFLINE (1<<5)
+#define CCI_NOPROTO (1<<6)
+#define CCI_HIDESUBCONTACT (1<<7)
+#define CCI_I (1<<8)
+#define CCI_APPARENT (1<<9)
+#define CCI_NOTONLIST (1<<10)
+#define CCI_IDLETS (1<<11)
+#define CCI_CCONTACT (1<<12)
+#define CCI_EXPAND (1<<13)
+#define CCI_UNKNOWN (1<<14)
+#define CCI_TIME (1<<15)
+#define CCI_OTHER ~( CCI_NAME|CCI_GROUP|CCI_PROTO|CCI_STATUS|CCI_LINES|CCI_TIME )
+#define CCI_ALL (0xFFFFFFFF)
+
+void CListSettings_FreeCacheItemData(pdisplayNameCacheEntry pDst);
+int CLUI_SyncGetPDNCE(WPARAM wParam, LPARAM lParam);
+WORD pdnce___GetStatus(pdisplayNameCacheEntry pdnce);
+void pdnce___SetStatus( pdisplayNameCacheEntry pdnce, WORD wStatus );
+
+/* move to list module */
+typedef void (*ItemDestuctor)(void*);
+
+
+void li_ListDestruct(SortedList *pList, ItemDestuctor pItemDestructor);
+void li_RemoveDestruct(SortedList *pList, int index, ItemDestuctor pItemDestructor);
+void li_RemovePtrDestruct(SortedList *pList, void * ptr, ItemDestuctor pItemDestructor);
+void li_SortList(SortedList *pList, FSortFunc pSortFunct);
+
+#define mir_safe_free(a) if(a) mir_free(a)
+
+#ifdef _UNICODE
+#define mir_t2a(s) mir_u2a(s)
+#define mir_a2t(s) mir_a2u(s)
+#define mir_t2u(s) mir_wstrdup(s)
+#define mir_u2t(s) mir_wstrdup(s)
+#else
+#define mir_t2a(s) mir_strdup(s)
+#define mir_a2t(s) mir_strdup(s)
+#define mir_t2u(s) mir_a2u(s)
+#define mir_u2t(s) mir_u2a(s)
+#endif
+
+
+template <class T> class INIT : public T
+{
+public:
+ INIT()
+ {
+ memset(this, 0, sizeof(T));
+ this->cbSize=sizeof(T);
+ }
+};
+
+#ifdef __cplusplus
+const ROWCELL * rowAddCell(ROWCELL* &, int );
+void rowDeleteTree(ROWCELL *cell);
+BOOL rowParse(ROWCELL* &cell, ROWCELL* parent, char *tbuf, int &hbuf, int &sequence, ROWCELL** RowTabAccess );
+void rowSizeWithReposition(ROWCELL* &root, int width);
+#endif
+
+//////////////////////////////////////////////////////////////////////////
+// Specific class for quick implementation of map<string, *> list
+// with some more fast searching it is
+// hash_map alternative - for faked hash search;
+// the items are stored no by char* key but both int(hash),char*.
+// have items sorted in map firstly via hash, secondly via string
+// the method is case insensitive
+// To use this simple define like
+// typedef std::map<HashStringKeyNoCase, _Type > map_Type;
+// map_Type myMap;
+// and access it as usual via simpe char* indexing:
+// myList[ "first" ]=_Type_value;
+// myList[ "second" ]=_Type_value;
+// _Type a = myList[ "second"];
+
+class HashStringKeyNoCase
+{
+public:
+
+ HashStringKeyNoCase( const char* szKey )
+ {
+ _strKey=_strdup( szKey );
+ _CreateHashKey();
+ }
+
+ HashStringKeyNoCase( const HashStringKeyNoCase& hsKey )
+ {
+ _strKey = _strdup( hsKey._strKey );
+ _dwKey = hsKey._dwKey;
+ }
+
+ HashStringKeyNoCase& operator= ( const HashStringKeyNoCase& hsKey )
+ {
+ _strKey = _strdup( hsKey._strKey );
+ _dwKey = hsKey._dwKey;
+ }
+
+#ifdef _UNICODE
+ HashStringKeyNoCase( const wchar_t* szKey )
+ {
+ int codepage=0;
+ int cbLen = WideCharToMultiByte( codepage, 0, szKey, -1, NULL, 0, NULL, NULL );
+ char* result = ( char* )malloc( cbLen+1 );
+ WideCharToMultiByte( codepage, 0, szKey, -1, result, cbLen, NULL, NULL );
+ result[ cbLen ] = 0;
+
+ _strKey=result;
+ _CreateHashKey();
+ }
+#endif
+
+ ~HashStringKeyNoCase()
+ {
+ if (_strKey) free (_strKey);
+ _strKey = NULL;
+ _dwKey=0;
+ }
+
+private:
+ char* _strKey;
+ DWORD _dwKey;
+
+ void _CreateHashKey()
+ {
+ _strKey=_strupr( _strKey );
+ _dwKey = mod_CalcHash( _strKey );
+ }
+
+public:
+ bool operator< ( const HashStringKeyNoCase& second ) const
+ {
+ if ( this->_dwKey != second._dwKey )
+ return ( this->_dwKey < second._dwKey );
+ else
+ return ( strcmp( this->_strKey, second._strKey ) < 0 ); // already maked upper so in any case - will be case insensitive
+ }
+
+ struct HashKeyLess
+ {
+ bool operator() ( const HashStringKeyNoCase& first, const HashStringKeyNoCase& second ) const
+ { return ( first < second ); }
+ };
+};
+
+#ifdef _UNICODE
+#define ModernGetStringT ModernGetStringW
+#else
+#define ModernGetStringT ModernGetStringA
+#endif
+
+char * ModernGetStringA ( HANDLE hContact, const char *szModule, const char *szSetting );
+wchar_t * ModernGetStringW ( HANDLE hContact, const char *szModule, const char *szSetting );
+
+WORD ModernGetSettingRangedWord ( HANDLE hContact, const char *szModule, const char *szSetting, WORD errorValue, WORD minValue, WORD maxValue);
+
+
+#define ModernGetSetting(a,b,c,d) ModernGetSetting_Helper(a,b,c,d,__FILE__,__LINE__)
+#define ModernGetSettingByte(a,b,c,d) ModernGetSettingByte_Helper(a,b,c,d,__FILE__,__LINE__)
+#define ModernGetSettingWord(a,b,c,d) ModernGetSettingWord_Helper(a,b,c,d,__FILE__,__LINE__)
+#define ModernGetSettingDword(a,b,c,d) ModernGetSettingDword_Helper(a,b,c,d,__FILE__,__LINE__)
+#define ModernGetSettingString(a,b,c,d) ModernGetSettingString_Helper(a,b,c,d,__FILE__,__LINE__,DBVT_ASCIIZ)
+#define ModernGetSettingWString(a,b,c,d) ModernGetSettingString_Helper(a,b,c,d,__FILE__,__LINE__,DBVT_WCHAR)
+#define ModernGetSettingUTF8String(a,b,c,d) ModernGetSettingString_Helper(a,b,c,d,__FILE__,__LINE__,DBVT_UTF8)
+
+int __cdecl ModernGetSettingByte_Helper ( HANDLE hContact, const char *szModule, const char *szSetting, int errorValue, const char *szFile, const int nLine);
+int __cdecl ModernGetSettingWord_Helper ( HANDLE hContact, const char *szModule, const char *szSetting, int errorValue, const char *szFile, const int nLine);
+int __cdecl ModernGetSettingDword_Helper ( HANDLE hContact, const char *szModule, const char *szSetting, int errorValue, const char *szFile, const int nLine);
+int __cdecl ModernGetSettingString_Helper ( HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv, const char *szFile, const int nLine, const int nType);
+int __cdecl ModernGetSetting_Helper ( HANDLE hContact, const char *szModule, const char *szSetting, DBVARIANT *dbv, const char *szFile, const int nLine);
+
+int __cdecl ModernWriteSettingByte ( HANDLE hContact, const char *szModule, const char *szSetting, BYTE val );
+int __cdecl ModernWriteSettingWord ( HANDLE hContact, const char *szModule, const char *szSetting, WORD val );
+int __cdecl ModernWriteSettingDword ( HANDLE hContact, const char *szModule, const char *szSetting, DWORD val );
+int __cdecl ModernWriteSettingString ( HANDLE hContact, const char *szModule, const char *szSetting, const char *val );
+
+
+int __cdecl ModernDeleteSetting ( HANDLE hContact, const char *szModule, const char *szSetting);
+int __cdecl ModernDBFreeVariant ( DBVARIANT *dbv );
+
+
+#ifdef _UNICODE
+ int __cdecl ModernWriteSettingWString ( HANDLE hContact, const char *szModule, const char *szSetting, const WCHAR *val );
+ #define ModernWriteSettingTString(a,b,c,d) ModernWriteSettingWString( a,b,c,d )
+ #define ModernGetSettingTString(a,b,c,d) ModernGetSettingWString(a,b,c,d)
+#else
+ #define ModernWriteSettingTString(a,b,c,d) ModernWriteSettingString( a,b,c,d )
+ #define ModernGetSettingTString(a,b,c,d) ModernGetSettingString(a,b,c,d)
+#endif //_UNICODE
+
+
+#define EXTRACOLUMNCOUNT 10
+
+
+#endif // commonheaders_h__
diff --git a/plugins/Modernb/hdr/modern_commonprototypes.h b/plugins/Modernb/hdr/modern_commonprototypes.h
new file mode 100644
index 0000000000..ad79a497ed
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_commonprototypes.h
@@ -0,0 +1,360 @@
+#pragma once
+
+#ifndef _COMMONPROTOTYPES
+#define _COMMONPROTOTYPES
+
+#ifndef commonheaders_h__
+#error "hdr/modern_commonheaders.h have to be including first"
+#endif
+
+#include "modern_commonheaders.h" //TO DO: Move contents of this file to commonheaders.h
+#include "modern_clist.h"
+#include "modern_cluiframes.h"
+#include "modern_row.h"
+#include "modern_skinengine.h"
+#include "modern_skinselector.h"
+#include "modern_statusbar.h"
+
+#define SKIN "ModernSkin"
+
+extern PLUGININFOEX pluginInfo;
+extern CLIST_INTERFACE * pcli;
+extern CLIST_INTERFACE corecli;
+extern struct UTF8_INTERFACE utfi;
+extern struct LIST_INTERFACE li;
+extern struct MM_INTERFACE mmi;
+
+//Global variables
+extern int ON_SETALLEXTRAICON_CYCLE;
+extern BOOL CLM_AUTOREBUILD_WAS_POSTED;
+extern FRAMEWND *g_pfwFrames;
+extern int g_nFramesCount;
+extern RECT g_rcEdgeSizingRect;
+extern FRAMEWND *wndFrameEventArea;
+extern ROWCELL * gl_RowTabAccess[];
+extern ROWCELL * gl_RowRoot;
+extern HIMAGELIST hAvatarOverlays;
+extern int g_nTitleBarHeight;
+extern BOOL g_bTransparentFlag;
+extern HIMAGELIST g_himlCListClc;
+extern HIMAGELIST hCListImages;
+extern BOOL g_mutex_bSizing;
+extern BOOL LOCK_RECALC_SCROLLBAR;
+extern HIMAGELIST g_himlCListClc;
+extern int currentDesiredStatusMode;
+extern BYTE nameOrder[];
+extern SortedList lContactsCache;
+extern BOOL g_flag_bOnModulesLoadedCalled;
+extern HIMAGELIST hCListImages;
+extern SKINOBJECTSLIST g_SkinObjectList;
+extern CURRWNDIMAGEDATA * g_pCachedWindow;
+extern BOOL g_mutex_bLockUpdating;
+extern LISTMODERNMASK *MainModernMaskList;
+extern HIMAGELIST hCListImages;
+extern STATUSBARDATA g_StatusBarData;
+extern SKINOBJECTSLIST g_SkinObjectList;
+extern CURRWNDIMAGEDATA * g_pCachedWindow;
+extern char * g_szConnectingProto;
+extern BOOL g_mutex_bLockUpdating;
+extern BOOL g_mutex_bSetAllExtraIconsCycle;
+extern int g_mutex_nCalcRowHeightLock;
+extern int g_mutex_bOnTrayRightClick;
+extern BOOL g_flag_bPostWasCanceled;
+extern BOOL g_flag_bFullRepaint;
+extern BOOL g_bMultiConnectionMode;
+extern BYTE g_bCalledFromShowHide;
+extern HICON g_hListeningToIcon;
+extern BOOL glOtherSkinWasLoaded;
+extern BYTE glSkinWasModified;
+extern HWND g_hCLUIOptionsWnd;
+extern BOOL g_bTransparentFlag;
+extern HINSTANCE g_hInst;
+extern HIMAGELIST hCListImages;
+extern BOOL g_mutex_bChangingMode;
+extern HANDLE g_hMainThread;
+extern DWORD g_dwMainThreadID;
+extern DWORD g_dwAwayMsgThreadID;
+extern DWORD g_dwGetTextAsyncThreadID;
+extern DWORD g_dwSmoothAnimationThreadID;
+extern DWORD g_dwFillFontListThreadID;
+extern HWND g_hwndViewModeFrame;
+extern HANDLE hSmileyAddOptionsChangedHook,hAvatarChanged,hIconChangedHook;
+extern BYTE gl_TrimText;
+
+/************************************************************************/
+/* TYPE DEFS */
+/************************************************************************/
+
+typedef INT_PTR (*PSYNCCALLBACKPROC)(WPARAM,LPARAM);
+
+/************************************************************************/
+/* PROTOTYPES */
+/************************************************************************/
+
+
+/* CLCItems */
+BOOL CLCItems_IsShowOfflineGroup(struct ClcGroup* group);
+
+/* CListMod */
+int CListMod_HideWindow(HWND hwndContactList, int mode);
+
+/* CLUI */
+HANDLE RegisterIcolibIconHandle(char * szIcoID, char *szSectionName, char * szDescription, TCHAR * tszDefaultFile, int iDefaultIndex, HINSTANCE hDefaultModule, int iDefaultResource );
+void CLUI_UpdateAeroGlass();
+void CLUI_ChangeWindowMode();
+BOOL CLUI_CheckOwnedByClui(HWND hwnd);
+INT_PTR CLUI_GetConnectingIconService(WPARAM wParam,LPARAM lParam);
+int CLUI_HideBehindEdge();
+int CLUI_IconsChanged(WPARAM,LPARAM);
+int CLUI_IsInMainWindow(HWND hwnd);
+HICON CLUI_LoadIconFromExternalFile (char *filename,int i,boolean UseLibrary,boolean registerit,char *IconName,char *SectName,char *Description,int internalidx, BOOL * needFree);
+int CLUI_OnSkinLoad(WPARAM wParam, LPARAM lParam);
+int CLUI_ReloadCLUIOptions();
+int CLUI_ShowFromBehindEdge();
+int CLUI_SizingGetWindowRect(HWND hwnd,RECT * rc);
+int CLUI_SizingOnBorder(POINT ,int);
+int CLUI_SmoothAlphaTransition(HWND hwnd, BYTE GoalAlpha, BOOL wParam);
+int CLUI_TestCursorOnBorders();
+int CLUI_UpdateTimer(BYTE BringIn);
+void CLUI_UpdateLayeredMode();
+UINT_PTR CLUI_SafeSetTimer(HWND hwnd, int ID, int Timeout, TIMERPROC proc);
+
+/* CLUIServices */
+INT_PTR CLUIServices_ProtocolStatusChanged(WPARAM wParam,LPARAM lParam);
+
+int CLUIUnreadEmailCountChanged(WPARAM wParam,LPARAM lParam);
+
+/* GDIPlus */
+BOOL GDIPlus_AlphaBlend(HDC hdcDest,int nXOriginDest,int nYOriginDest,int nWidthDest,int nHeightDest,HDC hdcSrc,int nXOriginSrc,int nYOriginSrc,int nWidthSrc,int nHeightSrc, BLENDFUNCTION * blendFunction);
+HBITMAP GDIPlus_LoadGlyphImage(char *szFileName);
+
+/* EventArea */
+void EventArea_ConfigureEventArea();
+
+/* ExtraImage */
+void ExtraImage_SetAllExtraIcons(HWND hwndList,HANDLE hContact);
+
+/* ModernSkinButton */
+int ModernSkinButton_AddButton(HWND parent,char * ID,char * CommandService,char * StateDefService,char * HandeService, int Left, int Top, int Right, int Bottom, DWORD AlignedTo,TCHAR * Hint,char * DBkey,char * TypeDef,int MinWidth, int MinHeight);
+int ModernSkinButtonLoadModule();
+int ModernSkinButton_ReposButtons(HWND parent, BYTE draw, RECT * r);
+int ModernSkinButtonUnloadModule(WPARAM,LPARAM);
+
+/* RowHeight */
+int RowHeight_CalcRowHeight(struct ClcData *dat, HWND hwnd, struct ClcContact *contact, int item);
+
+/* SkinEngine */
+BOOL ske_AlphaBlend(HDC hdcDest,int nXOriginDest,int nYOriginDest,int nWidthDest,int nHeightDest,HDC hdcSrc,int nXOriginSrc,int nYOriginSrc,int nWidthSrc,int nHeightSrc,BLENDFUNCTION blendFunction);
+void ske_ApplyTransluency(void);
+int ske_BltBackImage (HWND destHWND, HDC destDC, RECT * BltClientRect);
+HBITMAP ske_CreateDIB32(int cx, int cy);
+HBITMAP ske_CreateDIB32Point(int cx, int cy, void ** bits);
+HRGN ske_CreateOpaqueRgn(BYTE Level, bool Opaque);
+HICON ske_CreateJoinedIcon(HICON hBottom, HICON hTop,BYTE alpha);
+int ske_DrawImageAt(HDC hdc, RECT *rc);
+BOOL ske_DrawIconEx(HDC hdc,int xLeft,int yTop,HICON hIcon,int cxWidth,int cyWidth, UINT istepIfAniCur, HBRUSH hbrFlickerFreeDraw, UINT diFlags);
+int ske_DrawNonFramedObjects(BOOL Erase,RECT *r);
+BOOL ske_DrawText(HDC hdc, LPCTSTR lpString, int nCount, RECT * lpRect, UINT format);
+BOOL ske_DrawTextA(HDC hdc, char * lpString, int nCount, RECT * lpRect, UINT format);
+LPSKINOBJECTDESCRIPTOR ske_FindObjectByName(const char * szName, BYTE objType, SKINOBJECTSLIST* Skin);
+HBITMAP ske_GetCurrentWindowImage();
+int ske_GetFullFilename(char * buf, char *file, char * skinfolder,BOOL madeAbsolute);
+int ske_GetSkinFolder(char * szFileName, char * t2);
+BOOL ske_ImageList_DrawEx( HIMAGELIST himl,int i,HDC hdcDst,int x,int y,int dx,int dy,COLORREF rgbBk,COLORREF rgbFg,UINT fStyle);
+HICON ske_ImageList_GetIcon(HIMAGELIST himl, int i, UINT fStyle);
+int ske_JustUpdateWindowImageRect(RECT * rty);
+HBITMAP ske_LoadGlyphImage(char * szFileName);
+HRESULT SkinEngineLoadModule();
+void ske_LoadSkinFromDB(void);
+int ske_LoadSkinFromIniFile(TCHAR*, BOOL);
+TCHAR* ske_ParseText(TCHAR *stzText);
+int ske_PrepeareImageButDontUpdateIt(RECT * r);
+int ske_ReCreateBackImage(BOOL Erase,RECT *w);
+int ske_RedrawCompleteWindow();
+BOOL ske_ResetTextEffect(HDC);
+BOOL ske_SelectTextEffect(HDC hdc, BYTE EffectID, DWORD FirstColor, DWORD SecondColor);
+INT_PTR ske_Service_DrawGlyph(WPARAM wParam,LPARAM lParam);
+BOOL ske_SetRectOpaque(HDC memdc,RECT *fr, BOOL force = FALSE );
+BOOL ske_SetRgnOpaque(HDC memdc,HRGN hrgn, BOOL force = FALSE );
+BOOL ske_TextOut(HDC hdc, int x, int y, LPCTSTR lpString, int nCount);
+BOOL ske_TextOutA(HDC hdc, int x, int y, char * lpString, int nCount);
+int ske_UnloadGlyphImage(HBITMAP hbmp);
+int SkinEngineUnloadModule();
+int ske_UpdateWindowImage();
+int ske_UpdateWindowImageRect(RECT * lpRect);
+int ske_ValidateFrameImageProc(RECT * r);
+
+/* CLUIFrames.c PROXIED */
+
+int CLUIFrames_ActivateSubContainers(BOOL wParam);
+int CLUIFrames_OnClistResize_mod(WPARAM wParam,LPARAM lParam);
+int CLUIFrames_OnMoving( HWND, RECT * );
+int CLUIFrames_OnShowHide( HWND hwnd, int mode );
+int CLUIFrames_SetLayeredMode( BOOL fLayeredMode, HWND hwnd );
+int CLUIFrames_SetParentForContainers( HWND parent );
+int CLUIFramesOnClistResize(WPARAM wParam,LPARAM lParam);
+
+FRAMEWND * FindFrameByItsHWND(HWND FrameHwnd); //cluiframes.c
+
+//int callProxied_DrawTitleBar(HDC hdcMem2,RECT * rect,int Frameid);
+int DrawTitleBar(HDC hdcMem2,RECT * rect,int Frameid);
+
+int FindFrameID(HWND FrameHwnd);
+int SetAlpha(BYTE Alpha);
+
+
+/* others TODO: move above */
+int Docking_ProcessWindowMessage(WPARAM wParam,LPARAM lParam);
+void DrawBackGround(HWND hwnd,HDC mhdc, HBITMAP hBmpBackground, COLORREF bkColour, DWORD backgroundBmpUse );
+HRESULT BackgroundsLoadModule();
+int BackgroundsUnloadModule();
+BOOL wildcmp(const char * name, const char * mask, BYTE option); //mod_skin_selector.c
+BOOL wildcmpi(char * name, char * mask); //mod_skin_selector.c
+BOOL wildcmpi(WCHAR* name, WCHAR* mask); //mod_skin_selector.c
+INT_PTR CALLBACK DlgSkinEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); //SkinEditor.c
+INT_PTR CALLBACK DlgTmplEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); //RowTemplate.c
+BOOL FindMenuHanleByGlobalID(HMENU hMenu, int globalID, struct _MenuItemHandles * dat); //GenMenu.c
+BOOL MatchMask(char * name, char * mask); //mod_skin_selector.c
+char* DBGetStringA(HANDLE hContact,const char *szModule,const char *szSetting); //commonheaders.c
+char* GetContactCachedProtocol(HANDLE hContact); //clistsettings.c
+char* GetParamN(char * string, char * buf, int buflen, BYTE paramN, char Delim, BOOL SkipSpaces); //mod_skin_selector.c
+DWORD CompareContacts2_getLMTime(HANDLE u); //contact.c
+DWORD mod_CalcHash(const char * a); //mod_skin_selector.c
+HICON cliGetIconFromStatusMode(HANDLE hContact, const char *szProto,int status); //clistmod.c
+HICON GetMainStatusOverlay(int STATUS); //clc.c
+int __fastcall CLVM_GetContactHiddenStatus(HANDLE hContact, char *szStatus, struct ClcData *dat); //clcitems.c
+int BgStatusBarChange(WPARAM wParam,LPARAM lParam); //clcopts.c
+int ClcDoProtoAck(HANDLE wParam,ACKDATA * ack); //clc.c
+int ModernSkinButtonDeleteAll(); //modernbutton.c
+int GetAverageMode( void ); //clisttray.c
+int GetContactCachedStatus(HANDLE hContact); //clistsettings.c
+INT_PTR GetContactIcon(WPARAM wParam,LPARAM lParam); //clistmod.c
+int GetContactIconC(pdisplayNameCacheEntry cacheEntry); //clistmod.c
+int GetContactIndex(struct ClcGroup *group,struct ClcContact *contact); //clcidents.c
+int GetStatusForContact(HANDLE hContact,char *szProto); //clistsettings.c
+int InitCustomMenus(void); //clistmenus.c
+int InitFramesMenus(void); //framesmenus.c
+int LoadMoveToGroup(); //movetogroup.c
+int LoadPositionsFromDB(BYTE * OrderPos); //clistopts.c
+int LoadStatusBarData(); //modern_statusbar.c
+int MenuModulesLoaded(WPARAM wParam,LPARAM lParam); //clistmenu.c
+int MenuModulesShutdown(WPARAM wParam,LPARAM lParam); //clistmenu.c
+int MenuProcessCommand(WPARAM wParam,LPARAM lParam); //clistmenu.c
+int ModifyMenuItemProxy(WPARAM wParam,LPARAM lParam); //framesmenu.c
+int OnFrameTitleBarBackgroundChange(WPARAM wParam,LPARAM lParam); //cluiframes.c
+int ProcessCommandProxy(WPARAM wParam,LPARAM lParam); //framesmenu.c
+int QueueAllFramesUpdating (BYTE); //cluiframes.c
+int RecursiveDeleteMenu(HMENU hMenu); //clistmenus.c
+int ModernSkinButtonRedrawAll(HDC hdc); //modern_button.c
+int RegisterButtonByParce(char * ObjectName, char * Params); //mod_skin_selector.c
+int RestoreAllContactData(struct ClcData *dat); //cache_funcs.c
+
+int SkinSelector_DeleteMask(MODERNMASK * mm); //mod_skin_selector.c
+int StoreAllContactData(struct ClcData *dat); //cache_func.c
+INT_PTR ToggleHideOffline(WPARAM wParam,LPARAM lParam); //contact.c
+INT_PTR ToggleGroups(WPARAM wParam,LPARAM lParam); //contact.c
+INT_PTR SetUseGroups(WPARAM wParam,LPARAM lParam); //contact.c
+INT_PTR ToggleSounds(WPARAM wParam,LPARAM lParam); //contact.c
+int UnitFramesMenu(); //framesmenu.c
+void ClcOptionsChanged(); //clc.c
+void Docking_GetMonitorRectFromWindow(HWND hWnd,RECT *rc); //Docking.c
+void DrawAvatarImageWithGDIp(HDC hDestDC,int x, int y, DWORD width, DWORD height, HBITMAP hbmp, int x1, int y1, DWORD width1, DWORD height1,DWORD flag,BYTE alpha); //gdiplus.cpp
+void FreeRowCell(); //RowHeight
+void InitGdiPlus(); //gdiplus.cpp
+void InitTray(); //clisttray.c
+void InvalidateDNCEbyPointer(HANDLE hContact,pdisplayNameCacheEntry pdnce,int SettingType); //clistsettings.c
+void ReAssignExtraIcons(); //extraimage.c
+void ShutdownGdiPlus(); //gdiplus.cpp
+void TextOutWithGDIp(HDC hDestDC, int x, int y, LPCTSTR lpString, int nCount); //gdiplus.cpp
+void UninitCustomMenus(); //clistmenus.c
+void UnloadAvatarOverlayIcon(); //clc.c
+void UnLoadContactListModule(); //clistmod.c
+void UpdateAllAvatars(struct ClcData *dat); //cache_func.c
+ //cluiframes.c
+void gtaRenewText(HANDLE hContact);
+int ExtraImage_ExtraIDToColumnNum(int extra);
+int ExtraImage_ColumnNumToExtraID(int column);
+
+int LoadSkinButtonModule();
+void UninitSkinHotKeys();
+void GetDefaultFontSetting(int i,LOGFONTA *lf,COLORREF *colour);
+int CLUI_OnSkinLoad(WPARAM wParam, LPARAM lParam);
+HRESULT CluiLoadModule();
+HRESULT PreLoadContactListModule();
+HRESULT ClcLoadModule();
+HRESULT ToolbarLoadModule();
+HRESULT ToolbarButtonLoadModule();
+
+// INTERFACES
+
+void cliCheckCacheItem(pdisplayNameCacheEntry pdnce);
+void cliFreeCacheItem( pdisplayNameCacheEntry p );
+void cliRebuildEntireList(HWND hwnd,struct ClcData *dat);
+void cliRecalcScrollBar(HWND hwnd,struct ClcData *dat);
+void CLUI_cliOnCreateClc(void);
+int cli_AddItemToGroup(struct ClcGroup *group, int iAboveItem);
+int cli_AddInfoItemToGroup(struct ClcGroup *group,int flags,const TCHAR *pszText);
+int cliGetGroupContentsCount(struct ClcGroup *group, int visibleOnly);
+int cliFindRowByText(HWND hwnd, struct ClcData *dat, const TCHAR *text, int prefixOk);
+int cliGetRowsPriorTo(struct ClcGroup *group,struct ClcGroup *subgroup,int contactIndex);
+int cli_IconFromStatusMode(const char *szProto,int nStatus, HANDLE hContact);
+int cli_RemoveEvent(HANDLE hContact, HANDLE hDbEvent);
+void cli_AddContactToTree(HWND hwnd,struct ClcData *dat,HANDLE hContact,int updateTotalCount,int checkHideOffline);
+void cli_DeleteItemFromTree(HWND hwnd, HANDLE hItem);
+void cli_FreeContact( struct ClcContact* );
+void cli_FreeGroup( struct ClcGroup* );
+char* cli_GetGroupCountsText(struct ClcData *dat, struct ClcContact *contact);
+void cli_ChangeContactIcon(HANDLE hContact,int iIcon,int add);
+LRESULT cli_ProcessExternalMessages(HWND hwnd,struct ClcData *dat,UINT msg,WPARAM wParam,LPARAM lParam);
+struct CListEvent* cliCreateEvent( void );
+struct CListEvent* cli_AddEvent(CLISTEVENT *cle);
+LRESULT CALLBACK cli_ContactListControlWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam);
+int cliShowHide(WPARAM wParam,LPARAM lParam);
+BOOL CLUI__cliInvalidateRect(HWND hWnd, CONST RECT* lpRect,BOOL bErase );
+int cliCompareContacts(const struct ClcContact *contact1,const struct ClcContact *contact2);
+int cliFindItem(HWND hwnd,struct ClcData *dat,HANDLE hItem,struct ClcContact **contact,struct ClcGroup **subgroup,int *isVisible);
+void cliTrayIconUpdateBase(const char *szChangedProto);
+void cliCluiProtocolStatusChanged(int status,const char * proto);
+HMENU cliBuildGroupPopupMenu(struct ClcGroup *group);
+void cliInvalidateDisplayNameCacheEntry(HANDLE hContact);
+void cliCheckCacheItem(pdisplayNameCacheEntry pdnce);
+void cli_SaveStateAndRebuildList(HWND hwnd, struct ClcData *dat);
+void CLUI_cli_LoadCluiGlobalOpts(void);
+INT_PTR cli_TrayIconProcessMessage(WPARAM wParam,LPARAM lParam);
+BOOL CLUI__cliInvalidateRect(HWND hWnd, CONST RECT* lpRect,BOOL bErase );
+
+struct ClcContact* cliCreateClcContact( void );
+ClcCacheEntryBase* cliCreateCacheItem(HANDLE hContact);
+ClcCacheEntryBase* cliGetCacheEntry(HANDLE hContact);
+
+// FUNCTION POINTERS
+extern BOOL (WINAPI *g_proc_UpdateLayeredWindow)(HWND,HDC,POINT*,SIZE*,HDC,POINT*,COLORREF,BLENDFUNCTION*,DWORD);
+extern BOOL (WINAPI *g_proc_SetLayeredWindowAttributesNew)(HWND,COLORREF,BYTE,DWORD);
+
+#define WM_DWMCOMPOSITIONCHANGED 0x031E
+
+#define DWM_BB_ENABLE 0x00000001
+#define DWM_BB_BLURREGION 0x00000002
+#define DWM_BB_TRANSITIONONMAXIMIZED 0x00000004
+struct DWM_BLURBEHIND
+{
+ DWORD dwFlags;
+ BOOL fEnable;
+ HRGN hRgnBlur;
+ BOOL fTransitionOnMaximized;
+};
+extern HRESULT (WINAPI *g_proc_DWMEnableBlurBehindWindow)(HWND hWnd, DWM_BLURBEHIND *pBlurBehind);
+
+extern tPaintCallbackProc CLCPaint_PaintCallbackProc(HWND hWnd, HDC hDC, RECT * rcPaint, HRGN rgn, DWORD dFlags, void * CallBackData);
+extern BOOL (WINAPI *MySetProcessWorkingSetSize)(HANDLE,SIZE_T,SIZE_T);
+
+/* SkinEngine.c */
+
+
+BYTE SkinDBGetContactSettingByte(HANDLE hContact, const char* szSection, const char*szKey, BYTE bDefault);
+
+extern OVERLAYICONINFO g_pAvatarOverlayIcons[ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE + 1];
+extern OVERLAYICONINFO g_pStatusOverlayIcons[ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE + 1];
+
+
+#endif
diff --git a/plugins/Modernb/hdr/modern_defsettings.h b/plugins/Modernb/hdr/modern_defsettings.h
new file mode 100644
index 0000000000..7298a8b4e8
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_defsettings.h
@@ -0,0 +1,285 @@
+/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2007 Artem Shpynov
+Copyright 2000-2008 Miranda ICQ/IM project,
+
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+/////////////////////////////////////////////////////////////////////////
+/// This file contains default settings value predefinitions
+//////////////////////////////////////////////////////////////////////////
+
+#pragma once
+
+#undef CLCDEFAULT_GROUPINDENT
+#undef CLCDEFAULT_SHOWIDLE
+#undef CLCDEFAULT_TEXTCOLOUR
+#undef CLCDEFAULT_SELBKCOLOUR
+#undef SETTING_ONTOP_DEFAULT
+#undef SETTING_TRAY1CLICK_DEFAULT
+
+#define SETTING_ENABLESKINEDITOR_DEFAULT 0 //"ModernData", "EnableSkinEditor"
+#define SETTING_TOOLWINDOW_DEFAULT 1 //"CList","ToolWindow"
+#define SETTING_ONTOP_DEFAULT 0 //"CList","OnTop"
+#define SETTING_MIN2TRAY_DEFAULT 1 //"CList","Min2Tray"
+#define SETTING_TRAY1CLICK_DEFAULT 1 //"CList","Tray1Click"
+#define SETTING_HIDEOFFLINE_DEFAULT 0 //"CList", "HideOffline"
+#define SETTING_HIDEEMPTYGROUPS_DEFAULT 0 //"CList","HideEmptyGroups"
+#define SETTING_USEGROUPS_DEFAULT 1 //"CList","UseGroups"
+#define SETTING_PLACEOFFLINETOROOT_DEFAULT 0 //"CList","PlaceOfflineToRoot"
+#define SETTING_ALWAYSPRIMARY_DEFAULT 0 //! "CList","AlwaysPrimary"
+#define SETTING_DISABLETRAYFLASH_DEFAULT 0 //! "CList","DisableTrayFlash"
+#define SETTING_ICONFLASHTIME_DEFAULT 550 //! "CList","IconFlashTime"
+#define SETTING_THINBORDER_DEFAULT 0 //! "CList","ThinBorder"
+#define SETTING_NOBORDER_DEFAULT 0 //! "CList","NoBorder"
+#define SETTING_WINDOWSHADOW_DEFAULT 0 //! "CList","WindowShadow"
+#define SETTING_ONDESKTOP_DEFAULT 0 //! "CList","OnDesktop"
+#define SETTING_DISABLEWORKINGSET_DEFAULT 1 //! "CList","DisableWorkingSet"
+#define SETTING_NOICONBLINF_DEFAULT 0 //! "CList","NoIconBlink"
+#define SETTING_ALWAYSVISICON_DEFAULT 0 //! "CList","AlwaysShowAlwaysVisIcon"
+
+#define SETTING_SHOWMAINMENU_DEFAULT 1 //"CLUI","ShowMainMenu"
+#define SETTING_SHOWCAPTION_DEFAULT 1 //"CLUI","ShowCaption"
+#define SETTING_CLIENTDRAG_DEFAULT 1 //"CLUI","ClientAreaDrag"
+#define SETTING_SHOWSBAR_DEFAULT 1 //! "CLUI","ShowSBar"
+#define SETTING_SBARPERPROTO_DEFAULT 0 //! "CLUI","SBarPerProto"
+#define SETTING_USECONNECTINGICON_DEFAULT 1 //! "CLUI","UseConnectingIcon"
+#define SETTING_SHOWXSTATUS_DEFAULT 6 //! "CLUI","ShowXStatus"
+#define SETTING_SHOWUNREADEMAILS_DEFAULT 0 //! "CLUI","ShowUnreadEmails"
+#define SETTING_SBARSHOW_DEFAULT 3 //! "CLUI","SBarShow"
+#define SETTING_SBARACCOUNTISCUSTOM_DEFAULT 0 //! "CLUI","AccountIsCustom"
+#define SETTING_SBARHIDEACCOUNT_DEFAULT 0 //! "CLUI","HideAccount"
+#define SETTING_SBARRIGHTCLK_DEFAULT 0 //! "CLUI","SBarRightClk"
+#define SETTING_EQUALSECTIONS_DEFAULT 0 //! "CLUI","EqualSections"
+#define SETTING_LEFTOFFSET_DEFAULT 0 //! "CLUI","LeftOffset"
+#define SETTING_RIGHTOFFSET_DEFAULT 0 //! "CLUI","RightOffset
+#define SETTING_TOPOFFSET_DEFAULT 0 //! "CLUI","TopOffset"
+#define SETTING_BOTTOMOFFSET_DEFAULT 0 //! "CLUI","BottomOffset
+#define SETTING_SPACEBETWEEN_DEFAULT 0 //! "CLUI","SpaceBetween"
+#define SETTING_ALIGN_DEFAULT 0 //! "CLUI","Align"
+#define SETTING_VALIGN_DEFAULT 1 //! "CLUI","VAlign"
+#define SETTING_PADDINGLEFT_DEFAULT 0 //! "CLUI","PaddingLeft_*"
+#define SETTING_PADDINGRIGHT_DEFAULT 0 //! "CLUI","PaddingRight_*"
+#define SETTING_DRAGTOSCROLL_DEFAULT 0 //! "CLUI","DragToScroll"
+#define SETTING_AUTOSIZE_DEFAULT 0 //! "CLUI","AutoSize"
+#define SETTING_LOCKSIZE_DEFAULT 0 //! "CLUI","LockSize"
+#define SETTING_MINHEIGTH_DEFAULT 0 //! "CLUI","MinHeight"
+#define SETTING_MINWIDTH_DEFAULT 18 //! "CLUI","MinWidth"
+#define SETTING_MAXSIZEHEIGHT_DEFAULT 75 //! "CLUI","MaxSizeHeight"
+#define SETTING_MINSIZEHEIGHT_DEFAULT 10 //! "CLUI","MinSizeHeight"
+#define SETTING_AUTOSIZEUPWARD_DEFAULT 0 //! "CLUI","AutoSizeUpward"
+#define SETTING_SNAPTOEDGES_DEFAULT 1 //! "CLUI","SnapToEdges"
+#define SETTING_DOCKTOSIDES_DEFAULT 1 //! "CLUI","DockToSides",
+
+#define SETTING_PROTOSPERLINE_DEFAULT 0 //! "CLUI","StatusBarProtosPerLine"
+#define SETTING_TEXTEFFECTID_DEFAULT 0xFF //! "StatusBar","TextEffectID"
+#define SETTING_TEXTEFFECTCOLOR1_DEFAULT 0 //! "StatusBar","TextEffectColor1"
+#define SETTING_TEXTEFFECTCOLOR2_DEFAULT 0 //! "StatusBar","TextEffectColor2"
+#define SETTING_SBHILIGHTMODE_DEFAULT 0 //! "StatusBar","HiLightMode"
+#define SETTING_HIDETOOLTIPTIME_DEFAULT 5000 //! "CLUIFrames","HideToolTipTime"
+
+#define SETTING_EXTRA_ICON_EMAIL_DEFAULT 0 //!
+#define SETTING_EXTRA_ICON_PROTO_DEFAULT 0 //!
+#define SETTING_EXTRA_ICON_SMS_DEFAULT 0 //!
+#define SETTING_EXTRA_ICON_ADV1_DEFAULT 1 //!
+#define SETTING_EXTRA_ICON_ADV2_DEFAULT 1 //!
+#define SETTING_EXTRA_ICON_WEB_DEFAULT 0 //!
+#define SETTING_EXTRA_ICON_CLIENT_DEFAULT 1 //!
+#define SETTING_EXTRA_ICON_VISMODE_DEFAULT 1 //!
+#define SETTING_EXTRA_ICON_ADV3_DEFAULT 1 //!
+#define SETTING_EXTRA_ICON_ADV4_DEFAULT 1 //!
+
+#define SETTING_EXTRACOLUMNSPACE_DEFAULT 18 //! "CLUI","ExtraColumnSpace"
+
+#define SETTING_HIDEBEHIND_DEFAULT 0 //! "ModernData","HideBehind" //(0-none, 1-leftedge, 2-rightedge)
+#define SETTING_BEHINDEDGE_DEFAULT 0 //! "ModernData", "BehindEdge"
+#define SETTING_SHOWDELAY_DEFAULT 3 //! "ModernData","ShowDelay"
+#define SETTING_HIDEDELAY_DEFAULT 3 //! "ModernData","HideDelay"
+#define SETTING_HIDEBEHINDBORDERSIZE_DEFAULT 0 //! "ModernData","HideBehindBorderSize"
+#define SETTING_AEROGLASS_DEFAULT 1 //! "ModernData","AeroGlass"
+
+#define SETTING_ROUNDCORNERS_DEFAULT 0 //! "CLC","RoundCorners"
+#define SETTING_GAPFRAMES_DEFAULT 1 //! "CLUIFrames","GapBetweenFrames"
+#define SETTING_GAPTITLEBAR_DEFAULT 1 //! "CLUIFrames","GapBetweenTitleBar"
+#define SETTING_LEFTCLIENTMARIGN_DEFAULT 0 //! "CLUI","LeftClientMargin"
+#define SETTING_RIGHTCLIENTMARIGN_DEFAULT 0 //! "CLUI","RightClientMargin"
+#define SETTING_TOPCLIENTMARIGN_DEFAULT 0 //! "CLUI","TopClientMargin"
+#define SETTING_BOTTOMCLIENTMARIGN_DEFAULT 0 //! "CLUI","BottomClientMargin"
+#define SETTING_KEYCOLOR_DEFAULT RGB(255,0,255) //! "ModernSettings","KeyColor"
+#define SETTING_LINEUNDERMENU_DEFAULT 0 //! "CLUI","LineUnderMenu"
+#define SETTING_SHOWONSTART_DEFAULT 0 //! "CList","ShowOnStart"
+#define SETTING_AUTOSIZE_DEFAULT 0 //! "CLUI","AutoSize"
+
+#define SETTING_INTERNALAWAYMSGREQUEST_DEFAULT 1 //"ModernData","InternalAwayMsgDiscovery"
+#define SETTING_REMOVEAWAYMSGFOROFFLINE_DEFAULT 1 //"ModernData","RemoveAwayMessageForOffline"
+#define SETTING_METAAVOIDDBLCLICK_DEFAULT 1 //"CLC","MetaDoubleClick"
+#define SETTING_METAIGNOREEMPTYEXTRA_DEFAULT 1 //"CLC","MetaIgnoreEmptyExtra"
+#define SETTING_METAHIDEEXTRA_DEFAULT 0 //"CLC","MetaHideExtra"
+#define SETTING_METAEXPANDING_DEFAULT 1 //"CLC","MetaExpanding"
+#define SETTING_METAAVOIDDBLCLICK_DEFAULT 1 //"CLC","MetaDoubleClick"
+#define SETTING_METAHIDEOFFLINESUB_DEFAULT 1 //"CLC","MetaHideOfflineSub"
+#define SETTING_USEMETAICON_DEFAULT 0 //"CLC","Meta"
+#define SETTING_DRAWOVERLAYEDSTATUS_DEFAULT 3 //todo replace by contstants
+
+
+#define SETTING_SORTBY1_DEFAULT SORTBY_RATE //"CList","SortBy1"
+#define SETTING_SORTBY2_DEFAULT SORTBY_NAME //"CList","SortBy2"
+#define SETTING_SORTBY3_DEFAULT SORTBY_STATUS //"CList","SortBy3"
+
+#define SETTING_PLACEOOFLINETOROOT_DEFAULT 0 //"CList","PlaceOfflineToRoot"
+#define SETTING_NOOFFLINEBOTTOM_DEFAULT 0 //"CList","NoOfflineBottom"
+#define SETTING_HIDEOFFLINEATROOT_DEFAULT 0 //"CLC","HideOfflineRoot"
+#define SETTING_HILIGHTMODE_DEFAULT 0 //todo replace by constant //"CLC","HiLightMode"
+
+#define SETTING_DISABLESKIN_DEFAULT 0 //"ModernData","DisableEngine"
+#define SETTING_ENABLELAYERING_DEFAULT 1 //! "ModernData","EnableLayering"
+#define SETTING_COMPACTMODE_DEFAULT 0 //"CLC","CompactMode"
+
+#define SETTING_EVENTAREAMODE_DEFAULT 1 //autohide todo replace by const //"CLUI","EventArea"
+#define SETTING_SHOWEVENTAREAFRAME_DEFAULT 1 //"CLUI","ShowEventArea"
+
+#define SETTING_TRAYOPTION_DEFAULT 15 //show combined icon
+#define SETTING_FADEIN_DEFAULT 0 //"CLUI","FadeInOut"
+
+#define SETTINGS_SHOWBUTTONBAR_DEFAULT 1 //"CLUI","ShowButtonBar"
+//////////////////////////////////////////////////////////////////////////
+// ROW SETTINGS
+#define SETTING_ROWBORDER_DEFAULT 1 //"CList","RowBorder"
+#define SETTING_ROW_ADVANCEDLAYOUT_DEFAULT 0 //"ModernData","UseAdvancedRowLayout"
+#define SETTING_ROW_ROWBORDER_DEFAULT 1 //"CList","RowBorder"
+#define SETTING_VARIABLEROWHEIGHT_DEFAULT 1 //"CList","VariableRowHeight"
+#define SETTING_ALIGNLEFTTOLEFT_DEFAULT 0 //"CList","AlignLeftItemsToLeft"
+#define SETTING_ALIGNRIGHTORIGHT_DEFAULT 1 //"CList","AlignRightItemsToRight"
+#define SETTING_HIDEGROUPSICON_DEFAULT 0 //"CList","HideGroupsIcon"
+#define SETTING_ALIGNGROPCAPTION_DEFAULT 0 //left todo replace by const //"CList","AlignGroupCaptions"
+#define SETTINS_ROWITEMORDER_DEFAULT {ITEM_AVATAR, ITEM_ICON, ITEM_TEXT, ITEM_EXTRA_ICONS, ITEM_CONTACT_TIME}
+
+#define SETTINGS_SHOWAVATARS_DEFAULT 1 //"CList","AvatarsShow"
+#define SETTINGS_AVATARDRAWBORDER_DEFAULT 0 //"CList","AvatarsDrawBorders"
+#define SETTINGS_AVATARBORDERCOLOR_DEFAULT RGB(0,0,0) //"CList","AvatarsBorderColor"
+#define SETTINGS_AVATARROUNDCORNERS_DEFAULT 0 //"CList","AvatarsRoundCorners"
+#define SETTINGS_AVATARUSECUTOMCORNERSIZE_DEFAULT 0 //"CList","AvatarsUseCustomCornerSize"
+#define SETTINGS_AVATARCORNERSIZE_DEFAULT 4 //"CList","AvatarsCustomCornerSize"
+#define SETTINGS_AVATARIGNORESIZEFORROW_DEFAULT 0 //"CList","AvatarsIgnoreSizeForRow"
+#define SETTINGS_AVATARDRAWOVERLAY_DEFAULT 0 //"CList","AvatarsDrawOverlay"
+#define SETTINGS_AVATAROVERLAYTYPE_DEFAULT SETTING_AVATAR_OVERLAY_TYPE_NORMAL
+#define SETTING_AVATARHEIGHT_DEFAULT 24 //"CList","AvatarsSize"
+#define SETTING_AVATARWIDTH_DEFAULT 24 //"CList","AvatarsWidth"
+#define SETTINGS_AVATARINSEPARATE_DEFAULT 0 //"CList","AvatarsInSeparateWnd",
+
+
+
+#define SETTING_HIDEICONONAVATAR_DEFAULT 0 //"CList","IconHideOnAvatar"
+#define SETTING_ICONONAVATARPLACE_DEFAULT 0 //"CList","IconDrawOnAvatarSpace"
+#define SETTING_ICONIGNORESIZE_DEFAULT 0 //"CList","IconIgnoreSizeForRownHeight"
+#define SETTING_SHOWTIME_DEFAULT 0 //"CList","ContactTimeShow"
+#define SETTING_SHOWTIMEIFDIFF_DEFAULT 1 //"CList","ContactTimeShowOnlyIfDifferent"
+
+#define SETTING_TEXT_RTL_DEFAULT 0 //"CList","TextRTL"
+#define SETTING_TEXT_RIGHTALIGN_DEFAULT 0 //"CList","TextAlignToRight"
+#define SETTING_TEXT_SMILEY_DEFAULT 1 //"CList","TextReplaceSmileys"
+#define SETTING_TEXT_RESIZESMILEY_DEFAULT 1 //"CList","TextResizeSmileys"
+#define SETTING_TEXT_PROTOSMILEY_DEFAULT 1 //"CList","TextUseProtocolSmileys"
+#define SETTING_TEXT_IGNORESIZE_DEFAULT 0 //"CList","TextIgnoreSizeForRownHeight"
+
+#define SETTING_FIRSTLINE_SMILEYS_DEFAULT 1 //"CList","FirstLineDrawSmileys"
+#define SETTING_FIRSTLINE_APPENDNICK_DEFAULT 0 //"CList","FirstLineAppendNick"
+#define SETTING_FIRSTLINE_TRIMTEXT_DEFAULT 1 //"CList","TrimText"
+
+#define SETTING_SECONDLINE_SHOW_DEFAULT 1 //"CList","SecondLineShow"
+#define SETTING_SECONDLINE_TOPSPACE_DEFAULT 2 //"CList","SecondLineTopSpace"
+#define SETTING_SECONDLINE_SMILEYS_DEFAULT 1 //"CList","SecondLineDrawSmileys"
+#define SETTING_SECONDLINE_TYPE_DEFAULT TEXT_STATUS_MESSAGE //"CList","SecondLineType"
+#define SETTING_SECONDLINE_XSTATUS_DEFAULT 1 //"CList","SecondLineXStatusHasPriority"
+#define SETTING_SECONDLINE_XSTATUSNAMETEXT_DEFAULT 0 //"CList","SecondLineUseNameAndMessageForXStatus"
+#define SETTING_SECONDLINE_STATUSIFNOAWAY_DEFAULT 1 //"CList","SecondLineShowStatusIfNoAway"
+#define SETTING_SECONDLINE_LISTENINGIFNOAWAY_DEFAULT 1 //"CList","SecondLineShowListeningIfNoAway"
+
+#define SETTING_THIRDLINE_SHOW_DEFAULT 0 //"CList","ThirdLineShow"
+#define SETTING_THIRDLINE_TOPSPACE_DEFAULT 2 //"CList","ThirdLineTopSpace"
+#define SETTING_THIRDLINE_SMILEYS_DEFAULT 0 //"CList","ThirdLineDrawSmileys"
+#define SETTING_THIRDLINE_TYPE_DEFAULT TEXT_STATUS_MESSAGE //"CList","ThirdLineType"
+#define SETTING_THIRDLINE_XSTATUS_DEFAULT 1 //"ThirdLineXStatusHasPriority"
+#define SETTING_THIRDLINE_XSTATUSNAMETEXT_DEFAULT 0 //"ThirdLineUseNameAndMessageForXStatus"
+#define SETTING_THIRDLINE_STATUSIFNOAWAY_DEFAULT 0 //"CList","ThirdLineShowStatusIfNoAway"
+#define SETTING_THIRDLINE_LISTENINGIFNOAWAY_DEFAULT 0 //"ThirdLineShowListeningIfNoAway"
+
+
+#define SETTING_TRANSPARENT_DEFAULT 0 //"CList","Transparent"
+#define SETTING_AUTOALPHA_DEFAULT 150 //"CList","AutoAlpha"
+#define SETTING_CONFIRMDELETE_DEFAULT 1 //"CList","ConfirmDelete"
+#define SETTING_AUTOHIDE_DEFAULT 0 //"CList","AutoHide"
+#define SETTING_HIDETIME_DEFAULT 30 //"CList","HideTime"
+#define SETTING_CYCLETIME_DEFAULT 4 //"CList","CycleTime"
+#define SETTING_TRAYICON_DEFAULT SETTING_TRAYICON_SINGLE //"CList","TrayIcon"
+#define SETTING_ALWAYSSTATUS_DEFAULT 0 //"CList","AlwaysStatus"
+#define SETTING_ALWAYSMULTI_DEFAULT 0 //"CList","AlwaysMulti"
+
+#define SETTING_BLENDINACTIVESTATE_DEFAULT 0 //"CLC","BlendInActiveState"
+#define SETTING_BLEND25_DEFAULT 1 //NOT USED
+
+#define CLCDEFAULT_EXSTYLE (CLS_EX_EDITLABELS|CLS_EX_TRACKSELECT|CLS_EX_SHOWGROUPCOUNTS|CLS_EX_HIDECOUNTSWHENEMPTY|CLS_EX_TRACKSELECT|CLS_EX_NOTRANSLUCENTSEL) //plus CLS_EX_NOSMOOTHSCROLL is got from the system
+#define CLCDEFAULT_SCROLLTIME 150 //"CLC","ScrollTime"
+#define CLCDEFAULT_GROUPINDENT 20 //"CLC","SubIndent"
+#define CLCDEFAULT_BKCOLOUR GetSysColor(COLOR_3DFACE)
+#define CLCDEFAULT_USEBITMAP 0 //"StatusBar","UseBitmap"
+#define CLCDEFAULT_BKBMPUSE CLB_STRETCH //"StatusBar","BkBmpUse"
+#define CLCDEFAULT_OFFLINEMODES MODEF_OFFLINE //"CLC","OfflineModes"
+#define CLCDEFAULT_GREYOUTFLAGS 0 //"CLC","GreyoutFlags"
+#define CLCDEFAULT_FULLGREYOUTFLAGS (MODEF_OFFLINE|PF2_INVISIBLE|GREYF_UNFOCUS)
+#define CLCDEFAULT_SELBKCOLOUR RGB(100,100,100) //GetSysColor(COLOR_HIGHLIGHT)
+
+
+#define CLCDEFAULT_TEXTCOLOUR (g_CluiData.fDisableSkinEngine?GetSysColor(COLOR_WINDOWTEXT):RGB(0,0,0))
+#define CLCDEFAULT_MODERN_SELTEXTCOLOUR (g_CluiData.fDisableSkinEngine?GetSysColor(COLOR_HIGHLIGHTTEXT):RGB(0,0,128))
+#define CLCDEFAULT_MODERN_HOTTEXTCOLOUR (g_CluiData.fDisableSkinEngine?(IsWinVer98Plus()?CLCDEFAULT_MODERN_SELTEXTCOLOUR:GetSysColor(COLOR_HOTLIGHT)):RGB(0,0,255))
+#define CLCDEFAULT_MODERN_QUICKSEARCHCOLOUR RGB(255,255,0)
+#define CLCDEFAULT_LEFTMARGIN 0 //"CLC","LeftMargin"
+#define CLCDEFAULT_RIGHTMARGIN 2 //"CLC","RightMargin"
+#define CLCDEFAULT_GAMMACORRECT 1 //"CLC","GammaCorrect"
+#define CLCDEFAULT_SHOWIDLE 1 //"CLC","ShowIdle"
+#define CLCDEFAULT_NOVSCROLL 0 //"CLC","NoVScrollBar"
+#define CLCDEFAULT_INFOTIPTIME 750 //"! "CLC","InfoTipHoverTime"
+#define CLCDEFAULT_COLLICONTOLEFT 0 //"! "FrameTitleBar","AlignCOLLIconToLeft"
+
+#define SKIN_OFFSET_TOP_DEFAULT 0 //! "ModernSkin","SizeMarginOffset_Top"
+#define SKIN_OFFSET_BOTTOM_DEFAULT 0 //! "ModernSkin","SizeMarginOffset_Bottom"
+#define SKIN_OFFSET_LEFT_DEFAULT 0 //! "ModernSkin","SizeMarginOffset_Left"
+#define SKIN_OFFSET_RIGHT_DEFAULT 0 //! "ModernSkin","SizeMarginOffset_Right"
+#define SKIN_SPACEBEFOREGROUP_DEFAULT 0 //! "ModernSkin","SpaceBeforeGroup"
+
+
+
+
+
+
+
+#define SETTINGS_BARBTNWIDTH_DEFAULT 22 //"ModernToolBar", "option_Bar0_BtnWidth"
+#define SETTINGS_BARBTNHEIGHT_DEFAULT 22 //"ModernToolBar", "option_Bar0_BtnHeight"
+#define SETTINGS_BARBTNSPACE_DEFAULT 0 //"ModernToolBar", "option_Bar0_BtnSpace"
+#define SETTINGS_BARAUTOSIZE_DEFAULT 1 //"ModernToolBar", "option_Bar0_Autosize"
+#define SETTINGS_BARMULTILINE_DEFAULT 1 //"ModernToolBar", "option_Bar0_Multiline"
+
+#define SETTING_ENABLESOUNDS_DEFAULT 1 // !"Skin", "UseSound",
+
+
+
+
diff --git a/plugins/Modernb/hdr/modern_effectenum.h b/plugins/Modernb/hdr/modern_effectenum.h
new file mode 100644
index 0000000000..e3c5600dc6
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_effectenum.h
@@ -0,0 +1,93 @@
+#pragma once
+
+typedef signed char sbyte;
+typedef struct _MODERNEFFECTMATRIX
+{
+ sbyte matrix[25];
+ BYTE topEffect;
+ BYTE leftEffect;
+ BYTE rightEffect;
+ BYTE bottomEffect;
+ BYTE cycleCount; //low 7 bits
+}MODERNEFFECTMATRIX;
+
+typedef struct _MODERNEFFECT
+{
+ BYTE EffectID;
+ MODERNEFFECTMATRIX EffectMatrix;
+ DWORD EffectColor1;
+ DWORD EffectColor2;
+}MODERNEFFECT;
+
+#ifdef _EFFECTENUM_FULL_H
+ TCHAR * ModernEffectNames[]=
+#else
+ TCHAR * _ModernEffectNames[]=
+#endif
+{
+ _T("Shadow at left"),
+ _T("Shadow at right"),
+ _T("Outline"),
+ _T("Outline smooth"),
+ _T("Smooth bump"),
+ _T("Contour thin"),
+ _T("Contour heavy"),
+};
+
+#ifdef _EFFECTENUM_FULL_H
+MODERNEFFECTMATRIX ModernEffectsEnum[]={
+ { //Shadow at Left
+ { 0, 0, 0, 0, 0,
+ 0, 4, 16, 4, 4,
+ 0, 16, 64, 32, 16,
+ 0, 4, 32, 32, 16,
+ 0, 4, 16, 16, 16 }, 2,2,2,2,1},
+ { //Shadow at Right
+ { 0, 0, 0, 0, 0,
+ 4, 4, 16, 4, 0,
+ 16, 32, 64, 16, 0,
+ 16, 32, 32, 4, 0,
+ 16, 16, 16, 4, 0 }, 2,2,2,2,1},
+ { //Outline
+ { 0, 0, 0, 0, 0,
+ 0, 16, 16, 16, 0,
+ 0, 16, 32, 16, 0,
+ 0, 16, 16, 16, 0,
+ 0, 0, 0, 0, 0 }, 1,1,1,1,1},
+
+ { //Outline smooth
+ { 4, 4, 4, 4, 4,
+ 4, 8, 8, 8, 4,
+ 4, 8, 32, 8, 4,
+ 4, 8, 8, 8, 4,
+ 4, 4, 4, 4, 4 }, 2,2,2,2,1},
+
+ { //Smooth bump
+ { -2, 2, 2, 2, 2,
+ -2, -16, 16, 16, 2,
+ -2, -16, 48, 16, 2,
+ -2, -16,-16, 16, 2,
+ -2, -2, -2, -2, -2 }, 2,2,2,2,1+0x80},
+ { //Contour thin
+ { 0, 0, 0, 0, 0,
+ 0, 48, 64, 48, 0,
+ 0, 64, 64, 64, 0,
+ 0, 48, 64, 48, 0,
+ 0, 0, 0, 0, 0 }, 1,1,1,1,1},
+ { //Contour heavy
+ { 8, 16, 16, 16, 8,
+ 16, 64, 64, 64, 16,
+ 16, 64, 64, 64, 16,
+ 16, 64, 64, 64, 16,
+ 8, 16, 16, 16, 8 }, 2,2,2,2,1},
+
+};
+#endif
+#ifdef _EFFECTENUM_FULL_H
+ #define MAXPREDEFINEDEFFECTS sizeof(ModernEffectNames)/sizeof(ModernEffectNames[0])
+#else
+ #define MAXPREDEFINEDEFFECTS sizeof(_ModernEffectNames)/sizeof(_ModernEffectNames[0])
+ extern TCHAR * ModernEffectNames[];
+#endif
+extern BOOL SkinEngine_ResetTextEffect(HDC);
+extern BOOL SkinEngine_SelectTextEffect(HDC hdc, BYTE EffectID, DWORD FirstColor, DWORD SecondColor); \ No newline at end of file
diff --git a/plugins/Modernb/hdr/modern_gettextasync.h b/plugins/Modernb/hdr/modern_gettextasync.h
new file mode 100644
index 0000000000..881e2b738d
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_gettextasync.h
@@ -0,0 +1,5 @@
+#pragma once
+void InitCacheAsync();
+void UninitCacheAsync();
+void gtaRenewText(HANDLE hContact);
+int gtaAddRequest(struct ClcData *dat,struct ClcContact *contact,HANDLE hContact); \ No newline at end of file
diff --git a/plugins/Modernb/hdr/modern_global_structure.h b/plugins/Modernb/hdr/modern_global_structure.h
new file mode 100644
index 0000000000..3ee93c7385
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_global_structure.h
@@ -0,0 +1,93 @@
+#pragma once
+
+#ifndef modern_global_structure_h__
+#define modern_global_structure_h__
+
+typedef struct tagCLUIDATA
+{
+ /************************************
+ ** Global variables **
+ ************************************/
+
+ /* NotifyArea menu */
+ HMENU hMenuNotify;
+ WORD wNextMenuID;
+ int iIconNotify;
+ BOOL bEventAreaEnabled;
+ BOOL bNotifyActive;
+ DWORD dwFlags;
+ TCHAR * szNoEvents;
+ int hIconNotify;
+ HANDLE hUpdateContact;
+
+ /* Contact List View Mode */
+ TCHAR groupFilter[2048];
+ char protoFilter[2048];
+ char varFilter[2048];
+ DWORD lastMsgFilter;
+ char current_viewmode[256], old_viewmode[256];
+ BYTE boldHideOffline;
+ BYTE bOldUseGroups;
+ DWORD statusMaskFilter;
+ DWORD stickyMaskFilter;
+ DWORD filterFlags;
+ DWORD bFilterEffective;
+ BOOL bMetaAvail;
+ DWORD t_now;
+
+ // Modern Global Variables
+ BOOL fDisableSkinEngine;
+ BOOL fOnDesktop;
+ BOOL fSmoothAnimation;
+ BOOL fLayered;
+ BOOL fDocked;
+ BOOL fGDIPlusFail;
+ BOOL fSortNoOfflineBottom;
+ BOOL fAutoSize;
+ BOOL fAeroGlass;
+ HRGN hAeroGlassRgn;
+
+ BOOL mutexPreventDockMoving;
+ BOOL mutexOnEdgeSizing;
+ BOOL mutexPaintLock;
+
+ BYTE bCurrentAlpha;
+ BYTE bSTATE;
+ BYTE bBehindEdgeSettings;
+ BYTE bSortByOrder[3];
+
+ signed char nBehindEdgeState;
+
+ DWORD dwKeyColor;
+
+ HWND hwndEventFrame;
+
+ int LeftClientMargin;
+ int RightClientMargin;
+ int TopClientMargin;
+ int BottomClientMargin;
+
+ BOOL bInternalAwayMsgDiscovery;
+ BOOL bRemoveAwayMessageForOffline;
+
+ //hEventHandles
+
+ HANDLE hEventExtraImageListRebuilding;
+ HANDLE hEventExtraImageApplying;
+ HANDLE hEventExtraClick;
+ HANDLE hEventBkgrChanged;
+ HANDLE hEventPreBuildTrayMenu;
+ HANDLE hEventPreBuildFrameMenu;
+ HANDLE hEventPreBuildGroupMenu;
+ HANDLE hEventPreBuildSubGroupMenu;
+ HANDLE hEventStatusBarShowToolTip;
+ HANDLE hEventStatusBarHideToolTip;
+ HANDLE hEventToolBarModuleLoaded;
+ HANDLE hEventSkinServicesCreated;
+
+ int nGapBetweenTitlebar;
+} CLUIDATA;
+
+EXTERN_C CLUIDATA g_CluiData;
+
+#endif // modern_global_structure_h__
diff --git a/plugins/Modernb/hdr/modern_image_array.h b/plugins/Modernb/hdr/modern_image_array.h
new file mode 100644
index 0000000000..130c51ce95
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_image_array.h
@@ -0,0 +1,104 @@
+/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2008 Miranda ICQ/IM project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+Created by Pescuma
+
+*/
+
+#pragma once
+
+#ifndef __IMAGE_ARRAY_H__
+# define __IMAGE_ARRAY_H__
+
+#include <windows.h>
+
+
+typedef struct _IMAGE_ARRAY_DATA_NODE
+{
+ int width;
+ int height;
+}
+IMAGE_ARRAY_DATA_NODE;
+
+typedef struct _IMAGE_ARRAY_DATA
+{
+ // Configuration
+ BOOL width_based;
+ int grow_step;
+ HDC hdc;
+
+ // Img data
+ HBITMAP img;
+ int width;
+ int height;
+ void * lpBits;
+
+ // CS
+ CRITICAL_SECTION cs;
+
+ // Array
+ IMAGE_ARRAY_DATA_NODE *nodes;
+ int nodes_size;
+ int nodes_allocated_size;
+}
+IMAGE_ARRAY_DATA, *LP_IMAGE_ARRAY_DATA;
+
+
+// Initialize data
+void ImageArray_Initialize(LP_IMAGE_ARRAY_DATA iad, BOOL width_based, int grow_step);
+
+// Free data but keep config
+void ImageArray_Clear(LP_IMAGE_ARRAY_DATA iad);
+
+// Free data
+// If keep_bitmap is TRUE, doesn't delete de bitmap and return its handle. Else, return NULL
+HBITMAP ImageArray_Free(LP_IMAGE_ARRAY_DATA iad, BOOL keep_bitmap);
+
+// Add image to the list (return the index of the image or -1 on error)
+// If pos == -1, add to the end of the list
+int ImageArray_AddImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos);
+
+// Change an image in the list (return TRUE on success)
+BOOL ImageArray_ChangeImage(LP_IMAGE_ARRAY_DATA iad, HBITMAP hBmp, int pos);
+
+// Remove an image
+BOOL ImageArray_RemoveImage(LP_IMAGE_ARRAY_DATA iad, int pos);
+
+// Draw an image
+BOOL ImageArray_DrawImage(LP_IMAGE_ARRAY_DATA iad, int pos, HDC hdcDest, int nXDest, int nYDest, BYTE Alpha);
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+#endif // __IMAGE_ARRAY_H__
diff --git a/plugins/Modernb/hdr/modern_layered_window_engine.h b/plugins/Modernb/hdr/modern_layered_window_engine.h
new file mode 100644
index 0000000000..918bfabf37
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_layered_window_engine.h
@@ -0,0 +1,51 @@
+#pragma once
+#include "../m_api/m_skin_eng.h"
+
+// typedef int (/*__stdcall*/ *tPaintCallbackProc)(HWND hWnd, HDC hDC, RECT * rcPaint, HRGN rgnUpdate, DWORD dFlags, void * CallBackData);
+
+class CLayeredWindowEngine
+{
+private:
+ /*class CLweInfo
+ {
+ HWND hWnd;
+ HRGN hInvalidRgn;
+ };
+ */
+ //typedef std::map<HWND, CLweInfo> WndInfos;
+
+ enum { state_invalid, state_normal };
+
+ //WndInfos m_infos;
+ DWORD m_hValidatorThread;
+ CRITICAL_SECTION m_cs;
+ int m_state;
+ volatile bool m_invalid;
+
+public:
+ CLayeredWindowEngine(void);
+ ~CLayeredWindowEngine(void);
+
+ void _init();
+ void _deinit();
+
+ void lock() { EnterCriticalSection( &m_cs ); }
+ void unlock() { LeaveCriticalSection( &m_cs ); }
+
+ int get_state();
+
+public:
+ static void __cdecl LweValidatorProc();
+
+ void LweValidatorProcWorker();
+
+ void LweValidatorWorker();
+ int LweInvalidateRect( HWND hWnd, const RECT * rect, BOOL bErase );
+ // int LweValidateWindowRect( HWND hWnd, RECT * rect );
+ // int RegisterWindow( HWND hwnd, tPaintCallbackProc pPaintCallBackProc );
+
+};
+
+extern CLayeredWindowEngine _lwe;
+
+#define _InvalidateRect _lwe.LweInvalidateRect \ No newline at end of file
diff --git a/plugins/Modernb/hdr/modern_log.h b/plugins/Modernb/hdr/modern_log.h
new file mode 100644
index 0000000000..0696c280bd
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_log.h
@@ -0,0 +1,27 @@
+#pragma once
+
+#ifndef __LOG_H__
+# define __LOG_H__
+
+#ifdef _DEBUG_LOG
+
+void Log(const char *file,int line,const char *fmt,...);
+#define logg() Log(__FILE__,__LINE__,"")
+#define log0(s) Log(__FILE__,__LINE__,s)
+#define log1(s,a) Log(__FILE__,__LINE__,s,a)
+#define log2(s,a,b) Log(__FILE__,__LINE__,s,a,b)
+#define log3(s,a,b,c) Log(__FILE__,__LINE__,s,a,b,c)
+#define log4(s,a,b,c,d) Log(__FILE__,__LINE__,s,a,b,c,d)
+
+#else
+
+#define logg()
+#define log0(s)
+#define log1(s,a)
+#define log2(s,a,b)
+#define log3(s,a,b,c)
+#define log4(s,a,b,c,d)
+
+#endif
+
+#endif // __LOG_H__ \ No newline at end of file
diff --git a/plugins/Modernb/hdr/modern_popup.h b/plugins/Modernb/hdr/modern_popup.h
new file mode 100644
index 0000000000..d333ab1e36
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_popup.h
@@ -0,0 +1,48 @@
+/*
+Copyright (C) 2005 Ricardo Pescuma Domenecci
+
+This is free software; you can redistribute it and/or
+modify it under the terms of the GNU Library General Public
+License as published by the Free Software Foundation; either
+version 2 of the License, or (at your option) any later version.
+
+This is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+Library General Public License for more details.
+
+You should have received a copy of the GNU Library General Public
+License along with this file; see the file license.txt. If
+not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+Boston, MA 02111-1307, USA.
+*/
+
+#pragma once
+
+#ifndef __POPUP_H__
+# define __POPUP_H__
+
+#include <m_popup.h>
+
+extern BOOL EnablePopups;
+
+
+#define POPUP_TYPE_NORMAL 0
+#define POPUP_TYPE_TEST 1
+#define POPUP_TYPE_ERROR 2
+
+// Show an popup
+void ShowPopup(const char *title, const char *description, int type);
+
+// Show an error popup
+void ShowErrPopup(const char *title, const char *description);
+
+// Show an trace popup
+void ShowTracePopup(const char *text);
+
+
+
+
+
+
+#endif // __POPUP_H__
diff --git a/plugins/Modernb/hdr/modern_row.h b/plugins/Modernb/hdr/modern_row.h
new file mode 100644
index 0000000000..47b9582c29
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_row.h
@@ -0,0 +1,86 @@
+#ifndef modern_row_h__
+#define modern_row_h__
+
+#pragma once
+
+
+// Types of cells
+#define TC_TEXT1 1
+#define TC_TEXT2 2
+#define TC_TEXT3 3
+#define TC_STATUS 4
+#define TC_AVATAR 5
+#define TC_EXTRA 6
+#define TC_EXTRA1 7
+#define TC_EXTRA2 8
+#define TC_EXTRA3 9
+#define TC_EXTRA4 10
+#define TC_EXTRA5 11
+#define TC_EXTRA6 12
+#define TC_EXTRA7 13
+#define TC_EXTRA8 14
+#define TC_EXTRA9 15
+#define TC_TIME 16
+#define TC_SPACE 17
+#define TC_FIXED 18
+
+
+#define TC_ELEMENTSCOUNT 18
+
+// Containers
+#define TC_ROOT 50
+#define TC_ROW 51
+#define TC_COL 52
+#define TC_FLOAT 53
+
+// Alignes
+#define TC_LEFT 0
+#define TC_HCENTER 100
+#define TC_RIGHT 101
+
+#define TC_TOP 0
+#define TC_VCENTER 102
+#define TC_BOTTOM 103
+
+// Sizes
+#define TC_WIDTH 104
+#define TC_HEIGHT 105
+
+
+
+// Ñòðóêòóðà, îïèñûâàþùàÿ êîíòåéíåð ýëåìåíòà êîíòàêòà
+//
+typedef struct tagRowCell
+{
+ int cont; // Òèï êîíòåéíåðà - êîíòàêò, ñòîðîêà, ñòîëáåö
+ int type; // Òèï ýëåìåíòà, ñîäåðæàùåãîñÿ â êîíòåéíåðå, åñëè 0 - ïóñòîé êîíòåéíåð
+ int halign; // Ãîðèçîíòàëüíîå âûðàâíèâàíèå âíóòðè êîíòåéíåðà
+ int valign; // Âåðòèêàëüíîå âûðàâíèâàíèå âíóòðè êîíòåéíåðà
+
+ int w; // Øèðèíà ýëåìåíòà êîíòàêòà, äëÿ òåêñòîâûõ ïîëåé èãíîðèðóåòñÿ
+ int h; // Âûñîòà ýëåìåíòà êîòíàêòà
+
+ BOOL sizing; // Ïàðàìåòð, ïîêàçûâàþùèé íàëè÷èå òåêñòîâûõ ïîëåé â äî÷åðíèõ êîíòåéíåðàõ
+ BOOL layer; // Ïàðàìåòð, ïîêàçûâàþùèé, ÷òî êîíòåéíåð îáðàçóåò íîâûé ñëîé
+
+ BOOL hasfixed; // Ïàðàìåòð ïîêàçûâàþùèé ÷òî åñòü âëîæåííûå ôèêñèðîâàííûå ýëåìåíòû
+ BOOL fitwidth; // Ïàðàìåòð óêàçûâàþùèé ÷òî ïîñëåäíèé ýëåìåíò çàïîëíÿåò âñå îñòàâøååñÿ
+ // Ïðîñòðàíñòâî (ðàññòÿãèâàåò ðîäèòåëÿ.îâåðëåé)
+
+ int fixed_width;
+ int full_width;
+
+ RECT r; // Ïðÿìîóãîëüíèê äëÿ ðèñîâàíèÿ ýëåìåíòà
+ struct tagRowCell * next; // Ïîëå ñâÿçè
+ struct tagRowCell * child; // Ïîëå ñâÿçè ñì. ôàéë îïèñàíèÿ
+} ROWCELL, *pROWCELL;
+
+// Ñòðóêòóðà äëÿ äîñòóïà ê êîíòåéíåðàì ýëåìåíòà êîíòàêòà âíóòðè äåðåâà îïèâàíèÿ
+#ifndef _CPPCODE
+ int cppCalculateRowHeight(ROWCELL *RowRoot);
+ void cppCalculateRowItemsPos(ROWCELL *RowRoot, int width);
+ ROWCELL *cppInitModernRow(ROWCELL ** tabAccess);
+ void cppDeleteTree(ROWCELL * RowRoot);
+#endif
+
+#endif // modern_row_h__ \ No newline at end of file
diff --git a/plugins/Modernb/hdr/modern_rowheight_funcs.h b/plugins/Modernb/hdr/modern_rowheight_funcs.h
new file mode 100644
index 0000000000..57223cf3c0
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_rowheight_funcs.h
@@ -0,0 +1,70 @@
+/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2008 Miranda ICQ/IM project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+
+Created by Pescuma
+
+*/
+
+#pragma once
+
+#ifndef __ROWHEIGHT_FUNCS_H__
+# define __ROWHEIGHT_FUNCS_H__
+
+#include "modern_clc.h"
+
+#define ROW_SPACE_BEETWEEN_LINES 2
+#define ICON_HEIGHT 16
+#define ICON_WIDTH 16
+
+
+
+BOOL RowHeights_Initialize(struct ClcData *dat);
+void RowHeights_Free(struct ClcData *dat);
+void RowHeights_Clear(struct ClcData *dat);
+
+BOOL RowHeights_Alloc(struct ClcData *dat, int size);
+
+// Calc and store max row height
+int RowHeights_GetMaxRowHeight(struct ClcData *dat, HWND hwnd);
+
+// Calc and store row height
+int RowHeights_GetRowHeight(struct ClcData *dat, HWND hwnd, struct ClcContact *contact, int item);
+
+// Calc and store row height for all itens in the list
+void RowHeights_CalcRowHeights(struct ClcData *dat, HWND hwnd);
+
+// Calc item top Y (using stored data)
+int cliGetRowTopY(struct ClcData *dat, int item);
+
+// Calc item bottom Y (using stored data)
+int cliGetRowBottomY(struct ClcData *dat, int item);
+
+// Calc total height of rows (using stored data)
+int cliGetRowTotalHeight(struct ClcData *dat);
+
+// Return the line that pos_y is at or -1 (using stored data). Y start at 0
+int cliRowHitTest(struct ClcData *dat, int pos_y);
+
+// Returns the height of the chosen row
+int cliGetRowHeight(struct ClcData *dat, int item);
+
+#endif // __ROWHEIGHT_FUNCS_H__
diff --git a/plugins/Modernb/hdr/modern_skinengine.h b/plugins/Modernb/hdr/modern_skinengine.h
new file mode 100644
index 0000000000..a2b365b2ba
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_skinengine.h
@@ -0,0 +1,148 @@
+#pragma once
+
+#ifndef ske_H_INC
+#define ske_H_INC
+
+#include "modern_skinselector.h"
+#include "modern_commonprototypes.h"
+
+/* Definitions */
+#define GetAValue(argb)((BYTE)((argb)>>24))
+
+#define DEFAULTSKINSECTION "ModernSkin"
+
+
+
+#define MAX_BUFF_SIZE 255*400
+#define MAXSN_BUFF_SIZE 255*1000
+
+/* External variables */
+
+/* Structs */
+
+typedef struct tagSKINOBJECTSLIST
+{
+ DWORD dwObjLPReserved;
+ DWORD dwObjLPAlocated;
+ char * szSkinPlace;
+ LISTMODERNMASK * pMaskList;
+ SKINOBJECTDESCRIPTOR * pObjects;
+ SortedList * pTextList;
+} SKINOBJECTSLIST;
+
+typedef struct tagGLYPHIMAGE
+{
+ char * szFileName;
+ DWORD dwLoadedTimes;
+ HBITMAP hGlyph;
+ BYTE isSemiTransp;
+} GLYPHIMAGE,*LPGLYPHIMAGE;
+
+typedef struct tagCURRWNDIMAGEDATA
+{
+ HDC hImageDC;
+ HDC hBackDC;
+ HDC hScreenDC;
+ HBITMAP hImageDIB, hImageOld;
+ HBITMAP hBackDIB, hBackOld;
+ BYTE * hImageDIBByte;
+ BYTE * hBackDIBByte;
+ int Width,Height;
+
+}CURRWNDIMAGEDATA;
+
+typedef struct tagEFFECTSSTACKITEM
+{
+ HDC hdc;
+ BYTE EffectID;
+ DWORD FirstColor;
+ DWORD SecondColor;
+} EFFECTSSTACKITEM;
+
+#pragma pack(push, 1)
+/* tga header */
+typedef struct
+{
+ BYTE id_lenght; /* size of image id */
+ BYTE colormap_type; /* 1 is has a colormap */
+ BYTE image_type; /* compression type */
+
+ short cm_first_entry; /* colormap origin */
+ short cm_length; /* colormap length */
+ BYTE cm_size; /* colormap size */
+
+ short x_origin; /* bottom left x coord origin */
+ short y_origin; /* bottom left y coord origin */
+
+ short width; /* picture width (in pixels) */
+ short height; /* picture height (in pixels) */
+
+ BYTE pixel_depth; /* bits per pixel: 8, 16, 24 or 32 */
+ BYTE image_descriptor; /* 24 bits = 0x00; 32 bits = 0x80 */
+
+} tga_header_t;
+#pragma pack(pop)
+
+
+class IniParser
+{
+public:
+ enum { FLAG_WITH_SETTINGS = 0,
+ FLAG_ONLY_OBJECTS = 1,
+ };
+
+ enum { IT_UNKNOWN, IT_FILE, IT_RESOURCE };
+
+ typedef HRESULT (*ParserCallback_t)( const char * szSection, const char * szKey, const char * szValue, IniParser * This );
+
+ IniParser( TCHAR * szFileName, BYTE flags = FLAG_WITH_SETTINGS );
+ IniParser( HINSTANCE hInst, const char * resourceName, const char * resourceType, BYTE flags = FLAG_ONLY_OBJECTS );
+ ~IniParser();
+
+ bool CheckOK() { return _isValid; }
+ HRESULT Parse( ParserCallback_t pLineCallBackProc, LPARAM lParam );
+
+ static HRESULT WriteStrToDb( const char * szSection, const char * szKey, const char * szValue, IniParser * This);
+ static int GetSkinFolder( IN const TCHAR * szFileName, OUT TCHAR * pszFolderName );
+
+private:
+
+ // common
+ enum { MAX_LINE_LEN = 512 };
+ int _eType;
+ bool _isValid;
+ char * _szSection;
+ ParserCallback_t _pLineCallBackProc;
+ BOOL _SecCheck;
+ int _nLine;
+
+ void _DoInit();
+ BOOL _DoParseLine( char * szLine );
+
+ // Processing File
+ HRESULT _DoParseFile();
+ FILE * _hFile;
+
+ // Processing resource
+ void _LoadResourceIni( HINSTANCE hInst, const char * resourceName, const char * resourceType );
+ HRESULT _DoParseResource();
+ const char * _RemoveTailings( const char * szLine, size_t& len );
+
+ HGLOBAL _hGlobalRes;
+ DWORD _dwSizeOfRes;
+ char * _pPosition;
+
+ BYTE _Flags;
+
+
+};
+
+
+int ske_UnloadSkin(SKINOBJECTSLIST * Skin);
+int ske_AddDescriptorToSkinObjectList (LPSKINOBJECTDESCRIPTOR lpDescr, SKINOBJECTSLIST* Skin);
+INT_PTR ske_Service_DrawGlyph(WPARAM wParam,LPARAM lParam);
+
+
+
+#endif
+
diff --git a/plugins/Modernb/hdr/modern_skinned_profile.h b/plugins/Modernb/hdr/modern_skinned_profile.h
new file mode 100644
index 0000000000..95ab85c606
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_skinned_profile.h
@@ -0,0 +1,245 @@
+#ifndef modern_skinned_profile_h__
+#define modern_skinned_profile_h__
+
+//#include "modern_commonheaders.h"
+//#include "modern_commonprototypes.h"
+
+#include <map>
+#include <string>
+//#include <atlstr.h>
+
+class MString
+{
+private:
+ TCHAR * _buffer;
+public:
+ MString() : _buffer( NULL ) {};
+ MString( const TCHAR * str ) { _buffer = str ? _tcsdup( str ) : NULL; }
+ MString( const MString& str ) { _buffer = str._buffer ? _tcsdup( str._buffer ) : NULL; }
+ MString& operator=( const MString& str )
+ {
+ if ( _buffer ) free( _buffer );
+ _buffer = str._buffer ? _tcsdup( str._buffer ) : NULL;
+ }
+ TCHAR* operator()( const MString& str ) { return _buffer; }
+ ~MString()
+ {
+ if ( _buffer )
+ free( _buffer );
+ _buffer = NULL;
+ }
+
+#ifdef _UNICODE
+ MString( const char * str)
+ {
+ if ( !str )
+ _buffer = NULL;
+ else
+ {
+ int cbLen = MultiByteToWideChar( 0, 0, str, -1, NULL, 0 );
+ wchar_t* _buffer = ( wchar_t* )malloc( sizeof( wchar_t )*(cbLen+1));
+ if ( _buffer == NULL ) return;
+ MultiByteToWideChar( 0, 0, str, -1, _buffer, cbLen );
+ _buffer[ cbLen ] = 0;
+ }
+ }
+#endif
+
+};
+
+class CAutoCriticalSection
+{
+public:
+ CAutoCriticalSection() //Init critical section here
+ : _pLinkedCS( NULL )
+ {
+ InitializeCriticalSection( &_CS );
+ _ifCSOwner = true;
+ _ifLocked = false;
+ }
+ CAutoCriticalSection( CAutoCriticalSection& Locker, bool doLock = true )
+ : _pLinkedCS ( &Locker )
+ {
+ _ifCSOwner = false;
+ _ifLocked = false;
+ if ( doLock )
+ Lock();
+ }
+ ~CAutoCriticalSection() // Leave if auto locker, and destroy if not
+ {
+ if ( _ifLocked )
+ Unlock();
+ if ( _ifCSOwner )
+ DeleteCriticalSection( &_CS );
+ }
+
+ void Lock() // Enter Section
+ {
+ if ( _ifLocked ) return;
+ if ( _ifCSOwner ) EnterCriticalSection( &_CS );
+ else _pLinkedCS->Lock();
+ _ifLocked = true;
+ return;
+ }
+ void Unlock() // Leave Section
+ {
+ if ( !_ifLocked ) return;
+ if ( _ifCSOwner ) LeaveCriticalSection( &_CS );
+ else _pLinkedCS->Unlock();
+ _ifLocked = false;
+ }
+
+private:
+ CRITICAL_SECTION _CS;
+ CAutoCriticalSection * _pLinkedCS;
+ bool _ifCSOwner;
+ bool _ifLocked;
+};
+
+class ValueVariant
+{
+public:
+ ValueVariant() : _type( VVT_EMPTY ) {};
+ ValueVariant( BYTE bValue ) : _type( VVT_BYTE ), _bValue( bValue ) {};
+ ValueVariant( WORD wValue ) : _type( VVT_WORD ), _wValue( wValue ) {};
+ ValueVariant( DWORD dwValue ) : _type( VVT_DWORD ), _dwValue( dwValue ) {};
+ ValueVariant( const MString& strValue ) : _type( VVT_STRING ), _strValue( strValue ) {};
+ ValueVariant( const char * szValue ) : _type( VVT_STRING ), _strValue( szValue ) {};
+#ifdef _UNICODE
+ ValueVariant( const wchar_t * szValue ) : _type( VVT_STRING ), _strValue( szValue ) {};
+#endif
+
+ BYTE GetByte()
+ {
+ switch ( _type )
+ {
+ case VVT_BYTE:
+ return ( BYTE ) _bValue;
+ case VVT_WORD:
+ case VVT_DWORD:
+ DebugBreak();
+ return ( BYTE ) _bValue;
+ default:
+ DebugBreak();
+ }
+ return 0;
+ }
+
+ WORD GetWord()
+ {
+ switch ( _type )
+ {
+ case VVT_WORD:
+ return ( WORD ) _wValue;
+
+ case VVT_BYTE:
+ case VVT_DWORD:
+ DebugBreak();
+ return ( WORD ) _wValue;
+ default:
+ DebugBreak();
+ }
+ return 0;
+ }
+
+ DWORD GetDword()
+ {
+ switch ( _type )
+ {
+ case VVT_DWORD:
+ return ( DWORD ) _dwValue;
+
+ case VVT_BYTE:
+ case VVT_WORD:
+ DebugBreak();
+ return ( DWORD ) _dwValue;
+ default:
+ DebugBreak();
+ }
+ return 0;
+ }
+ MString GetString()
+ {
+ switch ( _type )
+ {
+ case VVT_STRING:
+ return _strValue;
+
+ default:
+ DebugBreak();
+ }
+ return "";
+ }
+ const MString& GetStringStatic()
+ {
+ switch ( _type )
+ {
+ case VVT_STRING:
+ return _strValue;
+
+ default:
+ DebugBreak();
+ }
+ return _strValue;
+ }
+ bool IsEmpty() { return _type==VVT_EMPTY; }
+
+private:
+ enum
+ {
+ VVT_EMPTY = 0,
+ VVT_BYTE,
+ VVT_WORD,
+ VVT_DWORD,
+ VVT_STRING
+ };
+ int _type;
+ union
+ {
+ BYTE _bValue;
+ WORD _wValue;
+ DWORD _dwValue;
+ };
+ MString _strValue;
+
+};
+
+// this is single tone class to represent some profile settings to be skinned
+class CSkinnedProfile
+{
+private:
+ static CSkinnedProfile _me;
+ CSkinnedProfile();
+ ~CSkinnedProfile();
+
+private:
+ // Skinned profile holded attributes
+ MString _strSkinFilename;
+ bool _bLoadedFonts;
+ bool _bLoadedOthers;
+
+ typedef std::map<HashStringKeyNoCase, ValueVariant> ValueList_t;
+ typedef std::map<HashStringKeyNoCase, ValueList_t> KeyList_t;
+
+ KeyList_t SkinnedProfile;
+
+ ValueVariant* _GetValue( const char * szSection, const char * szKey );
+
+ CAutoCriticalSection _Lock; // critical section to matable skinned profile access
+
+public:
+ static CSkinnedProfile* SkinProfile() { return &_me; }
+
+ HRESULT Init();
+ HRESULT Clear();
+
+ static BYTE SpiGetSkinByte ( HANDLE hContact, const char * szSection, const char * szKey, const BYTE defValue );
+ static WORD SpiGetSkinWord ( HANDLE hContact, const char * szSection, const char * szKey, const WORD defValue );
+ static DWORD SpiGetSkinDword( HANDLE hContact, const char * szSection, const char * szKey, const DWORD defValue );
+ static BOOL SpiCheckSkinned( HANDLE hContact, const char * szSection, const char * szKey );
+
+};
+
+
+
+#endif // modern_skinned_profile_h__ \ No newline at end of file
diff --git a/plugins/Modernb/hdr/modern_skinselector.h b/plugins/Modernb/hdr/modern_skinselector.h
new file mode 100644
index 0000000000..9509695ad3
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_skinselector.h
@@ -0,0 +1,88 @@
+/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2008 Miranda ICQ/IM project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+#pragma once
+
+#ifndef M_MOD_SKIN_SELECTOR_H_INC
+#define M_MOD_SKIN_SELECTOR_H_INC
+
+#include "newpluginapi.h"
+#include "modern_commonheaders.h"
+
+#define MAXVALUE 20
+
+#define MPF_EQUAL 1
+#define MPF_DIFF 2
+#define MPF_NOT_EQUAL ( MPF_DIFF|MPF_EQUAL )
+#define MPF_HASHED 4
+
+typedef struct tagMASKPARAM
+{
+ DWORD dwId;
+ BYTE bMaskParamFlag;
+ char* szName;
+ DWORD dwValueHash;
+ char* szValue;
+} MASKPARAM;
+
+
+typedef struct tagMODERNMASK
+{
+ MASKPARAM* pl_Params;
+ DWORD dwParamCnt;
+ union
+ {
+ void* pObject;
+ char* szObjectName;
+ };
+ DWORD dwMaskId;
+ BOOL bObjectFound;
+} MODERNMASK;
+
+typedef struct tagLISTMODERNMASK
+{
+ MODERNMASK* pl_Masks;
+ DWORD dwMaskCnt;
+} LISTMODERNMASK;
+
+/// PROTOTYPES
+int AddModernMaskToList(MODERNMASK * mm, LISTMODERNMASK * mmTemplateList);
+int AddStrModernMaskToList(DWORD maskID, char * szStr, char * objectName, LISTMODERNMASK * mmTemplateList, void * pObjectList);
+int SortMaskList(LISTMODERNMASK * mmList);
+
+int DeleteMaskByItID(DWORD mID,LISTMODERNMASK * mmTemplateList);
+int ClearMaskList(LISTMODERNMASK * mmTemplateList);
+int ExchangeMasksByID(DWORD mID1, DWORD mID2, LISTMODERNMASK * mmTemplateList);
+
+int ParseToModernMask(MODERNMASK * mm, char * szText);
+BOOL CompareModernMask(MODERNMASK * mmValue,MODERNMASK * mmTemplate);
+BOOL CompareStrWithModernMask(char * szValue,MODERNMASK * mmTemplate);
+MODERNMASK * FindMaskByStr(char * szValue,LISTMODERNMASK * mmTemplateList);
+DWORD mod_CalcHash(const char * a);
+char * ModernMaskToString(MODERNMASK * mm, char * buf, UINT bufsize);
+BOOL __inline wildcmp(const char * name, const char * mask, BYTE option);
+int RegisterObjectByParce(char * ObjectName, char * Params);
+SKINOBJECTDESCRIPTOR * skin_FindObjectByRequest(char * szValue,LISTMODERNMASK * mmTemplateList);
+SKINOBJECTDESCRIPTOR * skin_FindObjectByMask (MODERNMASK * mm,LISTMODERNMASK * mmTemplateList);
+TCHAR * GetParamNT(char * string, TCHAR * buf, int buflen, BYTE paramN, char Delim, BOOL SkipSpaces);
+int SkinDrawGlyphMask(HDC hdc, RECT * rcSize, RECT * rcClip, MODERNMASK * ModernMask);
+#endif
diff --git a/plugins/Modernb/hdr/modern_static_clui.h b/plugins/Modernb/hdr/modern_static_clui.h
new file mode 100644
index 0000000000..e03008951b
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_static_clui.h
@@ -0,0 +1,251 @@
+/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2008 Miranda ICQ/IM project,
+all portions of this codebase are copyrighted to the people
+
+listed in contributors.txt.
+
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+
+/************************************************************************/
+/** FILE CONTAINS HEADER PART FOR .../modernb/clui.c file **/
+/** **/
+/** !!! DO NOT INCLUDE IN TO OTHER FILES !!! **/
+/************************************************************************/
+
+/* Definitions */
+#pragma once
+
+#define TM_AUTOALPHA 1
+#define TM_DELAYEDSIZING 2
+#define TM_BRINGOUTTIMEOUT 3
+#define TM_BRINGINTIMEOUT 4
+#define TM_UPDATEBRINGTIMER 5
+#define TM_SMOTHALPHATRANSITION 20
+#define TM_WINDOWUPDATE 100
+#define TM_STATUSBARUPDATE 200
+
+
+
+
+#define MS_CLUI_SHOWMAINMENU "CList/ShowMainMenu"
+#define MS_CLUI_SHOWSTATUSMENU "CList/ShowStatusMenu"
+
+#define AC_SRC_NO_PREMULT_ALPHA 0x01
+#define AC_SRC_NO_ALPHA 0x02
+#define AC_DST_NO_PREMULT_ALPHA 0x10
+#define AC_DST_NO_ALPHA 0x20
+
+#define ANIMATION_STEP 40
+
+#define AEROGLASS_MINALPHA 24
+
+/* Declaration of prototypes in other modules */
+
+int ClcUnloadModule();
+int ClcGetShortData(struct ClcData* pData, struct SHORTDATA *pShortData);
+int ClcEnterDragToScroll(HWND hwnd, int Y);
+
+int CListMod_ContactListShutdownProc(WPARAM wParam,LPARAM lParam);
+int CListMod_HideWindow(HWND hwndContactList, int mode);
+
+int CListSettings_GetCopyFromCache(pdisplayNameCacheEntry pDest, DWORD flag);
+int CListSettings_SetToCache(pdisplayNameCacheEntry pSrc, DWORD flag);
+
+int CLUIServices_LoadModule(void);
+INT_PTR CLUIServices_SortList(WPARAM wParam,LPARAM lParam);
+INT_PTR CLUIServices_ProtocolStatusChanged(WPARAM wParam,LPARAM lParam);
+
+void Docking_GetMonitorRectFromWindow(HWND hWnd,RECT *rc);
+
+int EventArea_Create(HWND hCluiWnd);
+
+int ExtraImage_ExtraIDToColumnNum(int extra);
+void ExtraImage_LoadModule();
+void ExtraImage_ReloadExtraIcons();
+void ExtraImage_SetAllExtraIcons(HWND hwndList,HANDLE hContact);
+
+void GroupMenus_Init();
+
+int ModernSkinButtonLoadModule();
+int ModernSkinButton_ReposButtons(HWND parent, BYTE draw,RECT *r);
+
+void ske_ApplyTransluency();
+HBITMAP ske_CreateDIB32(int cx, int cy);
+HBITMAP ske_CreateDIB32Point(int cx, int cy, void ** bits);
+int ske_JustUpdateWindowImage();
+void ske_LoadSkinFromDB(void);
+int ske_RedrawCompleteWindow();
+int ske_UpdateWindowImage();
+int ske_ValidateFrameImageProc(RECT * r);
+
+HWND StatusBar_Create(HWND parent);
+
+void RowHeight_InitModernRow();
+
+int UnhookAll();
+
+
+/* External variables */
+
+
+/* Global variables */
+
+
+HANDLE g_hMainThread=NULL;
+
+DWORD g_dwMainThreadID=0,
+ g_dwAwayMsgThreadID=0,
+ g_dwGetTextAsyncThreadID=0,
+ g_dwSmoothAnimationThreadID=0,
+ g_dwFillFontListThreadID=0;
+
+HMENU g_hMenuMain;
+BOOL g_bTransparentFlag=FALSE;
+
+BOOL g_mutex_bChangingMode=FALSE,
+ g_mutex_bSizing=FALSE;
+
+BOOL g_flag_bOnModulesLoadedCalled=FALSE;
+
+RECT g_rcEdgeSizingRect={0};
+
+BOOL (WINAPI *g_proc_SetLayeredWindowAttributes)(HWND,COLORREF,BYTE,DWORD);
+BOOL (WINAPI *g_proc_SetLayeredWindowAttributesNew)(HWND,COLORREF,BYTE,DWORD);
+BOOL (WINAPI *g_proc_AnimateWindow)(HWND hWnd,DWORD dwTime,DWORD dwFlags);
+
+/* Module function prototypes */
+
+int CLUI_IsInMainWindow(HWND hwnd);
+int CLUI_SizingOnBorder(POINT pt, int size);
+int CLUI_SmoothAlphaTransition(HWND hwnd, BYTE GoalAlpha, BOOL wParam);
+int CLUI_TestCursorOnBorders();
+
+static int CLUI_CreateTimerForConnectingIcon(WPARAM wParam,LPARAM lParam);
+static int CLUI_SmoothAlphaThreadTransition(HWND hwnd);
+
+/* structs */
+
+typedef struct tagPROTOTICKS{
+ int nIconsCount;
+ int nCycleStartTick;
+ char * szProto;
+ int nIndex;
+ BOOL bTimerCreated;
+ BOOL bGlobal;
+ HIMAGELIST himlIconList;
+} PROTOTICKS,*LPPROTOTICKS;
+
+typedef struct tagCHECKFILLING
+{
+ HDC hDC;
+ RECT rcRect;
+} CHECKFILLING;
+
+/* Module global variables */
+
+static BYTE bAlphaEnd;
+static BYTE bOldHideOffline;
+static BYTE bOldUseGroups;
+
+static WORD wBehindEdgeShowDelay,
+ wBehindEdgeHideDelay,
+ wBehindEdgeBorderSize;
+
+static BOOL mutex_bAnimationInProgress=FALSE,
+ mutex_bShowHideCalledFromAnimation=FALSE,
+ mutex_bIgnoreActivation=FALSE,
+ mutex_bDisableAutoUpdate=TRUE,
+ mutex_bDuringSizing=FALSE,
+ mutex_bDelayedSizing=FALSE; //TBC is it need?
+
+static BOOL flag_bFirstTimeCall=FALSE;
+
+static BOOL bTransparentFocus=TRUE,
+ bNeedFixSizingRect=FALSE,
+ bShowEventStarted=FALSE;
+
+static HANDLE hRenameMenuItem,
+ hShowAvatarMenuItem,
+ hHideAvatarMenuItem;
+
+
+static HANDLE hSettingChangedHook=NULL;
+
+static UINT uMsgGetProfile=0;
+
+static int nLastRequiredHeight=0,
+ nRequiredHeight=0,
+ nMirMenuState=0,
+ nStatusMenuState=0;
+
+static RECT rcNewWindowRect={0},
+ rcOldWindowRect ={0},
+ rcSizingRect={0},
+ rcCorrectSizeRect={0};
+
+static HANDLE hFrameContactTree;
+
+static PROTOTICKS CycleStartTick[64]={0};//max 64 protocols
+
+static int nAnimatedIconStep=100;
+
+
+
+int CheckFramesPos(RECT *wr); //cluiframes.c
+int CLUIFrames_ApplyNewSizes(int mode); //cluiframes.c
+int CLUIFrames_GetTotalHeight(); //cluiframes.c
+int CLUIFrames_RepaintSubContainers(); //cluiframes.c
+int CLUIFramesGetMinHeight(); //cluiframes.c
+
+int SizeFramesByWindowRect(RECT *r, HDWP * PosBatch, int mode); //cluiframes.c
+
+int InitSkinHotKeys();
+BOOL amWakeThread();
+BOOL gtaWakeThread();
+void CreateViewModeFrame();
+
+HIMAGELIST hAvatarOverlays=NULL;
+
+OVERLAYICONINFO g_pAvatarOverlayIcons[ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE + 1] =
+{
+ { "AVATAR_OVERLAY_OFFLINE", LPGEN("Offline"), IDI_AVATAR_OVERLAY_OFFLINE, -1},
+ { "AVATAR_OVERLAY_ONLINE", LPGEN("Online"), IDI_AVATAR_OVERLAY_ONLINE, -1},
+ { "AVATAR_OVERLAY_AWAY", LPGEN("Away"), IDI_AVATAR_OVERLAY_AWAY, -1},
+ { "AVATAR_OVERLAY_DND", LPGEN("DND"), IDI_AVATAR_OVERLAY_DND, -1},
+ { "AVATAR_OVERLAY_NA", LPGEN("NA"), IDI_AVATAR_OVERLAY_NA, -1},
+ { "AVATAR_OVERLAY_OCCUPIED", LPGEN("Occupied"), IDI_AVATAR_OVERLAY_OCCUPIED, -1},
+ { "AVATAR_OVERLAY_CHAT", LPGEN("Free for chat"), IDI_AVATAR_OVERLAY_CHAT, -1},
+ { "AVATAR_OVERLAY_INVISIBLE", LPGEN("Invisible"), IDI_AVATAR_OVERLAY_INVISIBLE, -1},
+ { "AVATAR_OVERLAY_PHONE", LPGEN("On the phone"), IDI_AVATAR_OVERLAY_PHONE, -1},
+ { "AVATAR_OVERLAY_LUNCH", LPGEN("Out to lunch"), IDI_AVATAR_OVERLAY_LUNCH, -1}
+};
+OVERLAYICONINFO g_pStatusOverlayIcons[ID_STATUS_OUTTOLUNCH - ID_STATUS_OFFLINE + 1] =
+{
+ { "STATUS_OVERLAY_OFFLINE", LPGEN("Offline"), IDI_STATUS_OVERLAY_OFFLINE, -1},
+ { "STATUS_OVERLAY_ONLINE", LPGEN("Online"), IDI_STATUS_OVERLAY_ONLINE, -1},
+ { "STATUS_OVERLAY_AWAY", LPGEN("Away"), IDI_STATUS_OVERLAY_AWAY, -1},
+ { "STATUS_OVERLAY_DND", LPGEN("DND"), IDI_STATUS_OVERLAY_DND, -1},
+ { "STATUS_OVERLAY_NA", LPGEN("NA"), IDI_STATUS_OVERLAY_NA, -1},
+ { "STATUS_OVERLAY_OCCUPIED", LPGEN("Occupied"), IDI_STATUS_OVERLAY_OCCUPIED, -1},
+ { "STATUS_OVERLAY_CHAT", LPGEN("Free for chat"), IDI_STATUS_OVERLAY_CHAT, -1},
+ { "STATUS_OVERLAY_INVISIBLE", LPGEN("Invisible"), IDI_STATUS_OVERLAY_INVISIBLE, -1},
+ { "STATUS_OVERLAY_PHONE", LPGEN("On the phone"), IDI_STATUS_OVERLAY_PHONE, -1},
+ { "STATUS_OVERLAY_LUNCH", LPGEN("Out to lunch"), IDI_STATUS_OVERLAY_LUNCH, -1}
+};
diff --git a/plugins/Modernb/hdr/modern_static_cluiframes_service.h b/plugins/Modernb/hdr/modern_static_cluiframes_service.h
new file mode 100644
index 0000000000..34403ad8cd
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_static_cluiframes_service.h
@@ -0,0 +1,192 @@
+//////////////////////////////////////////////////////////////////////////
+// WARNING
+//////////////////////////////////////////////////////////////////////////
+// TO BE INCLUDED ONLY TO modern_cluiframes.cpp
+//////////////////////////////////////////////////////////////////////////
+
+static int _us_DoSetFramePaintProc( WPARAM wParam,LPARAM lParam );
+static int _us_DoAddFrame( WPARAM wParam,LPARAM lParam );
+static int _us_DoRemoveFrame( WPARAM wParam,LPARAM lParam );
+static int _us_DoSetFrameOptions( WPARAM wParam,LPARAM lParam );
+static INT_PTR _us_DoGetFrameOptions( WPARAM wParam,LPARAM lParam );
+static int _us_DoUpdateFrame( WPARAM wParam,LPARAM lParam );
+static int _us_DoShowHideFrameTitle( WPARAM wParam,LPARAM lParam );
+static int _us_DoShowTitles( WPARAM wParam,LPARAM lParam );
+static int _us_DoHideTitles( WPARAM wParam,LPARAM lParam );
+static int _us_DoShowHideFrame( WPARAM wParam,LPARAM lParam );
+static int _us_DoShowAllFrames( WPARAM wParam,LPARAM lParam );
+static int _us_DoLockFrame( WPARAM wParam,LPARAM lParam );
+static int _us_DoCollapseFrame( WPARAM wParam,LPARAM lParam );
+static int _us_DoSetFrameBorder( WPARAM wParam,LPARAM lParam );
+static int _us_DoSetFrameAlign( WPARAM wParam,LPARAM lParam );
+static int _us_DoMoveFrame( WPARAM wParam,LPARAM lParam );
+static int _us_DoMoveFrameUp( WPARAM wParam,LPARAM lParam );
+static int _us_DoMoveFrameDown( WPARAM wParam,LPARAM lParam );
+static int _us_DoAlignFrameTop( WPARAM wParam,LPARAM lParam );
+static int _us_DoAlignFrameClient( WPARAM wParam,LPARAM lParam );
+static int _us_DoAlignFrameBottom( WPARAM wParam,LPARAM lParam );
+static int _us_DoSetFrameFloat( WPARAM wParam,LPARAM lParam );
+
+enum {
+ CFM_FIRST_MGS= WM_USER + 0x2FF,
+
+ CFM_SETFRAMEPAINTPROC,
+ CFM_ADDFRAME,
+ CFM_REMOVEFRAME,
+ CFM_SETFRAMEOPTIONS,
+ CFM_GETFRAMEOPTIONS,
+ CFM_UPDATEFRAME,
+ CFM_SHOWHIDEFRAMETITLE,
+ CFM_SHOWTITLES,
+ CFM_HIDETITLES,
+ CFM_SHOWHIDEFRAME,
+ CFM_SHOWALL,
+ CFM_LOCKFRAME,
+ CFM_COLLAPSEFRAME,
+ CFM_SETFRAMEBORDER,
+ CFM_SETFRAMEALIGN,
+ CFM_MOVEFRAME,
+ CFM_MOVEFRAMEUP,
+ CFM_MOVEFRAMEDOWN,
+ CFM_ALIGNFRAMETOP,
+ CFM_ALIGNFRAMEBOTTOM,
+ CFM_ALIGNFRAMECLIENT,
+ CFM_SETFRAMEFLOAT,
+
+ CFM_LAST_MSG
+};
+
+#define CLM_PROCESS( msg, proc ) case msg: result = proc( wParam, lParam); break;
+
+BOOL CALLBACK ProcessCLUIFrameInternalMsg(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam, LRESULT& result )
+{
+ if ( msg <= CFM_FIRST_MGS || msg >= CFM_LAST_MSG ) return FALSE;
+
+ switch ( msg )
+ {
+ CLM_PROCESS( CFM_SETFRAMEPAINTPROC, _us_DoSetFramePaintProc );
+ CLM_PROCESS( CFM_ADDFRAME, _us_DoAddFrame );
+ CLM_PROCESS( CFM_REMOVEFRAME, _us_DoRemoveFrame );
+ CLM_PROCESS( CFM_SETFRAMEOPTIONS, _us_DoSetFrameOptions );
+ CLM_PROCESS( CFM_GETFRAMEOPTIONS, _us_DoGetFrameOptions );
+ CLM_PROCESS( CFM_UPDATEFRAME, _us_DoUpdateFrame );
+ CLM_PROCESS( CFM_SHOWHIDEFRAMETITLE, _us_DoShowHideFrameTitle );
+ CLM_PROCESS( CFM_SHOWTITLES, _us_DoShowTitles );
+ CLM_PROCESS( CFM_HIDETITLES, _us_DoHideTitles );
+ CLM_PROCESS( CFM_SHOWHIDEFRAME, _us_DoShowHideFrame );
+ CLM_PROCESS( CFM_SHOWALL, _us_DoShowAllFrames );
+ CLM_PROCESS( CFM_LOCKFRAME, _us_DoLockFrame );
+ CLM_PROCESS( CFM_COLLAPSEFRAME, _us_DoCollapseFrame );
+ CLM_PROCESS( CFM_SETFRAMEBORDER, _us_DoSetFrameBorder );
+ CLM_PROCESS( CFM_SETFRAMEALIGN, _us_DoSetFrameAlign );
+ CLM_PROCESS( CFM_MOVEFRAME, _us_DoMoveFrame );
+ CLM_PROCESS( CFM_MOVEFRAMEUP, _us_DoMoveFrameUp );
+ CLM_PROCESS( CFM_MOVEFRAMEDOWN, _us_DoMoveFrameDown );
+ CLM_PROCESS( CFM_ALIGNFRAMETOP, _us_DoAlignFrameTop );
+ CLM_PROCESS( CFM_ALIGNFRAMEBOTTOM, _us_DoAlignFrameClient );
+ CLM_PROCESS( CFM_ALIGNFRAMECLIENT, _us_DoAlignFrameBottom );
+ CLM_PROCESS( CFM_SETFRAMEFLOAT, _us_DoSetFrameFloat );
+ default:
+ return FALSE; // Not Handled
+ }
+ return TRUE;
+}
+
+
+static INT_PTR CLUIFrames_SetFramePaintProc( WPARAM wParam,LPARAM lParam )
+{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SETFRAMEPAINTPROC, wParam,lParam ) : 0; }
+
+static INT_PTR CLUIFrames_AddFrame( WPARAM wParam,LPARAM lParam )
+{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_ADDFRAME, wParam, lParam ) : 0; }
+
+static INT_PTR CLUIFrames_RemoveFrame( WPARAM wParam,LPARAM lParam )
+{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_REMOVEFRAME, wParam, lParam ) : 0; }
+
+static INT_PTR CLUIFrames_SetFrameOptions( WPARAM wParam,LPARAM lParam )
+{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SETFRAMEOPTIONS, wParam, lParam ) : 0; }
+
+static INT_PTR CLUIFrames_GetFrameOptions( WPARAM wParam,LPARAM lParam )
+{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_GETFRAMEOPTIONS, wParam, lParam ) : 0; }
+
+static INT_PTR CLUIFrames_UpdateFrame( WPARAM wParam,LPARAM lParam )
+{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_UPDATEFRAME, wParam, lParam ) : 0; }
+
+static INT_PTR CLUIFrames_ShowHideFrameTitle( WPARAM wParam,LPARAM lParam )
+{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SHOWHIDEFRAMETITLE, wParam, lParam ) : 0; }
+
+static INT_PTR CLUIFrames_ShowTitles( WPARAM wParam,LPARAM lParam )
+{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SHOWTITLES, wParam, lParam ) : 0; }
+
+static INT_PTR CLUIFrames_HideTitles( WPARAM wParam,LPARAM lParam )
+{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_HIDETITLES, wParam, lParam ) : 0; }
+
+static INT_PTR CLUIFrames_ShowHideFrame( WPARAM wParam,LPARAM lParam )
+{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SHOWHIDEFRAME, wParam, lParam ) : 0; }
+
+static INT_PTR CLUIFrames_ShowAllFrames( WPARAM wParam,LPARAM lParam )
+{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SHOWALL, wParam, lParam ) : 0; }
+
+static INT_PTR CLUIFrames_LockFrame( WPARAM wParam,LPARAM lParam )
+{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_LOCKFRAME, wParam, lParam ) : 0; }
+
+static INT_PTR CLUIFrames_CollapseFrame( WPARAM wParam,LPARAM lParam )
+{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_COLLAPSEFRAME, wParam, lParam ) : 0; }
+
+static INT_PTR CLUIFrames_SetFrameBorder( WPARAM wParam,LPARAM lParam )
+{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SETFRAMEBORDER, wParam, lParam ) : 0; }
+
+static INT_PTR CLUIFrames_SetFrameAlign( WPARAM wParam,LPARAM lParam )
+{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SETFRAMEALIGN, wParam, lParam ) : 0; }
+
+static INT_PTR CLUIFrames_MoveFrame( WPARAM wParam,LPARAM lParam )
+{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_MOVEFRAME, wParam, lParam ) : 0; }
+
+static INT_PTR CLUIFrames_MoveFrameUp( WPARAM wParam,LPARAM lParam )
+{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_MOVEFRAMEUP, wParam, lParam ) : 0; }
+
+static INT_PTR CLUIFrames_MoveFrameDown( WPARAM wParam,LPARAM lParam )
+{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_MOVEFRAMEDOWN, wParam, lParam ) : 0; }
+
+static INT_PTR CLUIFrames_AlignFrameTop( WPARAM wParam,LPARAM lParam )
+{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_ALIGNFRAMETOP, wParam, lParam ) : 0; }
+
+static INT_PTR CLUIFrames_AlignFrameClient( WPARAM wParam,LPARAM lParam )
+{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_ALIGNFRAMEBOTTOM, wParam, lParam ) : 0; }
+
+static INT_PTR CLUIFrames_AlignFrameBottom( WPARAM wParam,LPARAM lParam )
+{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_ALIGNFRAMECLIENT, wParam, lParam ) : 0; }
+
+static INT_PTR CLUIFrames_SetFrameFloat( WPARAM wParam,LPARAM lParam )
+{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SETFRAMEFLOAT, wParam, lParam ) : 0; }
+
+static void CreateCluiFramesServices()
+{
+ CreateServiceFunction( MS_SKINENG_REGISTERPAINTSUB, CLUIFrames_SetFramePaintProc );
+ CreateServiceFunction( MS_CLIST_FRAMES_ADDFRAME, CLUIFrames_AddFrame );
+ CreateServiceFunction( MS_CLIST_FRAMES_REMOVEFRAME, CLUIFrames_RemoveFrame );
+
+ CreateServiceFunction( MS_CLIST_FRAMES_SETFRAMEOPTIONS, CLUIFrames_SetFrameOptions );
+ CreateServiceFunction( MS_CLIST_FRAMES_GETFRAMEOPTIONS, CLUIFrames_GetFrameOptions );
+ CreateServiceFunction( MS_CLIST_FRAMES_UPDATEFRAME, CLUIFrames_UpdateFrame );
+
+ CreateServiceFunction( MS_CLIST_FRAMES_SHFRAMETITLEBAR, CLUIFrames_ShowHideFrameTitle );
+ CreateServiceFunction( MS_CLIST_FRAMES_SHOWALLFRAMESTB, CLUIFrames_ShowTitles );
+ CreateServiceFunction( MS_CLIST_FRAMES_HIDEALLFRAMESTB, CLUIFrames_HideTitles );
+ CreateServiceFunction( MS_CLIST_FRAMES_SHFRAME, CLUIFrames_ShowHideFrame );
+ CreateServiceFunction( MS_CLIST_FRAMES_SHOWALLFRAMES, CLUIFrames_ShowAllFrames );
+
+ CreateServiceFunction( MS_CLIST_FRAMES_ULFRAME, CLUIFrames_LockFrame );
+ CreateServiceFunction( MS_CLIST_FRAMES_UCOLLFRAME, CLUIFrames_CollapseFrame );
+ CreateServiceFunction( MS_CLIST_FRAMES_SETUNBORDER, CLUIFrames_SetFrameBorder );
+
+ CreateServiceFunction( CLUIFRAMESSETALIGN, CLUIFrames_SetFrameAlign );
+ CreateServiceFunction( CLUIFRAMESMOVEUPDOWN, CLUIFrames_MoveFrame );
+ CreateServiceFunction( CLUIFRAMESMOVEUP, CLUIFrames_MoveFrameUp );
+ CreateServiceFunction( CLUIFRAMESMOVEDOWN, CLUIFrames_MoveFrameDown );
+
+ CreateServiceFunction( CLUIFRAMESSETALIGNALTOP, CLUIFrames_AlignFrameTop );
+ CreateServiceFunction( CLUIFRAMESSETALIGNALCLIENT, CLUIFrames_AlignFrameClient );
+ CreateServiceFunction( CLUIFRAMESSETALIGNALBOTTOM, CLUIFrames_AlignFrameBottom );
+
+ CreateServiceFunction( CLUIFRAMESSETFLOATING, CLUIFrames_SetFrameFloat );
+} \ No newline at end of file
diff --git a/plugins/Modernb/hdr/modern_statusbar.h b/plugins/Modernb/hdr/modern_statusbar.h
new file mode 100644
index 0000000000..65d0ca2e57
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_statusbar.h
@@ -0,0 +1,44 @@
+#pragma once
+
+#ifndef modern_statusbar_h__
+#define modern_statusbar_h__
+
+#include "modern_commonprototypes.h"
+#include "../m_api/m_xpTheme.h"
+
+int ModernDrawStatusBar(HWND hwnd, HDC hDC);
+int ModernDrawStatusBarWorker(HWND hWnd, HDC hDC);
+
+typedef struct tagSTATUSBARDATA
+{
+ BOOL sameWidth;
+ RECT rectBorders;
+ BYTE extraspace;
+ BYTE Align;
+ BYTE VAlign;
+ BYTE showProtoIcon;
+ BYTE showProtoName;
+ BYTE showStatusName;
+ HFONT BarFont;
+ DWORD fontColor;
+ BYTE connectingIcon;
+ BYTE TextEffectID;
+ DWORD TextEffectColor1;
+ DWORD TextEffectColor2;
+ BYTE xStatusMode; // 0-only main, 1-xStatus, 2-main as overlay
+ BYTE nProtosPerLine;
+ BYTE showProtoEmails;
+
+ HBITMAP hBmpBackground;
+ COLORREF bkColour;
+ DWORD backgroundBmpUse;
+ BOOL bkUseWinColors;
+
+ XPTHANDLE hTheme;
+
+ BOOL perProtoConfig;
+ BYTE SBarRightClk;
+
+} STATUSBARDATA;
+
+#endif // modern_statusbar_h__
diff --git a/plugins/Modernb/hdr/modern_statusmodes.h b/plugins/Modernb/hdr/modern_statusmodes.h
new file mode 100644
index 0000000000..f69f97abd9
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_statusmodes.h
@@ -0,0 +1,43 @@
+/*
+
+Miranda IM: the free IM client for Microsoft* Windows*
+
+Copyright 2000-2008 Miranda ICQ/IM project,
+all portions of this codebase are copyrighted to the people
+listed in contributors.txt.
+
+This program is free software; you can redistribute it and/or
+modify it under the terms of the GNU General Public License
+as published by the Free Software Foundation; either version 2
+of the License, or (at your option) any later version.
+
+This program is distributed in the hope that it will be useful,
+but WITHOUT ANY WARRANTY; without even the implied warranty of
+MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+GNU General Public License for more details.
+
+You should have received a copy of the GNU General Public License
+along with this program; if not, write to the Free Software
+Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
+*/
+//add 1 to ID_STATUS_CONNECTING to mark retries (v0.1.0.1+)
+//eg ID_STATUS_CONNECTING+2 is the third connection attempt, or the second retry
+
+#pragma once
+
+#define ID_STATUS_CONNECTING 1
+//max retries is just a marker so that the clist knows what numbers represent
+//retries. It does not set any kind of limit on the number of retries you can
+//and/or should do.
+#define MAX_CONNECT_RETRIES 10000
+#define ID_STATUS_OFFLINE 40071
+#define ID_STATUS_ONLINE 40072
+#define ID_STATUS_AWAY 40073
+#define ID_STATUS_DND 40074
+#define ID_STATUS_NA 40075
+#define ID_STATUS_OCCUPIED 40076
+#define ID_STATUS_FREECHAT 40077
+#define ID_STATUS_INVISIBLE 40078
+#define ID_STATUS_ONTHEPHONE 40079
+#define ID_STATUS_OUTTOLUNCH 40080
+#define ID_STATUS_IDLE 40081 /* do not use as a m_cache_nStatus */
diff --git a/plugins/Modernb/hdr/modern_sync.h b/plugins/Modernb/hdr/modern_sync.h
new file mode 100644
index 0000000000..34686470e5
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_sync.h
@@ -0,0 +1,98 @@
+#ifndef modern_sync_h__
+#define modern_sync_h__
+
+#include "hdr/modern_commonheaders.h"
+
+
+typedef INT_PTR (*PSYNCCALLBACKPROC)(WPARAM,LPARAM);
+
+int SyncCall(void * vproc, int count, ... );
+int SyncCallProxy( PSYNCCALLBACKPROC pfnProc, WPARAM wParam, LPARAM lParam, CRITICAL_SECTION * cs = NULL );
+HRESULT SyncCallWinProcProxy( PSYNCCALLBACKPROC pfnProc, WPARAM wParam, LPARAM lParam, int& nReturn );
+HRESULT SyncCallAPCProxy( PSYNCCALLBACKPROC pfnProc, WPARAM wParam, LPARAM lParam, int& hReturn );
+
+LRESULT SyncOnWndProcCall( WPARAM wParam );
+
+// Experimental sync caller
+
+int DoCall( PSYNCCALLBACKPROC pfnProc, WPARAM wParam, LPARAM lParam );
+
+// Have to be here due to MS Visual C++ does not support 'export' keyword
+
+// 3 params
+
+template<class RET, class A, class B, class C> class PARAMS3
+{
+ typedef RET(*proc_t)(A, B, C);
+ proc_t _proc; A _a; B _b; C _c; RET _ret;
+
+public:
+ PARAMS3( proc_t __proc, A __a, B __b, C __c ): _proc( __proc), _a (__a), _b(__b), _c(__c){};
+ static int DoSyncCall( WPARAM wParam, LPARAM lParam )
+ {
+ PARAMS3 * params = (PARAMS3 *) lParam;
+ params->_ret = params->_proc( params->_a, params->_b, params->_c );
+ return 0;
+ };
+ RET GetResult() { return _ret; }
+};
+
+template< class RET, class Ap, class Bp, class Cp, class A, class B, class C> RET Sync( RET(*proc)(Ap, Bp, Cp), A a, B b, C c )
+{
+ PARAMS3<RET, Ap, Bp, Cp> params( proc, a, b, c );
+ DoCall( (PSYNCCALLBACKPROC) PARAMS3<RET, Ap, Bp, Cp>::DoSyncCall, 0, (LPARAM) &params );
+ return params.GetResult();
+};
+
+
+// 2 params
+
+template<class RET, class A, class B> class PARAMS2
+{
+ typedef RET(*proc_t)(A, B);
+ proc_t _proc; A _a; B _b; RET _ret;
+
+public:
+ PARAMS2( proc_t __proc, A __a, B __b ): _proc( __proc), _a (__a), _b(__b){};
+ static int DoSyncCall( WPARAM wParam, LPARAM lParam )
+ {
+ PARAMS2 * params = (PARAMS2 *) lParam;
+ params->_ret = params->_proc( params->_a, params->_b );
+ return 0;
+ };
+ RET GetResult() { return _ret; }
+};
+
+template< class RET, class Ap, class Bp, class A, class B> RET Sync( RET(*proc)(Ap, Bp), A a, B b )
+{
+ PARAMS2<RET, Ap, Bp> params( proc, a, b );
+ DoCall( (PSYNCCALLBACKPROC) PARAMS2<RET, Ap, Bp>::DoSyncCall, 0, (LPARAM) &params );
+ return params.GetResult();
+};
+
+
+// 1 param
+template<class RET, class A> class PARAMS1
+{
+ typedef RET(*proc_t)(A);
+ proc_t _proc; A _a; RET _ret;
+
+public:
+ PARAMS1( proc_t __proc, A __a): _proc( __proc), _a (__a){};
+ static int DoSyncCall( WPARAM, LPARAM lParam )
+ {
+ PARAMS1 * params = (PARAMS1 *) lParam;
+ params->_ret = params->_proc( params->_a );
+ return 0;
+ };
+ RET GetResult() { return _ret; }
+};
+
+template< class RET, class Ap, class A> RET Sync( RET(*proc)(Ap), A a )
+{
+ PARAMS1<RET, Ap> params( proc, a );
+ DoCall( (PSYNCCALLBACKPROC) PARAMS1<RET, Ap>::DoSyncCall, 0, (LPARAM) &params );
+ return params.GetResult();
+};
+
+#endif // modern_sync_h__ \ No newline at end of file
diff --git a/plugins/Modernb/hdr/modern_tstring.h b/plugins/Modernb/hdr/modern_tstring.h
new file mode 100644
index 0000000000..5bd558c54d
--- /dev/null
+++ b/plugins/Modernb/hdr/modern_tstring.h
@@ -0,0 +1,58 @@
+#ifndef UNICODE //FIXME Build without UNICODE flag
+#define _AtlGetConversionACP() CP_THREAD_ACP
+#endif
+
+#include "MString.h"
+
+#ifdef UNICODE
+typedef CMStringA astring;
+typedef CMStringW wstring;
+
+class mbstring : public astring
+{
+ // It is prohibited to initialize by char* outside, use L"xxx"
+private:
+ mbstring( const char * pChar ) : astring( pChar ) {};
+ mbstring& operator=( const char * pChar ) { this->operator =( pChar ); return *this; }
+
+public:
+ mbstring() : astring() {};
+ mbstring( const mbstring& uStr ) : astring( uStr ) {};
+
+
+ mbstring( const wstring& tStr ) { *this = tStr.c_str(); }
+ mbstring& operator=( const wstring& tStr ) { this->operator =( tStr.c_str() ); return *this; }
+
+ mbstring( const wchar_t * wChar );
+ mbstring& operator=( const astring& aStr );
+ mbstring& operator=( const wchar_t * wChar );
+ operator wstring();
+ operator astring();
+};
+
+
+class tstring : public wstring
+{
+public:
+ tstring() : wstring() {};
+ tstring(const wchar_t * pwChar) : wstring( pwChar ) {};
+
+
+ tstring(const astring& aStr) { *this = aStr.c_str(); }
+ tstring(const mbstring& utfStr) { *this = utfStr; }
+
+ tstring(const char * pChar);
+ tstring& operator=( const char * pChar );
+ tstring& operator=( const astring& aStr );
+ tstring& operator=( const mbstring& uStr );
+ operator astring();
+ operator mbstring() { return mbstring( this->c_str() ); }
+};
+
+#else
+typedef CMStringA astring;
+typedef CMStringA wstring;
+typedef CMStringA tstring;
+typedef CMStringA mbstring;
+
+#endif