From 7f47efb0c5973054e00fac918d2e1cdd187dd35a Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 26 Nov 2012 22:28:47 +0000 Subject: virtual protos, invisible in the Account Manager & status bar, but fortunately searchable git-svn-id: http://svn.miranda-ng.org/main/trunk@2515 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_nicer/src/cluiservices.cpp | 29 ++++++--------- plugins/Clist_nicer/src/statusbar.cpp | 63 +++++++++++++++----------------- 2 files changed, 40 insertions(+), 52 deletions(-) (limited to 'plugins') diff --git a/plugins/Clist_nicer/src/cluiservices.cpp b/plugins/Clist_nicer/src/cluiservices.cpp index 2d8c2e0db8..df7296080f 100644 --- a/plugins/Clist_nicer/src/cluiservices.cpp +++ b/plugins/Clist_nicer/src/cluiservices.cpp @@ -45,18 +45,16 @@ static INT_PTR GetClistVersion(WPARAM wParam, LPARAM lParam) void FreeProtocolData( void ) { //free protocol data - int nPanel; - int nParts=SendMessage(pcli->hwndStatus,SB_GETPARTS,0,0); - for (nPanel=0;nPanelhwndStatus,SB_GETTEXT,(WPARAM)nPanel,0); - if (PD!=NULL&&!IsBadCodePtr((FARPROC)PD)) - { + int nParts = SendMessage(pcli->hwndStatus,SB_GETPARTS,0,0); + for (int nPanel=0; nPanel < nParts; nPanel++) { + ProtocolData *PD = (ProtocolData *)SendMessage(pcli->hwndStatus, SB_GETTEXT, nPanel, 0); + if (PD != NULL && !IsBadCodePtr((FARPROC)PD)) { SendMessage(pcli->hwndStatus,SB_SETTEXT,(WPARAM)nPanel|SBT_OWNERDRAW,0); if (PD->RealName) mir_free(PD->RealName); if (PD) mir_free(PD); -} } } + } + } +} int g_maxStatus = ID_STATUS_OFFLINE; char g_maxProto[100] = ""; @@ -173,20 +171,16 @@ void CluiProtocolStatusChanged( int parStatus, const char* szProto ) SendMessage(pcli->hwndStatus, SB_SETPARTS, partCount, (LPARAM)partWidths); for ( partCount=0, i=0; i < protoCount; i++ ) { //count down since built in ones tend to go at the end - ProtocolData *PD; - PROTOACCOUNT *pa; - int caps1, caps2; - int idx = pcli->pfnGetAccountIndexByPos( i ); if ( idx == -1 ) continue; - pa = accs[idx]; + PROTOACCOUNT *pa = accs[idx]; if ( !pcli->pfnGetProtocolVisibility( pa->szModuleName )) continue; status = CallProtoService( pa->szModuleName,PS_GETSTATUS,0,0); - PD = ( ProtocolData* )mir_alloc(sizeof(ProtocolData)); + ProtocolData *PD = ( ProtocolData* )mir_alloc(sizeof(ProtocolData)); PD->RealName = mir_strdup( pa->szModuleName ); PD->statusbarpos = partCount; { @@ -196,8 +190,8 @@ void CluiProtocolStatusChanged( int parStatus, const char* szProto ) flags |= SBT_NOBORDERS; SendMessageA( pcli->hwndStatus, SB_SETTEXTA, partCount|flags,(LPARAM)PD ); } - caps2 = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0); - caps1 = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); + int caps2 = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_2, 0); + int caps1 = CallProtoService(pa->szModuleName, PS_GETCAPS, PFLAGNUM_1, 0); if ((caps1 & PF1_IM) && (caps2 & (PF2_LONGAWAY | PF2_SHORTAWAY))) { onlineness = GetStatusOnlineness(status); if (onlineness > maxOnline) { @@ -262,5 +256,4 @@ void CluiProtocolStatusChanged( int parStatus, const char* szProto ) } SFL_Update(hIcon, iIcon, hCListImages, szStatus, TRUE); } - return; } diff --git a/plugins/Clist_nicer/src/statusbar.cpp b/plugins/Clist_nicer/src/statusbar.cpp index ae6b847bef..936f1f0b92 100644 --- a/plugins/Clist_nicer/src/statusbar.cpp +++ b/plugins/Clist_nicer/src/statusbar.cpp @@ -42,33 +42,35 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM { switch(msg) { case WM_SETCURSOR: - { - POINT pt; - - GetCursorPos(&pt); - SendMessage(GetParent(hwnd),msg,wParam,lParam); - if (pt.x == ptMouse.x && pt.y == ptMouse.y) - return 1;//return(TestCursorOnBorders()); - - ptMouse = pt; - if (tooltip_active){ - KillTimer(hwnd, TIMERID_HOVER); - if ( !NotifyEventHooks(hStatusBarHideToolTipEvent, 0, 0)) - CallService("mToolTip/HideTip", 0, 0); - tooltip_active = FALSE; + { + POINT pt; + GetCursorPos(&pt); + + SendMessage(GetParent(hwnd),msg,wParam,lParam); + if (pt.x == ptMouse.x && pt.y == ptMouse.y) + return 1;//return(TestCursorOnBorders()); + + ptMouse = pt; + if (tooltip_active){ + KillTimer(hwnd, TIMERID_HOVER); + if ( !NotifyEventHooks(hStatusBarHideToolTipEvent, 0, 0)) + CallService("mToolTip/HideTip", 0, 0); + tooltip_active = FALSE; } - KillTimer(hwnd, TIMERID_HOVER); - SetTimer(hwnd, TIMERID_HOVER, 750, 0); + KillTimer(hwnd, TIMERID_HOVER); + SetTimer(hwnd, TIMERID_HOVER, 750, 0); + } break; - } + case WM_NCHITTEST: - { - LRESULT lr = SendMessage(GetParent(hwnd), WM_NCHITTEST, wParam, lParam); - if (lr == HTLEFT || lr == HTRIGHT || lr == HTBOTTOM || lr == HTTOP || lr == HTTOPLEFT || lr == HTTOPRIGHT - || lr == HTBOTTOMLEFT || lr == HTBOTTOMRIGHT) - return HTTRANSPARENT; + { + LRESULT lr = SendMessage(GetParent(hwnd), WM_NCHITTEST, wParam, lParam); + if (lr == HTLEFT || lr == HTRIGHT || lr == HTBOTTOM || lr == HTTOP || lr == HTTOPLEFT || lr == HTTOPRIGHT + || lr == HTBOTTOMLEFT || lr == HTBOTTOMRIGHT) + return HTTRANSPARENT; + } break; - } + case WM_ERASEBKGND: if (cfg::dat.bSkinnedStatusBar) return 1; @@ -146,9 +148,6 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM } break; - case WM_DESTROY: - break; - case WM_TIMER: if (wParam == TIMERID_HOVER) { POINT pt; @@ -156,17 +155,13 @@ LRESULT CALLBACK NewStatusBarWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM GetCursorPos(&pt); if (pt.x == ptMouse.x && pt.y == ptMouse.y) { - int i,nParts; - RECT rc; - ScreenToClient(hwnd, &pt); - nParts = SendMessage(hwnd, SB_GETPARTS, 0, 0); - for (i = 0; i < nParts; i++) { + int nParts = SendMessage(hwnd, SB_GETPARTS, 0, 0); + for (int i = 0; i < nParts; i++) { + RECT rc; SendMessage(hwnd, SB_GETRECT, i, (LPARAM)&rc); if (PtInRect(&rc,pt)) { - ProtocolData *PD; - PD = (ProtocolData *)SendMessageA(hwnd, SB_GETTEXTA, i, 0); - + ProtocolData *PD = (ProtocolData *)SendMessageA(hwnd, SB_GETTEXTA, i, 0); if (PD) { if (NotifyEventHooks(hStatusBarShowToolTipEvent, (WPARAM)PD->RealName, 0) > 0) // a plugin handled this event tooltip_active = TRUE; -- cgit v1.2.3