From 88790eed4ffd9ca555c8f9b73cb014a93b57a34f Mon Sep 17 00:00:00 2001 From: George Hazan Date: Mon, 22 Jun 2015 20:38:56 +0000 Subject: Menu_ModifyItem unbound from CLISTMENUITEM structure git-svn-id: http://svn.miranda-ng.org/main/trunk@14334 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- plugins/SimpleAR/src/Main.cpp | 39 +++++++++++++++++---------------------- plugins/SimpleAR/src/Options.cpp | 10 +++++----- 2 files changed, 22 insertions(+), 27 deletions(-) (limited to 'plugins/SimpleAR') diff --git a/plugins/SimpleAR/src/Main.cpp b/plugins/SimpleAR/src/Main.cpp index b8c2f8bf39..27195caeaf 100644 --- a/plugins/SimpleAR/src/Main.cpp +++ b/plugins/SimpleAR/src/Main.cpp @@ -62,11 +62,10 @@ INT_PTR ToggleEnable(WPARAM wParam, LPARAM lParam) BOOL fEnabled = !db_get_b(NULL, protocolname, KEY_ENABLED, 1); db_set_b(NULL, protocolname, KEY_ENABLED, fEnabled); - CLISTMENUITEM mi = { 0 }; - mi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR; - mi.ptszName = fEnabled ? LPGENT("Disable Auto&reply") : LPGENT("Enable Auto&reply"); - mi.icolibItem = fEnabled ? iconList[0].hIcolib : iconList[1].hIcolib; - Menu_ModifyItem(hEnableMenu, &mi); + if (fEnabled) + Menu_ModifyItem(hEnableMenu, LPGENT("Disable Auto&reply"), iconList[0].hIcolib); + else + Menu_ModifyItem(hEnableMenu, LPGENT("Enable Auto&reply"), iconList[1].hIcolib); return 0; } @@ -77,11 +76,10 @@ INT_PTR Toggle(WPARAM w, LPARAM l) db_set_b(hContact, protocolname, "TurnedOn", on); on = !on; - CLISTMENUITEM mi = { 0 }; - mi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR; - mi.ptszName = on ? LPGENT("Turn off Autoanswer") : LPGENT("Turn on Autoanswer"); - mi.icolibItem = on ? iconList[0].hIcolib : iconList[1].hIcolib; - Menu_ModifyItem(hToggle, &mi); + if (on) + Menu_ModifyItem(hToggle, LPGENT("Turn off Autoanswer"), iconList[0].hIcolib); + else + Menu_ModifyItem(hToggle, LPGENT("Turn on Autoanswer"), iconList[1].hIcolib); return 0; } @@ -89,12 +87,11 @@ INT OnPreBuildContactMenu(WPARAM w, LPARAM l) { MCONTACT hContact = (MCONTACT)w; - CLISTMENUITEM mi = { 0 }; - mi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR; - BOOL on = !db_get_b(hContact, protocolname, "TurnedOn", 0); - mi.ptszName = on ? LPGENT("Turn off Autoanswer") : LPGENT("Turn on Autoanswer"); - mi.icolibItem = on ? iconList[0].hIcolib : iconList[1].hIcolib; - Menu_ModifyItem(hToggle, &mi); + BOOL on = !db_get_b(hContact, protocolname, "TurnedOn", 0); + if (on) + Menu_ModifyItem(hToggle, LPGENT("Turn off Autoanswer"), iconList[0].hIcolib); + else + Menu_ModifyItem(hToggle, LPGENT("Turn on Autoanswer"), iconList[1].hIcolib); return 0; } @@ -138,12 +135,10 @@ INT CheckDefaults(WPARAM, LPARAM) gbVarsServiceExist = TRUE; BOOL fEnabled = db_get_b(NULL, protocolname, KEY_ENABLED, 1); - CLISTMENUITEM mi = { 0 }; - mi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR; - mi.ptszName = fEnabled ? LPGENT("Disable Auto&reply") : LPGENT("Enable Auto&reply"); - mi.icolibItem = fEnabled ? iconList[0].hIcolib : iconList[1].hIcolib; - Menu_ModifyItem(hEnableMenu, &mi); - + if (fEnabled) + Menu_ModifyItem(hEnableMenu, LPGENT("Disable Auto&reply"), iconList[0].hIcolib); + else + Menu_ModifyItem(hEnableMenu, LPGENT("Enable Auto&reply"), iconList[1].hIcolib); return 0; } diff --git a/plugins/SimpleAR/src/Options.cpp b/plugins/SimpleAR/src/Options.cpp index a4b54633e4..011b19ee72 100644 --- a/plugins/SimpleAR/src/Options.cpp +++ b/plugins/SimpleAR/src/Options.cpp @@ -92,11 +92,11 @@ INT_PTR CALLBACK DlgProcOpts(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPara BOOL fEnabled = IsDlgButtonChecked(hwndDlg, IDC_ENABLEREPLIER) == 1; db_set_b(NULL, protocolname, KEY_ENABLED, (BYTE)fEnabled); - CLISTMENUITEM mi = { 0 }; - mi.flags = CMIM_NAME | CMIM_ICON | CMIF_TCHAR; - mi.ptszName = fEnabled ? LPGENT("Disable Auto&reply") : LPGENT("Enable Auto&reply"); - mi.icolibItem = fEnabled ? iconList[0].hIcolib : iconList[1].hIcolib; - Menu_ModifyItem(hEnableMenu, &mi); + + if (fEnabled) + Menu_ModifyItem(hEnableMenu, LPGENT("Disable Auto&reply"), iconList[0].hIcolib); + else + Menu_ModifyItem(hEnableMenu, LPGENT("Enable Auto&reply"), iconList[1].hIcolib); GetDlgItemText(hwndDlg, IDC_HEADING, ptszText, _countof(ptszText)); db_set_ts(NULL, protocolname, KEY_HEADING, ptszText); -- cgit v1.2.3