summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2015-06-03 19:39:19 +0000
committerGeorge Hazan <george.hazan@gmail.com>2015-06-03 19:39:19 +0000
commit7f0572d75b8e2814ef6117c9ab6c13bdfc2571b0 (patch)
tree05bb7fcb4e86be60a49142000917452b8dd426ba
parent17c113eeb4cf4a2a96f2bc73dbd86ce290e9d9e7 (diff)
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@13983 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
-rw-r--r--plugins/FloatingContacts/src/filedrop.cpp296
-rw-r--r--plugins/FloatingContacts/src/filedrop.h2
-rw-r--r--plugins/FloatingContacts/src/main.cpp211
-rw-r--r--plugins/FloatingContacts/src/options.cpp60
-rw-r--r--plugins/FloatingContacts/src/thumbs.cpp332
5 files changed, 417 insertions, 484 deletions
diff --git a/plugins/FloatingContacts/src/filedrop.cpp b/plugins/FloatingContacts/src/filedrop.cpp
index f53edeba5b..38f688381e 100644
--- a/plugins/FloatingContacts/src/filedrop.cpp
+++ b/plugins/FloatingContacts/src/filedrop.cpp
@@ -1,29 +1,28 @@
#include "stdhdr.h"
-static void ProcessDroppedItems ( char **ppDroppedItems, int nCount, char **ppFiles );
-static int CountDroppedFiles ( char **ppDroppedItems, int nCount );
-static BOOL OnDropFiles ( HDROP hDrop, ThumbInfo *pThumb );
+static void ProcessDroppedItems(char **ppDroppedItems, int nCount, char **ppFiles);
+static int CountDroppedFiles(char **ppDroppedItems, int nCount);
+static BOOL OnDropFiles(HDROP hDrop, ThumbInfo *pThumb);
-HRESULT STDMETHODCALLTYPE CDropTarget::QueryInterface(REFIID riid,LPVOID *ppvObj)
+HRESULT STDMETHODCALLTYPE CDropTarget::QueryInterface(REFIID riid, LPVOID *ppvObj)
{
- if ( IsEqualIID( riid, IID_IDropTarget ))
- {
+ if (IsEqualIID(riid, IID_IDropTarget)) {
*ppvObj = this;
this->AddRef();
return S_OK;
}
-
+
*ppvObj = NULL;
- return ( E_NOINTERFACE );
+ return (E_NOINTERFACE);
}
-ULONG STDMETHODCALLTYPE CDropTarget::AddRef( )
+ULONG STDMETHODCALLTYPE CDropTarget::AddRef()
{
return ++this->refCount;
}
-ULONG STDMETHODCALLTYPE CDropTarget::Release( )
+ULONG STDMETHODCALLTYPE CDropTarget::Release()
{
int res = --this->refCount;
if (!res) delete this;
@@ -31,215 +30,190 @@ ULONG STDMETHODCALLTYPE CDropTarget::Release( )
}
-HRESULT STDMETHODCALLTYPE CDropTarget::DragOver( DWORD fKeyState, POINTL pt, DWORD *pdwEffect )
+HRESULT STDMETHODCALLTYPE CDropTarget::DragOver(DWORD fKeyState, POINTL pt, DWORD *pdwEffect)
{
*pdwEffect = 0;
-
- if ( hwndCurDrag == NULL )
- {
+
+ if (hwndCurDrag == NULL) {
*pdwEffect = DROPEFFECT_NONE;
}
- else
- {
+ else {
*pdwEffect |= DROPEFFECT_COPY;
}
return S_OK;
}
-HRESULT STDMETHODCALLTYPE CDropTarget::DragEnter( IDataObject *pData, DWORD fKeyState, POINTL pt, DWORD *pdwEffect)
+HRESULT STDMETHODCALLTYPE CDropTarget::DragEnter(IDataObject *pData, DWORD fKeyState, POINTL pt, DWORD *pdwEffect)
{
- FORMATETC feFile = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
- FORMATETC feText = { CF_TEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
+ FORMATETC feFile = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
+ FORMATETC feText = { CF_TEXT, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
- if ( S_OK == pData->QueryGetData( &feFile ) ||
- S_OK == pData->QueryGetData( &feText ))
- {
+ if (S_OK == pData->QueryGetData(&feFile) ||
+ S_OK == pData->QueryGetData(&feText)) {
POINT shortPt;
- shortPt.x = pt.x;
+ shortPt.x = pt.x;
shortPt.y = pt.y;
-
- HWND hwnd = WindowFromPoint( shortPt );
-
+
+ HWND hwnd = WindowFromPoint(shortPt);
+
ThumbInfo *pThumb = thumbList.FindThumb(hwnd);
- if (pThumb)
- {
+ if (pThumb) {
hwndCurDrag = hwnd;
- pThumb->ThumbSelect( TRUE );
+ pThumb->ThumbSelect(TRUE);
}
}
- return DragOver( fKeyState, pt, pdwEffect);
+ return DragOver(fKeyState, pt, pdwEffect);
}
-HRESULT STDMETHODCALLTYPE CDropTarget::DragLeave( )
+HRESULT STDMETHODCALLTYPE CDropTarget::DragLeave()
{
- ThumbInfo *pThumb = thumbList.FindThumb( hwndCurDrag );
+ ThumbInfo *pThumb = thumbList.FindThumb(hwndCurDrag);
- if ( NULL != pThumb )
- {
- pThumb->ThumbDeselect( TRUE );
+ if (NULL != pThumb) {
+ pThumb->ThumbDeselect(TRUE);
}
hwndCurDrag = NULL;
-
+
return S_OK;
}
-HRESULT STDMETHODCALLTYPE CDropTarget::Drop( IDataObject *pData,DWORD fKeyState,POINTL pt,DWORD *pdwEffect)
+HRESULT STDMETHODCALLTYPE CDropTarget::Drop(IDataObject *pData, DWORD fKeyState, POINTL pt, DWORD *pdwEffect)
{
FORMATETC fe = { CF_HDROP, NULL, DVASPECT_CONTENT, -1, TYMED_HGLOBAL };
*pdwEffect = DROPEFFECT_NONE;
-
+
if (hwndCurDrag == NULL)
return S_OK;
- ThumbInfo *pThumb = (ThumbInfo*) GetWindowLongPtr( hwndCurDrag, GWLP_USERDATA );
+ ThumbInfo *pThumb = (ThumbInfo*)GetWindowLongPtr(hwndCurDrag, GWLP_USERDATA);
if (pThumb == NULL)
return S_OK;
STGMEDIUM stg;
bool bFormatText = false;
- if ( S_OK != pData->GetData(&fe,&stg))
- {
+ if (S_OK != pData->GetData(&fe, &stg)) {
fe.cfFormat = CF_UNICODETEXT;
- if ( S_OK != pData->GetData(&fe,&stg))
- {
+ if (S_OK != pData->GetData(&fe, &stg)) {
return S_OK;
}
- else
- {
+ else {
bFormatText = true;
}
}
-
- if (!bFormatText)
- {
- HDROP hDrop = (HDROP) stg.hGlobal;
- if (hDrop != NULL)
- {
+
+ if (!bFormatText) {
+ HDROP hDrop = (HDROP)stg.hGlobal;
+ if (hDrop != NULL) {
OnDropFiles(hDrop, pThumb);
}
}
- else
- {
- TCHAR *pText = (TCHAR*) GlobalLock(stg.hGlobal);
- if (pText != NULL)
- {
+ else {
+ TCHAR *pText = (TCHAR*)GlobalLock(stg.hGlobal);
+ if (pText != NULL) {
SendMsgDialog(hwndCurDrag, pText);
GlobalUnlock(stg.hGlobal);
}
}
- if (stg.pUnkForRelease != NULL)
- {
+ if (stg.pUnkForRelease != NULL) {
stg.pUnkForRelease->Release();
}
- else
- {
+ else {
GlobalFree(stg.hGlobal);
}
DragLeave();
-
+
return S_OK;
}
///////////////////////////////////////////////////////
// Send files processing
-BOOL OnDropFiles( HDROP hDrop, ThumbInfo *pThumb )
+BOOL OnDropFiles(HDROP hDrop, ThumbInfo *pThumb)
{
- UINT nDroppedItemsCount = DragQueryFile( hDrop, 0xFFFFFFFF, NULL, 0);
+ UINT nDroppedItemsCount = DragQueryFile(hDrop, 0xFFFFFFFF, NULL, 0);
- char **ppDroppedItems = ( char** )malloc( sizeof(char*)*( nDroppedItemsCount + 1));
-
- if ( ppDroppedItems == NULL )
- {
+ char **ppDroppedItems = (char**)malloc(sizeof(char*)*(nDroppedItemsCount + 1));
+
+ if (ppDroppedItems == NULL) {
return FALSE;
}
- ppDroppedItems[ nDroppedItemsCount ] = NULL;
-
+ ppDroppedItems[nDroppedItemsCount] = NULL;
+
char szFilename[MAX_PATH];
- for (UINT iItem = 0; iItem < nDroppedItemsCount; ++iItem )
- {
- DragQueryFileA( hDrop, iItem, szFilename, sizeof( szFilename ));
- ppDroppedItems[ iItem ] = _strdup( szFilename );
+ for (UINT iItem = 0; iItem < nDroppedItemsCount; ++iItem) {
+ DragQueryFileA(hDrop, iItem, szFilename, sizeof(szFilename));
+ ppDroppedItems[iItem] = _strdup(szFilename);
}
-
- UINT nFilesCount = CountDroppedFiles( ppDroppedItems, nDroppedItemsCount );
-
- char **ppFiles = ( char** )malloc( sizeof( char *)* ( nFilesCount+1));
-
+
+ UINT nFilesCount = CountDroppedFiles(ppDroppedItems, nDroppedItemsCount);
+
+ char **ppFiles = (char**)malloc(sizeof(char *)* (nFilesCount + 1));
+
BOOL bSuccess = FALSE;
- if (ppFiles != NULL)
- {
+ if (ppFiles != NULL) {
ppFiles[nFilesCount] = NULL;
ProcessDroppedItems(ppDroppedItems, nDroppedItemsCount, ppFiles);
- bSuccess = (BOOL)CallService(MS_CLIST_CONTACTFILESDROPPED, (WPARAM)pThumb->hContact, (LPARAM)ppFiles);
+ bSuccess = (BOOL)CallService(MS_CLIST_CONTACTFILESDROPPED, (WPARAM)pThumb->hContact, (LPARAM)ppFiles);
- for (UINT iItem = 0; iItem < nFilesCount ; ++iItem )
+ for (UINT iItem = 0; iItem < nFilesCount; ++iItem)
free(ppFiles[iItem]);
free(ppFiles);
}
// Cleanup
- for (UINT iItem = 0; ppDroppedItems[ iItem ]; ++iItem )
- {
- free( ppDroppedItems[ iItem ] );
+ for (UINT iItem = 0; ppDroppedItems[iItem]; ++iItem) {
+ free(ppDroppedItems[iItem]);
}
- free( ppDroppedItems );
+ free(ppDroppedItems);
return bSuccess;
}
-static int CountFiles( char *szItem )
+static int CountFiles(char *szItem)
{
int nCount = 0;
WIN32_FIND_DATAA fd;
-
- HANDLE hFind = FindFirstFileA( szItem, &fd );
-
- if ( hFind != INVALID_HANDLE_VALUE )
- {
- do
- {
- if ( fd.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY )
- {
+
+ HANDLE hFind = FindFirstFileA(szItem, &fd);
+
+ if (hFind != INVALID_HANDLE_VALUE) {
+ do {
+ if (fd.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY) {
// Skip parent directories
- if (( 0 != mir_strcmp( fd.cFileName, "." )) &&
- ( 0 != mir_strcmp( fd.cFileName, ".." )) )
- {
+ if ((0 != mir_strcmp(fd.cFileName, ".")) &&
+ (0 != mir_strcmp(fd.cFileName, ".."))) {
char szDirName[MAX_PATH];
- strncpy( szDirName, szItem, MAX_PATH - 1);
+ strncpy(szDirName, szItem, MAX_PATH - 1);
- if ( NULL != strstr( szItem, "*.*" ))
- {
- size_t offset = mir_strlen( szDirName ) - 3;
- mir_snprintf(szDirName + offset, SIZEOF( szDirName) - offset, "%s\0", fd.cFileName);
+ if (NULL != strstr(szItem, "*.*")) {
+ size_t offset = mir_strlen(szDirName) - 3;
+ mir_snprintf(szDirName + offset, SIZEOF(szDirName) - offset, "%s\0", fd.cFileName);
}
-
+
++nCount;
- mir_strcat( szDirName, "\\*.*" );
- nCount += CountFiles( szDirName );
+ mir_strcat(szDirName, "\\*.*");
+ nCount += CountFiles(szDirName);
}
}
- else
- {
+ else {
++nCount;
}
- }
- while( FALSE != FindNextFileA( hFind, &fd ));
+ } while (FALSE != FindNextFileA(hFind, &fd));
}
return nCount;
@@ -247,78 +221,67 @@ static int CountFiles( char *szItem )
-static void SaveFiles( char *szItem, char **ppFiles, int *pnCount )
+static void SaveFiles(char *szItem, char **ppFiles, int *pnCount)
{
WIN32_FIND_DATAA fd;
- HANDLE hFind = FindFirstFileA( szItem, &fd );
-
- if ( hFind != INVALID_HANDLE_VALUE )
- {
- do
- {
- if ( fd.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY )
- {
+ HANDLE hFind = FindFirstFileA(szItem, &fd);
+
+ if (hFind != INVALID_HANDLE_VALUE) {
+ do {
+ if (fd.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY) {
// Skip parent directories
- if (( 0 != mir_strcmp( fd.cFileName, "." )) &&
- ( 0 != mir_strcmp( fd.cFileName, ".." )) )
- {
+ if ((0 != mir_strcmp(fd.cFileName, ".")) &&
+ (0 != mir_strcmp(fd.cFileName, ".."))) {
char szDirName[MAX_PATH];
- strncpy( szDirName, szItem, MAX_PATH - 1);
+ strncpy(szDirName, szItem, MAX_PATH - 1);
- if ( NULL != strstr( szItem, "*.*" ))
- {
- size_t offset = mir_strlen( szDirName ) - 3;
- mir_snprintf(szDirName + offset, SIZEOF( szDirName) - offset, "%s\0", fd.cFileName);
+ if (NULL != strstr(szItem, "*.*")) {
+ size_t offset = mir_strlen(szDirName) - 3;
+ mir_snprintf(szDirName + offset, SIZEOF(szDirName) - offset, "%s\0", fd.cFileName);
}
-
- ppFiles[ *pnCount ] = _strdup( szDirName );
- ++( *pnCount );
- mir_strcat( szDirName, "\\*.*" );
- SaveFiles( szDirName, ppFiles, pnCount );
-
+ ppFiles[*pnCount] = _strdup(szDirName);
+ ++(*pnCount);
+
+ mir_strcat(szDirName, "\\*.*");
+ SaveFiles(szDirName, ppFiles, pnCount);
+
}
}
- else
- {
- size_t nSize = sizeof(char) * ( mir_strlen( szItem ) + mir_strlen( fd.cFileName ) + sizeof( char ));
- char *szFile = (char*) malloc( nSize ) ;
-
- strncpy( szFile, szItem, nSize - 1);
-
- if ( NULL != strstr( szFile, "*.*" ))
- {
- szFile[ mir_strlen( szFile ) - 3 ] = '\0';
+ else {
+ size_t nSize = sizeof(char) * (mir_strlen(szItem) + mir_strlen(fd.cFileName) + sizeof(char));
+ char *szFile = (char*)malloc(nSize);
+
+ strncpy(szFile, szItem, nSize - 1);
+
+ if (NULL != strstr(szFile, "*.*")) {
+ szFile[mir_strlen(szFile) - 3] = '\0';
mir_strncat(szFile, fd.cFileName, nSize - mir_strlen(szFile));
}
-
- ppFiles[ *pnCount ] = szFile;
- ++( *pnCount );
+
+ ppFiles[*pnCount] = szFile;
+ ++(*pnCount);
}
- }
- while( FALSE != FindNextFileA( hFind, &fd ));
+ } while (FALSE != FindNextFileA(hFind, &fd));
}
}
-static void ProcessDroppedItems( char **ppDroppedItems, int nCount, char **ppFiles )
+static void ProcessDroppedItems(char **ppDroppedItems, int nCount, char **ppFiles)
{
int fileCount = 0;
- for (int i = 0; i < nCount; ++i )
- {
- SaveFiles( ppDroppedItems[ i ], ppFiles, &fileCount );
- }
+ for (int i = 0; i < nCount; ++i)
+ SaveFiles(ppDroppedItems[i], ppFiles, &fileCount);
}
-static int CountDroppedFiles( char **ppDroppedItems, int nCount )
+static int CountDroppedFiles(char **ppDroppedItems, int nCount)
{
int fileCount = 0;
-
- for (int i = 0; i < nCount; ++i )
- {
- fileCount += CountFiles( ppDroppedItems[ i ] );
+
+ for (int i = 0; i < nCount; ++i) {
+ fileCount += CountFiles(ppDroppedItems[i]);
}
return fileCount;
@@ -327,20 +290,13 @@ static int CountDroppedFiles( char **ppDroppedItems, int nCount )
///////////////////////////////////////////////////////////////////////////////
// Init/destroy
-void InitFileDropping()
-{
-}
-
-void FreeFileDropping(void)
-{
-}
-void RegisterFileDropping( HWND hwnd, CDropTarget* pdropTarget )
+void RegisterFileDropping(HWND hwnd, CDropTarget* pdropTarget)
{
- RegisterDragDrop( hwnd, (IDropTarget*)pdropTarget );
+ RegisterDragDrop(hwnd, (IDropTarget*)pdropTarget);
}
-void UnregisterFileDropping( HWND hwnd )
+void UnregisterFileDropping(HWND hwnd)
{
- RevokeDragDrop( hwnd );
+ RevokeDragDrop(hwnd);
}
diff --git a/plugins/FloatingContacts/src/filedrop.h b/plugins/FloatingContacts/src/filedrop.h
index 7627ab5325..af384c67d3 100644
--- a/plugins/FloatingContacts/src/filedrop.h
+++ b/plugins/FloatingContacts/src/filedrop.h
@@ -20,7 +20,5 @@ public:
HRESULT STDMETHODCALLTYPE Drop(IDataObject *pData,DWORD fKeyState,POINTL pt,DWORD *pdwEffect);
};
-void InitFileDropping();
-void FreeFileDropping(void);
void RegisterFileDropping( HWND hwnd, CDropTarget* pdropTarget );
void UnregisterFileDropping( HWND hwnd );
diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp
index 03101b7fb8..0a5fd39e64 100644
--- a/plugins/FloatingContacts/src/main.cpp
+++ b/plugins/FloatingContacts/src/main.cpp
@@ -38,7 +38,7 @@ static void GetScreenRect(void);
extern void SetThumbsOpacity(BYTE btAlpha);
static int ClcStatusToPf2(int status);
-static VOID CALLBACK ToTopTimerProc ( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
+static VOID CALLBACK ToTopTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime);
HINSTANCE hInst;
HFONT hFont[FLT_FONTIDS];
@@ -70,7 +70,7 @@ CLIST_INTERFACE *pcli;
//Options
-FCOptions fcOpt = {0};
+FCOptions fcOpt = { 0 };
static void InitOptions()
{
@@ -102,7 +102,7 @@ PLUGININFOEX pluginInfoEx =
__AUTHORWEB,
UNICODE_AWARE,
// {53C715A8-EB01-4136-A73C-441868610074}
- {0x53c715a8, 0xeb01, 0x4136, {0xa7, 0x3c, 0x44, 0x18, 0x68, 0x61, 0x0, 0x74}}
+ { 0x53c715a8, 0xeb01, 0x4136, { 0xa7, 0x3c, 0x44, 0x18, 0x68, 0x61, 0x0, 0x74 } }
};
extern "C" __declspec(dllexport) PLUGININFOEX* MirandaPluginInfoEx(DWORD mirandaVersion)
@@ -122,7 +122,7 @@ BOOL WINAPI DllMain(HINSTANCE hinstDLL, DWORD fdwReason, LPVOID lpvReserved)
/////////////////////////////////////////////////////////////////////////////
// Fonts
-static LPCTSTR s_fonts[FLT_FONTIDS] =
+static LPCTSTR s_fonts[FLT_FONTIDS] =
{
{ LPGENT("Standard contacts") },
{ LPGENT("Online contacts to whom you have a different visibility") },
@@ -165,7 +165,7 @@ static int OnContactDrag(WPARAM hContact, LPARAM lParam)
if (pThumb == NULL) {
int idStatus = GetContactStatus(hContact);
- if ( !fcOpt.bHideAll && !HideOnFullScreen() && ( !fcOpt.bHideOffline || IsStatusVisible( idStatus )) && (!fcOpt.bHideWhenCListShow || !bIsCListShow)) {
+ if (!fcOpt.bHideAll && !HideOnFullScreen() && (!fcOpt.bHideOffline || IsStatusVisible(idStatus)) && (!fcOpt.bHideWhenCListShow || !bIsCListShow)) {
CreateThumbWnd(pcli->pfnGetContactDisplayName(hContact, 0), hContact, pt.x, pt.y);
ThumbInfo *pNewThumb = thumbList.FindThumbByContact(hContact);
ShowWindow(pNewThumb->hwnd, SW_SHOWNA);
@@ -229,7 +229,7 @@ static int OnContactSettingChanged(WPARAM hContact, LPARAM lParam)
DBCONTACTWRITESETTING *pdbcws = (DBCONTACTWRITESETTING*)lParam;
if (hContact == NULL) {
- if (( 0 == _stricmp( pdbcws->szModule, "CLC" )) || ( 0 == _stricmp( pdbcws->szModule, MODULE )) ) {
+ if ((0 == _stricmp(pdbcws->szModule, "CLC")) || (0 == _stricmp(pdbcws->szModule, MODULE))) {
LoadDBSettings();
ApplyOptionsChanges();
}
@@ -237,7 +237,7 @@ static int OnContactSettingChanged(WPARAM hContact, LPARAM lParam)
return 0;
}
- if ( pThumb == NULL )
+ if (pThumb == NULL)
return 0;
// Only on these 2 events we need to refresh
@@ -249,7 +249,7 @@ static int OnContactSettingChanged(WPARAM hContact, LPARAM lParam)
idStatus = GetContactStatus(hContact);
else if (0 == _stricmp(pdbcws->szSetting, "MyHandle"))
idStatus = GetContactStatus(hContact);
- else if (fcOpt.bShowIdle && 0 == _stricmp( pdbcws->szSetting, "IdleTS"))
+ else if (fcOpt.bShowIdle && 0 == _stricmp(pdbcws->szSetting, "IdleTS"))
idStatus = GetContactStatus(hContact);
else
bRefresh = FALSE;
@@ -268,8 +268,7 @@ static int OnStatusModeChange(WPARAM wParam, LPARAM lParam)
thumbList[i].RefreshContactStatus(idStatus);
}
- if (wParam == ID_STATUS_OFFLINE)
- {
+ if (wParam == ID_STATUS_OFFLINE) {
// Floating status window will use this
}
@@ -290,21 +289,21 @@ static int OnPrebuildContactMenu(WPARAM wParam, LPARAM lParam)
static void LoadDBSettings()
{
- fcOpt.thumbAlpha = (BYTE)((double)db_get_b( NULL, MODULE, "Opacity", 100 ) * 2.55);
- fcOpt.bHideOffline = (BOOL)db_get_b( NULL, MODULE, "HideOffline", 0);
- fcOpt.bHideAll = (BOOL)db_get_b( NULL, MODULE, "HideAll", 0);
- fcOpt.bHideWhenFullscreen = (BOOL)db_get_b( NULL, MODULE, "HideWhenFullscreen", 0);
- fcOpt.bMoveTogether = (BOOL)db_get_b( NULL, MODULE, "MoveTogether", 0);
- fcOpt.bFixedWidth = (BOOL)db_get_b( NULL, MODULE, "FixedWidth", 0);
- fcOpt.nThumbWidth = (DWORD)db_get_dw( NULL, MODULE, "Width", 0);
- dwOfflineModes = db_get_dw( NULL, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES);
- fcOpt.bShowTip = (BOOL)db_get_b( NULL, MODULE, "ShowTip", 1);
- fcOpt.TimeIn = (WORD)db_get_w( NULL, MODULE, "TimeIn", 0);
- fcOpt.bToTop = (BOOL)db_get_b( NULL, MODULE, "ToTop", 0);
- fcOpt.ToTopTime = (WORD)db_get_w( NULL, MODULE, "ToTopTime", TOTOPTIME_DEF);
- fcOpt.bHideWhenCListShow = (BOOL)db_get_b( NULL, MODULE, "HideWhenCListShow", 0);
- fcOpt.bUseSingleClick = (BOOL)db_get_b( NULL, MODULE, "UseSingleClick", 0);
- fcOpt.bShowIdle = (BOOL)db_get_b( NULL, MODULE, "ShowIdle", 0);
+ fcOpt.thumbAlpha = (BYTE)((double)db_get_b(NULL, MODULE, "Opacity", 100) * 2.55);
+ fcOpt.bHideOffline = (BOOL)db_get_b(NULL, MODULE, "HideOffline", 0);
+ fcOpt.bHideAll = (BOOL)db_get_b(NULL, MODULE, "HideAll", 0);
+ fcOpt.bHideWhenFullscreen = (BOOL)db_get_b(NULL, MODULE, "HideWhenFullscreen", 0);
+ fcOpt.bMoveTogether = (BOOL)db_get_b(NULL, MODULE, "MoveTogether", 0);
+ fcOpt.bFixedWidth = (BOOL)db_get_b(NULL, MODULE, "FixedWidth", 0);
+ fcOpt.nThumbWidth = (DWORD)db_get_dw(NULL, MODULE, "Width", 0);
+ dwOfflineModes = db_get_dw(NULL, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES);
+ fcOpt.bShowTip = (BOOL)db_get_b(NULL, MODULE, "ShowTip", 1);
+ fcOpt.TimeIn = (WORD)db_get_w(NULL, MODULE, "TimeIn", 0);
+ fcOpt.bToTop = (BOOL)db_get_b(NULL, MODULE, "ToTop", 0);
+ fcOpt.ToTopTime = (WORD)db_get_w(NULL, MODULE, "ToTopTime", TOTOPTIME_DEF);
+ fcOpt.bHideWhenCListShow = (BOOL)db_get_b(NULL, MODULE, "HideWhenCListShow", 0);
+ fcOpt.bUseSingleClick = (BOOL)db_get_b(NULL, MODULE, "UseSingleClick", 0);
+ fcOpt.bShowIdle = (BOOL)db_get_b(NULL, MODULE, "ShowIdle", 0);
if (db_get_b(NULL, "ModernData", "HideBehind", 0))
bIsCListShow = (db_get_b(NULL, "ModernData", "BehindEdge", 0) == 0);
@@ -312,23 +311,23 @@ static void LoadDBSettings()
bIsCListShow = (db_get_b(NULL, "CList", "State", 0) == 2);
}
-void SendMsgDialog( HWND hwnd, TCHAR *pText )
+void SendMsgDialog(HWND hwnd, TCHAR *pText)
{
- ThumbInfo *pThumb = thumbList.FindThumb( hwnd );
- if ( pThumb != NULL )
- CallService(MS_MSG_SENDMESSAGET, (WPARAM)pThumb->hContact, (LPARAM)pText );
+ ThumbInfo *pThumb = thumbList.FindThumb(hwnd);
+ if (pThumb != NULL)
+ CallService(MS_MSG_SENDMESSAGET, (WPARAM)pThumb->hContact, (LPARAM)pText);
}
-static void ShowContactMenu( HWND hwnd, POINT pt )
+static void ShowContactMenu(HWND hwnd, POINT pt)
{
- ThumbInfo *pThumb = thumbList.FindThumb( hwnd );
- if ( pThumb != NULL ) {
+ ThumbInfo *pThumb = thumbList.FindThumb(hwnd);
+ if (pThumb != NULL) {
hContactMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)pThumb->hContact, 0);
- if ( hContactMenu == NULL )
+ if (hContactMenu == NULL)
return;
- int idCommand = TrackPopupMenu( hContactMenu, TPM_RIGHTALIGN | TPM_TOPALIGN | TPM_RETURNCMD, pt.x, pt.y, 0 , hwnd, NULL );
- CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM( idCommand , MPCF_CONTACTMENU), (LPARAM)pThumb->hContact );
+ int idCommand = TrackPopupMenu(hContactMenu, TPM_RIGHTALIGN | TPM_TOPALIGN | TPM_RETURNCMD, pt.x, pt.y, 0, hwnd, NULL);
+ CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(idCommand, MPCF_CONTACTMENU), (LPARAM)pThumb->hContact);
}
}
@@ -336,7 +335,7 @@ static LRESULT __stdcall CommWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
{
ThumbInfo *pThumb = thumbList.FindThumb(hwnd);
- switch(uMsg) {
+ switch (uMsg) {
case WM_RBUTTONUP:
{
POINT pt;
@@ -346,7 +345,7 @@ static LRESULT __stdcall CommWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
if (pThumb) pThumb->ThumbDeselect(TRUE);
ClientToScreen(hwnd, &pt);
- ShowContactMenu( hwnd, pt );
+ ShowContactMenu(hwnd, pt);
}
break;
@@ -356,11 +355,11 @@ static LRESULT __stdcall CommWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
case WM_NCPAINT:
if (pThumb) {
- HDC hdc = GetWindowDC( hwnd );
+ HDC hdc = GetWindowDC(hwnd);
BitBlt(hdc, 0, 0, pThumb->bmpContent.getWidth(), pThumb->bmpContent.getHeight(), pThumb->bmpContent.getDC(), 0, 0, SRCCOPY);
//RepaintWindow( hwnd, hdc );
- ReleaseDC( hwnd, hdc );
- ValidateRect( hwnd, NULL );
+ ReleaseDC(hwnd, hdc);
+ ValidateRect(hwnd, NULL);
return 0;
}
@@ -391,11 +390,11 @@ static LRESULT __stdcall CommWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
break;
case WM_LBUTTONDOWN:
- if (pThumb) pThumb->OnLButtonDown( LOWORD(lParam), HIWORD(lParam));
+ if (pThumb) pThumb->OnLButtonDown(LOWORD(lParam), HIWORD(lParam));
break;
case WM_MOUSEMOVE:
- if (pThumb) pThumb->OnMouseMove( LOWORD(lParam), HIWORD(lParam), wParam);
+ if (pThumb) pThumb->OnMouseMove(LOWORD(lParam), HIWORD(lParam), wParam);
break;
case WM_LBUTTONUP:
@@ -415,7 +414,7 @@ static LRESULT __stdcall CommWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
case WM_REFRESH_CONTACT:
if (pThumb) {
- _tcsncpy( pThumb->ptszName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)pThumb->hContact, (LPARAM)GCDNF_TCHAR ), USERNAME_LEN - 1);
+ _tcsncpy(pThumb->ptszName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)pThumb->hContact, (LPARAM)GCDNF_TCHAR), USERNAME_LEN - 1);
pThumb->RefreshContactStatus((int)lParam);
pThumb->ResizeThumb();
}
@@ -435,7 +434,7 @@ static LRESULT __stdcall CommWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM
return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
-extern void SetThumbsOpacity( BYTE btAlpha )
+extern void SetThumbsOpacity(BYTE btAlpha)
{
for (int i = 0; i < thumbList.getCount(); ++i)
thumbList[i].SetThumbOpacity(btAlpha);
@@ -443,10 +442,10 @@ extern void SetThumbsOpacity( BYTE btAlpha )
static void GetScreenRect()
{
- rcScreen.left = GetSystemMetrics( SM_XVIRTUALSCREEN );
- rcScreen.top = GetSystemMetrics( SM_YVIRTUALSCREEN );
- rcScreen.right = GetSystemMetrics( SM_CXVIRTUALSCREEN ) + rcScreen.left;
- rcScreen.bottom = GetSystemMetrics( SM_CYVIRTUALSCREEN ) + rcScreen.top;
+ rcScreen.left = GetSystemMetrics(SM_XVIRTUALSCREEN);
+ rcScreen.top = GetSystemMetrics(SM_YVIRTUALSCREEN);
+ rcScreen.right = GetSystemMetrics(SM_CXVIRTUALSCREEN) + rcScreen.left;
+ rcScreen.bottom = GetSystemMetrics(SM_CYVIRTUALSCREEN) + rcScreen.top;
}
void OnStatusChanged()
@@ -471,8 +470,8 @@ void ApplyOptionsChanges()
if (fcOpt.bToTop) {
if (ToTopTimerID) KillTimer(NULL, ToTopTimerID);
- fcOpt.ToTopTime = (fcOpt.ToTopTime<1)?1:fcOpt.ToTopTime;
- fcOpt.ToTopTime = (fcOpt.ToTopTime>TOTOPTIME_MAX)?TOTOPTIME_MAX:fcOpt.ToTopTime;
+ fcOpt.ToTopTime = (fcOpt.ToTopTime < 1) ? 1 : fcOpt.ToTopTime;
+ fcOpt.ToTopTime = (fcOpt.ToTopTime > TOTOPTIME_MAX) ? TOTOPTIME_MAX : fcOpt.ToTopTime;
ToTopTimerID = SetTimer(NULL, 0, fcOpt.ToTopTime*TOTOPTIME_P, ToTopTimerProc);
}
@@ -493,7 +492,7 @@ static void RegisterWindowClass()
wcx.lpfnWndProc = CommWndProc;
wcx.hInstance = hInst;
wcx.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
- wcx.lpszClassName = WND_CLASS;
+ wcx.lpszClassName = WND_CLASS;
RegisterClassEx(&wcx);
}
@@ -518,7 +517,7 @@ static void CreateThumbWnd(TCHAR *ptszName, MCONTACT hContact, int nX, int nY)
pThumb->ResizeThumb();
pThumb->SetThumbOpacity(fcOpt.thumbAlpha);
- ShowWindow( hwnd, (fcOpt.bHideAll || HideOnFullScreen() || fcOpt.bHideOffline || (fcOpt.bHideWhenCListShow && bIsCListShow)) ? SW_HIDE : SW_SHOWNA);
+ ShowWindow(hwnd, (fcOpt.bHideAll || HideOnFullScreen() || fcOpt.bHideOffline || (fcOpt.bHideWhenCListShow && bIsCListShow)) ? SW_HIDE : SW_SHOWNA);
pThumb->PositionThumb(nX, nY);
// force repaint
@@ -534,7 +533,7 @@ static void CreateThumbsFont()
}
LOGFONT lf;
- FontService_GetFont( LPGENT("Floating contacts"), s_fonts[nFontId], &tColor[nFontId], &lf);
+ FontService_GetFont(LPGENT("Floating contacts"), s_fonts[nFontId], &tColor[nFontId], &lf);
hFont[nFontId] = CreateFontIndirect(&lf);
}
}
@@ -560,7 +559,7 @@ static void CreateBackgroundBrush()
if (NULL != hBkBrush) {
SetClassLong((HWND)WND_CLASS, GCLP_HBRBACKGROUND, (LONG)NULL);
- DeleteObject( hBkBrush );
+ DeleteObject(hBkBrush);
hBkBrush = NULL;
}
@@ -579,7 +578,7 @@ static void CreateBackgroundBrush()
nBackgroundBmpUse = (WORD)db_get_w(NULL, MODULE, "BkBitmapOpt", FLT_DEFAULT_BKGNDBITMAPOPT);
// Create brush
- hBkBrush = CreateSolidBrush(bkColor);
+ hBkBrush = CreateSolidBrush(bkColor);
// Attach brush to the window
SetClassLong((HWND)WND_CLASS, GCLP_HBRBACKGROUND, (LONG)hBkBrush);
@@ -588,7 +587,7 @@ static void CreateBackgroundBrush()
static int GetContactStatus(MCONTACT hContact)
{
if (hContact == NULL) {
- assert( !"Contact is NULL" );
+ assert(!"Contact is NULL");
return 0;
}
@@ -602,17 +601,17 @@ static int GetContactStatus(MCONTACT hContact)
static int ClcStatusToPf2(int status)
{
- switch(status) {
- case ID_STATUS_ONLINE: return PF2_ONLINE;
- case ID_STATUS_AWAY: return PF2_SHORTAWAY;
- case ID_STATUS_DND: return PF2_HEAVYDND;
- case ID_STATUS_NA: return PF2_LONGAWAY;
- case ID_STATUS_OCCUPIED: return PF2_LIGHTDND;
- case ID_STATUS_FREECHAT: return PF2_FREECHAT;
- case ID_STATUS_INVISIBLE: return PF2_INVISIBLE;
- case ID_STATUS_ONTHEPHONE: return PF2_ONTHEPHONE;
- case ID_STATUS_OUTTOLUNCH: return PF2_OUTTOLUNCH;
- case ID_STATUS_OFFLINE: return MODEF_OFFLINE;
+ switch (status) {
+ case ID_STATUS_ONLINE: return PF2_ONLINE;
+ case ID_STATUS_AWAY: return PF2_SHORTAWAY;
+ case ID_STATUS_DND: return PF2_HEAVYDND;
+ case ID_STATUS_NA: return PF2_LONGAWAY;
+ case ID_STATUS_OCCUPIED: return PF2_LIGHTDND;
+ case ID_STATUS_FREECHAT: return PF2_FREECHAT;
+ case ID_STATUS_INVISIBLE: return PF2_INVISIBLE;
+ case ID_STATUS_ONTHEPHONE: return PF2_ONTHEPHONE;
+ case ID_STATUS_OUTTOLUNCH: return PF2_OUTTOLUNCH;
+ case ID_STATUS_OFFLINE: return MODEF_OFFLINE;
}
return 0;
}
@@ -624,33 +623,33 @@ BOOL IsStatusVisible(int status)
void RegHotkey(MCONTACT hContact, HWND hwnd)
{
- char szBuf[MAX_PATH] = {0};
+ char szBuf[MAX_PATH] = { 0 };
DBVARIANT dbv;
if (db_get_s(hContact, MODULE, "Hotkey", &dbv)) return;
strncpy(szBuf, dbv.pszVal, MAX_PATH - 1);
- db_free( &dbv );
+ db_free(&dbv);
- if (szBuf[0] != '\0') {
+ if (szBuf[0] != '\0') {
UINT nModifiers = 0;
char chKey = 0;
- char szMod[2][20] = {0};
- char szKey[20] = {0};
+ char szMod[2][20] = { 0 };
+ char szKey[20] = { 0 };
- sscanf( szBuf, "%[^'+']+%[^'+']+%[^'+']", szMod[0], szMod[1], szKey );
+ sscanf(szBuf, "%[^'+']+%[^'+']+%[^'+']", szMod[0], szMod[1], szKey);
- for (int i=0; i < 2; i++) {
- if ( 0 == strncmp( szMod[ i ], "ALT", 19 ))
+ for (int i = 0; i < 2; i++) {
+ if (0 == strncmp(szMod[i], "ALT", 19))
nModifiers = nModifiers | MOD_ALT;
- else if ( 0 == strncmp( szMod[ i ], "CTRL", 19 ))
+ else if (0 == strncmp(szMod[i], "CTRL", 19))
nModifiers = nModifiers | MOD_CONTROL;
- else if ( 0 == strncmp( szMod[ i ], "SHIFT", 19 ))
+ else if (0 == strncmp(szMod[i], "SHIFT", 19))
nModifiers = nModifiers | MOD_SHIFT;
}
- chKey = szKey[ 0 ];
+ chKey = szKey[0];
- RegisterHotKey( hwnd, (int)hwnd, nModifiers, VkKeyScan( chKey ));
+ RegisterHotKey(hwnd, (int)hwnd, nModifiers, VkKeyScan(chKey));
}
}
@@ -660,7 +659,7 @@ void RegHotkey(MCONTACT hContact, HWND hwnd)
void SaveContactsPos()
{
for (int i = 0; i < thumbList.getCount(); ++i) {
- SetLastError( 0);
+ SetLastError(0);
RECT rc;
thumbList[i].GetThumbRect(&rc);
@@ -687,7 +686,7 @@ static INT_PTR OnMainMenu_HideAll(WPARAM wParam, LPARAM lParam)
CLISTMENUITEM clmi = { sizeof(clmi) };
clmi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR;
- clmi.hIcon = LoadIcon( hInst, MAKEINTRESOURCE(fcOpt.bHideAll ? IDI_SHOW : IDI_HIDE));
+ clmi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(fcOpt.bHideAll ? IDI_SHOW : IDI_HIDE));
clmi.ptszName = fcOpt.bHideAll ? LPGENT("Show all thumbs") : LPGENT("Hide all thumbs");
Menu_ModifyItem(hMainMenuItemHideAll, &clmi);
return 0;
@@ -727,9 +726,9 @@ static void LoadMenus()
hMenuItemRemove = Menu_AddContactMenuItem(&mi);
// Hide all thumbs main menu item
- CreateServiceFunction(MODULE "/MainHideAllThumbs", OnMainMenu_HideAll );
+ CreateServiceFunction(MODULE "/MainHideAllThumbs", OnMainMenu_HideAll);
- mi.hIcon = LoadIcon( hInst, MAKEINTRESOURCE( fcOpt.bHideAll ? IDI_SHOW : IDI_HIDE ));
+ mi.hIcon = LoadIcon(hInst, MAKEINTRESOURCE(fcOpt.bHideAll ? IDI_SHOW : IDI_HIDE));
mi.ptszName = fcOpt.bHideAll ? LPGENT("Show all thumbs") : LPGENT("Hide all thumbs");
mi.pszService = MODULE "/MainHideAllThumbs";
Menu_AddMainMenuItem(&mi);
@@ -743,7 +742,7 @@ static void LoadMenus()
hkd.pszService = MODULE "/MainHideAllThumbs";
Hotkey_Register(&hkd);
- CreateServiceFunction(MODULE "/HideWhenCListShow", OnHotKey_HideWhenCListShow );
+ CreateServiceFunction(MODULE "/HideWhenCListShow", OnHotKey_HideWhenCListShow);
hkd.pszName = MODULE "/HideWhenCListShow";
hkd.pszDescription = LPGEN("Hide when contact list is shown");
hkd.pszService = MODULE "/HideWhenCListShow";
@@ -752,18 +751,18 @@ static void LoadMenus()
/////////////////////////////////////////////////////////////////////////////////////////
-static void LoadContact( MCONTACT hContact )
+static void LoadContact(MCONTACT hContact)
{
ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact);
if (hContact == NULL)
return;
- DWORD dwPos = db_get_dw( hContact, MODULE, "ThumbsPos", (DWORD)-1);
- if ( dwPos != -1) {
+ DWORD dwPos = db_get_dw(hContact, MODULE, "ThumbsPos", (DWORD)-1);
+ if (dwPos != -1) {
TCHAR *ptName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, hContact, (LPARAM)GCDNF_TCHAR);
- if ( ptName != NULL ) {
- int nX = DB_POS_GETX( dwPos );
- int nY = DB_POS_GETY( dwPos );
+ if (ptName != NULL) {
+ int nX = DB_POS_GETX(dwPos);
+ int nY = DB_POS_GETY(dwPos);
CreateThumbWnd(ptName, hContact, nX, nY);
pThumb->PositionThumb(nX, nY);
@@ -776,7 +775,7 @@ BOOL HideOnFullScreen()
BOOL bFullscreen = FALSE;
HWND hWnd = 0;
- if ( fcOpt.bHideWhenFullscreen ) {
+ if (fcOpt.bHideWhenFullscreen) {
int w = GetSystemMetrics(SM_CXSCREEN);
int h = GetSystemMetrics(SM_CYSCREEN);
@@ -786,19 +785,19 @@ BOOL HideOnFullScreen()
RECT WindowRect;
GetWindowRect(hWnd, &WindowRect);
- if ( w == WindowRect.right - WindowRect.left && h == WindowRect.bottom - WindowRect.top) {
+ if (w == WindowRect.right - WindowRect.left && h == WindowRect.bottom - WindowRect.top) {
bFullscreen = TRUE;
break;
}
- hWnd = GetNextWindow( hWnd, GW_HWNDNEXT );
+ hWnd = GetNextWindow(hWnd, GW_HWNDNEXT);
}
}
return bFullscreen && fcOpt.bHideWhenFullscreen;
}
-static VOID CALLBACK ToTopTimerProc ( HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
+static VOID CALLBACK ToTopTimerProc(HWND hwnd, UINT uMsg, UINT_PTR idEvent, DWORD dwTime)
{
for (int i = 0; i < thumbList.getCount(); ++i)
SetWindowPos(thumbList[i].hwnd, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE | SWP_NOMOVE | SWP_NOACTIVATE);
@@ -810,7 +809,7 @@ void ShowThumbsOnHideCList()
return;
for (int i = 0; i < thumbList.getCount(); ++i)
- if ( !fcOpt.bHideOffline || IsStatusVisible( GetContactStatus(thumbList[i].hContact)))
+ if (!fcOpt.bHideOffline || IsStatusVisible(GetContactStatus(thumbList[i].hContact)))
ShowWindow(thumbList[i].hwnd, SW_SHOWNA);
}
@@ -840,17 +839,15 @@ static LRESULT __stdcall newMirandaWndProc(HWND hwnd, UINT uMsg, WPARAM wParam,
BYTE method = db_get_b(NULL, "ModernData", "HideBehind", 0);
if (method) {
WORD wBehindEdgeBorderSize = db_get_w(NULL, "ModernData", "HideBehindBorderSize", 0);
- RECT rc = {wp->x, wp->y, wp->x+wp->cx, wp->y+wp->cy};
- RECT rcScreen = {wBehindEdgeBorderSize*(2-method), 0, GetSystemMetrics(SM_CXSCREEN)-wBehindEdgeBorderSize*(method-1), GetSystemMetrics(SM_CYSCREEN)};
+ RECT rc = { wp->x, wp->y, wp->x + wp->cx, wp->y + wp->cy };
+ RECT rcScreen = { wBehindEdgeBorderSize*(2 - method), 0, GetSystemMetrics(SM_CXSCREEN) - wBehindEdgeBorderSize*(method - 1), GetSystemMetrics(SM_CYSCREEN) };
RECT rcOverlap;
- BOOL isIntersect;
-
- isIntersect = IntersectRect( &rcOverlap, &rc, &rcScreen );
- if ( !isIntersect && bIsCListShow ) {
+ BOOL isIntersect = IntersectRect(&rcOverlap, &rc, &rcScreen);
+ if (!isIntersect && bIsCListShow) {
bIsCListShow = FALSE;
ShowThumbsOnHideCList();
}
- else if ( isIntersect && !bIsCListShow ) {
+ else if (isIntersect && !bIsCListShow) {
bIsCListShow = TRUE;
HideThumbsOnShowCList();
}
@@ -882,7 +879,6 @@ static int OnModulesLoded(WPARAM wParam, LPARAM lParam)
bEnableTip = ServiceExists("mToolTip/ShowTip");
RegisterWindowClass();
- InitFileDropping();
GetScreenRect();
LoadDBSettings();
CreateBackgroundBrush();
@@ -891,8 +887,8 @@ static int OnModulesLoded(WPARAM wParam, LPARAM lParam)
LoadMenus();
if (fcOpt.bToTop) {
- fcOpt.ToTopTime = (fcOpt.ToTopTime<1)?1:fcOpt.ToTopTime;
- fcOpt.ToTopTime = (fcOpt.ToTopTime>TOTOPTIME_MAX)?TOTOPTIME_MAX:fcOpt.ToTopTime;
+ fcOpt.ToTopTime = (fcOpt.ToTopTime < 1) ? 1 : fcOpt.ToTopTime;
+ fcOpt.ToTopTime = (fcOpt.ToTopTime > TOTOPTIME_MAX) ? TOTOPTIME_MAX : fcOpt.ToTopTime;
ToTopTimerID = SetTimer(NULL, 0, fcOpt.ToTopTime*TOTOPTIME_P, ToTopTimerProc);
}
return 0;
@@ -912,7 +908,7 @@ extern "C" int __declspec(dllexport) Load()
InitOptions();
- for (int i=0; i < SIZEOF(s_fonts); i++) {
+ for (int i = 0; i < SIZEOF(s_fonts); i++) {
LOGFONT lf;
SystemParametersInfo(SPI_GETICONTITLELOGFONT, sizeof(lf), &lf, FALSE);
if (i == FLT_FONTID_OFFINVIS || i == FLT_FONTID_INVIS)
@@ -927,7 +923,6 @@ extern "C" int __declspec(dllexport) Load()
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoded);
HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreshutdown);
-
return 0;
}
@@ -952,7 +947,5 @@ extern "C" int __declspec(dllexport) Unload()
DeleteObject(hFont[nFontId]);
UnregisterWindowClass();
-
- FreeFileDropping();
return 0;
}
diff --git a/plugins/FloatingContacts/src/options.cpp b/plugins/FloatingContacts/src/options.cpp
index fbc0a79f65..2e0cf20636 100644
--- a/plugins/FloatingContacts/src/options.cpp
+++ b/plugins/FloatingContacts/src/options.cpp
@@ -10,7 +10,7 @@
static INT_PTR APIENTRY OptWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- switch ( uMsg ) {
+ switch (uMsg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
@@ -25,7 +25,7 @@ static INT_PTR APIENTRY OptWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
EnableWindow(GetDlgItem(hwndDlg, IDC_TXT_WIDTH), fcOpt.bFixedWidth);
EnableWindow(GetDlgItem(hwndDlg, IDC_WIDTHSPIN), fcOpt.bFixedWidth);
- SendDlgItemMessage(hwndDlg, IDC_WIDTHSPIN, UDM_SETRANGE, 0, MAKELONG(255,0));
+ SendDlgItemMessage(hwndDlg, IDC_WIDTHSPIN, UDM_SETRANGE, 0, MAKELONG(255, 0));
SendDlgItemMessage(hwndDlg, IDC_WIDTHSPIN, UDM_SETPOS, 0, fcOpt.nThumbWidth);
CheckDlgButton(hwndDlg, IDC_CHK_TIP, (fcOpt.bShowTip ? BST_CHECKED : BST_UNCHECKED));
@@ -37,7 +37,7 @@ static INT_PTR APIENTRY OptWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
EnableWindow(GetDlgItem(hwndDlg, IDC_TXT_TIMEIN), bEnableTip && fcOpt.bShowTip);
EnableWindow(GetDlgItem(hwndDlg, IDC_TIMEINSPIN), bEnableTip && fcOpt.bShowTip);
- SendDlgItemMessage(hwndDlg, IDC_TIMEINSPIN, UDM_SETRANGE, 0, MAKELONG(5000,0));
+ SendDlgItemMessage(hwndDlg, IDC_TIMEINSPIN, UDM_SETRANGE, 0, MAKELONG(5000, 0));
SendDlgItemMessage(hwndDlg, IDC_TIMEINSPIN, UDM_SETPOS, 0, fcOpt.TimeIn);
CheckDlgButton(hwndDlg, IDC_CHK_TOTOP, (fcOpt.bToTop ? BST_CHECKED : BST_UNCHECKED));
@@ -46,7 +46,7 @@ static INT_PTR APIENTRY OptWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
EnableWindow(GetDlgItem(hwndDlg, IDC_TXT_TOTOPTIME), fcOpt.bToTop);
EnableWindow(GetDlgItem(hwndDlg, IDC_TOTOPTIMESPIN), fcOpt.bToTop);
- SendDlgItemMessage(hwndDlg, IDC_TOTOPTIMESPIN, UDM_SETRANGE, 0, MAKELONG(TOTOPTIME_MAX,1));
+ SendDlgItemMessage(hwndDlg, IDC_TOTOPTIMESPIN, UDM_SETRANGE, 0, MAKELONG(TOTOPTIME_MAX, 1));
SendDlgItemMessage(hwndDlg, IDC_TOTOPTIMESPIN, UDM_SETPOS, 0, fcOpt.ToTopTime);
CheckDlgButton(hwndDlg, IDC_CHK_HIDE_WHEN_CLISTSHOW, (fcOpt.bHideWhenCListShow ? BST_CHECKED : BST_UNCHECKED));
@@ -61,8 +61,8 @@ static INT_PTR APIENTRY OptWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
if (BN_CLICKED == HIWORD(wParam)) {
BOOL bChecked = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_WIDTH);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_WIDTH ), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TXT_WIDTH ), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_WIDTH), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TXT_WIDTH), bChecked);
EnableWindow(GetDlgItem(hwndDlg, IDC_WIDTHSPIN), bChecked);
}
break;
@@ -78,9 +78,9 @@ static INT_PTR APIENTRY OptWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
if (BN_CLICKED == HIWORD(wParam)) {
BOOL bChecked = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_TIP);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_TIMEIN ), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_TIMEIN_CMT ), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TXT_TIMEIN ), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_TIMEIN), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_TIMEIN_CMT), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TXT_TIMEIN), bChecked);
EnableWindow(GetDlgItem(hwndDlg, IDC_TIMEINSPIN), bChecked);
}
break;
@@ -89,8 +89,8 @@ static INT_PTR APIENTRY OptWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
if (BN_CLICKED == HIWORD(wParam)) {
BOOL bChecked = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_TOTOP);
- EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_TOTOP ), bChecked);
- EnableWindow(GetDlgItem(hwndDlg, IDC_TXT_TOTOPTIME ), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_LBL_TOTOP), bChecked);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_TXT_TOTOPTIME), bChecked);
EnableWindow(GetDlgItem(hwndDlg, IDC_TOTOPTIMESPIN), bChecked);
}
break;
@@ -119,20 +119,20 @@ static INT_PTR APIENTRY OptWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
fcOpt.bFixedWidth = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_WIDTH);
db_set_b(NULL, MODULE, "FixedWidth", (BYTE)fcOpt.bFixedWidth);
- fcOpt.nThumbWidth = GetDlgItemInt(hwndDlg, IDC_TXT_WIDTH, &bSuccess, FALSE);
- db_set_dw(NULL, MODULE, "Width", fcOpt.nThumbWidth );
+ fcOpt.nThumbWidth = GetDlgItemInt(hwndDlg, IDC_TXT_WIDTH, &bSuccess, FALSE);
+ db_set_dw(NULL, MODULE, "Width", fcOpt.nThumbWidth);
if (bEnableTip) {
fcOpt.bShowTip = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_TIP);
db_set_b(NULL, MODULE, "ShowTip", (BYTE)fcOpt.bShowTip);
- fcOpt.TimeIn = GetDlgItemInt(hwndDlg, IDC_TXT_TIMEIN, &bSuccess, FALSE);
- db_set_w(NULL, MODULE, "TimeIn", fcOpt.TimeIn );
+ fcOpt.TimeIn = GetDlgItemInt(hwndDlg, IDC_TXT_TIMEIN, &bSuccess, FALSE);
+ db_set_w(NULL, MODULE, "TimeIn", fcOpt.TimeIn);
}
fcOpt.bToTop = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_TOTOP);
db_set_b(NULL, MODULE, "ToTop", (BYTE)fcOpt.bToTop);
- fcOpt.ToTopTime = GetDlgItemInt(hwndDlg, IDC_TXT_TOTOPTIME, &bSuccess, FALSE);
- db_set_w(NULL, MODULE, "ToTopTime", fcOpt.ToTopTime );
+ fcOpt.ToTopTime = GetDlgItemInt(hwndDlg, IDC_TXT_TOTOPTIME, &bSuccess, FALSE);
+ db_set_w(NULL, MODULE, "ToTopTime", fcOpt.ToTopTime);
fcOpt.bHideWhenCListShow = (BOOL)IsDlgButtonChecked(hwndDlg, IDC_CHK_HIDE_WHEN_CLISTSHOW);
db_set_b(NULL, MODULE, "HideWhenCListShow", (BYTE)fcOpt.bHideWhenCListShow);
@@ -160,7 +160,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
BOOL bEnable;
char szPercent[20];
- switch ( uMsg ) {
+ switch (uMsg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
// Border
@@ -180,7 +180,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
SendMessage(hwndDlg, M_REFRESHBKGBOXES, 0, 0);
{
DBVARIANT dbv;
- if ( !db_get_ts(NULL, MODULE, "BkBitmap", &dbv)) {
+ if (!db_get_ts(NULL, MODULE, "BkBitmap", &dbv)) {
SetDlgItemText(hwndDlg, IDC_FILENAME, dbv.ptszVal);
db_free(&dbv);
}
@@ -198,7 +198,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
BYTE btOpacity = (BYTE)db_get_b(NULL, MODULE, "Opacity", 100);
SendDlgItemMessage(hwndDlg, IDC_SLIDER_OPACITY, TBM_SETRANGE, TRUE, MAKELONG(0, 100));
SendDlgItemMessage(hwndDlg, IDC_SLIDER_OPACITY, TBM_SETPOS, TRUE, btOpacity);
-
+
mir_snprintf(szPercent, SIZEOF(szPercent), "%d%%", btOpacity);
SetDlgItemTextA(hwndDlg, IDC_OPACITY, szPercent);
@@ -227,7 +227,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
case WM_HSCROLL:
if (wParam != TB_ENDTRACK) {
int nPos = (int)SendDlgItemMessage(hwndDlg, IDC_SLIDER_OPACITY, TBM_GETPOS, 0, 0);
- fcOpt.thumbAlpha = (BYTE)(( nPos * 255 ) / 100 );
+ fcOpt.thumbAlpha = (BYTE)((nPos * 255) / 100);
SetThumbsOpacity(fcOpt.thumbAlpha);
mir_snprintf(szPercent, SIZEOF(szPercent), "%d%%", nPos);
@@ -248,7 +248,7 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
GetDlgItemText(hwndDlg, IDC_FILENAME, str, SIZEOF(str));
Bitmap_GetFilter(filter, SIZEOF(filter));
- OPENFILENAME ofn = {0};
+ OPENFILENAME ofn = { 0 };
ofn.lStructSize = sizeof(ofn);
ofn.hwndOwner = hwndDlg;
ofn.lpstrFilter = filter;
@@ -333,18 +333,18 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
int OnOptionsInitialize(WPARAM wParam, LPARAM lParam)
{
OPTIONSDIALOGPAGE odp = { 0 };
- odp.hInstance = hInst;
+ odp.hInstance = hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_FLTCONT);
- odp.pszTitle = LPGEN("Floating Contacts");
- odp.pszGroup = LPGEN("Contact list");
- odp.pszTab = LPGEN("Main Features");
- odp.flags = ODPF_BOLDGROUPS;
- odp.pfnDlgProc = OptWndProc;
+ odp.pszTitle = LPGEN("Floating Contacts");
+ odp.pszGroup = LPGEN("Contact list");
+ odp.pszTab = LPGEN("Main Features");
+ odp.flags = ODPF_BOLDGROUPS;
+ odp.pfnDlgProc = OptWndProc;
Options_AddPage(wParam, &odp);
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_SKIN);
- odp.pszTab = LPGEN("Appearance");
- odp.pfnDlgProc = OptSknWndProc;
+ odp.pszTab = LPGEN("Appearance");
+ odp.pfnDlgProc = OptSknWndProc;
Options_AddPage(wParam, &odp);
return 0;
}
diff --git a/plugins/FloatingContacts/src/thumbs.cpp b/plugins/FloatingContacts/src/thumbs.cpp
index e5ea984121..455626dbc0 100644
--- a/plugins/FloatingContacts/src/thumbs.cpp
+++ b/plugins/FloatingContacts/src/thumbs.cpp
@@ -13,21 +13,21 @@ static int nTop = 0;
static int nOffs = 5;
static ThumbInfo *pThumbMouseIn = NULL;
-static void SnapToScreen( RECT rcThumb, int nX, int nY, int *pX, int *pY )
+static void SnapToScreen(RECT rcThumb, int nX, int nY, int *pX, int *pY)
{
int nWidth;
int nHeight;
- assert( NULL != pX );
- assert( NULL != pY );
-
- nWidth = rcThumb.right - rcThumb.left;
+ assert(NULL != pX);
+ assert(NULL != pY);
+
+ nWidth = rcThumb.right - rcThumb.left;
nHeight = rcThumb.bottom - rcThumb.top;
- *pX = nX < ( nOffs + rcScreen.left ) ? rcScreen.left : nX;
- *pY = nY < ( nOffs + rcScreen.top ) ? rcScreen.top : nY;
- *pX = *pX > ( rcScreen.right - nWidth - nOffs ) ? ( rcScreen.right - nWidth ) : *pX;
- *pY = *pY > ( rcScreen.bottom - nHeight - nOffs ) ? ( rcScreen.bottom - nHeight ) : *pY;
+ *pX = nX < (nOffs + rcScreen.left) ? rcScreen.left : nX;
+ *pY = nY < (nOffs + rcScreen.top) ? rcScreen.top : nY;
+ *pX = *pX > (rcScreen.right - nWidth - nOffs) ? (rcScreen.right - nWidth) : *pX;
+ *pY = *pY > (rcScreen.bottom - nHeight - nOffs) ? (rcScreen.bottom - nHeight) : *pY;
}
ThumbInfo::ThumbInfo()
@@ -69,7 +69,7 @@ void ThumbInfo::PositionThumb(int nX, int nY)
pThumb->ptPos = pos;
pos.x += pThumb->szSize.cx;
- pThumb = fcOpt.bMoveTogether ? thumbList.FindThumb( pThumb->dockOpt.hwndRight ) : NULL;
+ pThumb = fcOpt.bMoveTogether ? thumbList.FindThumb(pThumb->dockOpt.hwndRight) : NULL;
}
EndDeferWindowPos(hdwp);
@@ -94,141 +94,140 @@ void ThumbInfo::PositionThumbWorker(int nX, int nY, POINT *newPos)
BOOL bLeading;
// Get thumb dimnsions
- GetThumbRect( &rcThumb );
- nWidth = rcThumb.right - rcThumb.left;
+ GetThumbRect(&rcThumb);
+ nWidth = rcThumb.right - rcThumb.left;
nHeight = rcThumb.bottom - rcThumb.top;
// Docking and screen boundaries check
- SnapToScreen( rcThumb, nX, nY, &nNewX, &nNewY );
-
+ SnapToScreen(rcThumb, nX, nY, &nNewX, &nNewY);
+
bLeading = dockOpt.hwndRight != NULL;
- if ( fcOpt.bMoveTogether )
- UndockThumbs( this, thumbList.FindThumb( dockOpt.hwndLeft ));
+ if (fcOpt.bMoveTogether)
+ UndockThumbs(this, thumbList.FindThumb(dockOpt.hwndLeft));
for (int i = 0; i < thumbList.getCount(); ++i) {
- ThumbInfo *pCurThumb = &thumbList[i];
+ ThumbInfo *pCurThumb = &thumbList[i];
if (pCurThumb == this)
continue;
- GetThumbRect( &rcThumb );
- OffsetRect( &rcThumb, nX - rcThumb.left, nY - rcThumb.top );
-
- pCurThumb->GetThumbRect( &rc );
+ GetThumbRect(&rcThumb);
+ OffsetRect(&rcThumb, nX - rcThumb.left, nY - rcThumb.top);
+
+ pCurThumb->GetThumbRect(&rc);
// These are rects we will dock into
-
- rcLeft.left = rc.left - nOffs;
- rcLeft.top = rc.top - nOffs;
- rcLeft.right = rc.left + nOffs;
- rcLeft.bottom = rc.bottom + nOffs;
-
- rcTop.left = rc.left - nOffs;
- rcTop.top = rc.top - nOffs;
- rcTop.right = rc.right + nOffs;
- rcTop.bottom = rc.top + nOffs;
-
- rcRight.left = rc.right - nOffs;
- rcRight.top = rc.top - nOffs;
- rcRight.right = rc.right + nOffs;
- rcRight.bottom = rc.bottom + nOffs;
-
- rcBottom.left = rc.left - nOffs;
- rcBottom.top = rc.bottom - nOffs;
- rcBottom.right = rc.right + nOffs;
+
+ rcLeft.left = rc.left - nOffs;
+ rcLeft.top = rc.top - nOffs;
+ rcLeft.right = rc.left + nOffs;
+ rcLeft.bottom = rc.bottom + nOffs;
+
+ rcTop.left = rc.left - nOffs;
+ rcTop.top = rc.top - nOffs;
+ rcTop.right = rc.right + nOffs;
+ rcTop.bottom = rc.top + nOffs;
+
+ rcRight.left = rc.right - nOffs;
+ rcRight.top = rc.top - nOffs;
+ rcRight.right = rc.right + nOffs;
+ rcRight.bottom = rc.bottom + nOffs;
+
+ rcBottom.left = rc.left - nOffs;
+ rcBottom.top = rc.bottom - nOffs;
+ rcBottom.right = rc.right + nOffs;
rcBottom.bottom = rc.bottom + nOffs;
-
- bDockedLeft = bDockedRight = FALSE;
+
+ bDockedLeft = bDockedRight = FALSE;
// Upper-left
pt.x = rcThumb.left;
pt.y = rcThumb.top;
bDocked = FALSE;
-
- if ( PtInRect(&rcRight, pt)) {
- nNewX = rc.right;
+
+ if (PtInRect(&rcRight, pt)) {
+ nNewX = rc.right;
bDocked = TRUE;
}
-
- if ( PtInRect(&rcBottom, pt)) {
+
+ if (PtInRect(&rcBottom, pt)) {
nNewY = rc.bottom;
- if ( PtInRect( &rcLeft, pt))
+ if (PtInRect(&rcLeft, pt))
nNewX = rc.left;
}
- if ( PtInRect(&rcTop, pt)) {
- nNewY = rc.top;
- bDockedLeft = bDocked;
+ if (PtInRect(&rcTop, pt)) {
+ nNewY = rc.top;
+ bDockedLeft = bDocked;
}
-
+
// Upper-right
pt.x = rcThumb.right;
pt.y = rcThumb.top;
bDocked = FALSE;
- if ( !bLeading && PtInRect( &rcLeft, pt)) {
+ if (!bLeading && PtInRect(&rcLeft, pt)) {
if (!bDockedLeft) {
- nNewX = rc.left - nWidth;
- bDocked = TRUE;
+ nNewX = rc.left - nWidth;
+ bDocked = TRUE;
}
- else if ( rc.right == rcThumb.left )
+ else if (rc.right == rcThumb.left)
bDocked = TRUE;
}
-
- if ( PtInRect( &rcBottom, pt)) {
+
+ if (PtInRect(&rcBottom, pt)) {
nNewY = rc.bottom;
- if ( PtInRect( &rcRight, pt))
+ if (PtInRect(&rcRight, pt))
nNewX = rc.right - nWidth;
}
- if ( !bLeading && PtInRect( &rcTop, pt)) {
+ if (!bLeading && PtInRect(&rcTop, pt)) {
nNewY = rc.top;
bDockedRight = bDocked;
}
-
- if ( fcOpt.bMoveTogether ) {
+
+ if (fcOpt.bMoveTogether) {
if (bDockedRight)
DockThumbs(this, pCurThumb, TRUE);
-
+
if (bDockedLeft)
DockThumbs(pCurThumb, this, FALSE);
- }
+ }
// Lower-left
pt.x = rcThumb.left;
pt.y = rcThumb.bottom;
- if ( PtInRect( &rcRight, pt))
+ if (PtInRect(&rcRight, pt))
nNewX = rc.right;
- if ( PtInRect( &rcTop, pt)) {
+ if (PtInRect(&rcTop, pt)) {
nNewY = rc.top - nHeight;
- if ( PtInRect( &rcLeft, pt))
+ if (PtInRect(&rcLeft, pt))
nNewX = rc.left;
}
-
+
// Lower-right
pt.x = rcThumb.right;
pt.y = rcThumb.bottom;
- if ( !bLeading && PtInRect( &rcLeft, pt))
+ if (!bLeading && PtInRect(&rcLeft, pt))
nNewX = rc.left - nWidth;
- if ( !bLeading && PtInRect( &rcTop, pt)) {
+ if (!bLeading && PtInRect(&rcTop, pt)) {
nNewY = rc.top - nHeight;
- if ( PtInRect( &rcRight, pt))
- {
+ if (PtInRect(&rcRight, pt)) {
nNewX = rc.right - nWidth;
}
}
}
// Adjust coords once again
- SnapToScreen( rcThumb, nNewX, nNewY, &nNewX, &nNewY );
-
+ SnapToScreen(rcThumb, nNewX, nNewY, &nNewX, &nNewY);
+
newPos->x = nNewX;
newPos->y = nNewY;
}
@@ -236,26 +235,24 @@ void ThumbInfo::PositionThumbWorker(int nX, int nY, POINT *newPos)
void ThumbInfo::ResizeThumb()
{
int index = FLT_FONTID_NOTONLIST;
-
+
himlMiranda = (HIMAGELIST)CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0);
if (himlMiranda == NULL)
return;
-
+
SIZEL sizeIcon;
ImageList_GetIconSize_my(himlMiranda, sizeIcon);
HDC hdc = GetWindowDC(hwnd);
if (!db_get_b(hContact, "CList", "NotOnList", 0)) {
char *szProto = GetContactProto(hContact);
- if ( NULL != szProto )
- {
+ if (NULL != szProto) {
int nStatus = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
int nContactStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
int nApparentMode = db_get_w(hContact, szProto, "ApparentMode", 0);
-
+
if ((nStatus == ID_STATUS_INVISIBLE && nApparentMode == ID_STATUS_ONLINE) ||
- (nStatus != ID_STATUS_INVISIBLE && nApparentMode == ID_STATUS_OFFLINE))
- {
+ (nStatus != ID_STATUS_INVISIBLE && nApparentMode == ID_STATUS_OFFLINE)) {
if (ID_STATUS_OFFLINE == nContactStatus)
index = FLT_FONTID_OFFINVIS;
else
@@ -269,27 +266,27 @@ void ThumbInfo::ResizeThumb()
}
else index = FLT_FONTID_NOTONLIST;
- HFONT hOldFont = (HFONT)SelectObject( hdc, hFont[ index ] );
-
+ HFONT hOldFont = (HFONT)SelectObject(hdc, hFont[index]);
+
// Get text and icon sizes
SIZEL sizeText;
- GetTextExtentPoint32( hdc, ptszName, (int)mir_tstrlen(ptszName), &sizeText);
-
+ GetTextExtentPoint32(hdc, ptszName, (int)mir_tstrlen(ptszName), &sizeText);
+
SelectObject(hdc, hOldFont);
-
+
// Transform text size
POINT ptText;
ptText.x = sizeText.cx;
ptText.y = sizeText.cy;
- LPtoDP( hdc, &ptText, 1);
-
+ LPtoDP(hdc, &ptText, 1);
+
szSize.cx = fcOpt.bFixedWidth ? fcOpt.nThumbWidth : sizeIcon.cx + ptText.x + 10;
- szSize.cy = (( sizeIcon.cy > ptText.y ) ? sizeIcon.cy : ptText.y ) + 4;
+ szSize.cy = ((sizeIcon.cy > ptText.y) ? sizeIcon.cy : ptText.y) + 4;
SetWindowPos(hwnd, HWND_TOPMOST, 0, 0, szSize.cx, szSize.cy, SWP_NOMOVE | SWP_NOACTIVATE);
-
+
RefreshContactIcon(0xFFFFFFFF);
-
+
ReleaseDC(hwnd, hdc);
// Move the docked widnow if needed
@@ -304,7 +301,7 @@ void ThumbInfo::ResizeThumb()
void ThumbInfo::RefreshContactIcon(int iIcon)
{
if (iIcon == 0xFFFFFFFF || ImageList_GetImageCount(himlMiranda) <= iIcon)
- this->iIcon = CallService(MS_CLIST_GETCONTACTICON, hContact, 0);
+ this->iIcon = CallService(MS_CLIST_GETCONTACTICON, hContact, 0);
else
this->iIcon = iIcon;
@@ -313,12 +310,12 @@ void ThumbInfo::RefreshContactIcon(int iIcon)
void ThumbInfo::RefreshContactStatus(int idStatus)
{
- if ( IsStatusVisible(idStatus))
- RegisterFileDropping( hwnd, dropTarget );
+ if (IsStatusVisible(idStatus))
+ RegisterFileDropping(hwnd, dropTarget);
else
- UnregisterFileDropping( hwnd );
+ UnregisterFileDropping(hwnd);
- ShowWindow( hwnd, fcOpt.bHideAll || HideOnFullScreen() || ( fcOpt.bHideOffline && ( !IsStatusVisible( idStatus )) ) || (fcOpt.bHideWhenCListShow && bIsCListShow) ? SW_HIDE : SW_SHOWNA );
+ ShowWindow(hwnd, fcOpt.bHideAll || HideOnFullScreen() || (fcOpt.bHideOffline && (!IsStatusVisible(idStatus))) || (fcOpt.bHideWhenCListShow && bIsCListShow) ? SW_HIDE : SW_SHOWNA);
}
void ThumbInfo::DeleteContactPos()
@@ -335,12 +332,12 @@ void ThumbInfo::OnLButtonDown(int nX, int nY)
RECT rc;
GetThumbRect(&rc);
-
- nLeft = rc.left;
- nTop = rc.top;
-
- bMouseDown = TRUE;
- bMouseMoved = FALSE;
+
+ nLeft = rc.left;
+ nTop = rc.top;
+
+ bMouseDown = TRUE;
+ bMouseMoved = FALSE;
}
void ThumbInfo::OnLButtonUp()
@@ -354,14 +351,14 @@ void ThumbInfo::OnLButtonUp()
if (bMouseDown) {
bMouseDown = FALSE;
- SetCursor( LoadCursor(NULL, IDC_ARROW));
-
+ SetCursor(LoadCursor(NULL, IDC_ARROW));
+
// Check whether we shoud remove the window
- GetWindowRect( hwndMiranda, &rcMiranda );
- GetThumbRect( &rcThumb );
+ GetWindowRect(hwndMiranda, &rcMiranda);
+ GetThumbRect(&rcThumb);
- if ( IntersectRect(&rcOverlap, &rcMiranda, &rcThumb)) {
- if ( IsWindowVisible(hwndMiranda)) {
+ if (IntersectRect(&rcOverlap, &rcMiranda, &rcThumb)) {
+ if (IsWindowVisible(hwndMiranda)) {
DeleteContactPos();
thumbList.RemoveThumb(this);
}
@@ -373,42 +370,35 @@ void ThumbInfo::OnLButtonUp()
void ThumbInfo::OnMouseMove(int nX, int nY, WPARAM wParam)
{
- int dX;
- int dY;
- POINT ptNew;
-
// Position thumb
-
if (bMouseDown) {
- ptNew.x = nX;
- ptNew.y = nY;
-
- ClientToScreen( hwnd, &ptNew );
-
- dX = ptNew.x - ptOld.x;
- dY = ptNew.y - ptOld.y;
-
+ POINT ptNew = { nX, nY };
+ ClientToScreen(hwnd, &ptNew);
+
+ int dX = ptNew.x - ptOld.x;
+ int dY = ptNew.y - ptOld.y;
+
if (dX || dY) {
- bMouseMoved = TRUE;
+ bMouseMoved = TRUE;
- nLeft += dX;
- nTop += dY;
+ nLeft += dX;
+ nTop += dY;
- PositionThumb( nLeft, nTop );
+ PositionThumb(nLeft, nTop);
}
ptOld = ptNew;
}
- else SetCursor( LoadCursor(NULL, IDC_ARROW));
+ else SetCursor(LoadCursor(NULL, IDC_ARROW));
// Update selection status
- if ( !pThumbMouseIn ) {
- SetTimer( hwnd, TIMERID_LEAVE_T, 10, NULL );
+ if (!pThumbMouseIn) {
+ SetTimer(hwnd, TIMERID_LEAVE_T, 10, NULL);
pThumbMouseIn = this;
ThumbSelect(TRUE);
}
-
+
if (bEnableTip && fcOpt.bShowTip && !bMouseDown) {
WORD tmpTimeIn;
POINT pt;
@@ -416,11 +406,11 @@ void ThumbInfo::OnMouseMove(int nX, int nY, WPARAM wParam)
GetCursorPos(&pt);
GetThumbRect(&rc);
- if (!PtInRect(&rc,pt)) {
+ if (!PtInRect(&rc, pt)) {
KillTip();
return;
}
- if (fTipTimerActive && abs(pt.x-ptTipSt.x)<5 && abs(pt.y-ptTipSt.x)<5)
+ if (fTipTimerActive && abs(pt.x - ptTipSt.x) < 5 && abs(pt.y - ptTipSt.x) < 5)
return;
ptTipSt = pt;
@@ -431,7 +421,7 @@ void ThumbInfo::OnMouseMove(int nX, int nY, WPARAM wParam)
if (fTipActive)
return;
- tmpTimeIn = (fcOpt.TimeIn>0)?fcOpt.TimeIn:CallService(MS_CLC_GETINFOTIPHOVERTIME, 0, 0);
+ tmpTimeIn = (fcOpt.TimeIn > 0) ? fcOpt.TimeIn : CallService(MS_CLC_GETINFOTIPHOVERTIME, 0, 0);
SetTimer(hwnd, TIMERID_HOVER_T, tmpTimeIn, 0);
fTipTimerActive = TRUE;
}
@@ -453,7 +443,7 @@ void ThumbInfo::ThumbDeselect(BOOL bMouse)
bMouseIn = FALSE;
ReleaseCapture();
}
-
+
SetThumbOpacity(fcOpt.thumbAlpha);
}
@@ -488,8 +478,8 @@ void ThumbInfo::UpdateContent()
DWORD oldColor;
int oldBkMode, index = 0;// nStatus;
UINT fStyle = ILD_NORMAL;
-
- HDC hdcDraw = bmpContent.getDC();
+
+ HDC hdcDraw = bmpContent.getDC();
SetRect(&rc, 0, 0, szSize.cx, szSize.cy);
if (NULL != hBmpBackground) {
@@ -507,7 +497,7 @@ void ThumbInfo::UpdateContent()
int maxx = (0 != (nBackgroundBmpUse & CLBF_TILEH) ? rcBkgnd.right : rcBkgnd.left + 1);
int maxy = (0 != (nBackgroundBmpUse & CLBF_TILEV) ? rcBkgnd.bottom : rcBkgnd.top + 1);
- int destw,desth;
+ int destw, desth;
switch (nBackgroundBmpUse & CLBM_TYPE) {
case CLB_STRETCH:
if (0 != (nBackgroundBmpUse & CLBF_PROPORTIONAL)) {
@@ -551,7 +541,7 @@ void ThumbInfo::UpdateContent()
for (int x = rcBkgnd.left; x < maxx; x += destw)
for (int y = rcBkgnd.top; y < maxy; y += desth)
- StretchBlt( hdcDraw, x, y, destw, desth, hdcBmp, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY );
+ StretchBlt(hdcDraw, x, y, destw, desth, hdcBmp, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY);
SelectObject(hdcBmp, hbmTmp);
DeleteDC(hdcBmp);
@@ -588,14 +578,13 @@ void ThumbInfo::UpdateContent()
int nStatus = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
int nContactStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
int nApparentMode = db_get_w(hContact, szProto, "ApparentMode", 0);
-
+
if ((nStatus == ID_STATUS_INVISIBLE && nApparentMode == ID_STATUS_ONLINE) ||
- (nStatus != ID_STATUS_INVISIBLE && nApparentMode == ID_STATUS_OFFLINE))
- {
+ (nStatus != ID_STATUS_INVISIBLE && nApparentMode == ID_STATUS_OFFLINE)) {
if (ID_STATUS_OFFLINE == nContactStatus)
index = FLT_FONTID_OFFINVIS;
else {
- index = FLT_FONTID_INVIS;
+ index = FLT_FONTID_INVIS;
if (fcOpt.bShowIdle && db_get_dw(hContact, szProto, "IdleTS", 0))
fStyle |= ILD_BLEND50;
}
@@ -608,7 +597,6 @@ void ThumbInfo::UpdateContent()
if (fcOpt.bShowIdle && db_get_dw(hContact, szProto, "IdleTS", 0))
fStyle |= ILD_BLEND50;
}
-
}
}
else {
@@ -617,16 +605,16 @@ void ThumbInfo::UpdateContent()
}
oldColor = SetTextColor(hdcDraw, tColor[index]);
-
+
HICON icon = ImageList_GetIcon(himlMiranda, iIcon, ILD_NORMAL);
MyBitmap bmptmp(size.cx, size.cy);
- bmptmp.DrawIcon(icon,0,0);//bmpContent
+ bmptmp.DrawIcon(icon, 0, 0);//bmpContent
BLENDFUNCTION blend;
blend.BlendOp = AC_SRC_OVER;
blend.BlendFlags = 0;
- blend.SourceConstantAlpha = (fStyle&ILD_BLEND50)?128:255;
+ blend.SourceConstantAlpha = (fStyle&ILD_BLEND50) ? 128 : 255;
blend.AlphaFormat = AC_SRC_ALPHA;
- AlphaBlend(hdcDraw, 2,( szSize.cy - size.cx ) / 2, bmptmp.getWidth(), bmptmp.getHeight(), bmptmp.getDC(), 0, 0, bmptmp.getWidth(), bmptmp.getHeight(), blend);
+ AlphaBlend(hdcDraw, 2, (szSize.cy - size.cx) / 2, bmptmp.getWidth(), bmptmp.getHeight(), bmptmp.getDC(), 0, 0, bmptmp.getWidth(), bmptmp.getHeight(), blend);
DestroyIcon(icon);
SetRect(&rcText, 0, 0, szSize.cx, szSize.cy);
@@ -639,28 +627,28 @@ void ThumbInfo::UpdateContent()
SetTextColor(hdcDraw, bkColor);
// simple border
- bmpContent.DrawText(ptszName, rcText.left-1, (rcText.top + rcText.bottom - szText.cy)/2);
- bmpContent.DrawText(ptszName, rcText.left+1, (rcText.top + rcText.bottom - szText.cy)/2);
- bmpContent.DrawText(ptszName, rcText.left, (rcText.top + rcText.bottom - szText.cy)/2-1);
- bmpContent.DrawText(ptszName, rcText.left, (rcText.top + rcText.bottom - szText.cy)/2+1);
+ bmpContent.DrawText(ptszName, rcText.left - 1, (rcText.top + rcText.bottom - szText.cy) / 2);
+ bmpContent.DrawText(ptszName, rcText.left + 1, (rcText.top + rcText.bottom - szText.cy) / 2);
+ bmpContent.DrawText(ptszName, rcText.left, (rcText.top + rcText.bottom - szText.cy) / 2 - 1);
+ bmpContent.DrawText(ptszName, rcText.left, (rcText.top + rcText.bottom - szText.cy) / 2 + 1);
// blurred border
// bmpContent.DrawText(ptszName, rcText.left, (rcText.top + rcText.bottom - szText.cy)/2, 3);
// text itself
SetTextColor(hdcDraw, tColor[index]);
- bmpContent.DrawText(ptszName, rcText.left, (rcText.top + rcText.bottom - szText.cy)/2);
-
+ bmpContent.DrawText(ptszName, rcText.left, (rcText.top + rcText.bottom - szText.cy) / 2);
+
SelectObject(hdcDraw, hOldFont);
-
+
SetTextColor(hdcDraw, oldColor);
SetBkMode(hdcDraw, oldBkMode);
- SetWindowLongPtr( hwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED );
+ SetWindowLongPtr(hwnd, GWL_EXSTYLE, GetWindowLongPtr(hwnd, GWL_EXSTYLE) | WS_EX_LAYERED);
GetWindowRect(hwnd, &rc);
- POINT ptDst = {rc.left, rc.top};
- POINT ptSrc = {0, 0};
+ POINT ptDst = { rc.left, rc.top };
+ POINT ptSrc = { 0, 0 };
blend.BlendOp = AC_SRC_OVER;
blend.BlendFlags = 0;
@@ -678,8 +666,8 @@ void ThumbInfo::PopupMessageDialog()
void ThumbInfo::OnTimer(BYTE idTimer)
{
if (idTimer == TIMERID_SELECT_T) {
- KillTimer( hwnd, TIMERID_SELECT_T );
- ThumbDeselect( FALSE );
+ KillTimer(hwnd, TIMERID_SELECT_T);
+ ThumbDeselect(FALSE);
}
if (idTimer == TIMERID_LEAVE_T && !bMouseDown) {
POINT pt;
@@ -688,20 +676,20 @@ void ThumbInfo::OnTimer(BYTE idTimer)
GetCursorPos(&pt);
GetThumbRect(&rc);
if (!PtInRect(&rc, pt)) {
- KillTimer( hwnd, TIMERID_LEAVE_T );
- pThumbMouseIn = NULL;
- ThumbDeselect( TRUE );
+ KillTimer(hwnd, TIMERID_LEAVE_T);
+ pThumbMouseIn = NULL;
+ ThumbDeselect(TRUE);
}
}
if (bEnableTip && fcOpt.bShowTip && idTimer == TIMERID_HOVER_T) {
POINT pt;
- CLCINFOTIP ti = {0};
+ CLCINFOTIP ti = { 0 };
ti.cbSize = sizeof(ti);
KillTimer(hwnd, TIMERID_HOVER_T);
fTipTimerActive = FALSE;
GetCursorPos(&pt);
- if (abs(pt.x-ptTipSt.x)<5 && abs(pt.y-ptTipSt.y)<5) {
+ if (abs(pt.x - ptTipSt.x) < 5 && abs(pt.y - ptTipSt.y) < 5) {
ti.ptCursor = pt;
fTipActive = TRUE;
@@ -713,11 +701,11 @@ void ThumbInfo::OnTimer(BYTE idTimer)
}
}
-void DockThumbs( ThumbInfo *pThumbLeft, ThumbInfo *pThumbRight, BOOL bMoveLeft )
+void DockThumbs(ThumbInfo *pThumbLeft, ThumbInfo *pThumbRight, BOOL bMoveLeft)
{
if (pThumbRight->dockOpt.hwndLeft == NULL && pThumbLeft->dockOpt.hwndRight == NULL) {
- pThumbRight->dockOpt.hwndLeft = pThumbLeft->hwnd;
- pThumbLeft->dockOpt.hwndRight = pThumbRight->hwnd;
+ pThumbRight->dockOpt.hwndLeft = pThumbLeft->hwnd;
+ pThumbLeft->dockOpt.hwndRight = pThumbRight->hwnd;
}
}
@@ -732,7 +720,7 @@ void UndockThumbs(ThumbInfo *pThumb1, ThumbInfo *pThumb2)
if (pThumb1->dockOpt.hwndLeft == pThumb2->hwnd)
pThumb1->dockOpt.hwndLeft = NULL;
-
+
if (pThumb2->dockOpt.hwndRight == pThumb1->hwnd)
pThumb2->dockOpt.hwndRight = NULL;
@@ -743,13 +731,11 @@ void UndockThumbs(ThumbInfo *pThumb1, ThumbInfo *pThumb2)
/////////////////////////////////////////////////////////////////////////////
// ThumbList
-ThumbList::ThumbList(): OBJLIST<ThumbInfo>(1, NumericKeySortT)
-{
-}
+ThumbList::ThumbList() : OBJLIST<ThumbInfo>(1, NumericKeySortT)
+{}
ThumbList::~ThumbList()
-{
-}
+{}
ThumbInfo *ThumbList::AddThumb(HWND hwnd, TCHAR *ptszName, MCONTACT hContact)
{
@@ -757,7 +743,7 @@ ThumbInfo *ThumbList::AddThumb(HWND hwnd, TCHAR *ptszName, MCONTACT hContact)
return NULL;
ThumbInfo *pThumb = new ThumbInfo;
- _tcsncpy( pThumb->ptszName, ptszName, USERNAME_LEN - 1);
+ _tcsncpy_s(pThumb->ptszName, ptszName, _TRUNCATE);
pThumb->hContact = hContact;
pThumb->hwnd = hwnd;