From 08f1e8bed5a53953c5ddbf06b2eaa22d6f891e36 Mon Sep 17 00:00:00 2001 From: Alexander Lantsev Date: Fri, 11 Sep 2015 18:52:51 +0000 Subject: NewAwaySys: fix #662 git-svn-id: http://svn.miranda-ng.org/main/trunk@15327 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/NewAwaySysMod/src/AwayOpt.cpp | 15 ++++++++---- plugins/NewAwaySysMod/src/AwaySys.cpp | 39 ++++++++++++++++++++++++-------- plugins/NewAwaySysMod/src/MsgTree.cpp | 6 ++--- plugins/NewAwaySysMod/src/Properties.h | 5 ++-- plugins/NewAwaySysMod/src/SetAwayMsg.cpp | 13 +++++++---- plugins/NewAwaySysMod/src/resource.h | 4 ++++ plugins/NewAwaySysMod/src/stdafx.h | 4 ++++ plugins/NewAwaySysMod/src/version.h | 2 +- 8 files changed, 61 insertions(+), 27 deletions(-) (limited to 'plugins/NewAwaySysMod/src') diff --git a/plugins/NewAwaySysMod/src/AwayOpt.cpp b/plugins/NewAwaySysMod/src/AwayOpt.cpp index 46be9c321a..62a346a1da 100644 --- a/plugins/NewAwaySysMod/src/AwayOpt.cpp +++ b/plugins/NewAwaySysMod/src/AwayOpt.cpp @@ -1109,15 +1109,20 @@ INT_PTR CALLBACK ContactsOptDlg(HWND hwndDlg, UINT msg, WPARAM, LPARAM lParam) { MySetPos(hwndDlg); HIMAGELIST hIml = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 5, 2); - ImageList_AddIcon(hIml, LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_DOT))); - ImageList_AddIcon(hIml, LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_IGNORE))); - ImageList_AddIcon(hIml, LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SOE_ENABLED))); - ImageList_AddIcon(hIml, LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SOE_DISABLED))); - ImageList_AddIcon(hIml, LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_INDEFINITE))); + ImageList_AddIcon(hIml, GetIcon(IDI_DOT)); + ImageList_AddIcon(hIml, GetIcon(IDI_IGNORE)); + ImageList_AddIcon(hIml, GetIcon(IDI_SOE_ENABLED)); + ImageList_AddIcon(hIml, GetIcon(IDI_SOE_DISABLED)); + ImageList_AddIcon(hIml, GetIcon(IDI_INDEFINITE)); SendMessage(hwndList, CLM_SETEXTRAIMAGELIST, 0, (LPARAM)hIml); SendMessage(hwndDlg, UM_CONTACTSDLG_RESETLISTOPTIONS, 0, 0); SendMessage(hwndList, CLM_SETEXTRACOLUMNS, EXTRACOLUMNSCOUNT, 0); + + SendDlgItemMessage(hwndDlg, IDC_SI_INDEFINITE, STM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)GetIcon(IDI_INDEFINITE)); + SendDlgItemMessage(hwndDlg, IDC_SI_SOE_ENABLED, STM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)GetIcon(IDI_SOE_ENABLED)); + SendDlgItemMessage(hwndDlg, IDC_SI_SOE_DISABLED, STM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)GetIcon(IDI_SOE_DISABLED)); + SendDlgItemMessage(hwndDlg, IDC_SI_IGNORE, STM_SETIMAGE, (WPARAM)IMAGE_ICON, (LPARAM)GetIcon(IDI_IGNORE)); CLCINFOITEM cii = { 0 }; cii.cbSize = sizeof(cii); diff --git a/plugins/NewAwaySysMod/src/AwaySys.cpp b/plugins/NewAwaySysMod/src/AwaySys.cpp index b3ac695fb9..2652a89873 100644 --- a/plugins/NewAwaySysMod/src/AwaySys.cpp +++ b/plugins/NewAwaySysMod/src/AwaySys.cpp @@ -54,11 +54,30 @@ bool g_fNoProcessing = false; // tells the status change proc not to do anything int g_bIsIdle = false; VAR_PARSE_DATA VarParseData; -static IconItem iconList[] = { - { LPGEN("Toggle On"), "on", IDI_SOE_DISABLED }, - { LPGEN("Toggle Off"), "off", IDI_SOE_ENABLED } +IconItem iconList[] = { + { LPGEN("Toggle Off"), "off", IDI_SOE_DISABLED }, + { LPGEN("Toggle On"), "on", IDI_SOE_ENABLED }, + { LPGEN("New message"), "new_msg", IDI_NEWMESSAGE }, + { LPGEN("New category"), "new_cat", IDI_NEWCATEGORY }, + { LPGEN("Delete"), "delete", IDI_DELETE }, + { LPGEN("Dot"), "dot", IDI_DOT }, + { LPGEN("Ignore"), "ignore", IDI_IGNORE }, + { LPGEN("Indefinite"), "indefinite", IDI_INDEFINITE }, + { LPGEN("Set status message"), "msg_icon", IDI_MSGICON }, + { LPGEN("Add"), "add", IDI_SAVEASNEW }, + { LPGEN("Save"), "save", IDI_SAVE }, + { LPGEN("Settings"), "settings", IDI_SETTINGS } }; +HICON GetIcon(int iconId, bool size) +{ + for (size_t i = 0; i < _countof(iconList); i++) + if (iconList[i].defIconID == iconId) + return IcoLib_GetIconByHandle(iconList[i].hIcolib, size); + + return NULL; +} + PLUGININFOEX pluginInfo = { sizeof(PLUGININFOEX), __PLUGIN_NAME, @@ -318,21 +337,21 @@ int PreBuildContactMenu(WPARAM hContact, LPARAM) if (szSetStr[0] == 0) Menu_ShowItem(g_hContactMenuItem, false); else - Menu_ModifyItem(g_hContactMenuItem, szSetStr, INVALID_HANDLE_VALUE, 0); + Menu_ModifyItem(g_hContactMenuItem, szSetStr, iconList[8].hIcolib, 0); // if this contact supports sending/receiving messages if ((Flag1 & PF1_IM) == PF1_IM) { int iAutoreply = CContactSettings(g_ProtoStates[szProto].m_status, hContact).Autoreply; HANDLE hIcon; switch (iAutoreply) { - case VAL_USEDEFAULT: hIcon = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_DOT)); break; + case VAL_USEDEFAULT: hIcon = Skin_LoadIcon(IDI_DOT); break; case 0: hIcon = iconList[0].hIcolib; break; default: iAutoreply = 1; hIcon = iconList[1].hIcolib; break; } Menu_ModifyItem(g_hToggleSOEContactMenuItem, NULL, hIcon, 0); - Menu_ModifyItem(g_hAutoreplyOnContactMenuItem, NULL, INVALID_HANDLE_VALUE, (iAutoreply == 1) ? CMIF_CHECKED : 0); - Menu_ModifyItem(g_hAutoreplyOffContactMenuItem, NULL, INVALID_HANDLE_VALUE, (iAutoreply == 0) ? CMIF_CHECKED : 0); - Menu_ModifyItem(g_hAutoreplyUseDefaultContactMenuItem, NULL, INVALID_HANDLE_VALUE, (iAutoreply == VAL_USEDEFAULT) ? CMIF_CHECKED : 0); + Menu_ModifyItem(g_hAutoreplyOnContactMenuItem, NULL, iconList[1].hIcolib, (iAutoreply == 1) ? CMIF_CHECKED : 0); + Menu_ModifyItem(g_hAutoreplyOffContactMenuItem, NULL, iconList[0].hIcolib, (iAutoreply == 0) ? CMIF_CHECKED : 0); + Menu_ModifyItem(g_hAutoreplyUseDefaultContactMenuItem, NULL, iconList[5].hIcolib, (iAutoreply == VAL_USEDEFAULT) ? CMIF_CHECKED : 0); } else // hide the Autoreply menu item Menu_ShowItem(g_hToggleSOEContactMenuItem, false); @@ -634,7 +653,7 @@ int MirandaLoaded(WPARAM, LPARAM) mi.flags = CMIF_TCHAR | CMIF_HIDDEN; mi.name.t = LPGENT("Set status message"); // will never be shown mi.position = 1000020000; - mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_MSGICON)); + mi.hIcolibItem = iconList[8].hIcolib; mi.pszService = MS_AWAYSYS_SETCONTACTSTATMSG; g_hContactMenuItem = Menu_AddContactMenuItem(&mi); @@ -663,7 +682,7 @@ int MirandaLoaded(WPARAM, LPARAM) g_hAutoreplyOffContactMenuItem = Menu_AddContactMenuItem(&mi); SET_UID(mi, 0x101471b9, 0x4309, 0x4062, 0xa8, 0x5e, 0xa2, 0xae, 0x14, 0x7e, 0x4a, 0xb3); - mi.hIcolibItem = LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_DOT)); + mi.hIcolibItem = iconList[5].hIcolib; mi.name.t = LPGENT("Use the default setting"); mi.pszService = MS_AWAYSYS_AUTOREPLY_USEDEFAULT; g_hAutoreplyUseDefaultContactMenuItem = Menu_AddContactMenuItem(&mi); diff --git a/plugins/NewAwaySysMod/src/MsgTree.cpp b/plugins/NewAwaySysMod/src/MsgTree.cpp index 4ac3d313c6..0cb9c2674c 100644 --- a/plugins/NewAwaySysMod/src/MsgTree.cpp +++ b/plugins/NewAwaySysMod/src/MsgTree.cpp @@ -470,9 +470,9 @@ CMsgTree::CMsgTree(HWND hTreeView) : MsgTreePage(g_MsgTreePage), hTreeView(hTree COptItem_TreeCtrl* TreeCtrl = (COptItem_TreeCtrl*)MsgTreePage.Find(IDV_MSGTREE); TreeCtrl->SetDlgItemID(GetDlgCtrlID(hTreeView)); hImageList = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 5, 2); - ImageList_AddIcon(hImageList, LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_NEWMESSAGE))); - ImageList_AddIcon(hImageList, LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_NEWCATEGORY))); - ImageList_AddIcon(hImageList, LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_DELETE))); + ImageList_AddIcon(hImageList, GetIcon(IDI_NEWMESSAGE)); + ImageList_AddIcon(hImageList, GetIcon(IDI_NEWCATEGORY)); + ImageList_AddIcon(hImageList, GetIcon(IDI_DELETE)); MsgTreePage.DBToMemToPage(); if (!g_MoreOptPage.GetDBValueCopy(IDC_MOREOPTDLG_RECENTMSGSCOUNT)) // show "Recent messages" group only when RECENTMSGSCOUNT is not set to 0. TreeView_DeleteItem(hTreeView, TreeCtrl->RootItems[g_Messages_RecentRootID].hItem); diff --git a/plugins/NewAwaySysMod/src/Properties.h b/plugins/NewAwaySysMod/src/Properties.h index f9231be443..e31053ef42 100644 --- a/plugins/NewAwaySysMod/src/Properties.h +++ b/plugins/NewAwaySysMod/src/Properties.h @@ -98,12 +98,11 @@ private: #define ILI_SAVEASNEW 20 #define ILI_DELETE 21 #define ILI_SETTINGS 22 -#define ILI_STATUS_OTHER 23 static unsigned Icons[] = { SKINICON_EVENT_MESSAGE | IL_SKINICON, SKINICON_EVENT_URL | IL_SKINICON, SKINICON_EVENT_FILE | IL_SKINICON, ID_STATUS_ONLINE | IL_PROTOICON, ID_STATUS_AWAY | IL_PROTOICON, ID_STATUS_NA | IL_PROTOICON, ID_STATUS_OCCUPIED | IL_PROTOICON, ID_STATUS_DND | IL_PROTOICON, ID_STATUS_FREECHAT | IL_PROTOICON, ID_STATUS_INVISIBLE | IL_PROTOICON, ID_STATUS_ONTHEPHONE | IL_PROTOICON, ID_STATUS_OUTTOLUNCH | IL_PROTOICON, - IDI_DOT, IDI_MSGICON, IDI_IGNORE, IDI_SOE_ENABLED, IDI_SOE_DISABLED, IDI_NEWMESSAGE, IDI_NEWCATEGORY, IDI_SAVE, IDI_SAVEASNEW, IDI_DELETE, IDI_SETTINGS, IDI_STATUS_OTHER + IDI_DOT, IDI_MSGICON, IDI_IGNORE, IDI_SOE_ENABLED, IDI_SOE_DISABLED, IDI_NEWMESSAGE, IDI_NEWCATEGORY, IDI_SAVE, IDI_SAVEASNEW, IDI_DELETE, IDI_SETTINGS }; @@ -132,7 +131,7 @@ public: else if (Icons[i] & IL_PROTOICON) IconList.SetAtGrow(i) = (HICON)CopyImage(Skin_LoadProtoIcon(NULL, Icons[i] & ~IL_PROTOICON), IMAGE_ICON, cxIcon, cyIcon, LR_COPYFROMRESOURCE); else - IconList.SetAtGrow(i) = (HICON)LoadImage(g_hInstance, MAKEINTRESOURCE(Icons[i]), IMAGE_ICON, cxIcon, cyIcon, 0); + IconList.SetAtGrow(i) = (HICON)GetIcon(Icons[i]); } } diff --git a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp index d974547d69..08a1a30865 100644 --- a/plugins/NewAwaySysMod/src/SetAwayMsg.cpp +++ b/plugins/NewAwaySysMod/src/SetAwayMsg.cpp @@ -495,6 +495,9 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)hTitleIcon); SendDlgItemMessage(hwndDlg, IDC_SAWAYMSG_MSGDATA, EM_LIMITTEXT, AWAY_MSGDATA_MAX, 0); + SendDlgItemMessage(hwndDlg, IDC_SAWAYMSG_STATIC_IGNOREICON, STM_SETIMAGE, IMAGE_ICON, (LPARAM)GetIcon(IDI_IGNORE)); + SendDlgItemMessage(hwndDlg, IDC_SAWAYMSG_STATIC_REPLYICON, STM_SETIMAGE, IMAGE_ICON, (LPARAM)GetIcon(IDI_SOE_ENABLED)); + // init window size variables / resize the window RECT rc; POINT pt; @@ -860,11 +863,11 @@ INT_PTR CALLBACK SetAwayMsgDlgProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARA { // init contact tree HIMAGELIST hil = ImageList_Create(GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), ILC_COLOR32 | ILC_MASK, 5, 2); - ImageList_AddIcon(hil, LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_DOT))); - ImageList_AddIcon(hil, LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_IGNORE))); - ImageList_AddIcon(hil, LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_MSGICON))); - ImageList_AddIcon(hil, LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SOE_ENABLED))); - ImageList_AddIcon(hil, LoadIcon(g_hInstance, MAKEINTRESOURCE(IDI_SOE_DISABLED))); + ImageList_AddIcon(hil, GetIcon(IDI_DOT)); + ImageList_AddIcon(hil, GetIcon(IDI_IGNORE)); + ImageList_AddIcon(hil, GetIcon(IDI_MSGICON)); + ImageList_AddIcon(hil, GetIcon(IDI_SOE_ENABLED)); + ImageList_AddIcon(hil, GetIcon(IDI_SOE_DISABLED)); CList->SetExtraImageList(hil); HTREEITEM hSelItem; diff --git a/plugins/NewAwaySysMod/src/resource.h b/plugins/NewAwaySysMod/src/resource.h index 5d3d715b5b..17b0647bce 100644 --- a/plugins/NewAwaySysMod/src/resource.h +++ b/plugins/NewAwaySysMod/src/resource.h @@ -33,6 +33,10 @@ #define IDD_SETAWAYMSG 216 #define IDD_MOREOPTDIALOG 217 #define IDD_POPUPOPTDLG 218 +#define IDC_SI_INDEFINITE 301 +#define IDC_SI_SOE_ENABLED 302 +#define IDC_SI_SOE_DISABLED 303 +#define IDC_SI_IGNORE 304 #define IDC_STATUSBAR 999 #define IDC_SAWAYMSG_MSGNAME 1001 #define IDC_MESSAGEDLG_DEL 1002 diff --git a/plugins/NewAwaySysMod/src/stdafx.h b/plugins/NewAwaySysMod/src/stdafx.h index b87211b678..8453aa8fae 100644 --- a/plugins/NewAwaySysMod/src/stdafx.h +++ b/plugins/NewAwaySysMod/src/stdafx.h @@ -339,3 +339,7 @@ static __inline int my_variables_showhelp(HWND hwndDlg, UINT uIDEdit, int flags return -1; } } + +//icons +extern IconItem iconList[]; +HICON GetIcon(int iconId, bool size = false); \ No newline at end of file diff --git a/plugins/NewAwaySysMod/src/version.h b/plugins/NewAwaySysMod/src/version.h index 0076dc1647..1dd0a85c9a 100644 --- a/plugins/NewAwaySysMod/src/version.h +++ b/plugins/NewAwaySysMod/src/version.h @@ -1,7 +1,7 @@ #define __MAJOR_VERSION 0 #define __MINOR_VERSION 4 #define __RELEASE_NUM 0 -#define __BUILD_NUM 3 +#define __BUILD_NUM 4 #include -- cgit v1.2.3