From ecb177cadbcff850a16c4b9e306beb15f61ac6f9 Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sun, 4 Nov 2012 18:51:53 +0000 Subject: kernel extraicons, part II git-svn-id: http://svn.miranda-ng.org/main/trunk@2188 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/src/hdr/modern_clc.h | 4 +- .../Clist_modern/src/hdr/modern_commonheaders.h | 1 + .../Clist_modern/src/hdr/modern_commonprototypes.h | 4 - plugins/Clist_modern/src/hdr/modern_static_clui.h | 3 - plugins/Clist_modern/src/init.cpp | 6 +- plugins/Clist_modern/src/modern_clistmod.cpp | 2 - plugins/Clist_modern/src/modern_clui.cpp | 38 +++--- plugins/Clist_modern/src/modern_extraimage.cpp | 141 --------------------- 8 files changed, 21 insertions(+), 178 deletions(-) delete mode 100644 plugins/Clist_modern/src/modern_extraimage.cpp (limited to 'plugins/Clist_modern/src') diff --git a/plugins/Clist_modern/src/hdr/modern_clc.h b/plugins/Clist_modern/src/hdr/modern_clc.h index 62d9473a60..10be28480c 100644 --- a/plugins/Clist_modern/src/hdr/modern_clc.h +++ b/plugins/Clist_modern/src/hdr/modern_clc.h @@ -74,8 +74,6 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #define INTM_AVATARCHANGED (WM_USER+28) #define INTM_TIMEZONECHANGED (WM_USER+29) -#define CLM_SETEXTRACOLUMNSSPACE (CLM_FIRST+73) //wParam=extra space between icons - #define CLBF_TILEVTOROWHEIGHT 0x0100 #define TIMERID_RENAME 10 @@ -391,7 +389,7 @@ struct SHORTDATA }; -typedef struct tagOVERLAYICONINFO +typedef struct tagOVERLAYICONINFO { char *name; char *description; diff --git a/plugins/Clist_modern/src/hdr/modern_commonheaders.h b/plugins/Clist_modern/src/hdr/modern_commonheaders.h index d2ce7442a8..a7ae21e716 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonheaders.h +++ b/plugins/Clist_modern/src/hdr/modern_commonheaders.h @@ -112,6 +112,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include #include #include +#include #include "modern_clc.h" #include "modern_clist.h" diff --git a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h index 120457fcab..2b63e85ecc 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h @@ -53,7 +53,6 @@ extern SKINOBJECTSLIST g_SkinObjectList; extern CURRWNDIMAGEDATA * g_pCachedWindow; extern char * g_szConnectingProto; extern BOOL g_mutex_bLockUpdating; -extern BOOL g_mutex_bSetAllExtraIconsCycle; extern int g_mutex_nCalcRowHeightLock; extern int g_mutex_bOnTrayRightClick; extern BOOL g_flag_bPostWasCanceled; @@ -127,9 +126,6 @@ HBITMAP GDIPlus_LoadGlyphImage(char *szFileName); /* EventArea */ void EventArea_ConfigureEventArea(); -/* ExtraImage */ -void ExtraImage_SetAllExtraIcons(HWND hwndList,HANDLE hContact); - /* ModernSkinButton */ int ModernSkinButton_AddButton(HWND parent,char * ID,char * CommandService,char * StateDefService,char * HandeService, int Left, int Top, int Right, int Bottom, DWORD AlignedTo,TCHAR * Hint,char * DBkey,char * TypeDef,int MinWidth, int MinHeight); int ModernSkinButtonLoadModule(); diff --git a/plugins/Clist_modern/src/hdr/modern_static_clui.h b/plugins/Clist_modern/src/hdr/modern_static_clui.h index 497474e1ee..198706d21a 100644 --- a/plugins/Clist_modern/src/hdr/modern_static_clui.h +++ b/plugins/Clist_modern/src/hdr/modern_static_clui.h @@ -77,9 +77,6 @@ void Docking_GetMonitorRectFromWindow(HWND hWnd,RECT *rc); int EventArea_Create(HWND hCluiWnd); int ExtraImage_ExtraIDToColumnNum(int extra); -void ExtraImage_LoadModule(); -void ExtraImage_ReloadExtraIcons(); -void ExtraImage_SetAllExtraIcons(HWND hwndList,HANDLE hContact); void GroupMenus_Init(); diff --git a/plugins/Clist_modern/src/init.cpp b/plugins/Clist_modern/src/init.cpp index 6f2cef1528..646543297a 100644 --- a/plugins/Clist_modern/src/init.cpp +++ b/plugins/Clist_modern/src/init.cpp @@ -225,9 +225,9 @@ static HRESULT SubclassClistInterface() static HRESULT CreateHookableEvents() { - g_CluiData.hEventExtraImageListRebuilding = CreateHookableEvent(ME_CLIST_EXTRA_LIST_REBUILD); - g_CluiData.hEventExtraImageApplying = CreateHookableEvent(ME_CLIST_EXTRA_IMAGE_APPLY); - g_CluiData.hEventExtraClick = CreateHookableEvent(ME_CLIST_EXTRA_CLICK); +// g_CluiData.hEventExtraImageListRebuilding = CreateHookableEvent(ME_CLIST_EXTRA_LIST_REBUILD); +// g_CluiData.hEventExtraImageApplying = CreateHookableEvent(ME_CLIST_EXTRA_IMAGE_APPLY); +// g_CluiData.hEventExtraClick = CreateHookableEvent(ME_CLIST_EXTRA_CLICK); g_CluiData.hEventBkgrChanged = CreateHookableEvent(ME_BACKGROUNDCONFIG_CHANGED); g_CluiData.hEventPreBuildTrayMenu = CreateHookableEvent(ME_CLIST_PREBUILDTRAYMENU); g_CluiData.hEventPreBuildFrameMenu = CreateHookableEvent(ME_CLIST_PREBUILDFRAMEMENU); diff --git a/plugins/Clist_modern/src/modern_clistmod.cpp b/plugins/Clist_modern/src/modern_clistmod.cpp index 74251d68eb..31f1f02a80 100644 --- a/plugins/Clist_modern/src/modern_clistmod.cpp +++ b/plugins/Clist_modern/src/modern_clistmod.cpp @@ -202,8 +202,6 @@ INT_PTR GetCapsService(WPARAM wParam,LPARAM lParam) return 0x0107; case CLUIF2_EXTRACOLUMNCOUNT: return EXTRA_ICON_COUNT; - case CLUIF2_USEREXTRASTART: - return EXTRA_ICON_ADV3; } } else { diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index de295b0214..79e947940b 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -260,7 +260,6 @@ m_hDwmapiDll( NULL ) nLastRequiredHeight = 0; LoadCLUIFramesModule(); - ExtraImage_LoadModule(); g_CluiData.boldHideOffline = -1; bOldHideOffline = db_get_b(NULL,"CList","HideOffline",SETTING_HIDEOFFLINE_DEFAULT); @@ -411,7 +410,7 @@ HRESULT CLUI::CreateCLC() CallService(MS_SKINENG_REGISTERPAINTSUB,(WPARAM)Frame.hWnd,(LPARAM)CLCPaint::PaintCallbackProc); CallService(MS_CLIST_FRAMES_SETFRAMEOPTIONS,MAKEWPARAM(FO_TBTIPNAME,hFrameContactTree),(LPARAM)Translate("My Contacts")); - ExtraImage_ReloadExtraIcons(); + pcli->pfnReloadExtraIcons(); nLastRequiredHeight = 0; if ( g_CluiData.current_viewmode[0] == '\0' ) @@ -1455,8 +1454,8 @@ int CLUI_IconsChanged(WPARAM wParam,LPARAM lParam) { if (MirandaExiting()) return 0; DrawMenuBar(pcli->hwndContactList); - ExtraImage_ReloadExtraIcons(); - ExtraImage_SetAllExtraIcons(pcli->hwndContactTree,0); + pcli->pfnReloadExtraIcons(); + pcli->pfnSetAllExtraIcons(pcli->hwndContactTree,0); // need to update tray cause it use combined icons pcli->pfnTrayIconIconsChanged(); //TODO: remove as soon as core will include icolib ske_RedrawCompleteWindow(); @@ -1778,21 +1777,15 @@ int CLUI_SmoothAlphaTransition(HWND hwnd, BYTE GoalAlpha, BOOL wParam) BOOL CLUI__cliInvalidateRect(HWND hWnd, CONST RECT* lpRect,BOOL bErase ) { - if (g_mutex_bSetAllExtraIconsCycle) - return FALSE; - if (CLUI_IsInMainWindow(hWnd) && g_CluiData.fLayered)// && IsWindowVisible(hWnd)) - { - if (IsWindowVisible(hWnd)) + if ( CLUI_IsInMainWindow(hWnd) && g_CluiData.fLayered) { + if ( IsWindowVisible(hWnd)) return SkinInvalidateFrame( hWnd, lpRect ); - else - { - g_flag_bFullRepaint = 1; - return 0; - } + + g_flag_bFullRepaint = 1; + return 0; } - else - return InvalidateRect(hWnd,lpRect,bErase); - return 1; + + return InvalidateRect(hWnd,lpRect,bErase); } static BOOL FileExists(TCHAR * tszFilename) @@ -2684,7 +2677,7 @@ LRESULT CLUI::OnGetMinMaxInfo( UINT msg, WPARAM wParam, LPARAM lParam ) return FALSE; } -LRESULT CLUI::OnMoving( UINT msg, WPARAM wParam, LPARAM lParam ) +LRESULT CLUI::OnMoving(UINT msg, WPARAM wParam, LPARAM lParam) { CallWindowProc( DefWindowProc, m_hWnd, msg, wParam, lParam ); if ( FALSE ) //showcontents is turned on @@ -2694,17 +2687,18 @@ LRESULT CLUI::OnMoving( UINT msg, WPARAM wParam, LPARAM lParam ) return TRUE; } -LRESULT CLUI::OnNewContactNotify( NMCLISTCONTROL * pnmc ) +LRESULT CLUI::OnNewContactNotify(NMCLISTCONTROL *pnmc) { - ExtraImage_SetAllExtraIcons( pcli->hwndContactTree, pnmc->hItem ); + pcli->pfnSetAllExtraIcons(pcli->hwndContactTree, pnmc->hItem); return FALSE; } -LRESULT CLUI::OnListRebuildNotify( NMCLISTCONTROL * pnmc ) +LRESULT CLUI::OnListRebuildNotify(NMCLISTCONTROL *pnmc) { - ExtraImage_SetAllExtraIcons( pcli->hwndContactTree, 0 ); + pcli->pfnSetAllExtraIcons(pcli->hwndContactTree, 0); return FALSE; } + LRESULT CLUI::OnListSizeChangeNotify( NMCLISTCONTROL * pnmc ) { diff --git a/plugins/Clist_modern/src/modern_extraimage.cpp b/plugins/Clist_modern/src/modern_extraimage.cpp deleted file mode 100644 index aca86ad0ea..0000000000 --- a/plugins/Clist_modern/src/modern_extraimage.cpp +++ /dev/null @@ -1,141 +0,0 @@ -#include "hdr/modern_commonheaders.h" -#include "hdr/modern_commonprototypes.h" - -#define ExtraImageIconsIndexCount 6 - -BOOL g_mutex_bSetAllExtraIconsCycle = 0; - -static HIMAGELIST hExtraImageList = NULL; -static HIMAGELIST hWideExtraImageList = NULL; - -void ExtraImage_SetAllExtraIcons(HWND hwndList,HANDLE hContact); - -bool ImageCreated = FALSE; - -int ExtraImage_ExtraIDToColumnNum(int extra) -{ - if (extra < 1 || extra > EXTRACOLUMNCOUNT) - return -1; - else - return extra-1; -} - -//wparam = hIcon -//return hImage on success,-1 on failure -INT_PTR AddIconToExtraImageList(WPARAM wParam,LPARAM lParam) -{ - if (hExtraImageList == 0 || wParam == 0) - return -1; - - int res = ((int)ImageList_AddIcon(hExtraImageList,(HICON)wParam)); - return (res > 254) ? -1 : res; -} - -void ExtraImage_ReloadExtraIcons() -{ - SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNSSPACE,db_get_b(NULL,"CLUI","ExtraColumnSpace",18),0); - SendMessage(pcli->hwndContactTree,CLM_SETEXTRAIMAGELIST,0,0); - if (hExtraImageList) - ImageList_Destroy(hExtraImageList); - if (hWideExtraImageList) - ImageList_Destroy(hWideExtraImageList); - - hExtraImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,1,256); - hWideExtraImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON),GetSystemMetrics(SM_CYSMICON),ILC_COLOR32|ILC_MASK,1,256); - - SendMessage(pcli->hwndContactTree,CLM_SETEXTRAIMAGELIST,(WPARAM)hWideExtraImageList,(LPARAM)hExtraImageList); - SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNS, EXTRACOLUMNCOUNT, 0); - NotifyEventHooks(g_CluiData.hEventExtraImageListRebuilding,0,0); - ImageCreated = TRUE; -} - -void ExtraImage_SetAllExtraIcons(HWND hwndList,HANDLE hContact) -{ - if (pcli->hwndContactTree == 0) - return; - - g_mutex_bSetAllExtraIconsCycle = 1; - bool hcontgiven = (hContact != 0); - - if (ImageCreated == FALSE) - ExtraImage_ReloadExtraIcons(); - - SendMessage(pcli->hwndContactTree,CLM_SETEXTRACOLUMNS, EXTRACOLUMNCOUNT, 0); - - if (hContact == NULL) - hContact = db_find_first(); - - do { - char *szProto = NULL; - HANDLE hItem = hContact; - if (hItem == 0) - continue; - - pClcCacheEntry pdnce = (pClcCacheEntry)pcli->pfnGetCacheEntry(hItem); - if (pdnce == NULL) - continue; - - szProto = pdnce->m_cache_cszProto; - NotifyEventHooks(g_CluiData.hEventExtraImageApplying, (WPARAM)hContact, 0); - if (hcontgiven) break; - Sleep(0); - } - while(hContact = db_find_next(hContact)); - - g_mutex_bSetAllExtraIconsCycle = 0; - CLUI__cliInvalidateRect(hwndList,NULL,FALSE); - Sleep(0); -} - -INT_PTR WideSetIconForExtraColumn(WPARAM wParam,LPARAM lParam) -{ - if (pcli->hwndContactTree == 0 || wParam == 0 || lParam == 0) - return -1; - - pIconExtraColumn piec = (pIconExtraColumn)lParam; - if (piec->cbSize != sizeof(IconExtraColumn)) - return -1; - - int icol = ExtraImage_ExtraIDToColumnNum(piec->ColumnType); - if (icol == -1) - return -1; - - HANDLE hItem = (HANDLE)SendMessage(pcli->hwndContactTree,CLM_FINDCONTACT,(WPARAM)wParam,0); - if (hItem == 0) - return -1; - - if (piec->hImage == (HANDLE)0xFF) - piec->hImage = (HANDLE)0xFFFF; - - SendMessage(pcli->hwndContactTree,CLM_SETWIDEEXTRAIMAGE,(WPARAM)hItem,MAKELPARAM(icol,piec->hImage)); - return 0; -}; - -//wparam = hIcon -//return hImage on success,-1 on failure - -INT_PTR WideAddIconToExtraImageList(WPARAM wParam,LPARAM lParam) -{ - if (hWideExtraImageList == 0 || wParam == 0){return(-1);}; - int res = ((int)ImageList_AddIcon(hWideExtraImageList,(HICON)wParam)); - if (res == 0xFF) res = ((int)ImageList_AddIcon(hWideExtraImageList,(HICON)wParam)); - if (res>0xFFFE) return -1; - return res; -}; - -static int ehhExtraImage_UnloadModule(WPARAM wParam,LPARAM lParam) -{ - if (hExtraImageList) - ImageList_Destroy(hExtraImageList); - if (hWideExtraImageList) - ImageList_Destroy(hWideExtraImageList); - return 0; - -} -void ExtraImage_LoadModule() -{ - CreateServiceFunction(MS_CLIST_EXTRA_SET_ICON, WideSetIconForExtraColumn); - CreateServiceFunction(MS_CLIST_EXTRA_ADD_ICON, WideAddIconToExtraImageList); - - HookEvent(ME_SYSTEM_SHUTDOWN, ehhExtraImage_UnloadModule ); -}; -- cgit v1.2.3