diff options
author | George Hazan <george.hazan@gmail.com> | 2015-12-03 18:39:40 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-12-03 18:39:40 +0000 |
commit | cbb6e1590a9eff7648b2c98b1a7e2b8a43b2c7fc (patch) | |
tree | d8f824e101207defe975c0ba00670ed1a2e09f14 /src | |
parent | b59f5ad7232eb7e22b30c64769ab43c8327661f5 (diff) |
- some old junk removed;
- warning fixes;
git-svn-id: http://svn.miranda-ng.org/main/trunk@15816 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src')
-rw-r--r-- | src/mir_app/src/clcitems.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/clcmsgs.cpp | 2 | ||||
-rw-r--r-- | src/mir_app/src/genmenu.h | 2 | ||||
-rw-r--r-- | src/mir_app/src/menu_options.cpp | 20 | ||||
-rw-r--r-- | src/mir_app/src/menu_utils.cpp | 81 | ||||
-rw-r--r-- | src/mir_app/src/proto_internal.cpp | 8 |
6 files changed, 51 insertions, 64 deletions
diff --git a/src/mir_app/src/clcitems.cpp b/src/mir_app/src/clcitems.cpp index bff9d4dc67..f6910e9e74 100644 --- a/src/mir_app/src/clcitems.cpp +++ b/src/mir_app/src/clcitems.cpp @@ -553,7 +553,7 @@ void fnSortCLC(HWND hwnd, struct ClcData *dat, int useInsertionSort) if (cli.pfnGetRowByIndex(dat, dat->selection, &selcontact, NULL) == -1) hSelItem = NULL; else - hSelItem = (MCONTACT)cli.pfnContactToHItem(selcontact); + hSelItem = (UINT_PTR)cli.pfnContactToHItem(selcontact); group->scanIndex = 0; SortGroup(dat, group, useInsertionSort); for (;;) { diff --git a/src/mir_app/src/clcmsgs.cpp b/src/mir_app/src/clcmsgs.cpp index 785877cb73..5c05231fe0 100644 --- a/src/mir_app/src/clcmsgs.cpp +++ b/src/mir_app/src/clcmsgs.cpp @@ -60,7 +60,7 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR if (cii->hParentGroup == NULL)
group = &dat->list;
else {
- if (!cli.pfnFindItem(hwnd, dat, int(cii->hParentGroup) | HCONTACT_ISGROUP, &contact, NULL, NULL))
+ if (!cli.pfnFindItem(hwnd, dat, INT_PTR(cii->hParentGroup) | HCONTACT_ISGROUP, &contact, NULL, NULL))
return NULL;
group = contact->group;
}
diff --git a/src/mir_app/src/genmenu.h b/src/mir_app/src/genmenu.h index 1924fd8ec8..0a73caa036 100644 --- a/src/mir_app/src/genmenu.h +++ b/src/mir_app/src/genmenu.h @@ -100,8 +100,6 @@ extern LIST<TIntMenuObject> g_menus; #define SEPARATORPOSITIONINTERVAL 100000
// internal usage
-void GetMenuItemName(TMO_IntMenuItem *pMenuItem, char* pszDest, size_t cbDestSize);
-
TMO_IntMenuItem* MO_GetIntMenuItem(HGENMENU);
int MO_DrawMenuItem(LPDRAWITEMSTRUCT dis);
diff --git a/src/mir_app/src/menu_options.cpp b/src/mir_app/src/menu_options.cpp index 2003d9b685..1a3b2f0b5e 100644 --- a/src/mir_app/src/menu_options.cpp +++ b/src/mir_app/src/menu_options.cpp @@ -24,7 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. #include "stdafx.h" #include "genmenu.h" -#include "plugins.h"
+#include "plugins.h" #define STR_SEPARATOR _T("-----------------------------------") @@ -42,7 +42,6 @@ struct MenuItemOptData : public MZeroedObject ptrT name; ptrT defname; - ptrA uniqname; bool bShow; int id; @@ -92,8 +91,8 @@ class CGenMenuOptionsPage : public CDlgBase else ptszCustomName = _T(""); - CMString tszValue(FORMAT, _T("%d;%d;%s"), visible, pimi->mi.position, ptszCustomName);
- db_set_ts(NULL, (char*)szModule, menuItemName, tszValue);
+ CMString tszValue(FORMAT, _T("%d;%d;%s"), visible, pimi->mi.position, ptszCustomName); + db_set_ts(NULL, (char*)szModule, menuItemName, tszValue); } if (pimi->submenu.first != NULL) @@ -157,7 +156,7 @@ class CGenMenuOptionsPage : public CDlgBase for (TMO_IntMenuItem *p = pFirst; p != NULL; p = p->next) { // filter out items whose presence & position might not be changed - if (p->mi.flags & CMIF_SYSTEM)
+ if (p->mi.flags & CMIF_SYSTEM) continue; TCHAR customName[201]; customName[0] = 0; @@ -187,10 +186,6 @@ class CGenMenuOptionsPage : public CDlgBase PD->pos = (PD->pimi) ? PD->pimi->originalPosition : 0; PD->id = p->iCommand; - - if (p->UniqName) - PD->uniqname = mir_strdup(p->UniqName); - arItems.insert(PD); } @@ -511,8 +506,11 @@ public: m_customName.SetText(iod->name); - if (iod->pimi->submenu.first == NULL && iod->uniqname) - m_service.SetTextA(iod->uniqname); + if (iod->pimi->submenu.first == NULL && !equalUUID(iod->pimi->mi.uid, miid_last)) { + char szText[100]; + bin2hex(&iod->pimi->mi.uid, sizeof(iod->pimi->mi.uid), szText); + m_service.SetTextA(szText); + } m_btnDefault.Enable(mir_tstrcmp(iod->name, iod->defname) != 0); m_btnSet.Enable(true); diff --git a/src/mir_app/src/menu_utils.cpp b/src/mir_app/src/menu_utils.cpp index 965a613116..f0bd1dcd82 100644 --- a/src/mir_app/src/menu_utils.cpp +++ b/src/mir_app/src/menu_utils.cpp @@ -849,16 +849,6 @@ static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *l #define PUTPOSITIONSONMENU
#endif
-void GetMenuItemName(TMO_IntMenuItem *pMenuItem, char* pszDest, size_t cbDestSize)
-{
- if (pMenuItem->UniqName)
- mir_snprintf(pszDest, cbDestSize, "{%s}", pMenuItem->UniqName);
- else if (pMenuItem->mi.flags & CMIF_UNICODE)
- mir_snprintf(pszDest, cbDestSize, "{%s}", (char*)_T2A(pMenuItem->mi.name.t));
- else
- mir_snprintf(pszDest, cbDestSize, "{%s}", pMenuItem->mi.name.t);
-}
-
static int sttDumpItem(TMO_IntMenuItem *pmi, void *szModule)
{
if (!equalUUID(pmi->mi.uid, miid_last)) {
@@ -911,7 +901,12 @@ static HMENU BuildRecursiveMenu(HMENU hMenu, TMO_IntMenuItem *pRootMenu, WPARAM char szSetting[256], menuItemName[256];
int visible = true, pos = 0;
if (bOldMenuFormat) {
- GetMenuItemName(pmi, menuItemName, sizeof(menuItemName));
+ if (pmi->UniqName)
+ mir_snprintf(menuItemName, "{%s}", pmi->UniqName);
+ else if (pmi->mi.flags & CMIF_UNICODE)
+ mir_snprintf(menuItemName, "{%s}", (char*)_T2A(pmi->mi.name.t));
+ else
+ mir_snprintf(menuItemName, "{%s}", pmi->mi.name.t);
// check if it visible
mir_snprintf(szSetting, "%s_visible", menuItemName);
@@ -1076,51 +1071,47 @@ int OnIconLibChanges(WPARAM, LPARAM) static int MO_RegisterIcon(TMO_IntMenuItem *pmi, void*)
{
- TCHAR *uname = (pmi->UniqName) ? mir_a2t(pmi->UniqName) : mir_tstrdup(pmi->CustomName),
- *descr = GetMenuItemText(pmi);
-
- if (!uname && !descr)
+ TCHAR *descr = GetMenuItemText(pmi);
+ if (!descr || pmi->hIcolibItem != NULL || equalUUID(pmi->mi.uid, miid_last))
return FALSE;
- if (!pmi->hIcolibItem) {
- HICON hIcon = ImageList_GetIcon(pmi->parent->m_hMenuIcons, pmi->iconId, 0);
+ HICON hIcon = ImageList_GetIcon(pmi->parent->m_hMenuIcons, pmi->iconId, 0);
- TCHAR sectionName[256];
- mir_sntprintf(sectionName, LPGENT("Menu icons") _T("/%s"), TranslateTS(pmi->parent->ptszDisplayName));
+ TCHAR sectionName[256];
+ mir_sntprintf(sectionName, LPGENT("Menu icons") _T("/%s"), TranslateTS(pmi->parent->ptszDisplayName));
- char iconame[256];
- mir_snprintf(iconame, "genmenu_%s_%s", pmi->parent->pszName, uname && *uname ? uname : descr);
+ char iconame[256], uname[100];
+ bin2hex(&pmi->mi.uid, sizeof(pmi->mi.uid), uname);
+ mir_snprintf(iconame, "genmenu_%s_%s", pmi->parent->pszName, uname);
- // remove '&'
- if (descr) {
- descr = NEWTSTR_ALLOCA(descr);
+ // remove '&'
+ if (descr) {
+ descr = NEWTSTR_ALLOCA(descr);
- for (TCHAR *p = descr; *p; p++) {
- if ((p = _tcschr(p, '&')) == NULL)
- break;
+ for (TCHAR *p = descr; *p; p++) {
+ if ((p = _tcschr(p, '&')) == NULL)
+ break;
- memmove(p, p + 1, sizeof(TCHAR)*(mir_tstrlen(p + 1) + 1));
- if (*p == '\0')
- p++;
- }
+ memmove(p, p + 1, sizeof(TCHAR)*(mir_tstrlen(p + 1) + 1));
+ if (*p == '\0')
+ p++;
}
+ }
- SKINICONDESC sid = { 0 };
- sid.flags = SIDF_TCHAR;
- sid.section.t = sectionName;
- sid.pszName = iconame;
- sid.description.t = descr;
- sid.hDefaultIcon = hIcon;
- pmi->hIcolibItem = IcoLib_AddIcon(&sid, 0);
-
- Safe_DestroyIcon(hIcon);
- if (hIcon = IcoLib_GetIcon(iconame)) {
- ImageList_ReplaceIcon(pmi->parent->m_hMenuIcons, pmi->iconId, hIcon);
- IcoLib_ReleaseIcon(hIcon);
- }
+ SKINICONDESC sid = { 0 };
+ sid.flags = SIDF_TCHAR;
+ sid.section.t = sectionName;
+ sid.pszName = iconame;
+ sid.description.t = descr;
+ sid.hDefaultIcon = hIcon;
+ pmi->hIcolibItem = IcoLib_AddIcon(&sid, 0);
+
+ Safe_DestroyIcon(hIcon);
+ if (hIcon = IcoLib_GetIcon(iconame)) {
+ ImageList_ReplaceIcon(pmi->parent->m_hMenuIcons, pmi->iconId, hIcon);
+ IcoLib_ReleaseIcon(hIcon);
}
- mir_free(uname);
return FALSE;
}
diff --git a/src/mir_app/src/proto_internal.cpp b/src/mir_app/src/proto_internal.cpp index c440c5c22d..65d2d636e8 100644 --- a/src/mir_app/src/proto_internal.cpp +++ b/src/mir_app/src/proto_internal.cpp @@ -143,7 +143,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE int __cdecl GetInfo(MCONTACT hContact, int flags)
{
- CCSDATA ccs = { hContact, PSS_GETINFO, flags, 0 };
+ CCSDATA ccs = { hContact, PSS_GETINFO, (WPARAM)flags, 0 };
return ProtoCallService(m_szModuleName, PSS_GETINFO, 0, (LPARAM)&ccs);
}
@@ -239,13 +239,13 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE int __cdecl SendUrl(MCONTACT hContact, int flags, const char* url)
{
- CCSDATA ccs = { hContact, PSS_URL, flags, (LPARAM)url };
+ CCSDATA ccs = { hContact, PSS_URL, (WPARAM)flags, (LPARAM)url };
return (int)ProtoCallService(m_szModuleName, PSS_URL, 0, (LPARAM)&ccs);
}
int __cdecl SetApparentMode(MCONTACT hContact, int mode)
{
- CCSDATA ccs = { hContact, PSS_SETAPPARENTMODE, mode, 0 };
+ CCSDATA ccs = { hContact, PSS_SETAPPARENTMODE, (WPARAM)mode, 0 };
return (int)ProtoCallService(m_szModuleName, PSS_SETAPPARENTMODE, 0, (LPARAM)&ccs);
}
@@ -262,7 +262,7 @@ struct DEFAULT_PROTO_INTERFACE : public PROTO_INTERFACE int __cdecl RecvAwayMsg(MCONTACT hContact, int statusMode, PROTORECVEVENT* evt)
{
- CCSDATA ccs = { hContact, PSR_AWAYMSG, statusMode, (LPARAM)evt };
+ CCSDATA ccs = { hContact, PSR_AWAYMSG, (WPARAM)statusMode, (LPARAM)evt };
return (int)ProtoCallService(m_szModuleName, PSR_AWAYMSG, 0, (LPARAM)&ccs);
}
|