From 9fcf8dce5638362799de647f8eb9711195e41992 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Fri, 22 Mar 2013 12:31:45 +0000 Subject: code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@4159 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/hdr/modern_clui.h | 92 +-- .../Clist_modern/src/hdr/modern_commonheaders.h | 2 + plugins/Clist_modern/src/hdr/modern_skinengine.h | 6 +- .../src/hdr/modern_static_cluiframes_service.h | 132 ++--- plugins/Clist_modern/src/hdr/modern_sync.h | 10 +- plugins/Clist_modern/src/modern_clc.cpp | 261 ++++----- plugins/Clist_modern/src/modern_clcpaint.cpp | 180 +++--- plugins/Clist_modern/src/modern_clui.cpp | 638 +++++++++------------ plugins/Clist_modern/src/modern_cluiframes.cpp | 104 ++-- plugins/Clist_modern/src/modern_skinbutton.cpp | 280 ++++----- plugins/Clist_modern/src/modern_skineditor.cpp | 4 - plugins/Clist_modern/src/modern_skinengine.cpp | 4 +- plugins/Clist_modern/src/modern_skinopt.cpp | 25 +- plugins/Clist_modern/src/modern_statusbar.cpp | 6 +- .../Clist_modern/src/modern_statusbar_options.cpp | 6 +- plugins/Clist_modern/src/modern_sync.cpp | 10 +- plugins/Clist_modern/src/modern_tbbutton.cpp | 10 +- 17 files changed, 798 insertions(+), 972 deletions(-) (limited to 'plugins/Clist_modern/src') diff --git a/plugins/Clist_modern/src/hdr/modern_clui.h b/plugins/Clist_modern/src/hdr/modern_clui.h index 0b8cc4f9e1..492889fadd 100644 --- a/plugins/Clist_modern/src/hdr/modern_clui.h +++ b/plugins/Clist_modern/src/hdr/modern_clui.h @@ -111,7 +111,7 @@ public: HANDLE_MESSAGE( WM_DRAWITEM, OnDrawItem ); HANDLE_MESSAGE( WM_DESTROY, OnDestroy ); default: - return This->DefCluiWndProc( msg, wParam, lParam ); + return This->DefCluiWndProc(msg, wParam, lParam); } return FALSE; } @@ -130,55 +130,55 @@ private: HRESULT CreateCLCWindow(const HWND parent); HRESULT CreateUIFrames(); - LRESULT DefCluiWndProc( UINT msg, WPARAM wParam, LPARAM lParam ) + LRESULT DefCluiWndProc(UINT msg, WPARAM wParam, LPARAM lParam) { - return corecli.pfnContactListWndProc( m_hWnd, msg, wParam, lParam ); + return corecli.pfnContactListWndProc( m_hWnd, msg, wParam, lParam); } // MessageMap - LRESULT PreProcessWndProc( UINT msg, WPARAM wParam, LPARAM lParam, BOOL& bHandled ); - LRESULT OnSizingMoving( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnThemeChanged( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnDwmCompositionChanged( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnSyncCall( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnUpdate( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnInitMenu( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnNcPaint( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnEraseBkgnd( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnNcCreate( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnPaint( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnCreate( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnSetAllExtraIcons( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnCreateClc( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnLButtonDown( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnParentNotify( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnSetFocus( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnTimer( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnStatusBarUpdateTimer( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnAutoAlphaTimer( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnSmoothAlphaTransitionTimer( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnDelayedSizingTimer( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnBringOutTimer( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnBringInTimer( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnUpdateBringTimer( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnActivate( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnSetCursor( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnMouseActivate( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnNcLButtonDown( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnNcLButtonDblClk( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnNcHitTest( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnShowWindow( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnSysCommand( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnKeyDown( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnGetMinMaxInfo( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnMoving( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnNotify( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnListSizeChangeNotify( NMCLISTCONTROL * pnmc ); - LRESULT OnClickNotify( NMCLISTCONTROL * pnmc ); - LRESULT OnContextMenu( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnMeasureItem( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnDrawItem( UINT msg, WPARAM wParam, LPARAM lParam ); - LRESULT OnDestroy( UINT msg, WPARAM wParam, LPARAM lParam ); + LRESULT PreProcessWndProc(UINT msg, WPARAM wParam, LPARAM lParam, BOOL& bHandled ); + LRESULT OnSizingMoving(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnThemeChanged(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnDwmCompositionChanged(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnSyncCall(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnUpdate(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnInitMenu(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnNcPaint(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnEraseBkgnd(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnNcCreate(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnPaint(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnCreate(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnSetAllExtraIcons(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnCreateClc(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnLButtonDown(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnParentNotify(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnSetFocus(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnTimer(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnStatusBarUpdateTimer(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnAutoAlphaTimer(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnSmoothAlphaTransitionTimer(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnDelayedSizingTimer(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnBringOutTimer(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnBringInTimer(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnUpdateBringTimer(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnActivate(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnSetCursor(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnMouseActivate(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnNcLButtonDown(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnNcLButtonDblClk(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnNcHitTest(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnShowWindow(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnSysCommand(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnKeyDown(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnGetMinMaxInfo(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnMoving(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnNotify(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnListSizeChangeNotify(NMCLISTCONTROL *pnmc); + LRESULT OnClickNotify(NMCLISTCONTROL *pnmc); + LRESULT OnContextMenu(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnMeasureItem(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnDrawItem(UINT msg, WPARAM wParam, LPARAM lParam); + LRESULT OnDestroy(UINT msg, WPARAM wParam, LPARAM lParam); protected: HMODULE m_hDwmapiDll; diff --git a/plugins/Clist_modern/src/hdr/modern_commonheaders.h b/plugins/Clist_modern/src/hdr/modern_commonheaders.h index 480a928935..eb5b67dd8d 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonheaders.h +++ b/plugins/Clist_modern/src/hdr/modern_commonheaders.h @@ -331,6 +331,8 @@ BOOL rowParse(ROWCELL* &cell, ROWCELL* parent, char *tbuf, int &hbuf, int &seque void rowSizeWithReposition(ROWCELL* &root, int width); #endif +#define UNPACK_POINT(X) { (short)LOWORD(X), (short)HIWORD(X) } + ////////////////////////////////////////////////////////////////////////// // Specific class for quick implementation of map list // with some more fast searching it is diff --git a/plugins/Clist_modern/src/hdr/modern_skinengine.h b/plugins/Clist_modern/src/hdr/modern_skinengine.h index 5d7f23f2e5..87fd769f40 100644 --- a/plugins/Clist_modern/src/hdr/modern_skinengine.h +++ b/plugins/Clist_modern/src/hdr/modern_skinengine.h @@ -94,12 +94,12 @@ public: typedef HRESULT (*ParserCallback_t)( const char * szSection, const char * szKey, const char * szValue, IniParser * This ); - IniParser( TCHAR * szFileName, BYTE flags = FLAG_WITH_SETTINGS ); - IniParser( HINSTANCE hInst, const char * resourceName, const char * resourceType, BYTE flags = FLAG_ONLY_OBJECTS ); + IniParser(TCHAR * szFileName, BYTE flags = FLAG_WITH_SETTINGS); + IniParser(HINSTANCE hInst, const char *resourceName, const char *resourceType, BYTE flags = FLAG_ONLY_OBJECTS); ~IniParser(); bool CheckOK() { return _isValid; } - HRESULT Parse( ParserCallback_t pLineCallBackProc, LPARAM lParam ); + HRESULT Parse(ParserCallback_t pLineCallBackProc, LPARAM lParam); static HRESULT WriteStrToDb( const char * szSection, const char * szKey, const char * szValue, IniParser * This); static int GetSkinFolder( IN const TCHAR * szFileName, OUT TCHAR * pszFolderName ); diff --git a/plugins/Clist_modern/src/hdr/modern_static_cluiframes_service.h b/plugins/Clist_modern/src/hdr/modern_static_cluiframes_service.h index 46a2dfaed9..7bfd947ced 100644 --- a/plugins/Clist_modern/src/hdr/modern_static_cluiframes_service.h +++ b/plugins/Clist_modern/src/hdr/modern_static_cluiframes_service.h @@ -4,28 +4,28 @@ // TO BE INCLUDED ONLY TO modern_cluiframes.cpp ////////////////////////////////////////////////////////////////////////// -static int _us_DoSetFramePaintProc( WPARAM wParam,LPARAM lParam ); -static int _us_DoAddFrame( WPARAM wParam,LPARAM lParam ); -static int _us_DoRemoveFrame( WPARAM wParam,LPARAM lParam ); -static int _us_DoSetFrameOptions( WPARAM wParam,LPARAM lParam ); -static INT_PTR _us_DoGetFrameOptions( WPARAM wParam,LPARAM lParam ); -static int _us_DoUpdateFrame( WPARAM wParam,LPARAM lParam ); -static int _us_DoShowHideFrameTitle( WPARAM wParam,LPARAM lParam ); -static int _us_DoShowTitles( WPARAM wParam,LPARAM lParam ); -static int _us_DoHideTitles( WPARAM wParam,LPARAM lParam ); -static int _us_DoShowHideFrame( WPARAM wParam,LPARAM lParam ); -static int _us_DoShowAllFrames( WPARAM wParam,LPARAM lParam ); -static int _us_DoLockFrame( WPARAM wParam,LPARAM lParam ); -static int _us_DoCollapseFrame( WPARAM wParam,LPARAM lParam ); -static int _us_DoSetFrameBorder( WPARAM wParam,LPARAM lParam ); -static int _us_DoSetFrameAlign( WPARAM wParam,LPARAM lParam ); -static int _us_DoMoveFrame( WPARAM wParam,LPARAM lParam ); -static int _us_DoMoveFrameUp( WPARAM wParam,LPARAM lParam ); -static int _us_DoMoveFrameDown( WPARAM wParam,LPARAM lParam ); -static int _us_DoAlignFrameTop( WPARAM wParam,LPARAM lParam ); -static int _us_DoAlignFrameClient( WPARAM wParam,LPARAM lParam ); -static int _us_DoAlignFrameBottom( WPARAM wParam,LPARAM lParam ); -static int _us_DoSetFrameFloat( WPARAM wParam,LPARAM lParam ); +static int _us_DoSetFramePaintProc(WPARAM wParam,LPARAM lParam); +static int _us_DoAddFrame(WPARAM wParam,LPARAM lParam); +static int _us_DoRemoveFrame(WPARAM wParam,LPARAM lParam); +static int _us_DoSetFrameOptions(WPARAM wParam,LPARAM lParam); +static INT_PTR _us_DoGetFrameOptions(WPARAM wParam,LPARAM lParam); +static int _us_DoUpdateFrame(WPARAM wParam,LPARAM lParam); +static int _us_DoShowHideFrameTitle(WPARAM wParam,LPARAM lParam); +static int _us_DoShowTitles(WPARAM wParam,LPARAM lParam); +static int _us_DoHideTitles(WPARAM wParam,LPARAM lParam); +static int _us_DoShowHideFrame(WPARAM wParam,LPARAM lParam); +static int _us_DoShowAllFrames(WPARAM wParam,LPARAM lParam); +static int _us_DoLockFrame(WPARAM wParam,LPARAM lParam); +static int _us_DoCollapseFrame(WPARAM wParam,LPARAM lParam); +static int _us_DoSetFrameBorder(WPARAM wParam,LPARAM lParam); +static int _us_DoSetFrameAlign(WPARAM wParam,LPARAM lParam); +static int _us_DoMoveFrame(WPARAM wParam,LPARAM lParam); +static int _us_DoMoveFrameUp(WPARAM wParam,LPARAM lParam); +static int _us_DoMoveFrameDown(WPARAM wParam,LPARAM lParam); +static int _us_DoAlignFrameTop(WPARAM wParam,LPARAM lParam); +static int _us_DoAlignFrameClient(WPARAM wParam,LPARAM lParam); +static int _us_DoAlignFrameBottom(WPARAM wParam,LPARAM lParam); +static int _us_DoSetFrameFloat(WPARAM wParam,LPARAM lParam); enum { CFM_FIRST_MGS= WM_USER + 0x2FF, @@ -92,71 +92,71 @@ BOOL CALLBACK ProcessCLUIFrameInternalMsg(HWND hwnd, UINT msg, WPARAM wParam, LP return TRUE; } -static INT_PTR CLUIFrames_SetFramePaintProc( WPARAM wParam,LPARAM lParam ) -{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SETFRAMEPAINTPROC, wParam,lParam ) : 0; } +static INT_PTR CLUIFrames_SetFramePaintProc(WPARAM wParam,LPARAM lParam) +{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SETFRAMEPAINTPROC, wParam,lParam) : 0; } -static INT_PTR CLUIFrames_AddFrame( WPARAM wParam,LPARAM lParam ) -{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_ADDFRAME, wParam, lParam ) : 0; } +static INT_PTR CLUIFrames_AddFrame(WPARAM wParam,LPARAM lParam) +{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_ADDFRAME, wParam, lParam) : 0; } -static INT_PTR CLUIFrames_RemoveFrame( WPARAM wParam,LPARAM lParam ) -{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_REMOVEFRAME, wParam, lParam ) : 0; } +static INT_PTR CLUIFrames_RemoveFrame(WPARAM wParam,LPARAM lParam) +{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_REMOVEFRAME, wParam, lParam) : 0; } -static INT_PTR CLUIFrames_SetFrameOptions( WPARAM wParam,LPARAM lParam ) -{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SETFRAMEOPTIONS, wParam, lParam ) : 0; } +static INT_PTR CLUIFrames_SetFrameOptions(WPARAM wParam,LPARAM lParam) +{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SETFRAMEOPTIONS, wParam, lParam) : 0; } -static INT_PTR CLUIFrames_GetFrameOptions( WPARAM wParam,LPARAM lParam ) -{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_GETFRAMEOPTIONS, wParam, lParam ) : 0; } +static INT_PTR CLUIFrames_GetFrameOptions(WPARAM wParam,LPARAM lParam) +{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_GETFRAMEOPTIONS, wParam, lParam) : 0; } -static INT_PTR CLUIFrames_UpdateFrame( WPARAM wParam,LPARAM lParam ) -{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_UPDATEFRAME, wParam, lParam ) : 0; } +static INT_PTR CLUIFrames_UpdateFrame(WPARAM wParam,LPARAM lParam) +{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_UPDATEFRAME, wParam, lParam) : 0; } -static INT_PTR CLUIFrames_ShowHideFrameTitle( WPARAM wParam,LPARAM lParam ) -{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SHOWHIDEFRAMETITLE, wParam, lParam ) : 0; } +static INT_PTR CLUIFrames_ShowHideFrameTitle(WPARAM wParam,LPARAM lParam) +{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SHOWHIDEFRAMETITLE, wParam, lParam) : 0; } -static INT_PTR CLUIFrames_ShowTitles( WPARAM wParam,LPARAM lParam ) -{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SHOWTITLES, wParam, lParam ) : 0; } +static INT_PTR CLUIFrames_ShowTitles(WPARAM wParam,LPARAM lParam) +{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SHOWTITLES, wParam, lParam) : 0; } -static INT_PTR CLUIFrames_HideTitles( WPARAM wParam,LPARAM lParam ) -{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_HIDETITLES, wParam, lParam ) : 0; } +static INT_PTR CLUIFrames_HideTitles(WPARAM wParam,LPARAM lParam) +{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_HIDETITLES, wParam, lParam) : 0; } -static INT_PTR CLUIFrames_ShowHideFrame( WPARAM wParam,LPARAM lParam ) -{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SHOWHIDEFRAME, wParam, lParam ) : 0; } +static INT_PTR CLUIFrames_ShowHideFrame(WPARAM wParam,LPARAM lParam) +{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SHOWHIDEFRAME, wParam, lParam) : 0; } -static INT_PTR CLUIFrames_ShowAllFrames( WPARAM wParam,LPARAM lParam ) -{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SHOWALL, wParam, lParam ) : 0; } +static INT_PTR CLUIFrames_ShowAllFrames(WPARAM wParam,LPARAM lParam) +{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SHOWALL, wParam, lParam) : 0; } -static INT_PTR CLUIFrames_LockFrame( WPARAM wParam,LPARAM lParam ) -{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_LOCKFRAME, wParam, lParam ) : 0; } +static INT_PTR CLUIFrames_LockFrame(WPARAM wParam,LPARAM lParam) +{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_LOCKFRAME, wParam, lParam) : 0; } -static INT_PTR CLUIFrames_CollapseFrame( WPARAM wParam,LPARAM lParam ) -{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_COLLAPSEFRAME, wParam, lParam ) : 0; } +static INT_PTR CLUIFrames_CollapseFrame(WPARAM wParam,LPARAM lParam) +{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_COLLAPSEFRAME, wParam, lParam) : 0; } -static INT_PTR CLUIFrames_SetFrameBorder( WPARAM wParam,LPARAM lParam ) -{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SETFRAMEBORDER, wParam, lParam ) : 0; } +static INT_PTR CLUIFrames_SetFrameBorder(WPARAM wParam,LPARAM lParam) +{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SETFRAMEBORDER, wParam, lParam) : 0; } -static INT_PTR CLUIFrames_SetFrameAlign( WPARAM wParam,LPARAM lParam ) -{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SETFRAMEALIGN, wParam, lParam ) : 0; } +static INT_PTR CLUIFrames_SetFrameAlign(WPARAM wParam,LPARAM lParam) +{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SETFRAMEALIGN, wParam, lParam) : 0; } -static INT_PTR CLUIFrames_MoveFrame( WPARAM wParam,LPARAM lParam ) -{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_MOVEFRAME, wParam, lParam ) : 0; } +static INT_PTR CLUIFrames_MoveFrame(WPARAM wParam,LPARAM lParam) +{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_MOVEFRAME, wParam, lParam) : 0; } -static INT_PTR CLUIFrames_MoveFrameUp( WPARAM wParam,LPARAM lParam ) -{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_MOVEFRAMEUP, wParam, lParam ) : 0; } +static INT_PTR CLUIFrames_MoveFrameUp(WPARAM wParam,LPARAM lParam) +{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_MOVEFRAMEUP, wParam, lParam) : 0; } -static INT_PTR CLUIFrames_MoveFrameDown( WPARAM wParam,LPARAM lParam ) -{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_MOVEFRAMEDOWN, wParam, lParam ) : 0; } +static INT_PTR CLUIFrames_MoveFrameDown(WPARAM wParam,LPARAM lParam) +{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_MOVEFRAMEDOWN, wParam, lParam) : 0; } -static INT_PTR CLUIFrames_AlignFrameTop( WPARAM wParam,LPARAM lParam ) -{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_ALIGNFRAMETOP, wParam, lParam ) : 0; } +static INT_PTR CLUIFrames_AlignFrameTop(WPARAM wParam,LPARAM lParam) +{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_ALIGNFRAMETOP, wParam, lParam) : 0; } -static INT_PTR CLUIFrames_AlignFrameClient( WPARAM wParam,LPARAM lParam ) -{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_ALIGNFRAMEBOTTOM, wParam, lParam ) : 0; } +static INT_PTR CLUIFrames_AlignFrameClient(WPARAM wParam,LPARAM lParam) +{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_ALIGNFRAMEBOTTOM, wParam, lParam) : 0; } -static INT_PTR CLUIFrames_AlignFrameBottom( WPARAM wParam,LPARAM lParam ) -{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_ALIGNFRAMECLIENT, wParam, lParam ) : 0; } +static INT_PTR CLUIFrames_AlignFrameBottom(WPARAM wParam,LPARAM lParam) +{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_ALIGNFRAMECLIENT, wParam, lParam) : 0; } -static INT_PTR CLUIFrames_SetFrameFloat( WPARAM wParam,LPARAM lParam ) -{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SETFRAMEFLOAT, wParam, lParam ) : 0; } +static INT_PTR CLUIFrames_SetFrameFloat(WPARAM wParam,LPARAM lParam) +{ return ( pcli->hwndContactList ) ? SendMessage( pcli->hwndContactList, CFM_SETFRAMEFLOAT, wParam, lParam) : 0; } static void CreateCluiFramesServices() { diff --git a/plugins/Clist_modern/src/hdr/modern_sync.h b/plugins/Clist_modern/src/hdr/modern_sync.h index 334d4696a7..4f7010ae08 100644 --- a/plugins/Clist_modern/src/hdr/modern_sync.h +++ b/plugins/Clist_modern/src/hdr/modern_sync.h @@ -11,11 +11,11 @@ int SyncCallProxy( PSYNCCALLBACKPROC pfnProc, WPARAM wParam, LPARAM lParam, CRIT HRESULT SyncCallWinProcProxy( PSYNCCALLBACKPROC pfnProc, WPARAM wParam, LPARAM lParam, int& nReturn ); HRESULT SyncCallAPCProxy( PSYNCCALLBACKPROC pfnProc, WPARAM wParam, LPARAM lParam, int& hReturn ); -LRESULT SyncOnWndProcCall( WPARAM wParam ); +LRESULT SyncOnWndProcCall(WPARAM wParam ); // Experimental sync caller -int DoCall( PSYNCCALLBACKPROC pfnProc, WPARAM wParam, LPARAM lParam ); +int DoCall( PSYNCCALLBACKPROC pfnProc, WPARAM wParam, LPARAM lParam); // Have to be here due to MS Visual C++ does not support 'export' keyword @@ -28,7 +28,7 @@ template class PARAMS3 public: PARAMS3( proc_t __proc, A __a, B __b, C __c ): _proc( __proc), _a (__a), _b(__b), _c(__c){}; - static int DoSyncCall( WPARAM wParam, LPARAM lParam ) + static int DoSyncCall(WPARAM wParam, LPARAM lParam) { PARAMS3 * params = (PARAMS3 *) lParam; params->_ret = params->_proc( params->_a, params->_b, params->_c ); @@ -54,7 +54,7 @@ template class PARAMS2 public: PARAMS2( proc_t __proc, A __a, B __b ): _proc( __proc), _a (__a), _b(__b){}; - static int DoSyncCall( WPARAM wParam, LPARAM lParam ) + static int DoSyncCall(WPARAM wParam, LPARAM lParam) { PARAMS2 * params = (PARAMS2 *) lParam; params->_ret = params->_proc( params->_a, params->_b ); @@ -79,7 +79,7 @@ template class PARAMS1 public: PARAMS1( proc_t __proc, A __a): _proc( __proc), _a (__a){}; - static int DoSyncCall( WPARAM, LPARAM lParam ) + static int DoSyncCall(WPARAM, LPARAM lParam) { PARAMS1 * params = (PARAMS1 *) lParam; params->_ret = params->_proc( params->_a ); diff --git a/plugins/Clist_modern/src/modern_clc.cpp b/plugins/Clist_modern/src/modern_clc.cpp index b11350fc27..6c02f808bc 100644 --- a/plugins/Clist_modern/src/modern_clc.cpp +++ b/plugins/Clist_modern/src/modern_clc.cpp @@ -450,8 +450,7 @@ static LRESULT clcOnCommand(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LP if (hit == -1) return 0; if ( contact->type == CLCIT_CONTACT && CallService(MS_CLIST_MENUPROCESSCOMMAND, MAKEWPARAM(LOWORD(wParam), MPCF_CONTACTMENU), (LPARAM) contact->hContact)) return 0; - switch (LOWORD(wParam)) - { + switch (LOWORD(wParam)) { case POPUP_NEWSUBGROUP: if (contact->type != CLCIT_GROUP) return 0; @@ -483,7 +482,7 @@ static LRESULT clcOnCommand(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LP } if (contact->type == CLCIT_GROUP) - if (CallService(MO_PROCESSCOMMANDBYMENUIDENT,LOWORD(wParam),(LPARAM)hwnd)) + if (CallService(MO_PROCESSCOMMANDBYMENUIDENT, LOWORD(wParam), (LPARAM)hwnd)) return 0; return 0; @@ -852,6 +851,7 @@ static LRESULT clcOnActivate(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, L dat->dragStage |= DRAGSTAGEF_SKIPRENAME; return corecli.pfnContactListControlWndProc(hwnd, msg, wParam, lParam); } + static LRESULT clcOnSetCursor(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { int lResult; @@ -868,147 +868,142 @@ static LRESULT clcOnSetCursor(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, lResult = CLUI_TestCursorOnBorders(); return lResult ? lResult : DefWindowProc(hwnd, msg, wParam, lParam); } + static LRESULT clcOnLButtonDown(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) { - { - POINT pt; - int k = 0; - pt.x = LOWORD(lParam); - pt.y = HIWORD(lParam); - ClientToScreen(hwnd,&pt); - k = CLUI_SizingOnBorder(pt,0); - if (k) { - int io = dat->iHotTrack; - dat->iHotTrack = 0; - if (dat->exStyle & CLS_EX_TRACKSELECT) - pcli->pfnInvalidateItem(hwnd,dat,io); - - if (k && GetCapture() == hwnd) - SendMessage(GetParent(hwnd),WM_PARENTNOTIFY,WM_LBUTTONDOWN,lParam); - return FALSE; - } + POINT pt = { LOWORD(lParam), HIWORD(lParam) }; + ClientToScreen(hwnd, &pt); + int k = CLUI_SizingOnBorder(pt,0); + if (k) { + int io = dat->iHotTrack; + dat->iHotTrack = 0; + if (dat->exStyle & CLS_EX_TRACKSELECT) + pcli->pfnInvalidateItem(hwnd,dat,io); + + if (k && GetCapture() == hwnd) + SendMessage(GetParent(hwnd),WM_PARENTNOTIFY,WM_LBUTTONDOWN,lParam); + return FALSE; } - { - ClcContact *contact; - ClcGroup *group; - int hit; - DWORD hitFlags; - fMouseUpped = FALSE; - pcli->pfnHideInfoTip(hwnd,dat); - KillTimer(hwnd,TIMERID_INFOTIP); - KillTimer(hwnd,TIMERID_RENAME); - KillTimer(hwnd,TIMERID_SUBEXPAND); - - pcli->pfnEndRename(hwnd,dat,1); - dat->ptDragStart.x = (short)LOWORD(lParam); - dat->ptDragStart.y = (short)HIWORD(lParam); - //dat->szQuickSearch[0] = 0; - hit = cliHitTest(hwnd,dat,(short)LOWORD(lParam),(short)HIWORD(lParam),&contact,&group,&hitFlags); - if (GetFocus() != hwnd) SetFocus(hwnd); - if (hit != -1 && !(hitFlags & CLCHT_NOWHERE)) { - if ( hit == dat->selection && hitFlags & CLCHT_ONITEMLABEL && dat->exStyle & CLS_EX_EDITLABELS) { - if ( !(dat->dragStage & DRAGSTAGEF_SKIPRENAME)) { - SetCapture(hwnd); - dat->iDragItem = dat->selection; - dat->dragStage = DRAGSTAGE_NOTMOVED|DRAGSTAGEF_MAYBERENAME; - dat->dragAutoScrolling = 0; - return TRUE; - } - else { - dat->dragStage &= ~DRAGSTAGEF_SKIPRENAME; - return TRUE; - } - } - } - if (hit != -1 && !(hitFlags & CLCHT_NOWHERE) && contact->type == CLCIT_CONTACT && contact->SubAllocated && !contact->isSubcontact) - if (hitFlags&CLCHT_ONITEMICON && dat->expandMeta) - { - BYTE doubleClickExpand = db_get_b(NULL,"CLC","MetaDoubleClick",SETTING_METAAVOIDDBLCLICK_DEFAULT); + ClcContact *contact; + ClcGroup *group; + int hit; + DWORD hitFlags; + fMouseUpped = FALSE; + pcli->pfnHideInfoTip(hwnd,dat); + KillTimer(hwnd,TIMERID_INFOTIP); + KillTimer(hwnd,TIMERID_RENAME); + KillTimer(hwnd,TIMERID_SUBEXPAND); - hitcontact = contact; - HitPoint.x = (short)LOWORD(lParam); - HitPoint.y = (short)HIWORD(lParam); - fMouseUpped = FALSE; - if ((GetKeyState(VK_SHIFT)&0x8000) || (GetKeyState(VK_CONTROL)&0x8000) || (GetKeyState(VK_MENU)&0x8000)) - { - fMouseUpped = TRUE; - hitcontact = contact; - KillTimer(hwnd,TIMERID_SUBEXPAND); - CLUI_SafeSetTimer(hwnd,TIMERID_SUBEXPAND, 0, NULL); - } - } - else hitcontact = NULL; - - if (hit != -1 && !(hitFlags & CLCHT_NOWHERE) && contact->type == CLCIT_GROUP) - if (hitFlags & CLCHT_ONITEMICON) { - ClcGroup *selgroup; - ClcContact *selcontact; - dat->selection = cliGetRowByIndex(dat,dat->selection,&selcontact,&selgroup); - pcli->pfnSetGroupExpand(hwnd,dat,contact->group,-1); - if (dat->selection != -1) { - dat->selection = cliGetRowsPriorTo(&dat->list,selgroup,GetContactIndex(selgroup,selcontact)); - if (dat->selection == -1) dat->selection = cliGetRowsPriorTo(&dat->list,contact->group,-1); + pcli->pfnEndRename(hwnd,dat,1); + dat->ptDragStart.x = (short)LOWORD(lParam); + dat->ptDragStart.y = (short)HIWORD(lParam); + //dat->szQuickSearch[0] = 0; + hit = cliHitTest(hwnd,dat,(short)LOWORD(lParam),(short)HIWORD(lParam),&contact,&group,&hitFlags); + if (GetFocus() != hwnd) SetFocus(hwnd); + if (hit != -1 && !(hitFlags & CLCHT_NOWHERE)) { + if ( hit == dat->selection && hitFlags & CLCHT_ONITEMLABEL && dat->exStyle & CLS_EX_EDITLABELS) { + if ( !(dat->dragStage & DRAGSTAGEF_SKIPRENAME)) { + SetCapture(hwnd); + dat->iDragItem = dat->selection; + dat->dragStage = DRAGSTAGE_NOTMOVED|DRAGSTAGEF_MAYBERENAME; + dat->dragAutoScrolling = 0; + return TRUE; } - - if (dat->bCompactMode) - SendMessage(hwnd,WM_SIZE, 0, 0); else { - CLUI__cliInvalidateRect(hwnd,NULL,FALSE); - UpdateWindow(hwnd); + dat->dragStage &= ~DRAGSTAGEF_SKIPRENAME; + return TRUE; } - return TRUE; } + } - if (hit != -1 && !(hitFlags & CLCHT_NOWHERE) && (hitFlags & CLCHT_ONITEMCHECK)) { - contact->flags ^= CONTACTF_CHECKED; - if (contact->type == CLCIT_GROUP) pcli->pfnSetGroupChildCheckboxes(contact->group,contact->flags&CONTACTF_CHECKED); - pcli->pfnRecalculateGroupCheckboxes(hwnd,dat); - CLUI__cliInvalidateRect(hwnd,NULL,FALSE); + if (hit != -1 && !(hitFlags & CLCHT_NOWHERE) && contact->type == CLCIT_CONTACT && contact->SubAllocated && !contact->isSubcontact) + if (hitFlags&CLCHT_ONITEMICON && dat->expandMeta) + { + BYTE doubleClickExpand = db_get_b(NULL,"CLC","MetaDoubleClick",SETTING_METAAVOIDDBLCLICK_DEFAULT); - NMCLISTCONTROL nm; - nm.hdr.code = CLN_CHECKCHANGED; - nm.hdr.hwndFrom = hwnd; - nm.hdr.idFrom = GetDlgCtrlID(hwnd); - nm.flags = 0; - nm.hItem = ContactToItemHandle(contact,&nm.flags); - SendMessage(GetParent(hwnd),WM_NOTIFY, 0, (LPARAM)&nm); + hitcontact = contact; + HitPoint.x = (short)LOWORD(lParam); + HitPoint.y = (short)HIWORD(lParam); + fMouseUpped = FALSE; + if ((GetKeyState(VK_SHIFT)&0x8000) || (GetKeyState(VK_CONTROL)&0x8000) || (GetKeyState(VK_MENU)&0x8000)) + { + fMouseUpped = TRUE; + hitcontact = contact; + KillTimer(hwnd,TIMERID_SUBEXPAND); + CLUI_SafeSetTimer(hwnd,TIMERID_SUBEXPAND, 0, NULL); } + } + else hitcontact = NULL; - if ( !(hitFlags & (CLCHT_ONITEMICON|CLCHT_ONITEMLABEL|CLCHT_ONITEMCHECK))) { - NMCLISTCONTROL nm; - nm.hdr.code = NM_CLICK; - nm.hdr.hwndFrom = hwnd; - nm.hdr.idFrom = GetDlgCtrlID(hwnd); - nm.flags = 0; - if (hit == -1 || hitFlags&CLCHT_NOWHERE) nm.hItem = NULL; - else nm.hItem = ContactToItemHandle(contact,&nm.flags); - nm.iColumn = hitFlags&CLCHT_ONITEMEXTRA?HIBYTE(HIWORD(hitFlags)):-1; - nm.pt = dat->ptDragStart; - SendMessage(GetParent(hwnd),WM_NOTIFY, 0, (LPARAM)&nm); + if (hit != -1 && !(hitFlags & CLCHT_NOWHERE) && contact->type == CLCIT_GROUP) + if (hitFlags & CLCHT_ONITEMICON) { + ClcGroup *selgroup; + ClcContact *selcontact; + dat->selection = cliGetRowByIndex(dat,dat->selection,&selcontact,&selgroup); + pcli->pfnSetGroupExpand(hwnd,dat,contact->group,-1); + if (dat->selection != -1) { + dat->selection = cliGetRowsPriorTo(&dat->list,selgroup,GetContactIndex(selgroup,selcontact)); + if (dat->selection == -1) dat->selection = cliGetRowsPriorTo(&dat->list,contact->group,-1); } - if (hitFlags & (CLCHT_ONITEMCHECK|CLCHT_ONITEMEXTRA)) - return FALSE; + if (dat->bCompactMode) + SendMessage(hwnd,WM_SIZE, 0, 0); + else { + CLUI__cliInvalidateRect(hwnd,NULL,FALSE); + UpdateWindow(hwnd); + } + return TRUE; + } - dat->selection = (hitFlags&CLCHT_NOWHERE)?-1:hit; + if (hit != -1 && !(hitFlags & CLCHT_NOWHERE) && (hitFlags & CLCHT_ONITEMCHECK)) { + contact->flags ^= CONTACTF_CHECKED; + if (contact->type == CLCIT_GROUP) pcli->pfnSetGroupChildCheckboxes(contact->group,contact->flags&CONTACTF_CHECKED); + pcli->pfnRecalculateGroupCheckboxes(hwnd,dat); CLUI__cliInvalidateRect(hwnd,NULL,FALSE); - UpdateWindow(hwnd); - if (dat->selection != -1 && (contact->type == CLCIT_CONTACT || contact->type == CLCIT_GROUP) && !(hitFlags & (CLCHT_ONITEMEXTRA|CLCHT_ONITEMCHECK|CLCHT_NOWHERE))) { - SetCapture(hwnd); - dat->iDragItem = dat->selection; - dat->dragStage = DRAGSTAGE_NOTMOVED; - dat->dragAutoScrolling = 0; - } + NMCLISTCONTROL nm; + nm.hdr.code = CLN_CHECKCHANGED; + nm.hdr.hwndFrom = hwnd; + nm.hdr.idFrom = GetDlgCtrlID(hwnd); + nm.flags = 0; + nm.hItem = ContactToItemHandle(contact,&nm.flags); + SendMessage(GetParent(hwnd),WM_NOTIFY, 0, (LPARAM)&nm); + } - if (dat->bCompactMode) - SendMessage(hwnd,WM_SIZE, 0, 0); + if ( !(hitFlags & (CLCHT_ONITEMICON|CLCHT_ONITEMLABEL|CLCHT_ONITEMCHECK))) { + NMCLISTCONTROL nm; + nm.hdr.code = NM_CLICK; + nm.hdr.hwndFrom = hwnd; + nm.hdr.idFrom = GetDlgCtrlID(hwnd); + nm.flags = 0; + if (hit == -1 || hitFlags&CLCHT_NOWHERE) nm.hItem = NULL; + else nm.hItem = ContactToItemHandle(contact,&nm.flags); + nm.iColumn = hitFlags&CLCHT_ONITEMEXTRA?HIBYTE(HIWORD(hitFlags)):-1; + nm.pt = dat->ptDragStart; + SendMessage(GetParent(hwnd),WM_NOTIFY, 0, (LPARAM)&nm); + } - if (dat->selection != -1) - pcli->pfnEnsureVisible(hwnd,dat,hit,0); - return TRUE; + if (hitFlags & (CLCHT_ONITEMCHECK|CLCHT_ONITEMEXTRA)) + return FALSE; + + dat->selection = (hitFlags&CLCHT_NOWHERE)?-1:hit; + CLUI__cliInvalidateRect(hwnd,NULL,FALSE); + + UpdateWindow(hwnd); + if (dat->selection != -1 && (contact->type == CLCIT_CONTACT || contact->type == CLCIT_GROUP) && !(hitFlags & (CLCHT_ONITEMEXTRA|CLCHT_ONITEMCHECK|CLCHT_NOWHERE))) { + SetCapture(hwnd); + dat->iDragItem = dat->selection; + dat->dragStage = DRAGSTAGE_NOTMOVED; + dat->dragAutoScrolling = 0; } + + if (dat->bCompactMode) + SendMessage(hwnd,WM_SIZE, 0, 0); + + if (dat->selection != -1) + pcli->pfnEnsureVisible(hwnd,dat,hit,0); + return TRUE; } static LRESULT clcOnCaptureChanged(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam) @@ -1038,9 +1033,7 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, return 0; if (dat->dragStage & DRAGSTAGEF_MAYBERENAME) { - POINT pt; - pt.x = (short)LOWORD(lParam); - pt.y = (short)HIWORD(lParam); + POINT pt = UNPACK_POINT(lParam); if ( abs(pt.x-dat->ptDragStart.x) > GetSystemMetrics(SM_CXDOUBLECLK) || abs(pt.y-dat->ptDragStart.y) > GetSystemMetrics(SM_CYDOUBLECLK)) { KillTimer( hwnd, TIMERID_RENAME ); dat->dragStage &= (~DRAGSTAGEF_MAYBERENAME); @@ -1048,12 +1041,9 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, } if (dat->iDragItem == -1) { - POINT pt; - HWND window; - pt.x = (short)LOWORD(lParam); - pt.y = (short)HIWORD(lParam); + POINT pt = UNPACK_POINT(lParam); ClientToScreen(hwnd,&pt); - window = WindowFromPoint(pt); + HWND window = WindowFromPoint(pt); if (window != hwnd) isOutside = TRUE; } @@ -1121,8 +1111,7 @@ static LRESULT clcOnMouseMove(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, RECT clRect; GetClientRect(hwnd,&clRect); - POINT pt; - pt.x = (short)LOWORD(lParam); pt.y = (short)HIWORD(lParam); + POINT pt = UNPACK_POINT(lParam); HCURSOR hNewCursor = LoadCursor(NULL, IDC_NO); CLUI__cliInvalidateRect(hwnd,NULL,FALSE); if (dat->dragAutoScrolling) { @@ -1275,12 +1264,10 @@ static LRESULT clcOnLButtonUp(ClcData *dat, HWND hwnd, UINT msg, WPARAM wParam, if (dat->dragStage == (DRAGSTAGE_NOTMOVED | DRAGSTAGEF_MAYBERENAME)) CLUI_SafeSetTimer(hwnd,TIMERID_RENAME,GetDoubleClickTime(),NULL); else if ((dat->dragStage & DRAGSTAGEM_STAGE) == DRAGSTAGE_ACTIVE) { - POINT pt; - int target; TCHAR Wording[500]; int res = 0; - pt.x = (short)LOWORD(lParam); pt.y = (short)HIWORD(lParam); - target = GetDropTargetInformation(hwnd,dat,pt); + POINT pt = UNPACK_POINT(lParam); + int target = GetDropTargetInformation(hwnd,dat,pt); switch(target) { case DROPTARGET_ONSELF: break; diff --git a/plugins/Clist_modern/src/modern_clcpaint.cpp b/plugins/Clist_modern/src/modern_clcpaint.cpp index 578cfce328..c2cc5583fb 100644 --- a/plugins/Clist_modern/src/modern_clcpaint.cpp +++ b/plugins/Clist_modern/src/modern_clcpaint.cpp @@ -1658,114 +1658,111 @@ void CLCPaint::_DrawStatusIcon( ClcContact *Drawing, ClcData *dat, int iImage, H { if ( Drawing->type != CLCIT_CONTACT ) { - ske_ImageList_DrawEx( g_himlCListClc, LOWORD( iImage ), hdcMem, + ske_ImageList_DrawEx( g_himlCListClc, LOWORD(iImage), hdcMem, x, y, cx, cy, colorbg, colorfg, mode ); } else if ( Drawing->image_is_special ) { - ske_ImageList_DrawEx( g_himlCListClc, LOWORD( iImage ), hdcMem, + ske_ImageList_DrawEx( g_himlCListClc, LOWORD(iImage), hdcMem, x, y, cx, cy, colorbg, colorfg, mode ); } - else if ( iImage != -1 && HIWORD( iImage ) && dat->drawOverlayedStatus ) + else if ( iImage != -1 && HIWORD(iImage) && dat->drawOverlayedStatus ) { int status = GetContactCachedStatus( Drawing->hContact ); - if ( status < ID_STATUS_OFFLINE ) status = ID_STATUS_OFFLINE; - else if ( status>ID_STATUS_OUTTOLUNCH ) status = ID_STATUS_ONLINE; - ske_ImageList_DrawEx(g_himlCListClc, HIWORD( iImage ), hdcMem, - x, y, cx, cy, colorbg, colorfg, mode); + if (status < ID_STATUS_OFFLINE) status = ID_STATUS_OFFLINE; + else if (status > ID_STATUS_OUTTOLUNCH) status = ID_STATUS_ONLINE; + ske_ImageList_DrawEx(g_himlCListClc, HIWORD(iImage), hdcMem, x, y, cx, cy, colorbg, colorfg, mode); if (dat->drawOverlayedStatus & 2) //draw overlay ske_ImageList_DrawEx( hAvatarOverlays, g_pStatusOverlayIcons[status-ID_STATUS_OFFLINE].listID, hdcMem, x, y, cx, cy, colorbg, colorfg, mode ); } else { - ske_ImageList_DrawEx( g_himlCListClc, LOWORD( iImage ), hdcMem, + ske_ImageList_DrawEx( g_himlCListClc, LOWORD(iImage), hdcMem, x, y, cx, cy, colorbg, colorfg, mode ); } } BOOL CLCPaint::_DrawNonEnginedBackground( HWND hwnd, HDC hdcMem, RECT *rcPaint, RECT clRect, ClcData *dat ) { - if ( dat->hBmpBackground ) - { - BITMAP bmp; - HBITMAP oldbm; - HDC hdcBmp; - int x, y; - int maxx, maxy; - int destw, desth; - - // XXX: Halftone isnt supported on 9x, however the scretch problems dont happen on 98. - SetStretchBltMode( hdcMem, HALFTONE ); - - - GetObject( dat->hBmpBackground, sizeof( bmp ), &bmp ); - hdcBmp = CreateCompatibleDC( hdcMem ); - oldbm = ( HBITMAP )SelectObject( hdcBmp, dat->hBmpBackground ); - y = dat->backgroundBmpUse&CLBF_SCROLL?-dat->yScroll:0; - maxx = dat->backgroundBmpUse&CLBF_TILEH?clRect.right:1; - maxy = dat->backgroundBmpUse&CLBF_TILEV?maxy = rcPaint->bottom:y+1; - switch( dat->backgroundBmpUse&CLBM_TYPE ) { - case CLB_STRETCH: - if ( dat->backgroundBmpUse&CLBF_PROPORTIONAL ) { - if ( clRect.right*bmp.bmHeight < clRect.bottom*bmp.bmWidth ) { - desth = clRect.bottom; - destw = desth*bmp.bmWidth/bmp.bmHeight; - } - else { - destw = clRect.right; - desth = destw*bmp.bmHeight/bmp.bmWidth; - } - } - else { - destw = clRect.right; + if (!dat->hBmpBackground) + return FALSE; + + // XXX: Halftone isnt supported on 9x, however the scretch problems dont happen on 98. + SetStretchBltMode( hdcMem, HALFTONE ); + + BITMAP bmp; + GetObject(dat->hBmpBackground, sizeof(bmp), &bmp); + HDC hdcBmp = CreateCompatibleDC( hdcMem ); + HBITMAP oldbm = ( HBITMAP )SelectObject( hdcBmp, dat->hBmpBackground ); + int x, y = dat->backgroundBmpUse&CLBF_SCROLL?-dat->yScroll:0; + int maxx = dat->backgroundBmpUse&CLBF_TILEH?clRect.right:1; + int maxy = dat->backgroundBmpUse&CLBF_TILEV?maxy = rcPaint->bottom:y+1; + int destw, desth; + + switch( dat->backgroundBmpUse&CLBM_TYPE ) { + case CLB_STRETCH: + if ( dat->backgroundBmpUse&CLBF_PROPORTIONAL ) { + if ( clRect.right*bmp.bmHeight < clRect.bottom*bmp.bmWidth ) { desth = clRect.bottom; + destw = desth*bmp.bmWidth/bmp.bmHeight; } - break; - case CLB_STRETCHH: - if ( dat->backgroundBmpUse&CLBF_PROPORTIONAL ) { + else { destw = clRect.right; desth = destw*bmp.bmHeight/bmp.bmWidth; } - else { - destw = clRect.right; - desth = bmp.bmHeight; - if ( dat->backgroundBmpUse&CLBF_TILEVTOROWHEIGHT ) - { - desth = dat->row_min_heigh; - } + } + else { + destw = clRect.right; + desth = clRect.bottom; + } + break; - } - break; - case CLB_STRETCHV: - if ( dat->backgroundBmpUse&CLBF_PROPORTIONAL ) { - desth = clRect.bottom; - destw = desth*bmp.bmWidth/bmp.bmHeight; - } - else { - destw = bmp.bmWidth; - desth = clRect.bottom; - } - break; - default: //clb_topleft - destw = bmp.bmWidth; + case CLB_STRETCHH: + if ( dat->backgroundBmpUse&CLBF_PROPORTIONAL ) { + destw = clRect.right; + desth = destw*bmp.bmHeight/bmp.bmWidth; + } + else { + destw = clRect.right; desth = bmp.bmHeight; if ( dat->backgroundBmpUse&CLBF_TILEVTOROWHEIGHT ) { desth = dat->row_min_heigh; - } - break; + } + } - for ( ;y < maxy;y += desth ) { - if ( y < rcPaint->top-desth ) continue; - for ( x = 0;x < maxx;x += destw ) - StretchBlt( hdcMem, x, y, destw, desth, hdcBmp, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY ); + break; + + case CLB_STRETCHV: + if ( dat->backgroundBmpUse&CLBF_PROPORTIONAL ) { + desth = clRect.bottom; + destw = desth*bmp.bmWidth/bmp.bmHeight; } - SelectObject( hdcBmp, oldbm ); - DeleteDC( hdcBmp ); - return TRUE; + else { + destw = bmp.bmWidth; + desth = clRect.bottom; + } + break; + + default: //clb_topleft + destw = bmp.bmWidth; + desth = bmp.bmHeight; + if ( dat->backgroundBmpUse&CLBF_TILEVTOROWHEIGHT ) + { + desth = dat->row_min_heigh; + } + break; } - return FALSE; + + for ( ;y < maxy;y += desth ) { + if ( y < rcPaint->top-desth ) continue; + for ( x = 0;x < maxx;x += destw ) + StretchBlt( hdcMem, x, y, destw, desth, hdcBmp, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY ); + } + SelectObject( hdcBmp, oldbm ); + DeleteDC( hdcBmp ); + return TRUE; } int CLCPaint::_DetermineDrawMode( HWND hWnd, ClcData *dat ) @@ -1797,38 +1794,33 @@ int CLCPaint::_DetermineDrawMode( HWND hWnd, ClcData *dat ) void CLCPaint::_PreparePaintContext( HWND hWnd, ClcData *dat, HDC hdc, int paintMode, RECT& clRect, _PaintContext& pc ) { - if ( paintMode&DM_GRAY && !(paintMode&DM_LAYERED)) - { - pc.hdcMem2 = CreateCompatibleDC( hdc ); - if ( paintMode&DM_CLASSIC ) + if ((paintMode & DM_GRAY) && !(paintMode & DM_LAYERED)) { + pc.hdcMem2 = CreateCompatibleDC(hdc); + if (paintMode & DM_CLASSIC) pc.hBmpOsb2 = CreateBitmap( clRect.right, clRect.bottom, 1, GetDeviceCaps( hdc, BITSPIXEL ), NULL ); else pc.hBmpOsb2 = ske_CreateDIB32( clRect.right, clRect.bottom ); - pc.oldbmp2 = (HBITMAP) SelectObject( pc.hdcMem2, pc.hBmpOsb2 ); + pc.oldbmp2 = (HBITMAP)SelectObject( pc.hdcMem2, pc.hBmpOsb2 ); pc.fRelease |= _PaintContext::release_hdcmem2; } - if ( paintMode&( DM_DRAW_OFFSCREEN | DM_GRAY ) ) - { - pc.hdcMem = CreateCompatibleDC( hdc ); + if (paintMode & (DM_DRAW_OFFSCREEN | DM_GRAY)) { + pc.hdcMem = CreateCompatibleDC(hdc); pc.fRelease |= _PaintContext::release_hdcmem; pc.hBmpOsb = ske_CreateDIB32( clRect.right, clRect.bottom ); - pc.oldbmp = ( HBITMAP ) SelectObject( pc.hdcMem, pc.hBmpOsb ); + pc.oldbmp = (HBITMAP)SelectObject( pc.hdcMem, pc.hBmpOsb ); } - if ( paintMode&DM_CONTROL && !dat->bkChanged ) - { + if ((paintMode & DM_CONTROL) && !dat->bkChanged) { pc.tmpbkcolour = GetSysColor( COLOR_3DFACE ); pc.tmpforecolour = GetSysColor( COLOR_BTNTEXT ); } - else - { - pc.tmpbkcolour = (!(paintMode&DM_CONTROL) && dat->bkChanged ) ? dat->bkColour : ( !dat->useWindowsColours ? dat->bkColour : GetSysColor( COLOR_3DFACE )); - pc.tmpforecolour = /*(paintMode&DM_CONTROL) ? */dat->fontModernInfo[FONTID_CONTACTS].colour; + else { + pc.tmpbkcolour = (!(paintMode & DM_CONTROL) && dat->bkChanged ) ? dat->bkColour : ( !dat->useWindowsColours ? dat->bkColour : GetSysColor( COLOR_3DFACE )); + pc.tmpforecolour = dat->fontModernInfo[FONTID_CONTACTS].colour; } - if ( paintMode&DM_GREYALTERNATE ) - { + if ( paintMode & DM_GREYALTERNATE ) { int rDelta = ( GetRValue( pc.tmpbkcolour ) > GetRValue( pc.tmpforecolour )) ? -10 : 10; int gDelta = ( GetGValue( pc.tmpbkcolour ) > GetGValue( pc.tmpforecolour )) ? -10 : 10; int bDelta = ( GetBValue( pc.tmpbkcolour ) > GetBValue( pc.tmpforecolour )) ? -10 : 10; @@ -1844,8 +1836,8 @@ void CLCPaint::_PreparePaintContext( HWND hWnd, ClcData *dat, HDC hdc, int paint } // Set some draw states - SetBkMode( pc.hdcMem, TRANSPARENT ); - SetStretchBltMode( pc.hdcMem, HALFTONE ); + SetBkMode(pc.hdcMem, TRANSPARENT); + SetStretchBltMode(pc.hdcMem, HALFTONE); POINT org; GetBrushOrgEx( pc.hdcMem, &org ); diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index cc0b85635c..e82eb84c94 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -88,12 +88,11 @@ int CLUI::OnEvent_ModulesLoaded(WPARAM wParam,LPARAM lParam) int CLUI::OnEvent_FontReload(WPARAM wParam,LPARAM lParam) { - pcli->pfnClcBroadcast( INTM_RELOADOPTIONS, wParam, lParam ); + pcli->pfnClcBroadcast(INTM_RELOADOPTIONS, wParam, lParam); g_CluiData.dwKeyColor = db_get_dw(NULL,"ModernSettings","KeyColor",(DWORD)SETTING_KEYCOLOR_DEFAULT); - CLUI__cliInvalidateRect( pcli->hwndContactList, 0, 0 ); - + CLUI__cliInvalidateRect(pcli->hwndContactList, 0, 0); return 0; } @@ -961,17 +960,15 @@ static HICON CLUI_GetConnectingIconForProto(char *szAccoName, int idx) if (hIcon = CLUI_LoadIconFromExternalFile(szFullPath, idx)) return hIcon; - return LoadSmallIcon(g_hInst, IDI_ICQC1 + idx); + return LoadSmallIcon(g_hInst, -IDI_ICQC1-idx); } - INT_PTR CLUI_GetConnectingIconService(WPARAM wParam,LPARAM lParam) { - int b; HICON hIcon = NULL; char *szProto = (char *)wParam; - if ( !szProto) + if (!szProto) return 0; PROTOTICKS *pt = CLUI_GetProtoTicksByProto(szProto); @@ -983,23 +980,20 @@ INT_PTR CLUI_GetConnectingIconService(WPARAM wParam,LPARAM lParam) } if (pt != NULL) { if (pt->nCycleStartTick != 0 && pt->nIconsCount != 0) { - b = ((GetTickCount()-pt->nCycleStartTick)/(nAnimatedIconStep))%(pt->nIconsCount); + int b = ((GetTickCount()-pt->nCycleStartTick)/(nAnimatedIconStep))%(pt->nIconsCount); if (pt->himlIconList) - hIcon = ske_ImageList_GetIcon(pt->himlIconList,b,ILD_NORMAL); - else - hIcon = NULL; + return (INT_PTR)ske_ImageList_GetIcon(pt->himlIconList,b,ILD_NORMAL); } } - return (INT_PTR)hIcon; -}; - + return NULL; +} static int CLUI_CreateTimerForConnectingIcon(WPARAM wParam,LPARAM lParam) { int status = (int)wParam; char *szProto = (char*)lParam; - if ( !szProto || !status) + if (!szProto || !status) return 0; if ((g_StatusBarData.connectingIcon == 1) && status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES) { @@ -1033,12 +1027,12 @@ static int CLUI_CreateTimerForConnectingIcon(WPARAM wParam,LPARAM lParam) static BOOL CALLBACK BroadcastEnumChildProc(HWND hwndChild, LPARAM lParam) { MSG *pMsg = (MSG*)lParam; - SendNotifyMessage( hwndChild, pMsg->message, pMsg->wParam, pMsg->lParam ); - EnumChildWindows( hwndChild, BroadcastEnumChildProc, lParam ); + SendNotifyMessage(hwndChild, pMsg->message, pMsg->wParam, pMsg->lParam); + EnumChildWindows(hwndChild, BroadcastEnumChildProc, lParam); return TRUE; } -static LRESULT BroadCastMessageToChild(HWND hwnd, int message, WPARAM wParam, LPARAM lParam ) +static LRESULT BroadCastMessageToChild(HWND hwnd, int message, WPARAM wParam, LPARAM lParam) { MSG msg = {0}; msg.hwnd = hwnd; @@ -1104,76 +1098,65 @@ static int CLUI_DrawMenuBackGround(HWND hwnd, HDC hdc, int item, int state) return 1; GetWindowRect(hwnd, &ra); - { - MENUBARINFO mbi = {0}; - mbi.cbSize = sizeof(MENUBARINFO); - fnGetMenuBarInfo(hwnd,OBJID_MENU, 0, &mbi); - if ( !(mbi.rcBar.right-mbi.rcBar.left > 0 && mbi.rcBar.bottom-mbi.rcBar.top > 0)) - return 1; - r1 = mbi.rcBar; - r1.bottom += !db_get_b(NULL,"CLUI","LineUnderMenu",SETTING_LINEUNDERMENU_DEFAULT); - if (item < 1) { - treg = CreateRectRgn(mbi.rcBar.left,mbi.rcBar.top,mbi.rcBar.right,r1.bottom); - if (item == 0) { //should remove item clips - for (int t = 1; t <= 2; t++) { - fnGetMenuBarInfo(hwnd,OBJID_MENU, t, &mbi); - treg2 = CreateRectRgn(mbi.rcBar.left,mbi.rcBar.top,mbi.rcBar.right,mbi.rcBar.bottom); - CombineRgn(treg,treg,treg2,RGN_DIFF); - DeleteObject(treg2); - } + MENUBARINFO mbi = { sizeof(MENUBARINFO) }; + fnGetMenuBarInfo(hwnd,OBJID_MENU, 0, &mbi); + if ( !(mbi.rcBar.right-mbi.rcBar.left > 0 && mbi.rcBar.bottom-mbi.rcBar.top > 0)) + return 1; + r1 = mbi.rcBar; + r1.bottom += !db_get_b(NULL,"CLUI","LineUnderMenu",SETTING_LINEUNDERMENU_DEFAULT); + if (item < 1) { + treg = CreateRectRgn(mbi.rcBar.left,mbi.rcBar.top,mbi.rcBar.right,r1.bottom); + if (item == 0) { //should remove item clips + for (int t = 1; t <= 2; t++) { + fnGetMenuBarInfo(hwnd,OBJID_MENU, t, &mbi); + treg2 = CreateRectRgn(mbi.rcBar.left,mbi.rcBar.top,mbi.rcBar.right,mbi.rcBar.bottom); + CombineRgn(treg,treg,treg2,RGN_DIFF); + DeleteObject(treg2); } } - else { - fnGetMenuBarInfo(hwnd,OBJID_MENU, item, &mbi); - treg = CreateRectRgn(mbi.rcBar.left,mbi.rcBar.top,mbi.rcBar.right,mbi.rcBar.bottom+!db_get_b(NULL,"CLUI","LineUnderMenu",SETTING_LINEUNDERMENU_DEFAULT)); - } - OffsetRgn(treg,-ra.left,-ra.top); - r1.left -= ra.left; - r1.top -= ra.top; - r1.bottom -= ra.top; - r1.right -= ra.left; } + else { + fnGetMenuBarInfo(hwnd,OBJID_MENU, item, &mbi); + treg = CreateRectRgn(mbi.rcBar.left,mbi.rcBar.top,mbi.rcBar.right,mbi.rcBar.bottom+!db_get_b(NULL,"CLUI","LineUnderMenu",SETTING_LINEUNDERMENU_DEFAULT)); + } + OffsetRgn(treg,-ra.left,-ra.top); + r1.left -= ra.left; + r1.top -= ra.top; + r1.bottom -= ra.top; + r1.right -= ra.left; SelectClipRgn(hdc,treg); DeleteObject(treg); - { - RECT rc; - HWND hwnd = pcli->hwndContactList; - GetWindowRect(hwnd,&rc); - OffsetRect(&rc,-rc.left, -rc.top); - FillRect(hdc,&r1,GetSysColorBrush(COLOR_MENU)); - ske_SetRectOpaque(hdc,&r1); - //ske_BltBackImage(hwnd,hdc,&r1); - } + + RECT rc; + GetWindowRect(pcli->hwndContactList, &rc); + OffsetRect(&rc,-rc.left, -rc.top); + FillRect(hdc, &r1, GetSysColorBrush(COLOR_MENU)); + ske_SetRectOpaque(hdc, &r1); + if ( !g_CluiData.fDisableSkinEngine) SkinDrawGlyph(hdc,&r1,&r1,"Main,ID=MenuBar"); else { HBRUSH hbr = NULL; if (dat->hMenuBackground) { - BITMAP bmp; - HBITMAP oldbm; - HDC hdcBmp; - int x,y; - int maxx,maxy; - int destw,desth; RECT clRect = r1; // XXX: Halftone isnt supported on 9x, however the scretch problems dont happen on 98. SetStretchBltMode(hdc, HALFTONE); - GetObject(dat->hMenuBackground,sizeof(bmp),&bmp); - hdcBmp = CreateCompatibleDC(hdc); - oldbm = (HBITMAP)SelectObject(hdcBmp,dat->hMenuBackground); - y = clRect.top; - x = clRect.left; - maxx = dat->MenuBmpUse&CLBF_TILEH?maxx = r1.right:x+1; - maxy = dat->MenuBmpUse&CLBF_TILEV?maxy = r1.bottom:y+1; - - switch(dat->MenuBmpUse&CLBM_TYPE) { + BITMAP bmp; + GetObject(dat->hMenuBackground, sizeof(bmp), &bmp); + HDC hdcBmp = CreateCompatibleDC(hdc); + HBITMAP oldbm = (HBITMAP)SelectObject(hdcBmp,dat->hMenuBackground); + int y = clRect.top, x = clRect.left, destw, desth; + int maxx = (dat->MenuBmpUse & CLBF_TILEH) ? maxx = r1.right : x+1; + int maxy = (dat->MenuBmpUse & CLBF_TILEV) ? maxy = r1.bottom : y+1; + + switch(dat->MenuBmpUse & CLBM_TYPE) { case CLB_STRETCH: - if (dat->MenuBmpUse&CLBF_PROPORTIONAL) { + if (dat->MenuBmpUse & CLBF_PROPORTIONAL) { if (clRect.right-clRect.left*bmp.bmHeight < clRect.bottom-clRect.top*bmp.bmWidth) { desth = clRect.bottom-clRect.top; destw = desth*bmp.bmWidth/bmp.bmHeight; @@ -1217,11 +1200,11 @@ static int CLUI_DrawMenuBackGround(HWND hwnd, HDC hdc, int item, int state) break; } if (desth && destw) - for (y = clRect.top;y < maxy;y += desth) - for (x = clRect.left;x < maxx;x += destw) - StretchBlt(hdc,x,y,destw,desth,hdcBmp, 0, 0, bmp.bmWidth,bmp.bmHeight,SRCCOPY); + for (y = clRect.top; y < maxy; y += desth) + for (x = clRect.left; x < maxx; x += destw) + StretchBlt(hdc, x, y, destw, desth, hdcBmp, 0, 0, bmp.bmWidth, bmp.bmHeight, SRCCOPY); - SelectObject(hdcBmp,oldbm); + SelectObject(hdcBmp, oldbm); DeleteDC(hdcBmp); } else { @@ -1621,7 +1604,7 @@ HANDLE RegisterIcolibIconHandle(char *szIcoID, char *szSectionName, char *szDes } // MAIN WINPROC MESSAGE HANDLERS -LRESULT CLUI::PreProcessWndProc( UINT msg, WPARAM wParam, LPARAM lParam, BOOL& bHandled ) +LRESULT CLUI::PreProcessWndProc(UINT msg, WPARAM wParam, LPARAM lParam, BOOL& bHandled ) { // proxy CLUI Messages LRESULT result = 0; @@ -1672,7 +1655,7 @@ LRESULT CLUI::PreProcessWndProc( UINT msg, WPARAM wParam, LPARAM lParam, BOOL& b } -LRESULT CLUI::OnSizingMoving( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnSizingMoving(UINT msg, WPARAM wParam, LPARAM lParam) { if (g_CluiData.fLayered) { @@ -1893,32 +1876,32 @@ LRESULT CLUI::OnSizingMoving( UINT msg, WPARAM wParam, LPARAM lParam ) return 0; } -LRESULT CLUI::OnThemeChanged( UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/ ) +LRESULT CLUI::OnThemeChanged(UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/ ) { xpt_OnWM_THEMECHANGED(); return FALSE; } -LRESULT CLUI::OnDwmCompositionChanged( UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/ ) +LRESULT CLUI::OnDwmCompositionChanged(UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/ ) { g_CluiData.fAeroGlass = false; CLUI_UpdateAeroGlass(); return FALSE; } -LRESULT CLUI::OnSyncCall( UINT /*msg*/, WPARAM wParam, LPARAM /*lParam*/ ) +LRESULT CLUI::OnSyncCall(UINT /*msg*/, WPARAM wParam, LPARAM /*lParam*/ ) { return SyncOnWndProcCall( wParam ); } -LRESULT CLUI::OnUpdate( UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/ ) +LRESULT CLUI::OnUpdate(UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/ ) { if ( g_flag_bPostWasCanceled ) return FALSE; return ske_ValidateFrameImageProc( NULL ); } -LRESULT CLUI::OnInitMenu( UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/ ) +LRESULT CLUI::OnInitMenu(UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/ ) { if ( !CLUI::IsMainMenuInited()) { if ( ServiceExists( MS_CLIST_MENUBUILDMAIN )) @@ -1928,9 +1911,9 @@ LRESULT CLUI::OnInitMenu( UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/ ) return FALSE; } -LRESULT CLUI::OnNcPaint( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnNcPaint(UINT msg, WPARAM wParam, LPARAM lParam) { - int lRes = DefWindowProc( m_hWnd, msg, wParam, lParam ); + int lRes = DefWindowProc( m_hWnd, msg, wParam, lParam); if ( !g_CluiData.fLayered && db_get_b( NULL,"CLUI","ShowMainMenu",SETTING_SHOWMAINMENU_DEFAULT )) { HDC hdc = NULL; if ( msg == WM_PRINT ) hdc = (HDC)wParam; @@ -1941,37 +1924,34 @@ LRESULT CLUI::OnNcPaint( UINT msg, WPARAM wParam, LPARAM lParam ) return lRes; } -LRESULT CLUI::OnEraseBkgnd( UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/ ) +LRESULT CLUI::OnEraseBkgnd(UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/ ) { return TRUE; } -LRESULT CLUI::OnNcCreate( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnNcCreate(UINT msg, WPARAM wParam, LPARAM lParam) { - ((LPCREATESTRUCT)lParam )->style &= ~(CS_HREDRAW | CS_VREDRAW); - return DefCluiWndProc( msg, wParam, lParam ); + ((LPCREATESTRUCT)lParam)->style &= ~(CS_HREDRAW | CS_VREDRAW); + return DefCluiWndProc( msg, wParam, lParam); } -LRESULT CLUI::OnPaint( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnPaint(UINT msg, WPARAM wParam, LPARAM lParam) { if ( !g_CluiData.fLayered && IsWindowVisible(m_hWnd)) { RECT w = {0}; RECT w2 = {0}; PAINTSTRUCT ps = {0}; - HDC hdc; - HBITMAP hbmp,oldbmp; - HDC paintDC; GetClientRect(m_hWnd,&w); - if ( !(w.right>0 && w.bottom>0)) return DefWindowProc(m_hWnd, msg, wParam, lParam); + if ( !(w.right > 0 && w.bottom > 0)) + return DefWindowProc(m_hWnd, msg, wParam, lParam); - if ( !g_CluiData.fDisableSkinEngine) - { - paintDC = GetDC(m_hWnd); + if ( !g_CluiData.fDisableSkinEngine) { + HDC paintDC = GetDC(m_hWnd); w2 = w; - hdc = CreateCompatibleDC(paintDC); - hbmp = ske_CreateDIB32(w.right,w.bottom); - oldbmp = (HBITMAP)SelectObject(hdc,hbmp); + HDC hdc = CreateCompatibleDC(paintDC); + HBITMAP hbmp = ske_CreateDIB32(w.right,w.bottom); + HBITMAP oldbmp = (HBITMAP)SelectObject(hdc,hbmp); ske_ReCreateBackImage(FALSE,NULL); BitBlt(paintDC,w2.left,w2.top,w2.right-w2.left,w2.bottom-w2.top,g_pCachedWindow->hBackDC,w2.left,w2.top,SRCCOPY); SelectObject(hdc,oldbmp); @@ -2014,7 +1994,7 @@ LRESULT CLUI::OnPaint( UINT msg, WPARAM wParam, LPARAM lParam ) return DefWindowProc(m_hWnd, msg, wParam, lParam); } -LRESULT CLUI::OnCreate( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnCreate(UINT msg, WPARAM wParam, LPARAM lParam) { TranslateMenu(GetMenu(m_hWnd)); DrawMenuBar(m_hWnd); @@ -2044,12 +2024,12 @@ LRESULT CLUI::OnCreate( UINT msg, WPARAM wParam, LPARAM lParam ) return FALSE; } -LRESULT CLUI::OnSetAllExtraIcons( UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/ ) +LRESULT CLUI::OnSetAllExtraIcons(UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/ ) { return FALSE; } -LRESULT CLUI::OnCreateClc( UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/ ) +LRESULT CLUI::OnCreateClc(UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/ ) { CreateCLC(); if ( db_get_b( NULL, "CList", "ShowOnStart", SETTING_SHOWONSTART_DEFAULT )) @@ -2058,149 +2038,129 @@ LRESULT CLUI::OnCreateClc( UINT /*msg*/, WPARAM /*wParam*/, LPARAM /*lParam*/ ) return FALSE; } -LRESULT CLUI::OnLButtonDown( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnLButtonDown(UINT msg, WPARAM wParam, LPARAM lParam) { - POINT pt; - pt.x = (short)LOWORD(lParam); - pt.y = (short)HIWORD(lParam); + POINT pt = UNPACK_POINT(lParam); ClientToScreen( m_hWnd, &pt ); - if ( CLUI_SizingOnBorder( pt, 1 )) - { + if ( CLUI_SizingOnBorder( pt, 1 )) { mutex_bIgnoreActivation = TRUE; return FALSE; } - return DefCluiWndProc( msg, wParam, lParam ); + return DefCluiWndProc( msg, wParam, lParam); } -LRESULT CLUI::OnParentNotify( UINT msg, WPARAM wParam, LPARAM lParam ) + +LRESULT CLUI::OnParentNotify(UINT msg, WPARAM wParam, LPARAM lParam) { - switch ( wParam ) - { + switch (wParam) { case WM_LBUTTONDOWN: - { - POINT pt; - - pt.x = (short)LOWORD(lParam); - pt.y = (short)HIWORD(lParam); - ClientToScreen( m_hWnd, &pt ); - wParam = 0; - lParam = 0; + POINT pt = UNPACK_POINT(lParam); + ClientToScreen(m_hWnd, &pt); + wParam = 0; + lParam = 0; - if ( CLUI_SizingOnBorder( pt,1 )) - { - mutex_bIgnoreActivation = TRUE; - return 0; - } + if ( CLUI_SizingOnBorder(pt, 1)) { + mutex_bIgnoreActivation = TRUE; + return 0; } } return DefWindowProc(m_hWnd, msg, wParam, lParam);; } -LRESULT CLUI::OnSetFocus( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnSetFocus(UINT msg, WPARAM wParam, LPARAM lParam) { if ( hFrameContactTree && ( !CallService( MS_CLIST_FRAMES_GETFRAMEOPTIONS, MAKEWPARAM( FO_FLOATING, hFrameContactTree ), 0 ))) - { SetFocus(pcli->hwndContactTree); - } return FALSE; } -LRESULT CLUI::OnStatusBarUpdateTimer( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnStatusBarUpdateTimer(UINT msg, WPARAM wParam, LPARAM lParam) { - int status,i; - PROTOTICKS *pt = NULL; - - for (i=0;i < 64;i++) - { + int status; + PROTOTICKS *pt; + for (int i=0; i < 64; i++) { pt = &CycleStartTick[i]; - - if (pt->szProto != NULL && pt->bTimerCreated == 1) - { + if (pt->szProto != NULL && pt->bTimerCreated == 1) { if (pt->bGlobal) status = g_bMultiConnectionMode?ID_STATUS_CONNECTING:0; else status = CallProtoService(pt->szProto,PS_GETSTATUS, 0, 0); - if ( !(status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES)) - { + if ( !(status >= ID_STATUS_CONNECTING && status <= ID_STATUS_CONNECTING+MAX_CONNECT_RETRIES)) { pt->nCycleStartTick = 0; ImageList_Destroy(pt->himlIconList); pt->himlIconList = NULL; - KillTimer(m_hWnd,TM_STATUSBARUPDATE+pt->nIndex); + KillTimer(m_hWnd, TM_STATUSBARUPDATE + pt->nIndex); pt->bTimerCreated = 0; } } } - pt = &CycleStartTick[wParam-TM_STATUSBARUPDATE]; - { - if (IsWindowVisible(pcli->hwndStatus)) pcli->pfnInvalidateRect(pcli->hwndStatus,NULL,0);//InvalidateRectZ(pcli->hwndStatus,NULL,TRUE); - //if (DBGetContactSettingByte(NULL,"CList","TrayIcon",SETTING_TRAYICON_DEFAULT) != SETTING_TRAYICON_CYCLE) - if (pt->bGlobal) - cliTrayIconUpdateBase(g_szConnectingProto); - else - cliTrayIconUpdateBase(pt->szProto); + pt = &CycleStartTick[wParam - TM_STATUSBARUPDATE]; + + if (IsWindowVisible(pcli->hwndStatus)) + pcli->pfnInvalidateRect(pcli->hwndStatus,NULL,0); + if (pt->bGlobal) + cliTrayIconUpdateBase(g_szConnectingProto); + else + cliTrayIconUpdateBase(pt->szProto); - } pcli->pfnInvalidateRect(pcli->hwndStatus,NULL,TRUE); - return DefCluiWndProc( msg, wParam, lParam ); + return DefCluiWndProc( msg, wParam, lParam); } -LRESULT CLUI::OnAutoAlphaTimer( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnAutoAlphaTimer(UINT msg, WPARAM wParam, LPARAM lParam) { int inwnd; - if (GetForegroundWindow() == m_hWnd) - { + if (GetForegroundWindow() == m_hWnd) { KillTimer(m_hWnd,TM_AUTOALPHA); - inwnd = 1; + inwnd = TRUE; } - else - { - POINT pt; - HWND hwndPt; - pt.x = (short)LOWORD(GetMessagePos()); - pt.y = (short)HIWORD(GetMessagePos()); - hwndPt = WindowFromPoint(pt); + else { + DWORD dwPos = GetMessagePos(); + POINT pt = UNPACK_POINT(lParam); + HWND hwndPt = WindowFromPoint(pt); inwnd = FALSE; inwnd = CLUI_CheckOwnedByClui(hwndPt); if ( ! inwnd ) inwnd = ( GetCapture() == pcli->hwndContactList ); - } - if (inwnd != bTransparentFocus) - { //change + + if (inwnd != bTransparentFocus) { + //change HWND hwn = GetCapture(); - hwn = hwn; bTransparentFocus = inwnd; - if (bTransparentFocus) CLUI_SmoothAlphaTransition(m_hWnd, (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), 1); + if (bTransparentFocus) + CLUI_SmoothAlphaTransition(m_hWnd, (BYTE)db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT), 1); else - { - CLUI_SmoothAlphaTransition(m_hWnd, (BYTE)(g_bTransparentFlag?db_get_b(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT):255), 1); - } + CLUI_SmoothAlphaTransition(m_hWnd, (BYTE)(g_bTransparentFlag ? db_get_b(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT) : 255), 1); } - if ( !bTransparentFocus) KillTimer(m_hWnd,TM_AUTOALPHA); + if ( !bTransparentFocus) + KillTimer(m_hWnd,TM_AUTOALPHA); return TRUE; } -LRESULT CLUI::OnSmoothAlphaTransitionTimer( UINT msg, WPARAM wParam, LPARAM lParam ) + +LRESULT CLUI::OnSmoothAlphaTransitionTimer(UINT msg, WPARAM wParam, LPARAM lParam) { CLUI_SmoothAlphaTransition(m_hWnd, 0, 2); return TRUE; } -LRESULT CLUI::OnDelayedSizingTimer( UINT msg, WPARAM wParam, LPARAM lParam ) + +LRESULT CLUI::OnDelayedSizingTimer(UINT msg, WPARAM wParam, LPARAM lParam) { - if ( mutex_bDelayedSizing && !mutex_bDuringSizing ) - { + if (mutex_bDelayedSizing && !mutex_bDuringSizing) { mutex_bDelayedSizing = 0; KillTimer( m_hWnd,TM_DELAYEDSIZING ); pcli->pfnClcBroadcast( INTM_SCROLLBARCHANGED, 0, 0 ); } return TRUE; } -LRESULT CLUI::OnBringOutTimer( UINT msg, WPARAM wParam, LPARAM lParam ) + +LRESULT CLUI::OnBringOutTimer(UINT msg, WPARAM wParam, LPARAM lParam) { //hide KillTimer(m_hWnd,TM_BRINGINTIMEOUT); @@ -2213,7 +2173,8 @@ LRESULT CLUI::OnBringOutTimer( UINT msg, WPARAM wParam, LPARAM lParam ) CLUI_HideBehindEdge(); return TRUE; } -LRESULT CLUI::OnBringInTimer( UINT msg, WPARAM wParam, LPARAM lParam ) + +LRESULT CLUI::OnBringInTimer(UINT msg, WPARAM wParam, LPARAM lParam) { //show KillTimer(m_hWnd,TM_BRINGINTIMEOUT); @@ -2222,73 +2183,69 @@ LRESULT CLUI::OnBringInTimer( UINT msg, WPARAM wParam, LPARAM lParam ) POINT pt; GetCursorPos(&pt); HWND hAux = WindowFromPoint(pt); BOOL mouse_in_window = FALSE; - while(hAux != NULL) - { - if (hAux == m_hWnd) { mouse_in_window = TRUE; break;} + while(hAux != NULL) { + if (hAux == m_hWnd) { + mouse_in_window = TRUE; + break; + } hAux = GetParent(hAux); } if ( mouse_in_window ) CLUI_ShowFromBehindEdge(); return TRUE; } -LRESULT CLUI::OnUpdateBringTimer( UINT msg, WPARAM wParam, LPARAM lParam ) + +LRESULT CLUI::OnUpdateBringTimer(UINT msg, WPARAM wParam, LPARAM lParam) { CLUI_UpdateTimer( 0 ); return TRUE; } -LRESULT CLUI::OnTimer( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnTimer(UINT msg, WPARAM wParam, LPARAM lParam) { - if ( MirandaExiting()) return FALSE; + if ( MirandaExiting()) + return FALSE; - if ((int)wParam >= TM_STATUSBARUPDATE && (int)wParam <= TM_STATUSBARUPDATE+64 ) - { - if ( !pcli->hwndStatus ) return FALSE; - else return OnStatusBarUpdateTimer( msg, wParam, lParam ); + if ((int)wParam >= TM_STATUSBARUPDATE && (int)wParam <= TM_STATUSBARUPDATE+64 ) { + if (!pcli->hwndStatus) + return FALSE; + return OnStatusBarUpdateTimer( msg, wParam, lParam); } - switch ( wParam ) - { - case TM_AUTOALPHA: return OnAutoAlphaTimer( msg, wParam, lParam ); - case TM_SMOTHALPHATRANSITION: return OnSmoothAlphaTransitionTimer( msg, wParam, lParam ); - case TM_DELAYEDSIZING: return OnDelayedSizingTimer( msg, wParam, lParam ); - case TM_BRINGOUTTIMEOUT: return OnBringOutTimer( msg, wParam, lParam ); - case TM_BRINGINTIMEOUT: return OnBringInTimer( msg, wParam, lParam ); - case TM_UPDATEBRINGTIMER: return OnUpdateBringTimer( msg, wParam, lParam ); - default: return DefCluiWndProc( msg, wParam, lParam ); + switch ( wParam ) { + case TM_AUTOALPHA: return OnAutoAlphaTimer( msg, wParam, lParam); + case TM_SMOTHALPHATRANSITION: return OnSmoothAlphaTransitionTimer( msg, wParam, lParam); + case TM_DELAYEDSIZING: return OnDelayedSizingTimer( msg, wParam, lParam); + case TM_BRINGOUTTIMEOUT: return OnBringOutTimer( msg, wParam, lParam); + case TM_BRINGINTIMEOUT: return OnBringInTimer( msg, wParam, lParam); + case TM_UPDATEBRINGTIMER: return OnUpdateBringTimer( msg, wParam, lParam); } - return TRUE; + return DefCluiWndProc( msg, wParam, lParam); } -LRESULT CLUI::OnActivate( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnActivate(UINT msg, WPARAM wParam, LPARAM lParam) { BOOL IsOption = FALSE; SetCursor(LoadCursor(NULL, IDC_ARROW)); SendMessage(pcli->hwndContactTree, WM_ACTIVATE, wParam, lParam); - if ( db_get_b(NULL, "ModernData", "HideBehind", SETTING_HIDEBEHIND_DEFAULT)) - { + if ( db_get_b(NULL, "ModernData", "HideBehind", SETTING_HIDEBEHIND_DEFAULT)) { if (wParam == WA_INACTIVE && ((HWND)lParam != m_hWnd) && GetParent((HWND)lParam) != m_hWnd && !IsOption) { if ( !g_bCalledFromShowHide) CLUI_UpdateTimer(0); } else if ( !g_bCalledFromShowHide ) - { CLUI_ShowFromBehindEdge(); - } } - if ( !IsWindowVisible(m_hWnd) || mutex_bShowHideCalledFromAnimation) - { + if ( !IsWindowVisible(m_hWnd) || mutex_bShowHideCalledFromAnimation) { KillTimer(m_hWnd,TM_AUTOALPHA); return 0; } - if (wParam == WA_INACTIVE && ((HWND)lParam != m_hWnd) && !CLUI_CheckOwnedByClui((HWND)lParam) && !IsOption) - { - if (g_bTransparentFlag) - if (bTransparentFocus) - CLUI_SafeSetTimer(m_hWnd, TM_AUTOALPHA,250, NULL); + if (wParam == WA_INACTIVE && ((HWND)lParam != m_hWnd) && !CLUI_CheckOwnedByClui((HWND)lParam) && !IsOption) { + if (g_bTransparentFlag && bTransparentFocus) + CLUI_SafeSetTimer(m_hWnd, TM_AUTOALPHA,250, NULL); } else { if ( !db_get_b(NULL,"CList","OnTop",SETTING_ONTOP_DEFAULT)) @@ -2300,20 +2257,20 @@ LRESULT CLUI::OnActivate( UINT msg, WPARAM wParam, LPARAM lParam ) } } RedrawWindow(m_hWnd,NULL,NULL,RDW_INVALIDATE|RDW_ALLCHILDREN); - if (g_bTransparentFlag) - { + if (g_bTransparentFlag) { BYTE alpha; - if (wParam != WA_INACTIVE || CLUI_CheckOwnedByClui((HWND)lParam) || IsOption || ((HWND)lParam == m_hWnd) || GetParent((HWND)lParam) == m_hWnd) alpha = db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT); + if (wParam != WA_INACTIVE || CLUI_CheckOwnedByClui((HWND)lParam) || IsOption || ((HWND)lParam == m_hWnd) || GetParent((HWND)lParam) == m_hWnd) + alpha = db_get_b(NULL,"CList","Alpha",SETTING_ALPHA_DEFAULT); else - alpha = g_bTransparentFlag?db_get_b(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT):255; + alpha = g_bTransparentFlag ? db_get_b(NULL,"CList","AutoAlpha",SETTING_AUTOALPHA_DEFAULT) : 255; CLUI_SmoothAlphaTransition(m_hWnd, alpha, 1); if (IsOption) DefWindowProc(m_hWnd,msg,wParam,lParam); - else return 1; + else return 1; } - return DefWindowProc(m_hWnd,msg,wParam,lParam); + return DefWindowProc(m_hWnd,msg,wParam,lParam); } -LRESULT CLUI::OnSetCursor( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnSetCursor(UINT msg, WPARAM wParam, LPARAM lParam) { HWND gf = GetForegroundWindow(); if (g_CluiData.nBehindEdgeState >= 0) CLUI_UpdateTimer(1); @@ -2329,47 +2286,41 @@ LRESULT CLUI::OnSetCursor( UINT msg, WPARAM wParam, LPARAM lParam ) return k ? k : 1; } -LRESULT CLUI::OnMouseActivate( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnMouseActivate(UINT msg, WPARAM wParam, LPARAM lParam) { - - if ( mutex_bIgnoreActivation ) - { + if ( mutex_bIgnoreActivation ) { mutex_bIgnoreActivation = 0; - return( MA_NOACTIVATEANDEAT ); + return MA_NOACTIVATEANDEAT; } + int lRes = DefWindowProc(m_hWnd,msg,wParam,lParam); CLUIFrames_RepaintSubContainers(); return lRes; } -LRESULT CLUI::OnNcLButtonDown( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnNcLButtonDown(UINT msg, WPARAM wParam, LPARAM lParam) { - POINT pt; - pt.x = (short)LOWORD(lParam); - pt.y = (short)HIWORD(lParam); + POINT pt = UNPACK_POINT(lParam); int k = CLUI_SizingOnBorder(pt,1); - return k ? k : DefWindowProc( m_hWnd, msg, wParam, lParam ); + return k ? k : DefWindowProc( m_hWnd, msg, wParam, lParam); } -LRESULT CLUI::OnNcLButtonDblClk( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnNcLButtonDblClk(UINT msg, WPARAM wParam, LPARAM lParam) { - if (wParam == HTMENU || wParam == HTCAPTION) - { + if (wParam == HTMENU || wParam == HTCAPTION) { RECT rc; GetWindowRect(m_hWnd, &rc); - POINT pt; - pt.x = (short)LOWORD(lParam); - pt.y = (short)HIWORD(lParam); + + POINT pt = UNPACK_POINT(lParam); if ( pt.x > rc.right - 16 && pt.x < rc.right ) return CallService(MS_CLIST_SHOWHIDE, 0, 0); } - return DefCluiWndProc( msg, wParam, lParam ); + return DefCluiWndProc( msg, wParam, lParam); } -LRESULT CLUI::OnNcHitTest( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnNcHitTest(UINT msg, WPARAM wParam, LPARAM lParam) { - LRESULT result; - result = DefWindowProc(m_hWnd,WM_NCHITTEST,wParam,lParam); + LRESULT result = DefWindowProc(m_hWnd,WM_NCHITTEST,wParam,lParam); if ((g_CluiData.fAutoSize) && ( result == HTSIZE || result == HTTOP || result == HTTOPLEFT || result == HTTOPRIGHT || @@ -2377,25 +2328,16 @@ LRESULT CLUI::OnNcHitTest( UINT msg, WPARAM wParam, LPARAM lParam ) result == HTBOTTOMLEFT)) return HTCLIENT; - if (result == HTMENU) - { - int t; - POINT pt; - pt.x = (short)LOWORD(lParam); - pt.y = (short)HIWORD(lParam); - t = MenuItemFromPoint(m_hWnd,g_hMenuMain,pt); - + if (result == HTMENU) { + POINT pt = UNPACK_POINT(lParam); + int t = MenuItemFromPoint(m_hWnd, g_hMenuMain, pt); if (t == -1 && ( db_get_b(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT))) return HTCAPTION; } - if (result == HTCLIENT) - { - POINT pt; - int k; - pt.x = (short)LOWORD(lParam); - pt.y = (short)HIWORD(lParam); - k = CLUI_SizingOnBorder(pt,0); + if (result == HTCLIENT) { + POINT pt = UNPACK_POINT(lParam); + int k = CLUI_SizingOnBorder(pt, 0); if ( !k && ( db_get_b(NULL,"CLUI","ClientAreaDrag",SETTING_CLIENTDRAG_DEFAULT))) return HTCAPTION; else return k+9; @@ -2403,7 +2345,7 @@ LRESULT CLUI::OnNcHitTest( UINT msg, WPARAM wParam, LPARAM lParam ) return result; } -LRESULT CLUI::OnShowWindow( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnShowWindow(UINT msg, WPARAM wParam, LPARAM lParam) { if (lParam) return 0; if (mutex_bShowHideCalledFromAnimation) return 1; @@ -2418,7 +2360,7 @@ LRESULT CLUI::OnShowWindow( UINT msg, WPARAM wParam, LPARAM lParam ) return FALSE; } -LRESULT CLUI::OnSysCommand( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnSysCommand(UINT msg, WPARAM wParam, LPARAM lParam) { switch (wParam) { case SC_MAXIMIZE: @@ -2435,27 +2377,26 @@ LRESULT CLUI::OnSysCommand( UINT msg, WPARAM wParam, LPARAM lParam ) return FALSE; } -LRESULT CLUI::OnKeyDown( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnKeyDown(UINT msg, WPARAM wParam, LPARAM lParam) { if (wParam == VK_F5) SendMessage(pcli->hwndContactTree,CLM_AUTOREBUILD, 0, 0); - return DefCluiWndProc( msg, wParam, lParam ); + return DefCluiWndProc( msg, wParam, lParam); } -LRESULT CLUI::OnGetMinMaxInfo( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnGetMinMaxInfo(UINT msg, WPARAM wParam, LPARAM lParam) { DefWindowProc(m_hWnd,msg,wParam,lParam); ((LPMINMAXINFO)lParam)->ptMinTrackSize.x = max(db_get_w(NULL,"CLUI","MinWidth",SETTING_MINWIDTH_DEFAULT),max(18,db_get_b(NULL,"CLUI","LeftClientMargin",SETTING_LEFTCLIENTMARIGN_DEFAULT)+db_get_b(NULL,"CLUI","RightClientMargin",SETTING_RIGHTCLIENTMARIGN_DEFAULT)+18)); if (nRequiredHeight == 0) - { ((LPMINMAXINFO)lParam)->ptMinTrackSize.y = CLUIFramesGetMinHeight(); - } + return FALSE; } LRESULT CLUI::OnMoving(UINT msg, WPARAM wParam, LPARAM lParam) { - CallWindowProc( DefWindowProc, m_hWnd, msg, wParam, lParam ); + CallWindowProc( DefWindowProc, m_hWnd, msg, wParam, lParam); if ( FALSE ) //showcontents is turned on { Sync(CLUIFrames_OnMoving,m_hWnd,(RECT*)lParam); @@ -2483,7 +2424,7 @@ LRESULT CLUI::OnListSizeChangeNotify( NMCLISTCONTROL * pnmc ) rcOld = rcWindow; GetWindowRect(pcli->hwndContactTree,&rcTree); - FRAMEWND* frm = FindFrameByItsHWND(pcli->hwndContactTree); + FRAMEWND *frm = FindFrameByItsHWND(pcli->hwndContactTree); if (frm) rcTree2 = frm->wndSize; else @@ -2492,24 +2433,16 @@ LRESULT CLUI::OnListSizeChangeNotify( NMCLISTCONTROL * pnmc ) winstyle = GetWindowLongPtr(pcli->hwndContactTree,GWL_STYLE); SystemParametersInfo(SPI_GETWORKAREA, 0, &rcWorkArea,FALSE); - if (MyMonitorFromWindow) - { + if (MyMonitorFromWindow) { HMONITOR hMon = MyMonitorFromWindow(pcli->hwndContactTree, MONITOR_DEFAULTTONEAREST); - MONITORINFO mi; - mi.cbSize = sizeof(mi); + MONITORINFO mi = { sizeof(mi) }; if (MyGetMonitorInfo(hMon, &mi)) rcWorkArea = mi.rcWork; } - if (pnmc->pt.y>(rcWorkArea.bottom-rcWorkArea.top)) - { pnmc->pt.y = (rcWorkArea.bottom-rcWorkArea.top); - }; - if ((pnmc->pt.y) == nLastRequiredHeight) - { - } nLastRequiredHeight = pnmc->pt.y; newHeight = max(CLUIFramesGetMinHeight(),max(pnmc->pt.y,3)+1+((winstyle&WS_BORDER)?2:0)+(rcWindow.bottom-rcWindow.top)-(rcTree.bottom-rcTree.top)); if (newHeight < (rcWorkArea.bottom-rcWorkArea.top)*minHeight/100) @@ -2578,27 +2511,24 @@ LRESULT CLUI::OnClickNotify( NMCLISTCONTROL * pnmc ) return 0; } -LRESULT CLUI::OnNotify( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnNotify(UINT msg, WPARAM wParam, LPARAM lParam) { LPNMHDR pnmhdr = (LPNMHDR)lParam; if ( pnmhdr->hwndFrom != pcli->hwndContactTree ) - return DefCluiWndProc( msg, wParam, lParam ); + return DefCluiWndProc( msg, wParam, lParam); switch ( pnmhdr->code) { case CLN_LISTSIZECHANGE: return OnListSizeChangeNotify((NMCLISTCONTROL *)pnmhdr ); case NM_CLICK: return OnClickNotify((NMCLISTCONTROL *)pnmhdr ); } - return DefCluiWndProc( msg, wParam, lParam ); + return DefCluiWndProc( msg, wParam, lParam); } -LRESULT CLUI::OnContextMenu( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnContextMenu(UINT msg, WPARAM wParam, LPARAM lParam) { - RECT rc; - POINT pt; - - pt.x = (short)LOWORD(lParam); - pt.y = (short)HIWORD(lParam); + POINT pt = UNPACK_POINT(lParam); // x/y might be -1 if it was generated by a kb click + RECT rc; GetWindowRect(pcli->hwndContactTree,&rc); if ( pt.x == -1 && pt.y == -1) { // all this is done in screen-coords! @@ -2609,17 +2539,15 @@ LRESULT CLUI::OnContextMenu( UINT msg, WPARAM wParam, LPARAM lParam ) pt.y = rc.top + (rc.bottom - rc.top) / 2; } } - if (PtInRect( &rc ,pt )) - { - HMENU hMenu; - hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDGROUP, 0, 0); + if (PtInRect( &rc ,pt )) { + HMENU hMenu = (HMENU)CallService(MS_CLIST_MENUBUILDGROUP, 0, 0); TrackPopupMenu(hMenu,TPM_TOPALIGN|TPM_LEFTALIGN|TPM_LEFTBUTTON,pt.x,pt.y, 0, m_hWnd,NULL); DestroyTrayMenu(hMenu); } return FALSE; } -LRESULT CLUI::OnMeasureItem( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnMeasureItem(UINT msg, WPARAM wParam, LPARAM lParam) { LPMEASUREITEMSTRUCT pmis = (LPMEASUREITEMSTRUCT)lParam; switch ( pmis->itemData ) { @@ -2637,88 +2565,87 @@ LRESULT CLUI::OnMeasureItem( UINT msg, WPARAM wParam, LPARAM lParam ) ReleaseDC( m_hWnd, hdc ); return TRUE; } - return CallService( MS_CLIST_MENUMEASUREITEM, wParam, lParam ); + return CallService( MS_CLIST_MENUMEASUREITEM, wParam, lParam); } -LRESULT CLUI::OnDrawItem( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnDrawItem(UINT msg, WPARAM wParam, LPARAM lParam) { ClcData *dat = (ClcData*)GetWindowLongPtr(pcli->hwndContactTree,0); LPDRAWITEMSTRUCT dis = (LPDRAWITEMSTRUCT)lParam; - if ( !dat) return 0; + if (!dat || dis->CtlType != ODT_MENU) + return 0; - if (dis->CtlType == ODT_MENU) { - if (dis->itemData == MENU_MIRANDAMENU) { - if ( !g_CluiData.fLayered) - { - char buf[255]; - short offset = 1 + ( dis->itemState&ODS_SELECTED ? 1 : 0 ) - - ( dis->itemState&ODS_HOTLIGHT ? 1 : 0 ); + if (dis->itemData == MENU_MIRANDAMENU) { + if ( !g_CluiData.fLayered) { + char buf[255]; + short offset = 1 + ( dis->itemState&ODS_SELECTED ? 1 : 0 ) - ( dis->itemState&ODS_HOTLIGHT ? 1 : 0 ); - HICON hIcon = LoadSkinnedIcon(SKINICON_OTHER_MAINMENU); + HICON hIcon = LoadSkinnedIcon(SKINICON_OTHER_MAINMENU); - CLUI_DrawMenuBackGround(m_hWnd, dis->hDC, 1, dis->itemState); - mir_snprintf(buf,SIZEOF(buf),"Main,ID=MainMenu,Selected=%s,Hot=%s",(dis->itemState&ODS_SELECTED)?"True":"False",(dis->itemState&ODS_HOTLIGHT)?"True":"False"); - SkinDrawGlyph(dis->hDC,&dis->rcItem,&dis->rcItem,buf); + CLUI_DrawMenuBackGround(m_hWnd, dis->hDC, 1, dis->itemState); + mir_snprintf(buf,SIZEOF(buf),"Main,ID=MainMenu,Selected=%s,Hot=%s",(dis->itemState&ODS_SELECTED)?"True":"False",(dis->itemState&ODS_HOTLIGHT)?"True":"False"); + SkinDrawGlyph(dis->hDC,&dis->rcItem,&dis->rcItem,buf); - int x = (dis->rcItem.right + dis->rcItem.left - GetSystemMetrics(SM_CXSMICON)) / 2 + offset; - int y = (dis->rcItem.bottom + dis->rcItem.top - GetSystemMetrics(SM_CYSMICON)) / 2 + offset; + int x = (dis->rcItem.right + dis->rcItem.left - GetSystemMetrics(SM_CXSMICON)) / 2 + offset; + int y = (dis->rcItem.bottom + dis->rcItem.top - GetSystemMetrics(SM_CYSMICON)) / 2 + offset; - DrawState( dis->hDC, NULL, NULL, (LPARAM)hIcon, 0, x, y , 0 , 0 , - DST_ICON | ( dis->itemState & ODS_INACTIVE && (((FALSE))) ? DSS_DISABLED : DSS_NORMAL )); + DrawState( dis->hDC, NULL, NULL, (LPARAM)hIcon, 0, x, y , 0 , 0 , + DST_ICON | ( dis->itemState & ODS_INACTIVE && (((FALSE))) ? DSS_DISABLED : DSS_NORMAL )); - Skin_ReleaseIcon(hIcon); - nMirMenuState = dis->itemState; - } else { - nMirMenuState = dis->itemState; - pcli->pfnInvalidateRect(m_hWnd,NULL,0); - } - return TRUE; + Skin_ReleaseIcon(hIcon); + nMirMenuState = dis->itemState; } - else if (dis->itemData == MENU_STATUSMENU) { - if ( !g_CluiData.fLayered) - { - char buf[255] = {0}; - RECT rc = dis->rcItem; - short dx = 1+(dis->itemState&ODS_SELECTED?1:0)-(dis->itemState&ODS_HOTLIGHT?1:0); - if (dx>1){ - rc.left += dx; - rc.top += dx; - }else if (dx == 0){ - rc.right -= 1; - rc.bottom -= 1; - } - CLUI_DrawMenuBackGround(m_hWnd, dis->hDC, 2, dis->itemState); - SetBkMode(dis->hDC,TRANSPARENT); - mir_snprintf(buf,SIZEOF(buf),"Main,ID=StatusMenu,Selected=%s,Hot=%s",(dis->itemState&ODS_SELECTED)?"True":"False",(dis->itemState&ODS_HOTLIGHT)?"True":"False"); - SkinDrawGlyph(dis->hDC,&dis->rcItem,&dis->rcItem,buf); - SetTextColor(dis->hDC, (dis->itemState&ODS_SELECTED/*|dis->itemState&ODS_HOTLIGHT*/)?dat->MenuTextHiColor:dat->MenuTextColor); - DrawText(dis->hDC,TranslateT("Status"), lstrlen(TranslateT("Status")),&rc, DT_CENTER|DT_VCENTER|DT_SINGLELINE); - nStatusMenuState = dis->itemState; - } else { - nStatusMenuState = dis->itemState; - pcli->pfnInvalidateRect(m_hWnd,NULL,0); - } - return TRUE; - } else if (dis->itemData == MENU_MINIMIZE && !g_CluiData.fLayered) - { - //TODO check if caption is visible + else { + nMirMenuState = dis->itemState; + pcli->pfnInvalidateRect(m_hWnd,NULL,0); + } + return TRUE; + } + + if (dis->itemData == MENU_STATUSMENU) { + if ( !g_CluiData.fLayered) { char buf[255] = {0}; + RECT rc = dis->rcItem; short dx = 1+(dis->itemState&ODS_SELECTED?1:0)-(dis->itemState&ODS_HOTLIGHT?1:0); - HICON hIcon = LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); - CLUI_DrawMenuBackGround(m_hWnd, dis->hDC, 3, dis->itemState); - mir_snprintf(buf,SIZEOF(buf),"Main,ID=MainMenu,Selected=%s,Hot=%s",(dis->itemState&ODS_SELECTED)?"True":"False",(dis->itemState&ODS_HOTLIGHT)?"True":"False"); + if (dx>1){ + rc.left += dx; + rc.top += dx; + }else if (dx == 0){ + rc.right -= 1; + rc.bottom -= 1; + } + CLUI_DrawMenuBackGround(m_hWnd, dis->hDC, 2, dis->itemState); + SetBkMode(dis->hDC,TRANSPARENT); + mir_snprintf(buf,SIZEOF(buf),"Main,ID=StatusMenu,Selected=%s,Hot=%s",(dis->itemState&ODS_SELECTED)?"True":"False",(dis->itemState&ODS_HOTLIGHT)?"True":"False"); SkinDrawGlyph(dis->hDC,&dis->rcItem,&dis->rcItem,buf); - DrawState(dis->hDC,NULL,NULL,(LPARAM)hIcon, 0, (dis->rcItem.right+dis->rcItem.left-GetSystemMetrics(SM_CXSMICON))/2+dx,(dis->rcItem.bottom+dis->rcItem.top-GetSystemMetrics(SM_CYSMICON))/2+dx, 0, 0, DST_ICON|(dis->itemState&ODS_INACTIVE && FALSE?DSS_DISABLED:DSS_NORMAL)); - Skin_ReleaseIcon(hIcon); - nMirMenuState = dis->itemState; + SetTextColor(dis->hDC, (dis->itemState&ODS_SELECTED/*|dis->itemState&ODS_HOTLIGHT*/)?dat->MenuTextHiColor:dat->MenuTextColor); + DrawText(dis->hDC,TranslateT("Status"), lstrlen(TranslateT("Status")),&rc, DT_CENTER|DT_VCENTER|DT_SINGLELINE); + nStatusMenuState = dis->itemState; } - - return CallService(MS_CLIST_MENUDRAWITEM,wParam,lParam); + else { + nStatusMenuState = dis->itemState; + pcli->pfnInvalidateRect(m_hWnd,NULL,0); + } + return TRUE; } - return 0; + + if (dis->itemData == MENU_MINIMIZE && !g_CluiData.fLayered) { + //TODO check if caption is visible + char buf[255] = {0}; + short dx = 1+(dis->itemState&ODS_SELECTED?1:0)-(dis->itemState&ODS_HOTLIGHT?1:0); + HICON hIcon = LoadSkinnedIcon(SKINICON_OTHER_MIRANDA); + CLUI_DrawMenuBackGround(m_hWnd, dis->hDC, 3, dis->itemState); + mir_snprintf(buf,SIZEOF(buf),"Main,ID=MainMenu,Selected=%s,Hot=%s",(dis->itemState&ODS_SELECTED)?"True":"False",(dis->itemState&ODS_HOTLIGHT)?"True":"False"); + SkinDrawGlyph(dis->hDC,&dis->rcItem,&dis->rcItem,buf); + DrawState(dis->hDC,NULL,NULL,(LPARAM)hIcon, 0, (dis->rcItem.right+dis->rcItem.left-GetSystemMetrics(SM_CXSMICON))/2+dx,(dis->rcItem.bottom+dis->rcItem.top-GetSystemMetrics(SM_CYSMICON))/2+dx, 0, 0, DST_ICON|(dis->itemState&ODS_INACTIVE && FALSE?DSS_DISABLED:DSS_NORMAL)); + Skin_ReleaseIcon(hIcon); + nMirMenuState = dis->itemState; + } + + return CallService(MS_CLIST_MENUDRAWITEM,wParam,lParam); } -LRESULT CLUI::OnDestroy( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnDestroy(UINT msg, WPARAM wParam, LPARAM lParam) { int state = db_get_b(NULL,"CList","State",SETTING_STATE_NORMAL); BOOL wait = FALSE; @@ -2764,19 +2691,18 @@ LRESULT CLUI::OnDestroy( UINT msg, WPARAM wParam, LPARAM lParam ) TRACE("CLUI.c: WM_DESTROY - hFrameContactTree removed\n"); pcli->hwndContactTree = NULL; pcli->hwndStatus = NULL; - { - if (g_CluiData.fAutoSize && !g_CluiData.fDocked) - { - RECT r; - GetWindowRect(pcli->hwndContactList,&r); - if ( db_get_b(NULL,"CLUI","AutoSizeUpward",SETTING_AUTOSIZEUPWARD_DEFAULT)) - r.top = r.bottom-CLUIFrames_GetTotalHeight(); - else - r.bottom = r.top+CLUIFrames_GetTotalHeight(); - db_set_dw(NULL,"CList","y",r.top); - db_set_dw(NULL,"CList","Height",r.bottom-r.top); - } + + if (g_CluiData.fAutoSize && !g_CluiData.fDocked) { + RECT r; + GetWindowRect(pcli->hwndContactList, &r); + if ( db_get_b(NULL,"CLUI","AutoSizeUpward",SETTING_AUTOSIZEUPWARD_DEFAULT)) + r.top = r.bottom-CLUIFrames_GetTotalHeight(); + else + r.bottom = r.top+CLUIFrames_GetTotalHeight(); + db_set_dw(NULL,"CList","y",r.top); + db_set_dw(NULL,"CList","Height",r.bottom-r.top); } + UnLoadCLUIFramesModule(); //ExtFrames_Uninit(); TRACE("CLUI.c: WM_DESTROY - UnLoadCLUIFramesModule DONE\n"); diff --git a/plugins/Clist_modern/src/modern_cluiframes.cpp b/plugins/Clist_modern/src/modern_cluiframes.cpp index 2c7a1de338..56357fb542 100644 --- a/plugins/Clist_modern/src/modern_cluiframes.cpp +++ b/plugins/Clist_modern/src/modern_cluiframes.cpp @@ -51,7 +51,7 @@ enum { enum { eUnknownId = -1 }; -static int _us_DoSetFrameFloat( WPARAM wParam,LPARAM lParam ); +static int _us_DoSetFrameFloat(WPARAM wParam,LPARAM lParam); static int CLUIFrameResizeFloatingFrame( int framepos ); static HWND CreateSubContainerWindow( HWND parent,int x,int y,int width,int height ); static BOOL CLUIFramesFitInSize(); @@ -1099,22 +1099,17 @@ static int CLUIFramesModifyMainMenuItems(WPARAM wParam,LPARAM lParam) static INT_PTR _us_DoGetFrameOptions(WPARAM wParam,LPARAM lParam) { - int pos; INT_PTR retval; BOOL bUnicodeText = (LOWORD(wParam) & FO_UNICODETEXT) != 0; wParam = MAKEWPARAM((LOWORD(wParam)) & ~FO_UNICODETEXT, HIWORD(wParam)); if (_fCluiFramesModuleNotStarted) return -1; - - pos = id2pos(HIWORD(wParam)); - if (pos < 0 || pos >= g_nFramesCount) { - + int pos = id2pos(HIWORD(wParam)); + if (pos < 0 || pos >= g_nFramesCount) return -1; - } - switch(LOWORD(wParam)) - { + switch(LOWORD(wParam)) { case FO_FLAGS: retval = 0; if (g_pfwFrames[pos].visible) retval |= F_VISIBLE; @@ -1122,14 +1117,12 @@ static INT_PTR _us_DoGetFrameOptions(WPARAM wParam,LPARAM lParam) if (g_pfwFrames[pos].Locked) retval |= F_LOCKED; if (g_pfwFrames[pos].TitleBar.ShowTitleBar) retval |= F_SHOWTB; if (g_pfwFrames[pos].TitleBar.ShowTitleBarTip) retval |= F_SHOWTBTIP; - if ( !g_CluiData.fLayered) - { - if ( !(GetWindowLongPtr(g_pfwFrames[pos].hWnd,GWL_STYLE)&WS_BORDER)) retval |= F_NOBORDER; + if ( !g_CluiData.fLayered) { + if ( !(GetWindowLongPtr(g_pfwFrames[pos].hWnd,GWL_STYLE)&WS_BORDER)) + retval |= F_NOBORDER; } - else - if ( !g_pfwFrames[pos].UseBorder) retval |= F_NOBORDER; - - + else if ( !g_pfwFrames[pos].UseBorder) + retval |= F_NOBORDER; break; case FO_NAME: @@ -1185,20 +1178,14 @@ static INT_PTR _us_DoGetFrameOptions(WPARAM wParam,LPARAM lParam) static int UpdateTBToolTip(int framepos) { - { - TOOLINFO ti; - - ZeroMemory(&ti,sizeof(ti)); - ti.cbSize = sizeof(ti); - ti.lpszText = g_pfwFrames[framepos].TitleBar.tooltip; - ti.hinst = g_hInst; - ti.uFlags = TTF_IDISHWND|TTF_SUBCLASS ; - ti.uId = (UINT_PTR)g_pfwFrames[framepos].TitleBar.hwnd; - - return(SendMessage(g_pfwFrames[framepos].TitleBar.hwndTip,TTM_UPDATETIPTEXT , 0, (LPARAM)&ti)); - } + TOOLINFO ti = { sizeof(ti) }; + ti.lpszText = g_pfwFrames[framepos].TitleBar.tooltip; + ti.hinst = g_hInst; + ti.uFlags = TTF_IDISHWND|TTF_SUBCLASS ; + ti.uId = (UINT_PTR)g_pfwFrames[framepos].TitleBar.hwnd; + return SendMessage(g_pfwFrames[framepos].TitleBar.hwndTip, TTM_UPDATETIPTEXT, 0, (LPARAM)&ti); +} -}; //hiword(wParam) = frameid,loword(wParam) = flag static int _us_DoSetFrameOptions(WPARAM wParam,LPARAM lParam) { @@ -2958,47 +2945,42 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam Frameid = (GetWindowLongPtr(hwnd,GWLP_USERDATA)); memset(&rect, 0, sizeof(rect)); - - switch(msg) - { + switch(msg) { case WM_CREATE: if ( !_hFrameTitleTheme) _hFrameTitleTheme = xpt_AddThemeHandle(hwnd,L"WINDOW"); SendMessage(hwnd,WM_SETFONT,(WPARAM)_hTitleBarFont,0); return FALSE; + case WM_MEASUREITEM: return CallService(MS_CLIST_MENUMEASUREITEM,wParam,lParam); + case WM_DRAWITEM: return CallService(MS_CLIST_MENUDRAWITEM,wParam,lParam); + case WM_USER+100: return 1; + case WM_ENABLE: if (hwnd != 0) CLUI__cliInvalidateRect(hwnd,NULL,FALSE); return 0; - case WM_ERASEBKGND: - { - return 1; - } - case WM_COMMAND: - - if ( ServiceExists(MO_CREATENEWMENUOBJECT)) - { - //if ( CallService(MS_CLIST_MENUPROCESSCOMMAND,MAKEWPARAM(LOWORD(wParam),0),(LPARAM)Frameid)){break;}; - if (ProcessCommandProxy(MAKEWPARAM(LOWORD(wParam),0),(LPARAM)Frameid)) break; - }else - { - if ( CallService(MS_CLIST_MENUPROCESSCOMMAND,MAKEWPARAM(LOWORD(wParam),MPCF_CONTEXTFRAMEMENU),(LPARAM)Frameid)){break;}; - - }; + case WM_ERASEBKGND: + return 1; + case WM_COMMAND: + if ( ServiceExists(MO_CREATENEWMENUOBJECT)) { + if ( ProcessCommandProxy(MAKEWPARAM(LOWORD(wParam),0), (LPARAM)Frameid)) + break; + } + else if ( CallService(MS_CLIST_MENUPROCESSCOMMAND,MAKEWPARAM(LOWORD(wParam),MPCF_CONTEXTFRAMEMENU),(LPARAM)Frameid)) + break; if (HIWORD(wParam) == 0) {//mouse events for self created menu int framepos = id2pos(Frameid); if (framepos == -1){break;}; - switch(LOWORD(wParam)) - { + switch(LOWORD(wParam)) { case frame_menu_lock: g_pfwFrames[framepos].Locked = !g_pfwFrames[framepos].Locked; break; @@ -3014,8 +2996,8 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam } CLUIFramesOnClistResize((WPARAM)pcli->hwndContactList,0); } - break; + case WM_RBUTTONDOWN: { HMENU hmenu; @@ -3023,11 +3005,9 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam GetCursorPos(&pt); if ( ServiceExists(MS_CLIST_MENUBUILDFRAMECONTEXT)) - { hmenu = (HMENU)CallService(MS_CLIST_MENUBUILDFRAMECONTEXT,Frameid,0); - } - else - {//legacy menu support + else { + //legacy menu support int framepos = id2pos(Frameid); if (framepos == -1){break;}; @@ -3051,22 +3031,18 @@ static LRESULT CALLBACK CLUIFrameTitleBarProc(HWND hwnd, UINT msg, WPARAM wParam if (g_pfwFrames[framepos].floating) {AppendMenu(hmenu,MF_STRING|MF_CHECKED,frame_menu_floating,TranslateT("Floating"));} else{AppendMenu(hmenu,MF_STRING,frame_menu_floating,TranslateT("Floating"));}; - - //err = GetMenuItemCount(hmenu) - - }; + } TrackPopupMenu(hmenu,TPM_LEFTALIGN,pt.x,pt.y, 0, hwnd,0); DestroyMenu(hmenu); } break; + case WM_LBUTTONDBLCLK: - { - Framemod = -1; - s_nLastByPos = -1;s_nOldFrameHeight = -1;ReleaseCapture(); - CallService(MS_CLIST_FRAMES_UCOLLFRAME,Frameid,0); - s_nLastByPos = -1;s_nOldFrameHeight = -1;ReleaseCapture(); - } + Framemod = -1; + s_nLastByPos = -1;s_nOldFrameHeight = -1;ReleaseCapture(); + CallService(MS_CLIST_FRAMES_UCOLLFRAME,Frameid,0); + s_nLastByPos = -1;s_nOldFrameHeight = -1;ReleaseCapture(); break; case WM_LBUTTONUP: diff --git a/plugins/Clist_modern/src/modern_skinbutton.cpp b/plugins/Clist_modern/src/modern_skinbutton.cpp index 91a1ee3466..7949f1eecf 100644 --- a/plugins/Clist_modern/src/modern_skinbutton.cpp +++ b/plugins/Clist_modern/src/modern_skinbutton.cpp @@ -361,176 +361,130 @@ static LRESULT CALLBACK ModernSkinButtonWndProc(HWND hwndDlg, UINT msg, WPARAM bct->HandleService = NULL; if (bct) - if (bct->HandleService) - if ( ServiceExists(bct->HandleService)) - { - int t; - HandleServiceParams MSG = {0}; - MSG.hwnd = hwndDlg; - MSG.msg = msg; - MSG.wParam = wParam; - MSG.lParam = lParam; - t = CallService(bct->HandleService,(WPARAM)&MSG,0); - if (MSG.handled) return t; - } - switch(msg) - { - case WM_NCCREATE: - { - SetWindowLongPtr(hwndDlg, GWL_STYLE, GetWindowLongPtr(hwndDlg, GWL_STYLE)|BS_OWNERDRAW); - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0); - if (((CREATESTRUCT *)lParam)->lpszName) SetWindowText(hwndDlg, ((CREATESTRUCT *)lParam)->lpszName); - return TRUE; - } - case WM_DESTROY: - { - if (bct) { - EnterCriticalSection(&csTips); - if (hwndToolTips) { - TOOLINFO ti; - ZeroMemory(&ti, sizeof(ti)); - ti.cbSize = sizeof(ti); - ti.uFlags = TTF_IDISHWND; - ti.hwnd = bct->hwnd; - ti.uId = (UINT_PTR)bct->hwnd; - if (SendMessage(hwndToolTips, TTM_GETTOOLINFO, 0, (LPARAM)&ti)) { - SendMessage(hwndToolTips, TTM_DELTOOL, 0, (LPARAM)&ti); - } - if (SendMessage(hwndToolTips, TTM_GETTOOLCOUNT, 0, (LPARAM)&ti) == 0) { - DestroyWindow(hwndToolTips); - hwndToolTips = NULL; - } - } - LeaveCriticalSection(&csTips); - mir_free(bct->ID); - mir_free(bct->CommandService); - mir_free(bct->StateService); - mir_free(bct->HandleService); - mir_free(bct->Hint); - mir_free(bct->ValueDBSection); - mir_free(bct->ValueTypeDef); - mir_free(bct); - } - SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0); - break; // DONT! fall thru - } - case WM_SETCURSOR: - { - HCURSOR hCurs1; - hCurs1 = LoadCursor(NULL, IDC_ARROW); - if (hCurs1) SetCursor(hCurs1); - if (bct) SetToolTip(hwndDlg, bct->Hint); - return 1; - } - case WM_PRINT: - { - if (IsWindowVisible(hwndDlg)) - ModernSkinButtonPaintWorker(hwndDlg,(HDC)wParam); - break; - } - case WM_PAINT: - { - if (IsWindowVisible(hwndDlg) && !g_CluiData.fLayered) - { - PAINTSTRUCT ps = {0}; - BeginPaint(hwndDlg,&ps); - ModernSkinButtonPaintWorker(hwndDlg,(HDC)ps.hdc); - EndPaint(hwndDlg,&ps); - } - return DefWindowProc(hwndDlg, msg, wParam, lParam); - } - case WM_CAPTURECHANGED: - { - bct->hover = 0; - bct->down = 0; - ModernSkinButtonPaintWorker(bct->hwnd,0); - // KillTimer(bct->hwnd,1234); - break; - } - //case WM_TIMER: - // { - // POINT t; - // GetCursorPos(&t); - // if (bct->hover && WindowFromPoint(t) != bct->hwnd) - // { - // KillTimer(bct->hwnd,1234); - // bct->hover = 0; - // ReleaseCapture(); - // PaintWorker(bct->hwnd,0); - // } - // return 0; - // } - case WM_MOUSEMOVE: - { - if ( !bct->hover) - { - SetCapture(bct->hwnd); - bct->hover = 1; - //KillTimer(bct->hwnd,1234); - //CLUI_SafeSetTimer(bct->hwnd,1234,100, NULL); - ModernSkinButtonPaintWorker(bct->hwnd,0); - return 0; - } - else - { - POINT t; - t.x = LOWORD(lParam); - t.y = HIWORD(lParam); - ClientToScreen(bct->hwnd,&t); - if (WindowFromPoint(t) != bct->hwnd) - ReleaseCapture(); - return 0; - } - - - } - case WM_LBUTTONDOWN: - { - //KillTimer(bct->hwnd,1234); - //CLUI_SafeSetTimer(bct->hwnd,1234,100, NULL); - bct->down = 1; - SetForegroundWindow(GetParent(bct->hwnd)); - ModernSkinButtonPaintWorker(bct->hwnd,0); - if (bct && bct->CommandService && IsBadStringPtrA(bct->CommandService,255)) - bct->CommandService = NULL; - if (bct->fCallOnPress) - { - if (bct->CommandService) - { - - if ( !_CallServiceStrParams(bct->CommandService, NULL) && (bct->ValueDBSection && bct->ValueTypeDef)) - ModernSkinButtonToggleDBValue(bct->ValueDBSection,bct->ValueTypeDef); - } - bct->down = 0; - - ModernSkinButtonPaintWorker(bct->hwnd,0); - } + if (bct->HandleService && ServiceExists(bct->HandleService)) { + HandleServiceParams MSG = {0}; + MSG.hwnd = hwndDlg; + MSG.msg = msg; + MSG.wParam = wParam; + MSG.lParam = lParam; + int t = CallService(bct->HandleService,(WPARAM)&MSG,0); + if (MSG.handled) return t; + } - return 0; + switch(msg) { + case WM_NCCREATE: + SetWindowLongPtr(hwndDlg, GWL_STYLE, GetWindowLongPtr(hwndDlg, GWL_STYLE)|BS_OWNERDRAW); + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0); + if (((CREATESTRUCT *)lParam)->lpszName) SetWindowText(hwndDlg, ((CREATESTRUCT *)lParam)->lpszName); + return TRUE; + + case WM_DESTROY: + if (bct) { + EnterCriticalSection(&csTips); + if (hwndToolTips) { + TOOLINFO ti; + ZeroMemory(&ti, sizeof(ti)); + ti.cbSize = sizeof(ti); + ti.uFlags = TTF_IDISHWND; + ti.hwnd = bct->hwnd; + ti.uId = (UINT_PTR)bct->hwnd; + if (SendMessage(hwndToolTips, TTM_GETTOOLINFO, 0, (LPARAM)&ti)) { + SendMessage(hwndToolTips, TTM_DELTOOL, 0, (LPARAM)&ti); } - case WM_LBUTTONUP: - if (bct->down) - { - //KillTimer(bct->hwnd,1234); - //CLUI_SafeSetTimer(bct->hwnd,1234,100, NULL); - ReleaseCapture(); - bct->hover = 0; - bct->down = 0; - ModernSkinButtonPaintWorker(bct->hwnd,0); - if (bct && bct->CommandService && IsBadStringPtrA(bct->CommandService,255)) - bct->CommandService = NULL; - if (bct->CommandService) - if (_CallServiceStrParams(bct->CommandService, NULL)) - {} - else if (bct->ValueDBSection && bct->ValueTypeDef) - ModernSkinButtonToggleDBValue(bct->ValueDBSection,bct->ValueTypeDef); + if (SendMessage(hwndToolTips, TTM_GETTOOLCOUNT, 0, (LPARAM)&ti) == 0) { + DestroyWindow(hwndToolTips); + hwndToolTips = NULL; } + } + LeaveCriticalSection(&csTips); + mir_free(bct->ID); + mir_free(bct->CommandService); + mir_free(bct->StateService); + mir_free(bct->HandleService); + mir_free(bct->Hint); + mir_free(bct->ValueDBSection); + mir_free(bct->ValueTypeDef); + mir_free(bct); + } + SetWindowLongPtr(hwndDlg, GWLP_USERDATA, 0); + break; // DONT! fall thru + case WM_SETCURSOR: + { + HCURSOR hCurs1 = LoadCursor(NULL, IDC_ARROW); + if (hCurs1) SetCursor(hCurs1); + if (bct) SetToolTip(hwndDlg, bct->Hint); + } + return 1; + + case WM_PRINT: + if (IsWindowVisible(hwndDlg)) + ModernSkinButtonPaintWorker(hwndDlg,(HDC)wParam); + break; + + case WM_PAINT: + if (IsWindowVisible(hwndDlg) && !g_CluiData.fLayered) { + PAINTSTRUCT ps = {0}; + BeginPaint(hwndDlg,&ps); + ModernSkinButtonPaintWorker(hwndDlg,(HDC)ps.hdc); + EndPaint(hwndDlg,&ps); + } + return DefWindowProc(hwndDlg, msg, wParam, lParam); + + case WM_CAPTURECHANGED: + bct->hover = 0; + bct->down = 0; + ModernSkinButtonPaintWorker(bct->hwnd,0); + break; + + case WM_MOUSEMOVE: + if ( !bct->hover) { + SetCapture(bct->hwnd); + bct->hover = 1; + ModernSkinButtonPaintWorker(bct->hwnd,0); + } + else { + POINT t = UNPACK_POINT(lParam); + ClientToScreen(bct->hwnd,&t); + if (WindowFromPoint(t) != bct->hwnd) + ReleaseCapture(); + } + return 0; + case WM_LBUTTONDOWN: + bct->down = 1; + SetForegroundWindow(GetParent(bct->hwnd)); + ModernSkinButtonPaintWorker(bct->hwnd,0); + if (bct && bct->CommandService && IsBadStringPtrA(bct->CommandService,255)) + bct->CommandService = NULL; + if (bct->fCallOnPress) { + if (bct->CommandService) { + if ( !_CallServiceStrParams(bct->CommandService, NULL) && (bct->ValueDBSection && bct->ValueTypeDef)) + ModernSkinButtonToggleDBValue(bct->ValueDBSection,bct->ValueTypeDef); } - return DefWindowProc(hwndDlg, msg, wParam, lParam); -} + bct->down = 0; + ModernSkinButtonPaintWorker(bct->hwnd,0); + } + return 0; + + case WM_LBUTTONUP: + if (bct->down) { + ReleaseCapture(); + bct->hover = 0; + bct->down = 0; + ModernSkinButtonPaintWorker(bct->hwnd,0); + if (bct && bct->CommandService && IsBadStringPtrA(bct->CommandService,255)) + bct->CommandService = NULL; + if (bct->CommandService) + if (_CallServiceStrParams(bct->CommandService, NULL)) + {} + else if (bct->ValueDBSection && bct->ValueTypeDef) + ModernSkinButtonToggleDBValue(bct->ValueDBSection,bct->ValueTypeDef); + } + } + return DefWindowProc(hwndDlg, msg, wParam, lParam); +} HWND SetToolTip(HWND hwnd, TCHAR * tip) { diff --git a/plugins/Clist_modern/src/modern_skineditor.cpp b/plugins/Clist_modern/src/modern_skineditor.cpp index 4751720059..72450cedb1 100644 --- a/plugins/Clist_modern/src/modern_skineditor.cpp +++ b/plugins/Clist_modern/src/modern_skineditor.cpp @@ -709,16 +709,12 @@ INT_PTR CALLBACK DlgSkinEditorOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); UpdateInfo(hwndDlg); } - //check (LOWORD(wParam)) - //SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0); break; } case WM_NOTIFY: switch (((LPNMHDR)lParam)->idFrom) { case IDC_OBJECT_TREE: { - //Save existed object - //Change to new object NMTREEVIEWA * nmtv = (NMTREEVIEWA *) lParam; if ( !nmtv) return 0; if (nmtv->hdr.code == TVN_SELCHANGEDA || nmtv->hdr.code == TVN_SELCHANGEDW) diff --git a/plugins/Clist_modern/src/modern_skinengine.cpp b/plugins/Clist_modern/src/modern_skinengine.cpp index 75e42dac1a..ea09203cc0 100644 --- a/plugins/Clist_modern/src/modern_skinengine.cpp +++ b/plugins/Clist_modern/src/modern_skinengine.cpp @@ -92,7 +92,7 @@ static void ske_PreMultiplyChanells(HBITMAP hbmp,BYTE Mult); static int ske_ValidateSingleFrameImage(FRAMEWND * Frame, BOOL SkipBkgBlitting); static INT_PTR ske_Service_UpdateFrameImage(WPARAM wParam, LPARAM lParam); static INT_PTR ske_Service_InvalidateFrameImage(WPARAM wParam, LPARAM lParam); -static INT_PTR ske_Service_DrawTextWithEffect( WPARAM wParam, LPARAM lParam ); +static INT_PTR ske_Service_DrawTextWithEffect(WPARAM wParam, LPARAM lParam); //Decoders static HMODULE hImageDecoderModule; @@ -2971,7 +2971,7 @@ static int ske_DrawTextWithEffectWorker( HDC hdc, LPCTSTR lpString, int nCount, return res; } -INT_PTR ske_Service_DrawTextWithEffect( WPARAM wParam, LPARAM lParam ) +INT_PTR ske_Service_DrawTextWithEffect(WPARAM wParam, LPARAM lParam) { DrawTextWithEffectParam * p = ( DrawTextWithEffectParam * ) wParam; if ( p->cbSize != sizeof(DrawTextWithEffectParam)) diff --git a/plugins/Clist_modern/src/modern_skinopt.cpp b/plugins/Clist_modern/src/modern_skinopt.cpp index 24ca4f66d9..24239b9f85 100644 --- a/plugins/Clist_modern/src/modern_skinopt.cpp +++ b/plugins/Clist_modern/src/modern_skinopt.cpp @@ -49,7 +49,7 @@ HTREEITEM FillAvailableSkinList( HWND hwndDlg ); INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam); -int SkinOptInit( WPARAM wParam, LPARAM lParam ) +int SkinOptInit(WPARAM wParam, LPARAM lParam) { OPTIONSDIALOGPAGE odp; if ( !g_CluiData.fDisableSkinEngine ) @@ -77,7 +77,7 @@ int SkinOptInit( WPARAM wParam, LPARAM lParam ) return 0; } -int ModernSkinOptInit( WPARAM wParam, LPARAM lParam ) +int ModernSkinOptInit(WPARAM wParam, LPARAM lParam) { MODERNOPTOBJECT obj = {0}; obj.cbSize = sizeof(obj); @@ -114,8 +114,7 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara case WM_COMMAND: { int isLoad = 0; - switch ( LOWORD( wParam )) - { + switch ( LOWORD(wParam )) { case IDC_COLOUR_MENUNORMAL: case IDC_COLOUR_MENUSELECTED: case IDC_COLOUR_FRAMES: @@ -138,7 +137,7 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara tvi.hItem = hti; tvi.mask = TVIF_HANDLE|TVIF_PARAM; TreeView_GetItem( GetDlgItem( hwndDlg, IDC_TREE1 ), &tvi ); - sd = ( SkinListData* )( tvi.lParam ); + sd = ( SkinListData* )( tvi.lParam); } if ( !sd ) return 0; if ( sd->File && !_tcschr( sd->File, _T('%'))) @@ -164,7 +163,7 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara } break; case IDC_BUTTON_APPLY_SKIN: - if ( HIWORD( wParam ) == BN_CLICKED ) + if ( HIWORD(wParam ) == BN_CLICKED ) { SkinListData *sd = NULL; HTREEITEM hti = TreeView_GetSelection( GetDlgItem( hwndDlg, IDC_TREE1 )); @@ -174,7 +173,7 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara tvi.hItem = hti; tvi.mask = TVIF_HANDLE|TVIF_PARAM; TreeView_GetItem( GetDlgItem( hwndDlg, IDC_TREE1 ), &tvi ); - sd = ( SkinListData* )( tvi.lParam ); + sd = ( SkinListData* )( tvi.lParam); } if ( !sd ) return 0; if ( glSkinWasModified>0 ) @@ -210,7 +209,7 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara break; case IDC_BUTTON_LOAD: isLoad = 1; - if ( HIWORD( wParam ) == BN_CLICKED ) + if ( HIWORD(wParam ) == BN_CLICKED ) { { TCHAR str[MAX_PATH] = {0}; @@ -315,7 +314,7 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara break; case WM_NOTIFY: - switch (( ( LPNMHDR )lParam )->idFrom ) { + switch (( ( LPNMHDR )lParam)->idFrom ) { case IDC_TREE1: { NMTREEVIEW * nmtv = ( NMTREEVIEW * ) lParam; @@ -363,7 +362,7 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara tvi.hItem = hti; tvi.mask = TVIF_HANDLE|TVIF_PARAM; TreeView_GetItem( GetDlgItem( hwndDlg, IDC_TREE1 ), &tvi ); - sd = ( SkinListData* )( tvi.lParam ); + sd = ( SkinListData* )( tvi.lParam); } if ( !sd ) return 0; @@ -402,14 +401,14 @@ INT_PTR CALLBACK DlgSkinOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara return 0; } else if (nmtv->hdr.code == TVN_DELETEITEMA || nmtv->hdr.code == TVN_DELETEITEMW) { - mir_free_and_nil( nmtv->itemOld.lParam ); + mir_free_and_nil( nmtv->itemOld.lParam); return 0; } } break; case 0: - switch (((LPNMHDR)lParam )->code) { + switch (((LPNMHDR)lParam)->code) { case PSN_APPLY: pcli->pfnClcBroadcast( INTM_RELOADOPTIONS, 0, 0 ); NotifyEventHooks( g_CluiData.hEventBkgrChanged, 0, 0 ); @@ -673,7 +672,7 @@ INT_PTR SvcPreviewSkin(WPARAM wParam, LPARAM lParam) TCHAR prfn[MAX_PATH] = {0}; TCHAR imfn[MAX_PATH] = {0}; TCHAR skinfolder[MAX_PATH] = {0}; - GetPrivateProfileString( _T("Skin_Description_Section"), _T("Preview"), _T(""), imfn, SIZEOF( imfn ), (LPCTSTR)lParam ); + GetPrivateProfileString( _T("Skin_Description_Section"), _T("Preview"), _T(""), imfn, SIZEOF( imfn ), (LPCTSTR)lParam); IniParser::GetSkinFolder((LPCTSTR)lParam, skinfolder ); _sntprintf( prfn, SIZEOF( prfn ), _T("%s\\%s"), skinfolder, imfn ); PathToAbsoluteT(prfn, imfn); diff --git a/plugins/Clist_modern/src/modern_statusbar.cpp b/plugins/Clist_modern/src/modern_statusbar.cpp index 3417876ab7..1d6538b19d 100644 --- a/plugins/Clist_modern/src/modern_statusbar.cpp +++ b/plugins/Clist_modern/src/modern_statusbar.cpp @@ -811,9 +811,7 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam case WM_RBUTTONDOWN: { RECT rc; - POINT pt; - pt.x = (short)LOWORD(lParam); - pt.y = (short)HIWORD(lParam); + POINT pt = UNPACK_POINT(lParam); KillTimer(hwnd,TM_STATUSBARHIDE); KillTimer(hwnd,TM_STATUSBAR); @@ -942,7 +940,7 @@ LRESULT CALLBACK ModernStatusProc(HWND hwnd,UINT msg,WPARAM wParam,LPARAM lParam SetCapture( NULL ); return 0; } - return SendMessage(GetParent(hwnd), msg, wParam, lParam ); + return SendMessage(GetParent(hwnd), msg, wParam, lParam); } } return DefWindowProc(hwnd, msg, wParam, lParam); diff --git a/plugins/Clist_modern/src/modern_statusbar_options.cpp b/plugins/Clist_modern/src/modern_statusbar_options.cpp index 3f8e01b013..3c3953d0c3 100644 --- a/plugins/Clist_modern/src/modern_statusbar_options.cpp +++ b/plugins/Clist_modern/src/modern_statusbar_options.cpp @@ -388,8 +388,7 @@ INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l LOWORD(wParam) == IDC_SHOWBOTH || LOWORD(wParam) == IDC_SHOWNORMAL || LOWORD(wParam) == IDC_TRANSPARENTOVERLAY || - LOWORD(wParam) == IDC_SHOWXSTATUSNAME - ) + LOWORD(wParam) == IDC_SHOWXSTATUSNAME) { UpdateXStatusIconOptions(hwndDlg, perProto, dat, curSelProto); } @@ -450,8 +449,7 @@ INT_PTR CALLBACK DlgProcSBarOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l else _GlobalOptions.PaddingRight = (DWORD)SendDlgItemMessage(hwndDlg,IDC_OFFSETSPIN_RIGHT,UDM_GETPOS, 0, 0); } - else if ( - ( + else if (( LOWORD(wParam) == IDC_MULTI_COUNT || LOWORD(wParam) == IDC_OFFSETICON || LOWORD(wParam) == IDC_OFFSETICON2 || diff --git a/plugins/Clist_modern/src/modern_sync.cpp b/plugins/Clist_modern/src/modern_sync.cpp index df3572766e..35fe8d64f3 100644 --- a/plugins/Clist_modern/src/modern_sync.cpp +++ b/plugins/Clist_modern/src/modern_sync.cpp @@ -69,7 +69,7 @@ int SyncCallProxy(PSYNCCALLBACKPROC pfnProc, WPARAM wParam, LPARAM lParam, CRITI if ( cs != NULL ) { if ( !fnTryEnterCriticalSection ) { // for poor OSes like Win98 EnterCriticalSection( cs ); - int result = pfnProc( wParam, lParam ); + int result = pfnProc( wParam, lParam); LeaveCriticalSection( cs ); return result; } @@ -133,15 +133,15 @@ HRESULT SyncCallAPCProxy( PSYNCCALLBACKPROC pfnProc, WPARAM wParam, LPARAM lPara return S_OK; } -LRESULT SyncOnWndProcCall( WPARAM wParam ) +LRESULT SyncOnWndProcCall(WPARAM wParam ) { SYNCCALLITEM *psci = (SYNCCALLITEM *)wParam; if (psci) - return psci->pfnProc( psci->wParam, psci->lParam ); + return psci->pfnProc( psci->wParam, psci->lParam); return 0; } -int DoCall( PSYNCCALLBACKPROC pfnProc, WPARAM wParam, LPARAM lParam ) +int DoCall( PSYNCCALLBACKPROC pfnProc, WPARAM wParam, LPARAM lParam) { - return SyncCallProxy( pfnProc, 0, lParam ); + return SyncCallProxy( pfnProc, 0, lParam); } diff --git a/plugins/Clist_modern/src/modern_tbbutton.cpp b/plugins/Clist_modern/src/modern_tbbutton.cpp index e8f59245a6..d4b23904bc 100644 --- a/plugins/Clist_modern/src/modern_tbbutton.cpp +++ b/plugins/Clist_modern/src/modern_tbbutton.cpp @@ -297,13 +297,11 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam case WM_LBUTTONDOWN: { - int xPos = (( int )( short ) LOWORD( lParam )); - int yPos = (( int )( short ) HIWORD( lParam )); - POINT ptMouse = { xPos, yPos }; + POINT ptMouse = UNPACK_POINT(lParam); RECT rcClient; - GetClientRect( bct->hwnd, &rcClient ); - if ( !PtInRect( &rcClient, ptMouse )) { + GetClientRect(bct->hwnd, &rcClient); + if ( !PtInRect(&rcClient, ptMouse)) { bct->fHotMark = FALSE; ReleaseCapture(); } @@ -326,7 +324,7 @@ static LRESULT CALLBACK ToolbarButtonProc(HWND hwndDlg, UINT msg, WPARAM wParam case WM_LBUTTONUP: if ( GetCapture() == bct->hwnd ) { - POINT ptMouse = { LOWORD(lParam), HIWORD(lParam) }; + POINT ptMouse = UNPACK_POINT(lParam); RECT rcClient; GetClientRect( bct->hwnd, &rcClient ); -- cgit v1.2.3