From ba52e0ca7c8cc2903536fa8fa6b0150bb4069d1f Mon Sep 17 00:00:00 2001 From: slotwin Date: Sun, 8 Jun 2014 17:30:50 +0000 Subject: Clist_modern: add icons to menu items add icons to IcoLib remove unused code proper capitalization git-svn-id: http://svn.miranda-ng.org/main/trunk@9425 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/Clist_modern/res/addgoupp.ico | Bin 1150 -> 0 bytes plugins/Clist_modern/res/addgroup.ico | Bin 0 -> 1150 bytes plugins/Clist_modern/res/resource.rc | 2 +- plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp | 66 +++++++-------------- .../Clist_modern/src/hdr/modern_commonprototypes.h | 4 -- plugins/Clist_modern/src/modern_clistmod.cpp | 3 - plugins/Clist_modern/src/modern_clisttray.cpp | 4 +- plugins/Clist_modern/src/modern_clui.cpp | 11 +++- 8 files changed, 33 insertions(+), 57 deletions(-) delete mode 100644 plugins/Clist_modern/res/addgoupp.ico create mode 100644 plugins/Clist_modern/res/addgroup.ico (limited to 'plugins/Clist_modern') diff --git a/plugins/Clist_modern/res/addgoupp.ico b/plugins/Clist_modern/res/addgoupp.ico deleted file mode 100644 index 539c32fcd9..0000000000 Binary files a/plugins/Clist_modern/res/addgoupp.ico and /dev/null differ diff --git a/plugins/Clist_modern/res/addgroup.ico b/plugins/Clist_modern/res/addgroup.ico new file mode 100644 index 0000000000..539c32fcd9 Binary files /dev/null and b/plugins/Clist_modern/res/addgroup.ico differ diff --git a/plugins/Clist_modern/res/resource.rc b/plugins/Clist_modern/res/resource.rc index fab7494262..cdf7ceb50d 100644 --- a/plugins/Clist_modern/res/resource.rc +++ b/plugins/Clist_modern/res/resource.rc @@ -29,7 +29,7 @@ LANGUAGE LANG_RUSSIAN, SUBLANG_DEFAULT // remains consistent on all systems. IDI_HIDE_AVATAR ICON "hide_avatar.ico" IDI_SHOW_AVATAR ICON "show_avatar.ico" -IDI_NEWGROUP2 ICON "addgoupp.ico" +IDI_NEWGROUP2 ICON "addgroup.ico" IDI_LISTENING_TO ICON "listening_to.ico" IDI_FAVORITE_0 ICON "rate_none.ico" IDI_FAVORITE_1 ICON "rate_low.ico" diff --git a/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp b/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp index 23fe23fdaa..674d2f8b11 100644 --- a/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp +++ b/plugins/Clist_modern/src/CLUIFrames/groupmenu.cpp @@ -41,8 +41,6 @@ HGENMENU hDisableGroupsMenuItem; HGENMENU hNewGroupMenuItem; HGENMENU hNewSubGroupMenuItem; -int NewGroupIconidx; - void InitSubGroupMenus(void); //Groupmenu exec param(ownerdata) @@ -53,17 +51,14 @@ typedef struct } GroupMenuExecParam,*lpGroupMenuExecParam; -/* -wparam = handle to the menu item returned by MS_CLIST_ADDCONTACTMENUITEM -return 0 on success. -*/ +//wparam = handle to the menu item returned by MS_CLIST_ADDCONTACTMENUITEM +//return 0 on success. static INT_PTR RemoveGroupMenuItem(WPARAM wParam, LPARAM lParam) { CallService(MO_REMOVEMENUITEM,wParam,0); return 0; } - INT_PTR BuildGroupMenu(WPARAM wParam, LPARAM lParam) { ListParam param = { 0 }; @@ -224,31 +219,11 @@ static int OnBuildGroupMenu(WPARAM wParam, LPARAM lParam) return 0; } -static IconItem iconItem = { "New group", "NewGroup", IDI_NEWGROUP2 }; - -int static OnIconLibIconChanged(WPARAM wParam, LPARAM lParam) -{ - if (MirandaExiting()) return 0; - - HICON hIcon = Skin_GetIconByHandle(iconItem.hIcolib); - NewGroupIconidx = ImageList_ReplaceIcon(hCListImages, NewGroupIconidx, hIcon); - Skin_ReleaseIcon(hIcon); - - CLISTMENUITEM clmi = { sizeof(clmi) }; - clmi.flags = CMIM_ICON; - clmi.hIcon = ske_ImageList_GetIcon(hCListImages,NewGroupIconidx,0); - Menu_ModifyItem(hNewSubGroupMenuItem, &clmi); - Menu_ModifyItem(hNewGroupMenuItem, &clmi); - return 0; -} +static IconItemT iconItem = { LPGENT("New group"), "NewGroup", IDI_NEWGROUP2 }; void GroupMenus_Init(void) { - Icon_Register(g_hInst, LPGEN("Contact list"), &iconItem, 1); - - HICON hIcon = Skin_GetIconByHandle(iconItem.hIcolib); - NewGroupIconidx = hIcon ? ImageList_AddIcon(hCListImages, hIcon) : -1; - Skin_ReleaseIcon(hIcon); + Icon_RegisterT(g_hInst, LPGENT("Contact list"), &iconItem, 1); CreateServiceFunction("CLISTMENUSGroup/ExecService",GroupMenuExecService); CreateServiceFunction("CLISTMENUSGroup/FreeOwnerDataGroupMenu",FreeOwnerDataGroupMenu); @@ -285,13 +260,13 @@ void GroupMenus_Init(void) mi.position = 500; mi.pszService = MS_CLIST_SHOWHIDE; mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_SHOWHIDE); - mi.pszName = LPGEN("&Hide/Show"); + mi.pszName = LPGEN("&Hide/show"); hHideShowMainMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi); mi.position = 200000; mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_FINDUSER); mi.pszService = "FindAdd/FindAddCommand"; - mi.pszName = LPGEN("&Find/Add contacts..."); + mi.pszName = LPGEN("&Find/add contacts..."); AddGroupMenuItem(0, (LPARAM)&mi); mi.position = 300000; @@ -320,7 +295,7 @@ void GroupMenus_Init(void) mi.flags = 0; mi.position = 100000; - mi.hIcon = ske_ImageList_GetIcon(hCListImages,NewGroupIconidx,0); + mi.icolibItem = iconItem.hIcolib; mi.pszService = "CLISTMENUSGroup/CreateGroupHelper"; mi.pszName = LPGEN("&New group"); hNewGroupMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi); @@ -328,6 +303,7 @@ void GroupMenus_Init(void) mi.position = 100001; mi.hIcon = NULL; + mi.icolibItem = NULL; mi.pszService = MS_CLIST_SETHIDEOFFLINE; mi.pszName = LPGEN("&Hide offline users"); gmp.lParam = 0;gmp.wParam = -1; @@ -347,8 +323,6 @@ void GroupMenus_Init(void) mi.pszService = "CLISTMENUSGroup/UseGroupsHelper"; mi.pszName = LPGEN("Disable &groups"); hDisableGroupsMenuItem = (HGENMENU)AddGroupMenuItem(0, (LPARAM)&mi); - - HookEvent(ME_SKIN2_ICONSCHANGED, OnIconLibIconChanged); } //////////////////////////////END Group MENU///////////////////////// @@ -544,20 +518,22 @@ void InitSubGroupMenus(void) CLISTMENUITEM mi = { sizeof(mi) }; mi.position = 1000; - mi.hIcon = ske_ImageList_GetIcon(hCListImages,NewGroupIconidx,0); + mi.icolibItem = iconItem.hIcolib; mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; mi.pszName = LPGEN("&New subgroup"); - gmp.lParam = 0;gmp.wParam = POPUP_NEWSUBGROUP; - hNewSubGroupMenuItem = (HGENMENU)AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); + gmp.lParam = 0; + gmp.wParam = POPUP_NEWSUBGROUP; + hNewSubGroupMenuItem = (HGENMENU)AddSubGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi); DestroyIcon_protect(mi.hIcon); mi.position = 1001; mi.hIcon = NULL; + mi.icolibItem = NULL; mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; mi.pszName = LPGEN("&Hide offline users in here"); gmp.lParam = 0; gmp.wParam = POPUP_GROUPHIDEOFFLINE; - hHideOfflineUsersHereMenuItem = (HGENMENU)AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); + hHideOfflineUsersHereMenuItem = (HGENMENU)AddSubGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi); mi.position = 1002; mi.hIcon = NULL; @@ -565,7 +541,7 @@ void InitSubGroupMenus(void) mi.pszName = LPGEN("&Show offline users in here"); gmp.lParam = 0; gmp.wParam = POPUP_GROUPSHOWOFFLINE; - hShowOfflineUsersHereMenuItem = (HGENMENU)AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); + hShowOfflineUsersHereMenuItem = (HGENMENU)AddSubGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi); memset(&mi, 0, sizeof(mi)); mi.cbSize = sizeof(mi); @@ -573,17 +549,17 @@ void InitSubGroupMenus(void) mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_RENAME); mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; mi.pszName = LPGEN("&Rename group"); - gmp.lParam = 0;gmp.wParam = POPUP_RENAMEGROUP; - AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); - DestroyIcon_protect(mi.hIcon); + gmp.lParam = 0; + gmp.wParam = POPUP_RENAMEGROUP; + AddSubGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi); mi.position = 900002; mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_DELETE); mi.pszService = "CLISTMENUSSubGroup/GroupMenuExecProxy"; mi.pszName = LPGEN("&Delete group"); - gmp.lParam = 0;gmp.wParam = POPUP_DELETEGROUP; - AddSubGroupMenuItem((WPARAM)&gmp,(LPARAM)&mi); - DestroyIcon_protect(mi.hIcon); + gmp.lParam = 0; + gmp.wParam = POPUP_DELETEGROUP; + AddSubGroupMenuItem((WPARAM)&gmp, (LPARAM)&mi); } //////////////////////////////END SubGroup MENU///////////////////////// diff --git a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h index 11dabe3d12..3dca9f0ca8 100644 --- a/plugins/Clist_modern/src/hdr/modern_commonprototypes.h +++ b/plugins/Clist_modern/src/hdr/modern_commonprototypes.h @@ -33,18 +33,15 @@ extern HIMAGELIST hAvatarOverlays; extern int g_nTitleBarHeight; extern BOOL g_bTransparentFlag; extern HIMAGELIST g_himlCListClc; -extern HIMAGELIST hCListImages; extern BOOL g_mutex_bSizing; extern BOOL LOCK_RECALC_SCROLLBAR; extern HIMAGELIST g_himlCListClc; extern BYTE nameOrder[]; extern SortedList lContactsCache; extern BOOL g_flag_bOnModulesLoadedCalled; -extern HIMAGELIST hCListImages; extern SKINOBJECTSLIST g_SkinObjectList; extern CURRWNDIMAGEDATA * g_pCachedWindow; extern BOOL g_mutex_bLockUpdating; -extern HIMAGELIST hCListImages; extern STATUSBARDATA g_StatusBarData; extern SKINOBJECTSLIST g_SkinObjectList; extern CURRWNDIMAGEDATA * g_pCachedWindow; @@ -60,7 +57,6 @@ extern HICON g_hListeningToIcon; extern HWND g_hCLUIOptionsWnd; extern BOOL g_bTransparentFlag; extern HINSTANCE g_hInst; -extern HIMAGELIST hCListImages; extern BOOL g_mutex_bChangingMode; extern UINT g_dwMainThreadID; extern HANDLE g_hAwayMsgThread, g_hGetTextAsyncThread, g_hSmoothAnimationThread; diff --git a/plugins/Clist_modern/src/modern_clistmod.cpp b/plugins/Clist_modern/src/modern_clistmod.cpp index aa9dade438..c0f616ca7c 100644 --- a/plugins/Clist_modern/src/modern_clistmod.cpp +++ b/plugins/Clist_modern/src/modern_clistmod.cpp @@ -49,8 +49,6 @@ INT_PTR TrayIconPauseAutoHide(WPARAM wParam, LPARAM lParam); void InitTrayMenus(void); void UninitTrayMenu(); -HIMAGELIST hCListImages = NULL; - //returns normal icon or combined with status overlay. Needs to be destroyed. HICON cliGetIconFromStatusMode(MCONTACT hContact, const char *szProto,int status) { @@ -182,7 +180,6 @@ HRESULT CluiLoadModule() CreateServiceFunction(MS_CLIST_TOGGLESOUNDS,ToggleSounds); CreateServiceFunction(MS_CLIST_SETUSEGROUPS,SetUseGroups); - hCListImages = ImageList_Create(16, 16, ILC_MASK|ILC_COLOR32, 32, 0); InitCustomMenus(); InitTrayMenus(); diff --git a/plugins/Clist_modern/src/modern_clisttray.cpp b/plugins/Clist_modern/src/modern_clisttray.cpp index e74f604772..38b4ab8fbf 100644 --- a/plugins/Clist_modern/src/modern_clisttray.cpp +++ b/plugins/Clist_modern/src/modern_clisttray.cpp @@ -524,14 +524,14 @@ void InitTrayMenus(void) mi.position = 100000; mi.pszService = MS_CLIST_SHOWHIDE; - mi.pszName = LPGEN("&Hide/Show"); + mi.pszName = LPGEN("&Hide/show"); mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_SHOWHIDE); hTrayHideShowMainMenuItem = (HANDLE)AddTrayMenuItem(0, (LPARAM)&mi); mi.position = 200000; mi.icolibItem = LoadSkinnedIconHandle(SKINICON_OTHER_FINDUSER); mi.pszService = "FindAdd/FindAddCommand"; - mi.pszName = LPGEN("&Find/Add contacts..."); + mi.pszName = LPGEN("&Find/add contacts..."); AddTrayMenuItem(0, (LPARAM)&mi); mi.position = 300000; diff --git a/plugins/Clist_modern/src/modern_clui.cpp b/plugins/Clist_modern/src/modern_clui.cpp index 1c4013ad40..4c9d90e046 100644 --- a/plugins/Clist_modern/src/modern_clui.cpp +++ b/plugins/Clist_modern/src/modern_clui.cpp @@ -327,12 +327,19 @@ HRESULT CLUI::LoadDllsRuntime() return S_OK; } +static IconItemT iconItem[] = { + { LPGENT("Show avatar"), "ShowAvatar", IDI_SHOW_AVATAR }, + { LPGENT("Hide avatar"), "HideAvatar", IDI_HIDE_AVATAR } +}; + HRESULT CLUI::RegisterAvatarMenu() { + Icon_RegisterT(g_hInst, LPGENT("Contact list"), iconItem, SIZEOF(iconItem)); + CLISTMENUITEM mi = { sizeof(mi) }; CreateServiceFunction("CList/ShowContactAvatar", CLUI::Service_Menu_ShowContactAvatar); mi.position = 2000150000; - mi.hIcon = LoadSmallIcon(g_hInst, IDI_SHOW_AVATAR); + mi.icolibItem = iconItem[0].hIcolib; mi.pszName = LPGEN("Show contact &avatar"); mi.pszService = "CList/ShowContactAvatar"; hShowAvatarMenuItem = Menu_AddContactMenuItem(&mi); @@ -340,7 +347,7 @@ HRESULT CLUI::RegisterAvatarMenu() CreateServiceFunction("CList/HideContactAvatar", CLUI::Service_Menu_HideContactAvatar); mi.position = 2000150001; - mi.hIcon = LoadSmallIcon(g_hInst, IDI_HIDE_AVATAR); + mi.icolibItem = iconItem[1].hIcolib; mi.pszName = LPGEN("Hide contact &avatar"); mi.pszService = "CList/HideContactAvatar"; hHideAvatarMenuItem = Menu_AddContactMenuItem(&mi); -- cgit v1.2.3