summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--plugins/FloatingContacts/src/bitmap_funcs.cpp12
-rw-r--r--plugins/FloatingContacts/src/filedrop.cpp28
-rw-r--r--plugins/FloatingContacts/src/filedrop.h2
-rw-r--r--plugins/FloatingContacts/src/main.cpp507
-rw-r--r--plugins/FloatingContacts/src/options.cpp6
-rw-r--r--plugins/FloatingContacts/src/thumbs.cpp146
-rw-r--r--plugins/FloatingContacts/src/version.h2
7 files changed, 322 insertions, 381 deletions
diff --git a/plugins/FloatingContacts/src/bitmap_funcs.cpp b/plugins/FloatingContacts/src/bitmap_funcs.cpp
index 6a9f31ee45..d176ebc159 100644
--- a/plugins/FloatingContacts/src/bitmap_funcs.cpp
+++ b/plugins/FloatingContacts/src/bitmap_funcs.cpp
@@ -1053,7 +1053,7 @@ bool MyBitmap::loadFromFile_png(const char *fn, const char *fnAlpha)
BYTE *pDibBits;
if ((hFile = CreateFileA(fn, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, NULL)) != INVALID_HANDLE_VALUE)
if ((hMap = CreateFileMapping(hFile, NULL, PAGE_READONLY, 0, 0, NULL)) != NULL)
- if ((ppMap = (BYTE*)MapViewOfFile( hMap, FILE_MAP_READ, 0, 0, 0 )) != NULL)
+ if ((ppMap = (BYTE*)MapViewOfFile( hMap, FILE_MAP_READ, 0, 0, 0)) != NULL)
cbFileSize = GetFileSize(hFile, NULL);
if (cbFileSize)
{
@@ -1096,10 +1096,10 @@ bool MyBitmap::loadFromFile_png(const char *fn, const char *fnAlpha)
BYTE *p1 = (BYTE *)bits + (bi->bmiHeader.biHeight-y-1)*bi->bmiHeader.biWidth*4;
for (int x = 0; x<bi->bmiHeader.biWidth; ++x)
{
- p1[0] = p2[0];
- p1[1] = p2[1];
- p1[2] = p2[2];
- p1[3] = p2[3];
+ p1[0] = p2[0];
+ p1[1] = p2[1];
+ p1[2] = p2[2];
+ p1[3] = p2[3];
p1 += 4;
p2 += 4;
}
@@ -1143,7 +1143,7 @@ bool MyBitmap::loadFromFile_default(const char *fn, const char *fnAlpha)
(alpha.getHeight() == height))
{
for (int i = 0; i < width*height; i++)
- bits[i] = (bits[i] & 0x00ffffff) | ( (alpha.bits[i] & 0x000000ff) << 24 );
+ bits[i] = (bits[i] & 0x00ffffff) | ((alpha.bits[i] & 0x000000ff) << 24 );
premultipleChannels();
} else
{
diff --git a/plugins/FloatingContacts/src/filedrop.cpp b/plugins/FloatingContacts/src/filedrop.cpp
index 9d83459efb..1a869d6433 100644
--- a/plugins/FloatingContacts/src/filedrop.cpp
+++ b/plugins/FloatingContacts/src/filedrop.cpp
@@ -49,8 +49,8 @@ HRESULT STDMETHODCALLTYPE CDropTarget::DragOver( DWORD fKeyState, POINTL pt, DWO
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 ))
@@ -154,9 +154,9 @@ HRESULT STDMETHODCALLTYPE CDropTarget::Drop( IDataObject *pData,DWORD fKeyState,
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 ));
+ char **ppDroppedItems = ( char** )malloc( sizeof(char*)*( nDroppedItemsCount + 1));
if ( ppDroppedItems == NULL )
{
@@ -165,7 +165,7 @@ BOOL OnDropFiles( HDROP hDrop, ThumbInfo *pThumb )
ppDroppedItems[ nDroppedItemsCount ] = NULL;
- char szFilename[ MAX_PATH ];
+ char szFilename[MAX_PATH];
for (UINT iItem = 0; iItem < nDroppedItemsCount; ++iItem )
{
DragQueryFileA( hDrop, iItem, szFilename, sizeof( szFilename ));
@@ -174,7 +174,7 @@ BOOL OnDropFiles( HDROP hDrop, ThumbInfo *pThumb )
UINT nFilesCount = CountDroppedFiles( ppDroppedItems, nDroppedItemsCount );
- char **ppFiles = ( char** )malloc( sizeof( char *)* ( nFilesCount+1 ));
+ char **ppFiles = ( char** )malloc( sizeof( char *)* ( nFilesCount+1));
if ( ppFiles == NULL )
{
@@ -220,11 +220,11 @@ static int CountFiles( char *szItem )
if ( fd.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY )
{
// Skip parent directories
- if ( ( 0 != strcmp( fd.cFileName, "." )) &&
+ if (( 0 != strcmp( fd.cFileName, "." )) &&
( 0 != strcmp( fd.cFileName, ".." )) )
{
- char szDirName[ MAX_PATH ];
- strncpy( szDirName, szItem, MAX_PATH - 1 );
+ char szDirName[MAX_PATH];
+ strncpy( szDirName, szItem, MAX_PATH - 1);
if ( NULL != strstr( szItem, "*.*" ))
{
@@ -262,11 +262,11 @@ static void SaveFiles( char *szItem, char **ppFiles, int *pnCount )
if ( fd.dwFileAttributes == FILE_ATTRIBUTE_DIRECTORY )
{
// Skip parent directories
- if ( ( 0 != strcmp( fd.cFileName, "." )) &&
+ if (( 0 != strcmp( fd.cFileName, "." )) &&
( 0 != strcmp( fd.cFileName, ".." )) )
{
- char szDirName[ MAX_PATH ];
- strncpy( szDirName, szItem, MAX_PATH - 1 );
+ char szDirName[MAX_PATH];
+ strncpy( szDirName, szItem, MAX_PATH - 1);
if ( NULL != strstr( szItem, "*.*" ))
{
@@ -287,12 +287,12 @@ static void SaveFiles( char *szItem, char **ppFiles, int *pnCount )
size_t nSize = sizeof(char) * ( strlen( szItem ) + strlen( fd.cFileName ) + sizeof( char ));
char *szFile = (char*) malloc( nSize ) ;
- strncpy( szFile, szItem, nSize - 1 );
+ strncpy( szFile, szItem, nSize - 1);
if ( NULL != strstr( szFile, "*.*" ))
{
szFile[ strlen( szFile ) - 3 ] = '\0';
- strncat( szFile, fd.cFileName, MAX_PATH - 1 );
+ strncat( szFile, fd.cFileName, MAX_PATH - 1);
}
ppFiles[ *pnCount ] = szFile;
diff --git a/plugins/FloatingContacts/src/filedrop.h b/plugins/FloatingContacts/src/filedrop.h
index b5c7f803aa..7627ab5325 100644
--- a/plugins/FloatingContacts/src/filedrop.h
+++ b/plugins/FloatingContacts/src/filedrop.h
@@ -1,7 +1,7 @@
/* This file is a modification of clcfiledrop.h originally
written by Richard Hughes*/
-static HWND hwndCurDrag = NULL;
+static HWND hwndCurDrag = NULL;
class CDropTarget: public IDropTarget
{
diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp
index a3862997e0..d9a74482eb 100644
--- a/plugins/FloatingContacts/src/main.cpp
+++ b/plugins/FloatingContacts/src/main.cpp
@@ -26,80 +26,79 @@ BOOL (WINAPI *pUpdateLayeredWindow)
// Globals
// TODO: move to some more approriate place, probably part of Thumbs manager
-static void LoadContacts ( void );
-static void LoadContact ( HANDLE hContact );
+static void LoadContacts(void);
+static void LoadContact(HANDLE hContact);
// Internal funcs
-static void RepaintWindow ( HWND hwnd, HDC hdc );
-static void LoadMenus ();
-static void CreateThumbWnd ( TCHAR *ptszName, HANDLE hContact, int nX, int nY );
-static void RegisterWindowClass ( void );
-static void UnregisterWindowClass ( void );
-static void LoadDBSettings ( void );
-static void CreateThumbsFont ( void );
-static void CreateBackgroundBrush ( void );
-static int GetContactStatus ( HANDLE hContact );
-static void GetScreenRect ( void );
-extern void SetThumbsOpacity ( BYTE btAlpha );
-static int ClcStatusToPf2 ( int status );
-
-static LRESULT __stdcall CommWndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
-static LRESULT __stdcall newMirandaWndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam );
+static void RepaintWindow(HWND hwnd, HDC hdc);
+static void LoadMenus();
+static void CreateThumbWnd(TCHAR *ptszName, HANDLE hContact, int nX, int nY);
+static void RegisterWindowClass(void);
+static void UnregisterWindowClass(void);
+static void LoadDBSettings(void);
+static void CreateThumbsFont(void);
+static void CreateBackgroundBrush(void);
+static int GetContactStatus(HANDLE hContact);
+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);
-HINSTANCE hInst = NULL;
-HFONT hFont[FLT_FONTIDS] = {NULL};
-COLORREF tColor[FLT_FONTIDS] = {0};
-HIMAGELIST himl = NULL;
-HANDLE hNewContact = NULL;
-
-HPEN hLTEdgesPen = NULL;
-HPEN hRBEdgesPen = NULL;
-HBRUSH hBkBrush = NULL;
-DWORD bkColor = 0;
-HBITMAP hBmpBackground = NULL;
-WORD nBackgroundBmpUse = CLB_STRETCH;
-
-HWND hwndMiranda = NULL;
-BOOL bVersionOK = FALSE;
-BOOL bDockHorz = TRUE;
-//UINT nStatus = 0;
-HMENU hContactMenu = NULL;
-RECT rcScreen;
-DWORD dwOfflineModes = 0;
-BOOL bEnableTip = FALSE;
-UINT_PTR ToTopTimerID = 0;
-BOOL bIsCListShow = TRUE;
+HINSTANCE hInst;
+HFONT hFont[FLT_FONTIDS];
+COLORREF tColor[FLT_FONTIDS];
+HIMAGELIST himl;
+HANDLE hNewContact;
+
+HPEN hLTEdgesPen;
+HPEN hRBEdgesPen;
+HBRUSH hBkBrush;
+DWORD bkColor;
+HBITMAP hBmpBackground;
+WORD nBackgroundBmpUse = CLB_STRETCH;
+HANDLE hwndList;
+
+HWND hwndMiranda;
+BOOL bVersionOK;
+BOOL bDockHorz = TRUE;
+HMENU hContactMenu;
+RECT rcScreen;
+DWORD dwOfflineModes;
+BOOL bEnableTip;
+UINT_PTR ToTopTimerID;
+BOOL bIsCListShow;
HGENMENU hMenuItemRemove, hMenuItemHideAll, hMainMenuItemHideAll;
int hLangpack;
-pfnSHAutoComplete fnSHAutoComplete = NULL;
+pfnSHAutoComplete fnSHAutoComplete;
//Options
FCOptions fcOpt = {0};
-static void InitOptions() {
- fcOpt.thumbAlpha = 255;
- fcOpt.bHideOffline = FALSE;
- fcOpt.bHideAll = FALSE;
- fcOpt.bHideWhenFullscreen = FALSE;
- fcOpt.bMoveTogether = FALSE;
- fcOpt.bFixedWidth = FALSE;
- fcOpt.nThumbWidth = 0;
- fcOpt.bShowTip = TRUE;
- fcOpt.TimeIn = 0;
- fcOpt.bToTop = TRUE;
- fcOpt.ToTopTime = TOTOPTIME_DEF;
- fcOpt.bHideWhenCListShow = FALSE;
- fcOpt.bUseSingleClick = FALSE;
- fcOpt.bShowIdle = TRUE;
+static void InitOptions()
+{
+ fcOpt.thumbAlpha = 255;
+ fcOpt.bHideOffline = FALSE;
+ fcOpt.bHideAll = FALSE;
+ fcOpt.bHideWhenFullscreen = FALSE;
+ fcOpt.bMoveTogether = FALSE;
+ fcOpt.bFixedWidth = FALSE;
+ fcOpt.nThumbWidth = 0;
+ fcOpt.bShowTip = TRUE;
+ fcOpt.TimeIn = 0;
+ fcOpt.bToTop = TRUE;
+ fcOpt.ToTopTime = TOTOPTIME_DEF;
+ fcOpt.bHideWhenCListShow = FALSE;
+ fcOpt.bUseSingleClick = FALSE;
+ fcOpt.bShowIdle = TRUE;
}
-PLUGININFOEX pluginInfoEx = {
+PLUGININFOEX pluginInfoEx =
+{
sizeof(PLUGININFOEX),
__PLUGIN_NAME,
PLUGIN_MAKE_VERSION(__MAJOR_VERSION, __MINOR_VERSION, __RELEASE_NUM, __BUILD_NUM),
@@ -142,26 +141,23 @@ static LPCTSTR s_fonts[FLT_FONTIDS] =
///////////////////////////////////////////////////////
// Hooked events
-static int OnContactDeleted( WPARAM wParam, LPARAM lParam )
+static int OnContactDeleted(WPARAM wParam, LPARAM lParam)
{
- HANDLE hContact = ( HANDLE )wParam;
- ThumbInfo *pThumb = thumbList.FindThumbByContact( hContact );
- if (!pThumb) return 0;
-
- pThumb->DeleteContactPos();
- thumbList.RemoveThumb(pThumb);
-
+ HANDLE hContact = (HANDLE)wParam;
+ ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact);
+ if (pThumb) {
+ pThumb->DeleteContactPos();
+ thumbList.RemoveThumb(pThumb);
+ }
return 0;
}
-
-static int OnContactIconChanged( WPARAM wParam, LPARAM lParam )
+static int OnContactIconChanged(WPARAM wParam, LPARAM lParam)
{
- HANDLE hContact = ( HANDLE )wParam;
- ThumbInfo *pThumb = thumbList.FindThumbByContact( hContact );
-
- if ( pThumb ) {
- pThumb->RefreshContactIcon( ( int )lParam );
+ HANDLE hContact = (HANDLE)wParam;
+ ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact);
+ if (pThumb) {
+ pThumb->RefreshContactIcon((int)lParam);
//pThumb->ThumbSelect( FALSE );
//SetTimer( pThumb->hwnd, TIMERID_SELECT_T, 1000, NULL );
}
@@ -169,48 +165,43 @@ static int OnContactIconChanged( WPARAM wParam, LPARAM lParam )
return 0;
}
-
-static int OnContactDrag( WPARAM wParam, LPARAM lParam )
+static int OnContactDrag(WPARAM wParam, LPARAM lParam)
{
- ThumbInfo *pNewThumb = NULL;
- HANDLE hContact = ( HANDLE )wParam;
- ThumbInfo *pThumb = thumbList.FindThumbByContact( hContact );
- TCHAR *ptName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, (LPARAM)GCDNF_TCHAR );
- int idStatus = ID_STATUS_OFFLINE;
+ ThumbInfo *pNewThumb = NULL;
+ HANDLE hContact = (HANDLE)wParam;
+ ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact);
+ TCHAR *ptName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, wParam, (LPARAM)GCDNF_TCHAR );
+ int idStatus = ID_STATUS_OFFLINE;
POINT pt;
GetCursorPos(&pt);
- if ( pThumb == NULL ) {
- idStatus = GetContactStatus( hContact );
+ if (pThumb == NULL) {
+ idStatus = GetContactStatus(hContact);
if ( !fcOpt.bHideAll && !HideOnFullScreen() && ( !fcOpt.bHideOffline || IsStatusVisible( idStatus )) && (!fcOpt.bHideWhenCListShow || !bIsCListShow)) {
- CreateThumbWnd( ptName, hContact, pt.x, pt.y );
- pNewThumb = thumbList.FindThumbByContact( hContact );
- ShowWindow( pNewThumb->hwnd, SW_SHOWNA );
+ CreateThumbWnd(ptName, hContact, pt.x, pt.y);
+ pNewThumb = thumbList.FindThumbByContact(hContact);
+ ShowWindow(pNewThumb->hwnd, SW_SHOWNA);
hNewContact = hContact;
OnStatusChanged();
}
}
- else if ( hContact == hNewContact )
+ else if (hContact == hNewContact)
pThumb->PositionThumb(pt.x - 5, pt.y - 5);
- return( hNewContact != NULL ? 1 : 0 );
+ return hNewContact != NULL;
}
-
-
-static int OnContactDrop( WPARAM wParam, LPARAM lParam )
+static int OnContactDrop(WPARAM wParam, LPARAM lParam)
{
- RECT rcMiranda;
- RECT rcThumb;
-// RECT rcOverlap;
+ RECT rcMiranda;
+ RECT rcThumb;
- HANDLE hContact = ( HANDLE )wParam;
- ThumbInfo *pThumb = thumbList.FindThumbByContact( hContact );
+ HANDLE hContact = (HANDLE)wParam;
+ ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact);
- if ( ( hNewContact == hContact ) && ( pThumb != NULL ))
- {
+ if (hNewContact == hContact && pThumb != NULL) {
hNewContact = NULL;
GetWindowRect( hwndMiranda, &rcMiranda );
@@ -219,15 +210,13 @@ static int OnContactDrop( WPARAM wParam, LPARAM lParam )
SaveContactsPos();
- return( 1 );
+ return 1;
}
-
-static int OnContactDragStop( WPARAM wParam, LPARAM lParam )
+static int OnContactDragStop(WPARAM wParam, LPARAM lParam)
{
- HANDLE hContact = ( HANDLE )wParam;
- ThumbInfo *pThumb = thumbList.FindThumbByContact( hContact );
-
+ HANDLE hContact = (HANDLE)wParam;
+ ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact);
if (pThumb != NULL && hNewContact == hContact ) {
thumbList.RemoveThumb( pThumb );
hNewContact = NULL;
@@ -236,11 +225,10 @@ static int OnContactDragStop( WPARAM wParam, LPARAM lParam )
return 0;
}
-
-static int OnSkinIconsChanged( WPARAM wParam, LPARAM lParam )
+static int OnSkinIconsChanged(WPARAM wParam, LPARAM lParam)
{
// Get handle to the image list
- himl = ( HIMAGELIST )CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0 );
+ himl = ( HIMAGELIST )CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0);
// Update thumbs
for (int i = 0; i < thumbList.getCount(); ++i)
@@ -249,19 +237,15 @@ static int OnSkinIconsChanged( WPARAM wParam, LPARAM lParam )
return 0;
}
-
-
-static int OnContactSettingChanged( WPARAM wParam, LPARAM lParam )
+static int OnContactSettingChanged(WPARAM wParam, LPARAM lParam)
{
- HANDLE hContact = ( HANDLE )wParam;
- ThumbInfo *pThumb = thumbList.FindThumbByContact( hContact );
- int idStatus = ID_STATUS_OFFLINE;
- BOOL bRefresh = TRUE;
- DBCONTACTWRITESETTING* pdbcws = ( DBCONTACTWRITESETTING* )lParam;
+ HANDLE hContact = (HANDLE)wParam;
+ ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact);
+ int idStatus = ID_STATUS_OFFLINE;
+ BOOL bRefresh = TRUE;
+ DBCONTACTWRITESETTING* pdbcws = (DBCONTACTWRITESETTING*)lParam;
-
- if ( hContact == NULL )
- {
+ if (hContact == NULL) {
if (( 0 == _stricmp( pdbcws->szModule, "CLC" )) || ( 0 == _stricmp( pdbcws->szModule, MODULE )) ) {
LoadDBSettings();
ApplyOptionsChanges();
@@ -270,52 +254,46 @@ static int OnContactSettingChanged( WPARAM wParam, LPARAM lParam )
return 0;
}
- if ( pThumb == NULL ) return 0;
+ if ( pThumb == NULL )
+ return 0;
// Only on these 2 events we need to refresh
- if ( 0 == _stricmp( pdbcws->szSetting, "Status" ))
+ if (0 == _stricmp(pdbcws->szSetting, "Status"))
{
idStatus = pdbcws->value.wVal;
}
- else if ( 0 == _stricmp( pdbcws->szSetting, "Nick" ))
+ else if (0 == _stricmp(pdbcws->szSetting, "Nick"))
{
- idStatus = GetContactStatus( hContact );
+ idStatus = GetContactStatus(hContact);
}
- else if ( 0 == _stricmp( pdbcws->szSetting, "MyHandle" ))
+ else if (0 == _stricmp(pdbcws->szSetting, "MyHandle"))
{
- idStatus = GetContactStatus( hContact );
+ idStatus = GetContactStatus(hContact);
}
- else if ( fcOpt.bShowIdle && 0 == _stricmp( pdbcws->szSetting, "IdleTS" ))
+ else if (fcOpt.bShowIdle && 0 == _stricmp( pdbcws->szSetting, "IdleTS"))
{
- idStatus = GetContactStatus( hContact );
+ idStatus = GetContactStatus(hContact);
}
else
{
bRefresh = FALSE;
}
- if ( bRefresh )
- {
- // Detach call
- PostMessage( pThumb->hwnd, WM_REFRESH_CONTACT, 0, idStatus );
- }
+ // Detach call
+ if (bRefresh)
+ PostMessage(pThumb->hwnd, WM_REFRESH_CONTACT, 0, idStatus);
return 0;
}
-
-static int OnStatusModeChange( WPARAM wParam, LPARAM lParam )
+static int OnStatusModeChange(WPARAM wParam, LPARAM lParam)
{
- int idStatus;
-
- //nStatus = (int)wParam;
-
- for (int i = 0; i < thumbList.getCount(); ++i)
- {
- idStatus = GetContactStatus( thumbList[i]->hContact );
- thumbList[i]->RefreshContactStatus( idStatus );
+ for (int i = 0; i < thumbList.getCount(); ++i) {
+ int idStatus = GetContactStatus( thumbList[i]->hContact );
+ thumbList[i]->RefreshContactStatus(idStatus);
}
- if ( wParam == ID_STATUS_OFFLINE )
+
+ if (wParam == ID_STATUS_OFFLINE)
{
// Floating status window will use this
}
@@ -323,40 +301,35 @@ static int OnStatusModeChange( WPARAM wParam, LPARAM lParam )
return 0;
}
-
-
-static int OnPrebuildContactMenu( WPARAM wParam, LPARAM lParam )
+static int OnPrebuildContactMenu(WPARAM wParam, LPARAM lParam)
{
- ThumbInfo *pThumb = thumbList.FindThumbByContact( (HANDLE) wParam );
+ ThumbInfo *pThumb = thumbList.FindThumbByContact((HANDLE) wParam );
Menu_ShowItem(hMenuItemRemove, pThumb != NULL);
Menu_ShowItem(hMenuItemHideAll, !fcOpt.bHideAll);
return 0;
}
-
-
-
///////////////////////////////////////////////////////
// General functions
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);
@@ -367,52 +340,42 @@ static void LoadDBSettings()
void SendMsgDialog( HWND hwnd, TCHAR *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 )
{
- ThumbInfo *pThumb = thumbList.FindThumb( hwnd );
-
- if ( pThumb != NULL )
- {
- hContactMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)pThumb->hContact, 0 );
-
- if ( hContactMenu == NULL ) return;
+ ThumbInfo *pThumb = thumbList.FindThumb( hwnd );
+ if ( pThumb != NULL ) {
+ hContactMenu = (HMENU)CallService(MS_CLIST_MENUBUILDCONTACT, (WPARAM)pThumb->hContact, 0);
+ 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 );
}
}
-static LRESULT __stdcall CommWndProc( HWND hwnd,
- UINT uMsg,
- WPARAM wParam,
- LPARAM lParam )
+static LRESULT __stdcall CommWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
- LRESULT lResult = 0;
- ThumbInfo *pThumb = thumbList.FindThumb( hwnd );
+ LRESULT lResult = 0;
+ ThumbInfo *pThumb = thumbList.FindThumb(hwnd);
- switch( uMsg )
- {
+ switch(uMsg) {
case WM_RBUTTONUP:
{
POINT pt;
- pt.x = LOWORD(lParam );
- pt.y = HIWORD(lParam );
+ pt.x = LOWORD(lParam);
+ pt.y = HIWORD(lParam);
- if (pThumb) pThumb->ThumbDeselect( TRUE );
+ if (pThumb) pThumb->ThumbDeselect(TRUE);
ClientToScreen(hwnd, &pt);
ShowContactMenu( hwnd, pt );
}
-
break;
-//#if 0
case WM_NCPAINT:
if (pThumb){
HDC hdc = GetWindowDC( hwnd );
@@ -440,14 +403,13 @@ static LRESULT __stdcall CommWndProc( HWND hwnd,
//RepaintWindow(hwnd, (HDC)wParam);
break;
}
-//#endif
case WM_MEASUREITEM:
- lResult = CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam );
+ lResult = CallService(MS_CLIST_MENUMEASUREITEM, wParam, lParam);
break;
case WM_DRAWITEM:
- lResult = CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam );
+ lResult = CallService(MS_CLIST_MENUDRAWITEM, wParam, lParam);
break;
case WM_LBUTTONDOWN:
@@ -472,80 +434,66 @@ static LRESULT __stdcall CommWndProc( HWND hwnd,
break;
case WM_RBUTTONDOWN:
- if (bEnableTip && fcOpt.bShowTip && pThumb) pThumb->KillTip();
+ if (bEnableTip && fcOpt.bShowTip && pThumb)
+ pThumb->KillTip();
break;
+
case WM_REFRESH_CONTACT:
- if (pThumb)
- {
- _tcsncpy( pThumb->ptszName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)pThumb->hContact, (LPARAM)GCDNF_TCHAR ), USERNAME_LEN - 1 );
- pThumb->RefreshContactStatus( (int)lParam );
+ if (pThumb) {
+ _tcsncpy( pThumb->ptszName, (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)pThumb->hContact, (LPARAM)GCDNF_TCHAR ), USERNAME_LEN - 1);
+ pThumb->RefreshContactStatus((int)lParam);
pThumb->ResizeThumb();
}
break;
case WM_TIMER:
- if (pThumb)pThumb->OnTimer(wParam);
+ if (pThumb)
+ pThumb->OnTimer(wParam);
break;
case WM_HOTKEY:
- {
- ThumbInfo *pThumb = thumbList.FindThumb( ( HWND )wParam );
-
- if (pThumb) pThumb->PopupMessageDialog();
- }
-
- default:
- break;
+ ThumbInfo *pThumb = thumbList.FindThumb((HWND)wParam);
+ if (pThumb)
+ pThumb->PopupMessageDialog();
}
- lResult = DefWindowProc( hwnd, uMsg, wParam, lParam );
-
- return( lResult );
+ return DefWindowProc(hwnd, uMsg, wParam, lParam);
}
-
-
extern void SetThumbsOpacity( BYTE btAlpha )
{
for (int i = 0; i < thumbList.getCount(); ++i)
- thumbList[i]->SetThumbOpacity( btAlpha );
+ thumbList[i]->SetThumbOpacity(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()
{
- int idStatus = ID_STATUS_OFFLINE;
+ int idStatus = ID_STATUS_OFFLINE;
- for (int i = 0; i < thumbList.getCount(); ++i)
- {
+ for (int i = 0; i < thumbList.getCount(); ++i) {
idStatus = GetContactStatus( thumbList[i]->hContact );
thumbList[i]->RefreshContactStatus( idStatus );
}
}
-
-
void ApplyOptionsChanges()
{
CreateThumbsFont();
CreateBackgroundBrush();
-// dwOfflineModes = db_get_dw( NULL, "CLC", "OfflineModes", CLCDEFAULT_OFFLINEMODES );
- if (!fcOpt.bToTop && ToTopTimerID){
+ if (!fcOpt.bToTop && ToTopTimerID) {
KillTimer(NULL, ToTopTimerID);
ToTopTimerID = 0;
}
+
if (fcOpt.bToTop){
if (ToTopTimerID) KillTimer(NULL, ToTopTimerID);
fcOpt.ToTopTime = (fcOpt.ToTopTime<1)?1:fcOpt.ToTopTime;
@@ -559,35 +507,21 @@ void ApplyOptionsChanges()
thumbList[i]->ResizeThumb();
}
-
-
///////////////////////////////////////////////////////
// Window creation
+
static void RegisterWindowClass()
{
- WNDCLASSEX wcx;
- ZeroMemory( &wcx, sizeof( wcx ));
-
- wcx.cbSize = sizeof( WNDCLASSEX );
- wcx.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS;
- wcx.lpfnWndProc = CommWndProc;
- wcx.cbClsExtra = 0;
- wcx.cbWndExtra = 0;
- wcx.hInstance = hInst;
- wcx.hIcon = NULL;
- wcx.hCursor = NULL;
- wcx.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
- wcx.lpszMenuName = NULL;
- wcx.lpszClassName = WND_CLASS;
- wcx.hIconSm = NULL;
-
- SetLastError( 0 );
-
- RegisterClassEx( &wcx );
+ WNDCLASSEX wcx = { 0 };
+ wcx.cbSize = sizeof(WNDCLASSEX);
+ wcx.style = CS_VREDRAW | CS_HREDRAW | CS_DBLCLKS;
+ wcx.lpfnWndProc = CommWndProc;
+ wcx.hInstance = hInst;
+ wcx.hbrBackground = GetSysColorBrush(COLOR_3DFACE);
+ wcx.lpszClassName = WND_CLASS;
+ RegisterClassEx(&wcx);
}
-
-
static void UnregisterWindowClass()
{
UnregisterClass( WND_CLASS, hInst );
@@ -595,7 +529,7 @@ static void UnregisterWindowClass()
static void CreateThumbWnd(TCHAR *ptszName, HANDLE hContact, int nX, int nY)
{
- ThumbInfo *pThumb = thumbList.FindThumbByContact( hContact );
+ ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact);
if (pThumb != NULL)
return;
@@ -605,16 +539,18 @@ static void CreateThumbWnd(TCHAR *ptszName, HANDLE hContact, int nX, int nY)
if (hwnd == NULL)
return;
- pThumb = thumbList.AddThumb( hwnd, ptszName, hContact );
- SetWindowLongPtr( hwnd, GWLP_USERDATA, (long)pThumb );
+ pThumb = thumbList.AddThumb(hwnd, ptszName, hContact);
+ SetWindowLongPtr(hwnd, GWLP_USERDATA, (long)pThumb);
pThumb->ResizeThumb();
- pThumb->SetThumbOpacity( fcOpt.thumbAlpha );
- ShowWindow( hwnd, ( fcOpt.bHideAll || HideOnFullScreen() || fcOpt.bHideOffline || (fcOpt.bHideWhenCListShow && bIsCListShow))? SW_HIDE : SW_SHOWNA );
+ pThumb->SetThumbOpacity(fcOpt.thumbAlpha);
+ ShowWindow( hwnd, (fcOpt.bHideAll || HideOnFullScreen() || fcOpt.bHideOffline || (fcOpt.bHideWhenCListShow && bIsCListShow)) ? SW_HIDE : SW_SHOWNA);
pThumb->PositionThumb(nX, nY);
// force repaint
pThumb->UpdateContent();
+
+ WindowList_Add(hwndList, hwnd, hContact);
}
static void CreateThumbsFont()
@@ -681,13 +617,13 @@ 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);
}
-static int GetContactStatus( HANDLE hContact )
+static int GetContactStatus(HANDLE hContact)
{
if (hContact == NULL) {
assert( !"Contact is NULL" );
@@ -702,7 +638,7 @@ static int GetContactStatus( HANDLE hContact )
}
-static int ClcStatusToPf2( int status )
+static int ClcStatusToPf2(int status)
{
switch(status) {
case ID_STATUS_ONLINE: return PF2_ONLINE;
@@ -719,14 +655,14 @@ static int ClcStatusToPf2( int status )
return 0;
}
-BOOL IsStatusVisible( int status )
+BOOL IsStatusVisible(int status)
{
- return ( 0 == ( dwOfflineModes & ClcStatusToPf2( status )) );
+ return (0 == (dwOfflineModes & ClcStatusToPf2(status)));
}
-void RegHotkey( HANDLE hContact, HWND hwnd )
+void RegHotkey(HANDLE hContact, HWND hwnd)
{
- char szBuf[ MAX_PATH ] = {0};
+ char szBuf[MAX_PATH] = {0};
DBVARIANT dbv;
if (db_get_s(hContact, MODULE, "Hotkey", &dbv)) return;
@@ -737,7 +673,7 @@ void RegHotkey( HANDLE hContact, HWND hwnd )
UINT nModifiers = 0;
char chKey = 0;
char szMod[2][20] = {0};
- char szKey[20] = {0};
+ char szKey[20] = {0};
sscanf( szBuf, "%[^'+']+%[^'+']+%[^'+']", szMod[0], szMod[1], szKey );
@@ -763,30 +699,27 @@ void RegHotkey( HANDLE hContact, HWND hwnd )
void SaveContactsPos()
{
- RECT rc;
+ for (int i = 0; i < thumbList.getCount(); ++i) {
+ SetLastError( 0);
- for (int i = 0; i < thumbList.getCount(); ++i)
- {
- SetLastError( 0 );
-
- thumbList[i]->GetThumbRect( &rc );
+ RECT rc;
+ thumbList[i]->GetThumbRect(&rc);
if ( 0 == GetLastError())
db_set_dw( thumbList[i]->hContact, MODULE, "ThumbsPos", DB_POS_MAKE_XY(rc.left, rc.top));
}
}
-
static void LoadContacts()
{
for (HANDLE hContact = db_find_first(); hContact; hContact = db_find_next(hContact))
- LoadContact( hContact );
+ LoadContact(hContact);
}
/////////////////////////////////////////////////////////////////////////////////////////
// Menus
-static INT_PTR OnMainMenu_HideAll( WPARAM wParam, LPARAM lParam )
+static INT_PTR OnMainMenu_HideAll(WPARAM wParam, LPARAM lParam)
{
fcOpt.bHideAll = !fcOpt.bHideAll;
db_set_b(NULL, MODULE, "HideAll", (BYTE)fcOpt.bHideAll);
@@ -800,10 +733,10 @@ static INT_PTR OnMainMenu_HideAll( WPARAM wParam, LPARAM lParam )
return 0;
}
-static INT_PTR OnContactMenu_Remove( WPARAM wParam, LPARAM lParam )
+static INT_PTR OnContactMenu_Remove(WPARAM wParam, LPARAM lParam)
{
- HANDLE hContact = ( HANDLE )wParam;
- ThumbInfo *pThumb = thumbList.FindThumbByContact( hContact );
+ HANDLE hContact = (HANDLE)wParam;
+ ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact);
if (pThumb) {
pThumb->DeleteContactPos();
@@ -814,7 +747,7 @@ static INT_PTR OnContactMenu_Remove( WPARAM wParam, LPARAM lParam )
return 0;
}
-static INT_PTR OnHotKey_HideWhenCListShow( WPARAM wParam, LPARAM lParam )
+static INT_PTR OnHotKey_HideWhenCListShow(WPARAM wParam, LPARAM lParam)
{
fcOpt.bHideWhenCListShow = !fcOpt.bHideWhenCListShow;
db_set_b(NULL, MODULE, "HideWhenCListShow", (BYTE)fcOpt.bHideWhenCListShow);
@@ -863,24 +796,23 @@ static void LoadMenus()
static void LoadContact( HANDLE hContact )
{
- ThumbInfo *pThumb = thumbList.FindThumbByContact( hContact );
- if ( hContact == NULL )
+ ThumbInfo *pThumb = thumbList.FindThumbByContact(hContact);
+ if (hContact == NULL)
return;
- DWORD dwPos = db_get_dw( hContact, MODULE, "ThumbsPos", (DWORD)-1 );
- if ( dwPos != -1 ) {
- TCHAR *ptName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, (LPARAM)GCDNF_TCHAR );
+ DWORD dwPos = db_get_dw( hContact, MODULE, "ThumbsPos", (DWORD)-1);
+ if ( dwPos != -1) {
+ TCHAR *ptName = (TCHAR*)CallService(MS_CLIST_GETCONTACTDISPLAYNAME, (WPARAM)hContact, (LPARAM)GCDNF_TCHAR);
if ( ptName != NULL ) {
int nX = DB_POS_GETX( dwPos );
int nY = DB_POS_GETY( dwPos );
- CreateThumbWnd( ptName, hContact, nX, nY );
+ CreateThumbWnd(ptName, hContact, nX, nY);
pThumb->PositionThumb(nX, nY);
}
}
}
-
BOOL HideOnFullScreen()
{
BOOL bFullscreen = FALSE;
@@ -929,21 +861,21 @@ void ShowThumbsOnHideCList()
for (int i = 0; i < thumbList.getCount(); ++i)
if ( !fcOpt.bHideOffline || IsStatusVisible( GetContactStatus(thumbList[i]->hContact)))
- ShowWindow( thumbList[i]->hwnd, SW_SHOWNA );
+ ShowWindow(thumbList[i]->hwnd, SW_SHOWNA);
}
void HideThumbsOnShowCList()
{
- if (!fcOpt.bHideWhenCListShow || fcOpt.bHideAll || HideOnFullScreen())return;
+ if (!fcOpt.bHideWhenCListShow || fcOpt.bHideAll || HideOnFullScreen()) return;
for (int i = 0; i < thumbList.getCount(); ++i)
ShowWindow( thumbList[i]->hwnd, SW_HIDE );
}
-static LRESULT __stdcall newMirandaWndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
+static LRESULT __stdcall newMirandaWndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
if (uMsg == WM_WINDOWPOSCHANGED) {
- WINDOWPOS *wp = (WINDOWPOS *)lParam;
+ WINDOWPOS *wp = (WINDOWPOS*)lParam;
if (wp->flags & SWP_HIDEWINDOW) {
bIsCListShow = FALSE;
ShowThumbsOnHideCList();
@@ -978,7 +910,7 @@ static LRESULT __stdcall newMirandaWndProc( HWND hwnd, UINT uMsg, WPARAM wParam,
/////////////////////////////////////////////////////////////////////////////////////////
-static int OnModulesLoded( WPARAM wParam, LPARAM lParam )
+static int OnModulesLoded(WPARAM wParam, LPARAM lParam)
{
HookEvent(ME_CLIST_CONTACTICONCHANGED, OnContactIconChanged);
HookEvent(ME_SKIN_ICONSCHANGED, OnSkinIconsChanged);
@@ -1014,10 +946,18 @@ static int OnModulesLoded( WPARAM wParam, LPARAM lParam )
return 0;
}
+static int OnPreshutdown(WPARAM, LPARAM)
+{
+ WindowList_Broadcast(hwndList, WM_DESTROY, 0, 0);
+ return 0;
+}
+
extern "C" int __declspec(dllexport) Load()
{
mir_getLP(&pluginInfoEx);
+ hwndList = (HANDLE)CallService(MS_UTILS_ALLOCWINDOWLIST, 0, 0);
+
InitOptions();
for (int i=0; i < SIZEOF(s_fonts); i++) {
@@ -1034,6 +974,7 @@ extern "C" int __declspec(dllexport) Load()
}
HookEvent(ME_SYSTEM_MODULESLOADED, OnModulesLoded);
+ HookEvent(ME_SYSTEM_PRESHUTDOWN, OnPreshutdown);
HMODULE hUserDll = GetModuleHandleA("user32.dll");
if (hUserDll) {
diff --git a/plugins/FloatingContacts/src/options.cpp b/plugins/FloatingContacts/src/options.cpp
index be3a659c47..c28b3c767f 100644
--- a/plugins/FloatingContacts/src/options.cpp
+++ b/plugins/FloatingContacts/src/options.cpp
@@ -119,19 +119,19 @@ 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);
+ 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);
+ 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);
+ 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);
diff --git a/plugins/FloatingContacts/src/thumbs.cpp b/plugins/FloatingContacts/src/thumbs.cpp
index 36c010beb9..2dad4164b0 100644
--- a/plugins/FloatingContacts/src/thumbs.cpp
+++ b/plugins/FloatingContacts/src/thumbs.cpp
@@ -5,13 +5,13 @@ ThumbList thumbList;
/////////////////////////////////////////////////////////////////////////////
// ThumbInfo
static POINT ptOld;
-static BOOL bMouseDown = FALSE;
-static BOOL bMouseIn = FALSE;
-static BOOL bMouseMoved = FALSE;
+static BOOL bMouseDown = FALSE;
+static BOOL bMouseIn = FALSE;
+static BOOL bMouseMoved = FALSE;
static int nLeft = 0;
static int nTop = 0;
static int nOffs = 5;
-static ThumbInfo *pThumbMouseIn = NULL;
+static ThumbInfo *pThumbMouseIn = NULL;
static void SnapToScreen( RECT rcThumb, int nX, int nY, int *pX, int *pY )
{
@@ -21,7 +21,7 @@ static void SnapToScreen( RECT rcThumb, int nX, int nY, int *pX, int *pY )
assert( NULL != pX );
assert( NULL != pY );
- nWidth = rcThumb.right - rcThumb.left;
+ nWidth = rcThumb.right - rcThumb.left;
nHeight = rcThumb.bottom - rcThumb.top;
*pX = nX < ( nOffs + rcScreen.left ) ? rcScreen.left : nX;
@@ -104,7 +104,7 @@ void ThumbInfo::PositionThumbWorker(int nX, int nY, POINT *newPos)
// Get thumb dimnsions
GetThumbRect( &rcThumb );
- nWidth = rcThumb.right - rcThumb.left;
+ nWidth = rcThumb.right - rcThumb.left;
nHeight = rcThumb.bottom - rcThumb.top;
// Docking and screen boundaries check
@@ -120,7 +120,7 @@ void ThumbInfo::PositionThumbWorker(int nX, int nY, POINT *newPos)
for (int i = 0; i < thumbList.getCount(); ++i)
{
- ThumbInfo *pCurThumb = thumbList[i];
+ ThumbInfo *pCurThumb = thumbList[i];
if ( pCurThumb != this )
{
@@ -131,38 +131,38 @@ void ThumbInfo::PositionThumbWorker(int nX, int nY, POINT *newPos)
// 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;
+ 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;
+ 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 = FALSE;
- bDockedRight = FALSE;
+ bDockedLeft = FALSE;
+ bDockedRight = FALSE;
// Upper-left
- pt.x = rcThumb.left;
- pt.y = rcThumb.top;
- bDocked = FALSE;
+ pt.x = rcThumb.left;
+ pt.y = rcThumb.top;
+ bDocked = FALSE;
if ( PtInRect( &rcRight, pt ))
{
- nNewX = rc.right;
+ nNewX = rc.right;
bDocked = TRUE;
}
@@ -178,21 +178,21 @@ void ThumbInfo::PositionThumbWorker(int nX, int nY, POINT *newPos)
if ( PtInRect( &rcTop, pt ))
{
- nNewY = rc.top;
- bDockedLeft = bDocked;
+ nNewY = rc.top;
+ bDockedLeft = bDocked;
}
// Upper-right
- pt.x = rcThumb.right;
- pt.y = rcThumb.top;
- bDocked = FALSE;
+ pt.x = rcThumb.right;
+ pt.y = rcThumb.top;
+ bDocked = FALSE;
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 )
{
@@ -213,8 +213,8 @@ void ThumbInfo::PositionThumbWorker(int nX, int nY, POINT *newPos)
if ( !bLeading && PtInRect( &rcTop, pt ))
{
- nNewY = rc.top;
- bDockedRight = bDocked;
+ nNewY = rc.top;
+ bDockedRight = bDocked;
}
if ( fcOpt.bMoveTogether )
@@ -280,17 +280,17 @@ void ThumbInfo::PositionThumbWorker(int nX, int nY, POINT *newPos)
void ThumbInfo::ResizeThumb()
{
- HDC hdc = NULL;
- HFONT hOldFont = NULL;
+ HDC hdc = NULL;
+ HFONT hOldFont = NULL;
POINT ptText;
SIZEL sizeIcon;
SIZEL sizeText;
RECT rcThumb;
- int index = FLT_FONTID_NOTONLIST;
+ int index = FLT_FONTID_NOTONLIST;
ThumbInfo *pNextThumb = NULL;
- himl = ( HIMAGELIST )CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0 );
+ himl = ( HIMAGELIST )CallService(MS_CLIST_GETICONSIMAGELIST, 0, 0);
if ( himl == NULL ) return;
@@ -351,11 +351,11 @@ void ThumbInfo::ResizeThumb()
// Transform text size
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,
@@ -381,7 +381,7 @@ void ThumbInfo::RefreshContactIcon(int iIcon)
{
if ( iIcon == 0xFFFFFFFF || ImageList_GetImageCount(himl)<=iIcon )
{
- this->iIcon = CallService(MS_CLIST_GETCONTACTICON, (WPARAM)hContact, 0 );
+ this->iIcon = CallService(MS_CLIST_GETCONTACTICON, (WPARAM)hContact, 0);
}
else
{
@@ -424,12 +424,12 @@ void ThumbInfo::OnLButtonDown(int nX, int nY)
GetCursorPos(&ptOld);
GetThumbRect(&rc);
- nLeft = rc.left;
- nTop = rc.top;
+ nLeft = rc.left;
+ nTop = rc.top;
- //bMouseIn = FALSE;
- bMouseDown = TRUE;
- bMouseMoved = FALSE;
+ //bMouseIn = FALSE;
+ bMouseDown = TRUE;
+ bMouseMoved = FALSE;
// SetCapture(hwnd);
}
@@ -490,7 +490,7 @@ void ThumbInfo::OnMouseMove(int nX, int nY, WPARAM wParam)
dY = ptNew.y - ptOld.y;
if (dX || dY){
- bMouseMoved = TRUE;
+ bMouseMoved = TRUE;
nLeft += dX;
nTop += dY;
@@ -600,7 +600,7 @@ void ThumbInfo::UpdateContent()
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 )
@@ -622,7 +622,7 @@ void ThumbInfo::UpdateContent()
height = rcBkgnd.bottom - rcBkgnd.top;
GetObject(hBmpBackground, sizeof(bmp), &bmp);
- hdcBmp = CreateCompatibleDC( hdcDraw );
+ hdcBmp = CreateCompatibleDC( hdcDraw );
hbmTmp = (HBITMAP)SelectObject( hdcBmp, hBmpBackground );
maxx = (0 != (nBackgroundBmpUse & CLBF_TILEH) ? rcBkgnd.right : rcBkgnd.left + 1);
@@ -713,7 +713,7 @@ void ThumbInfo::UpdateContent()
ImageList_GetIconSize_my( himl, size );
- oldBkMode = SetBkMode( hdcDraw, TRANSPARENT );
+ oldBkMode = SetBkMode( hdcDraw, TRANSPARENT );
if (!db_get_b(hContact, "CList", "NotOnList", 0))
{
@@ -727,9 +727,9 @@ void ThumbInfo::UpdateContent()
if ( NULL != szProto )
{
- nStatus = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
- nContactStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
- nApparentMode = db_get_w(hContact, szProto, "ApparentMode", 0);
+ nStatus = CallProtoService(szProto, PS_GETSTATUS, 0, 0);
+ nContactStatus = db_get_w(hContact, szProto, "Status", ID_STATUS_OFFLINE);
+ 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))
@@ -815,10 +815,10 @@ void ThumbInfo::UpdateContent()
POINT ptSrc = {0, 0};
BLENDFUNCTION blend;
- blend.BlendOp = AC_SRC_OVER;
- blend.BlendFlags = 0;
+ blend.BlendOp = AC_SRC_OVER;
+ blend.BlendFlags = 0;
blend.SourceConstantAlpha = 255;
- blend.AlphaFormat = AC_SRC_ALPHA;
+ blend.AlphaFormat = AC_SRC_ALPHA;
pUpdateLayeredWindow(hwnd, NULL, &ptDst, &szSize, bmpContent.getDC(), &ptSrc, 0xffffffff, &blend, ULW_ALPHA);
} else
@@ -830,7 +830,7 @@ void ThumbInfo::UpdateContent()
void ThumbInfo::PopupMessageDialog( )
{
- CallService(MS_CLIST_CONTACTDOUBLECLICKED, (WPARAM)hContact, 0 );
+ CallService(MS_CLIST_CONTACTDOUBLECLICKED, (WPARAM)hContact, 0);
}
void ThumbInfo::OnTimer(BYTE idTimer)
@@ -847,7 +847,7 @@ void ThumbInfo::OnTimer(BYTE idTimer)
GetThumbRect(&rc);
if (!PtInRect(&rc, pt)) {
KillTimer( hwnd, TIMERID_LEAVE_T );
- pThumbMouseIn = NULL;
+ pThumbMouseIn = NULL;
ThumbDeselect( TRUE );
}
}
@@ -873,17 +873,17 @@ void ThumbInfo::OnTimer(BYTE idTimer)
void DockThumbs( ThumbInfo *pThumbLeft, ThumbInfo *pThumbRight, BOOL bMoveLeft )
{
- if ( ( pThumbRight->dockOpt.hwndLeft == NULL ) && ( pThumbLeft->dockOpt.hwndRight == NULL ))
+ 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;
}
}
void UndockThumbs( ThumbInfo *pThumb1, ThumbInfo *pThumb2 )
{
- if ( ( pThumb1 == NULL ) || ( pThumb2 == NULL ))
+ if (( pThumb1 == NULL ) || ( pThumb2 == NULL ))
{
return;
}
@@ -924,7 +924,7 @@ ThumbList::~ThumbList()
ThumbInfo *ThumbList::AddThumb(HWND hwnd, TCHAR *ptszName, HANDLE hContact)
{
- ThumbInfo *pThumb = NULL;
+ ThumbInfo *pThumb = NULL;
if ( ptszName == NULL ) return( NULL );
if ( hContact == NULL ) return( NULL );
@@ -934,12 +934,12 @@ ThumbInfo *ThumbList::AddThumb(HWND hwnd, TCHAR *ptszName, HANDLE hContact)
if ( pThumb != NULL )
{
- _tcsncpy( pThumb->ptszName, ptszName, USERNAME_LEN - 1 );
- pThumb->hContact = hContact;
- pThumb->hwnd = hwnd;
+ _tcsncpy( pThumb->ptszName, ptszName, USERNAME_LEN - 1);
+ pThumb->hContact = hContact;
+ pThumb->hwnd = hwnd;
- pThumb->dockOpt.hwndLeft = NULL;
- pThumb->dockOpt.hwndRight = NULL;
+ pThumb->dockOpt.hwndLeft = NULL;
+ pThumb->dockOpt.hwndRight = NULL;
pThumb->fTipActive = FALSE;
diff --git a/plugins/FloatingContacts/src/version.h b/plugins/FloatingContacts/src/version.h
index 8f946ebb53..3982ae491f 100644
--- a/plugins/FloatingContacts/src/version.h
+++ b/plugins/FloatingContacts/src/version.h
@@ -1,7 +1,7 @@
#define __MAJOR_VERSION 0
#define __MINOR_VERSION 7
#define __RELEASE_NUM 0
-#define __BUILD_NUM 0
+#define __BUILD_NUM 1
#define __FILEVERSION_STRING __MAJOR_VERSION,__MINOR_VERSION,__RELEASE_NUM,__BUILD_NUM