summaryrefslogtreecommitdiff
path: root/plugins/FloatingContacts/src
diff options
context:
space:
mode:
Diffstat (limited to 'plugins/FloatingContacts/src')
-rw-r--r--plugins/FloatingContacts/src/main.cpp67
-rw-r--r--plugins/FloatingContacts/src/options.cpp26
-rw-r--r--plugins/FloatingContacts/src/resource.h6
-rw-r--r--plugins/FloatingContacts/src/thumbs.cpp32
-rw-r--r--plugins/FloatingContacts/src/thumbs.h8
5 files changed, 75 insertions, 64 deletions
diff --git a/plugins/FloatingContacts/src/main.cpp b/plugins/FloatingContacts/src/main.cpp
index e2c8a30fe2..72435a07ef 100644
--- a/plugins/FloatingContacts/src/main.cpp
+++ b/plugins/FloatingContacts/src/main.cpp
@@ -194,7 +194,7 @@ static int OnContactDrag( WPARAM wParam, LPARAM lParam )
}
}
else if ( hContact == hNewContact )
- pThumb->PositionThumb( (short)( pt.x - 5 ), (short)( pt.y - 5 ));
+ pThumb->PositionThumb(pt.x - 5, pt.y - 5);
return( hNewContact != NULL ? 1 : 0 );
}
@@ -216,11 +216,6 @@ static int OnContactDrop( WPARAM wParam, LPARAM lParam )
GetWindowRect( hwndMiranda, &rcMiranda );
pThumb->GetThumbRect( &rcThumb );
-
- //if ( IntersectRect( &rcOverlap, &rcThumb, &rcMiranda ))
- //{
- // pThumb->OnLButtonDown( (short)(rcThumb.left + 5), (short)(rcThumb.top + 5));
- //}
}
SaveContactsPos();
@@ -413,8 +408,8 @@ static LRESULT __stdcall CommWndProc( HWND hwnd,
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 );
@@ -455,19 +450,19 @@ static LRESULT __stdcall CommWndProc( HWND hwnd,
//#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:
- if (pThumb) pThumb->OnLButtonDown( (short)LOWORD( lParam ), (short)HIWORD( lParam ));
+ if (pThumb) pThumb->OnLButtonDown( LOWORD(lParam), HIWORD(lParam));
break;
case WM_MOUSEMOVE:
- if (pThumb) pThumb->OnMouseMove( (short)LOWORD( lParam ), (short)HIWORD( lParam ), wParam);
+ if (pThumb) pThumb->OnMouseMove( LOWORD(lParam), HIWORD(lParam), wParam);
break;
case WM_LBUTTONUP:
@@ -623,7 +618,7 @@ static void CreateThumbWnd(TCHAR *ptszName, HANDLE hContact, int nX, int nY)
pThumb->SetThumbOpacity( fcOpt.thumbAlpha );
ShowWindow( hwnd, ( fcOpt.bHideAll || HideOnFullScreen() || fcOpt.bHideOffline || (fcOpt.bHideWhenCListShow && bIsCListShow))? SW_HIDE : SW_SHOWNA );
- pThumb->PositionThumb( (short)nX, (short)nY );
+ pThumb->PositionThumb(nX, nY);
// force repaint
pThumb->UpdateContent();
@@ -878,27 +873,19 @@ static void LoadMenus()
static void LoadContact( HANDLE hContact )
{
- DWORD dwPos = (DWORD)-1;
- TCHAR *ptName = NULL;
- ThumbInfo *pThumb = thumbList.FindThumbByContact( hContact );
- int nX, nY;
-
-
- if ( hContact == NULL ) return;
-
- dwPos = db_get_dw( hContact, MODULE, "ThumbsPos", (DWORD)-1 );
-
- if ( dwPos != -1 )
- {
- ptName = (TCHAR*)CallService( MS_CLIST_GETCONTACTDISPLAYNAME, ( WPARAM )hContact, (LPARAM)GCDNF_TCHAR );
+ ThumbInfo *pThumb = thumbList.FindThumbByContact( hContact );
+ if ( hContact == NULL )
+ return;
- if ( ptName != NULL )
- {
- nX = DB_POS_GETX( dwPos );
- nY = DB_POS_GETY( dwPos );
+ 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 );
- pThumb->PositionThumb( (short)nX, (short)nY );
+ pThumb->PositionThumb(nX, nY);
}
}
}
@@ -909,21 +896,17 @@ BOOL HideOnFullScreen()
BOOL bFullscreen = FALSE;
HWND hWnd = 0;
- if ( fcOpt.bHideWhenFullscreen )
- {
+ if ( fcOpt.bHideWhenFullscreen ) {
int w = GetSystemMetrics(SM_CXSCREEN);
int h = GetSystemMetrics(SM_CYSCREEN);
hWnd = GetForegroundWindow();
- while (GetWindowLongPtr(hWnd, GWL_EXSTYLE) & WS_EX_TOPMOST)
- {
+ while (GetWindowLongPtr(hWnd, GWL_EXSTYLE) & WS_EX_TOPMOST) {
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;
}
@@ -969,17 +952,17 @@ void HideThumbsOnShowCList()
static LRESULT __stdcall newMirandaWndProc( HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam )
{
- if ( uMsg == WM_WINDOWPOSCHANGED) {
+ if (uMsg == WM_WINDOWPOSCHANGED) {
WINDOWPOS *wp = (WINDOWPOS *)lParam;
- if (wp->flags&SWP_HIDEWINDOW) {
+ if (wp->flags & SWP_HIDEWINDOW) {
bIsCListShow = FALSE;
ShowThumbsOnHideCList();
}
- else if (wp->flags&SWP_SHOWWINDOW){
+ else if (wp->flags & SWP_SHOWWINDOW){
bIsCListShow = TRUE;
HideThumbsOnShowCList();
}
- else if (!(wp->flags&SWP_NOMOVE)) {
+ else if (!(wp->flags & SWP_NOMOVE)) {
BYTE method = db_get_b(NULL, "ModernData", "HideBehind", 0);
if (method) {
WORD wBehindEdgeBorderSize = db_get_w(NULL, "ModernData", "HideBehindBorderSize", 0);
diff --git a/plugins/FloatingContacts/src/options.cpp b/plugins/FloatingContacts/src/options.cpp
index 7525300237..4eb3cf3fd1 100644
--- a/plugins/FloatingContacts/src/options.cpp
+++ b/plugins/FloatingContacts/src/options.cpp
@@ -158,6 +158,7 @@ static INT_PTR APIENTRY OptWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA
static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
{
BOOL bEnable;
+ char szPercent[20];
switch ( uMsg ) {
case WM_INITDIALOG:
@@ -193,6 +194,17 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
if (fnSHAutoComplete)
fnSHAutoComplete(GetDlgItem(hwndDlg, IDC_FILENAME), 1);
+
+ // Windows 2K/XP
+ BYTE btOpacity = (BYTE)DBGetContactSettingByte(NULL, MODULE, "Opacity", 100);
+ SendDlgItemMessage(hwndDlg, IDC_SLIDER_OPACITY, TBM_SETRANGE, TRUE, MAKELONG(0, 100));
+ SendDlgItemMessage(hwndDlg, IDC_SLIDER_OPACITY, TBM_SETPOS, TRUE, btOpacity);
+
+ wsprintfA(szPercent, "%d%%", btOpacity);
+ SetDlgItemTextA(hwndDlg, IDC_OPACITY, szPercent);
+
+ EnableWindow(GetDlgItem(hwndDlg, IDC_SLIDER_OPACITY), pSetLayeredWindowAttributes != 0);
+ EnableWindow(GetDlgItem(hwndDlg, IDC_OPACITY), pSetLayeredWindowAttributes != 0);
}
return TRUE;
@@ -213,6 +225,18 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
EnableWindow(GetDlgItem(hwndDlg, IDC_RBEDGESCOLOR), bEnable);
break;
+ 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 );
+ SetThumbsOpacity(fcOpt.thumbAlpha);
+
+ wsprintfA(szPercent, "%d%%", nPos);
+ SetDlgItemTextA(hwndDlg, IDC_OPACITY, szPercent);
+ SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
+ }
+ break;
+
case WM_COMMAND:
switch (LOWORD(wParam)) {
case IDC_DRAWBORDER:
@@ -272,6 +296,8 @@ static INT_PTR APIENTRY OptSknWndProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LP
col = SendDlgItemMessage(hwndDlg, IDC_RBEDGESCOLOR, CPM_GETCOLOUR, 0, 0);
db_set_dw(NULL, MODULE, "RBEdgesColor", col);
+ db_set_b(NULL, MODULE, "Opacity", (BYTE)SendDlgItemMessage(hwndDlg, IDC_SLIDER_OPACITY, TBM_GETPOS, 0, 0));
+
// Backgroud
col = SendDlgItemMessage(hwndDlg, IDC_BKGCOLOUR, CPM_GETCOLOUR, 0, 0);
db_set_dw(NULL, MODULE, "BkColor", col);
diff --git a/plugins/FloatingContacts/src/resource.h b/plugins/FloatingContacts/src/resource.h
index d41877bc12..87664ca12b 100644
--- a/plugins/FloatingContacts/src/resource.h
+++ b/plugins/FloatingContacts/src/resource.h
@@ -1,6 +1,6 @@
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ generated include file.
-// Used by ..\res\fltcnt.rc
+// Used by D:\Myranda\plugins\FloatingContacts\res\fltcnt.rc
//
#define IDD_OPT_FLTCONT 101
#define IDI_ICON1 103
@@ -8,6 +8,8 @@
#define IDI_SHOW 105
#define IDD_OPT_FNT 106
#define IDD_OPT_SKIN 106
+#define IDC_SLIDER_OPACITY 1001
+#define IDC_OPACITY 1002
#define IDC_CHK_HIDE_OFFLINE 1003
#define IDC_CHK_STICK 1004
#define IDC_CHK_WIDTH 1005
@@ -45,7 +47,7 @@
#define IDC_RBEDGESCOLOR 1211
// Next default values for new objects
-//
+//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 107
diff --git a/plugins/FloatingContacts/src/thumbs.cpp b/plugins/FloatingContacts/src/thumbs.cpp
index 613de3d734..407bf18220 100644
--- a/plugins/FloatingContacts/src/thumbs.cpp
+++ b/plugins/FloatingContacts/src/thumbs.cpp
@@ -4,13 +4,13 @@ ThumbList thumbList;
/////////////////////////////////////////////////////////////////////////////
// ThumbInfo
-static POINT ptOld;
+static POINT ptOld;
static BOOL bMouseDown = FALSE;
static BOOL bMouseIn = FALSE;
static BOOL bMouseMoved = FALSE;
-static short nLeft = 0;
-static short nTop = 0;
-static int nOffs = 5;
+static int nLeft = 0;
+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 )
@@ -54,7 +54,7 @@ void ThumbInfo::GetThumbRect(RECT *rc)
rc->bottom = ptPos.y + szSize.cy;
}
-void ThumbInfo::PositionThumb(short nX, short nY)
+void ThumbInfo::PositionThumb(int nX, int nY)
{
POINT pos = { nX, nY };
HDWP hdwp;
@@ -64,7 +64,7 @@ void ThumbInfo::PositionThumb(short nX, short nY)
ThumbInfo *pThumb = this;
while (pThumb)
{
- pThumb->PositionThumbWorker( (short)pos.x, (short)pos.y, &pos );
+ pThumb->PositionThumbWorker(pos.x, pos.y, &pos);
DeferWindowPos( hdwp,
pThumb->hwnd,
@@ -84,7 +84,7 @@ void ThumbInfo::PositionThumb(short nX, short nY)
EndDeferWindowPos(hdwp);
}
-void ThumbInfo::PositionThumbWorker(short nX, short nY, POINT *newPos)
+void ThumbInfo::PositionThumbWorker(int nX, int nY, POINT *newPos)
{
RECT rc;
RECT rcThumb;
@@ -373,7 +373,7 @@ void ThumbInfo::ResizeThumb()
if (pNextThumb = thumbList.FindThumb(dockOpt.hwndRight))
{
GetThumbRect( &rcThumb );
- pNextThumb->PositionThumb( (short)rcThumb.right, (short)rcThumb.top );
+ pNextThumb->PositionThumb(rcThumb.right, rcThumb.top);
}
}
@@ -410,7 +410,7 @@ void ThumbInfo::DeleteContactPos()
DBDeleteContactSetting( hContact, MODULE, "ThumbsPos" );
}
-void ThumbInfo::OnLButtonDown(short nX, short nY)
+void ThumbInfo::OnLButtonDown(int nX, int nY)
{
RECT rc;
@@ -424,8 +424,8 @@ void ThumbInfo::OnLButtonDown(short nX, short nY)
GetCursorPos(&ptOld);
GetThumbRect(&rc);
- nLeft = (short)rc.left;
- nTop = (short)rc.top;
+ nLeft = rc.left;
+ nTop = rc.top;
//bMouseIn = FALSE;
bMouseDown = TRUE;
@@ -459,8 +459,8 @@ void ThumbInfo::OnLButtonUp()
{
if ( IsWindowVisible( hwndMiranda ))
{
- DeleteContactPos( );
- thumbList.RemoveThumb( this );
+ DeleteContactPos();
+ thumbList.RemoveThumb(this);
}
}
}
@@ -468,7 +468,7 @@ void ThumbInfo::OnLButtonUp()
SaveContactsPos();
}
-void ThumbInfo::OnMouseMove(short nX, short nY, WPARAM wParam)
+void ThumbInfo::OnMouseMove(int nX, int nY, WPARAM wParam)
{
// if (bMouseDown && !wParam&MK_LBUTTON) OnLButtonUp();
@@ -492,8 +492,8 @@ void ThumbInfo::OnMouseMove(short nX, short nY, WPARAM wParam)
if (dX || dY){
bMouseMoved = TRUE;
- nLeft += (short)dX;
- nTop += (short)dY;
+ nLeft += dX;
+ nTop += dY;
PositionThumb( nLeft, nTop );
}
diff --git a/plugins/FloatingContacts/src/thumbs.h b/plugins/FloatingContacts/src/thumbs.h
index ee6db80097..6ea6823273 100644
--- a/plugins/FloatingContacts/src/thumbs.h
+++ b/plugins/FloatingContacts/src/thumbs.h
@@ -34,15 +34,15 @@ public:
~ThumbInfo();
void GetThumbRect (RECT *rc);
- void PositionThumb (short nX, short nY);
- void PositionThumbWorker (short nX, short nY, POINT *rcNewPos);
+ void PositionThumb (int nX, int nY);
+ void PositionThumbWorker (int nX, int nY, POINT *rcNewPos);
void ResizeThumb ();
void RefreshContactIcon (int iIcon);
void RefreshContactStatus (int idStatus);
void DeleteContactPos ();
- void OnLButtonDown (short nX, short nY);
+ void OnLButtonDown (int nX, int nY);
void OnLButtonUp ();
- void OnMouseMove (short nX, short nY, WPARAM wParam);
+ void OnMouseMove (int nX, int nY, WPARAM wParam);
void ThumbSelect (BOOL bMouse);
void ThumbDeselect (BOOL bMouse);
void SetThumbOpacity (BYTE btAlpha);