summaryrefslogtreecommitdiff
path: root/plugins/FloatingContacts/src/main.cpp
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 /plugins/FloatingContacts/src/main.cpp
parent17c113eeb4cf4a2a96f2bc73dbd86ce290e9d9e7 (diff)
code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@13983 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/FloatingContacts/src/main.cpp')
-rw-r--r--plugins/FloatingContacts/src/main.cpp211
1 files changed, 102 insertions, 109 deletions
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;
}