summaryrefslogtreecommitdiff
path: root/src/modules/clist
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-06-14 17:17:39 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-06-14 17:17:39 +0000
commit37e1f0cb88e2344c288064b7d88963ba7ea26955 (patch)
tree5841101832e4c2a95a571c46ea6281c4018d09bf /src/modules/clist
parentd5d023f683b23fe26ddea93738cb721d532804f0 (diff)
- clists' menus compatibility issues;
- code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@412 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/clist')
-rw-r--r--src/modules/clist/clc.cpp2
-rw-r--r--src/modules/clist/clc.h1
-rw-r--r--src/modules/clist/clistcore.cpp1
-rw-r--r--src/modules/clist/clistmenus.cpp218
-rw-r--r--src/modules/clist/genmenu.cpp48
-rw-r--r--src/modules/clist/genmenu.h1
6 files changed, 124 insertions, 147 deletions
diff --git a/src/modules/clist/clc.cpp b/src/modules/clist/clc.cpp
index 982ede3406..e438e4d7b3 100644
--- a/src/modules/clist/clc.cpp
+++ b/src/modules/clist/clc.cpp
@@ -71,7 +71,7 @@ static int ClcSettingChanged(WPARAM wParam, LPARAM lParam)
{
char *szProto;
DBCONTACTWRITESETTING *cws = (DBCONTACTWRITESETTING *) lParam;
- if ( (HANDLE)wParam != NULL && !strcmp(cws->szModule, "CList")) {
+ if ((HANDLE)wParam != NULL && !strcmp(cws->szModule, "CList")) {
if (!strcmp(cws->szSetting, "MyHandle")) {
cli.pfnInvalidateDisplayNameCacheEntry((HANDLE) wParam);
cli.pfnClcBroadcast( INTM_NAMECHANGED, wParam, lParam);
diff --git a/src/modules/clist/clc.h b/src/modules/clist/clc.h
index f9ac61e634..ba12d8b70a 100644
--- a/src/modules/clist/clc.h
+++ b/src/modules/clist/clc.h
@@ -156,6 +156,7 @@ void GetFontSetting(int i, LOGFONTA *lf, COLORREF *colour);
/* clistmenus.c */
HGENMENU fnGetProtocolMenu( const char* );
int fnGetProtocolVisibility( const char* accName );
+int fnConvertMenu( CLISTMENUITEM*, TMO_MenuItem* );
int fnGetAccountIndexByPos(int Pos);
int fnGetProtoIndexByPos(PROTOCOLDESCRIPTOR ** proto, int protoCnt, int Pos);
diff --git a/src/modules/clist/clistcore.cpp b/src/modules/clist/clistcore.cpp
index ad3f6832de..ae662be16f 100644
--- a/src/modules/clist/clistcore.cpp
+++ b/src/modules/clist/clistcore.cpp
@@ -205,6 +205,7 @@ static INT_PTR srvRetrieveInterface( WPARAM, LPARAM lParam )
cli.pfnReloadProtoMenus = fnReloadProtoMenus;
cli.pfnGetAccountIndexByPos = fnGetAccountIndexByPos;
cli.pfnGetProtocolMenu = fnGetProtocolMenu;
+ cli.pfnConvertMenu = fnConvertMenu;
cli.hInst = ( HMODULE )lParam;
diff --git a/src/modules/clist/clistmenus.cpp b/src/modules/clist/clistmenus.cpp
index 2a77fbb731..b14675091a 100644
--- a/src/modules/clist/clistmenus.cpp
+++ b/src/modules/clist/clistmenus.cpp
@@ -210,33 +210,21 @@ static INT_PTR BuildMainMenu(WPARAM, LPARAM)
static INT_PTR AddMainMenuItem(WPARAM, LPARAM lParam)
{
- CLISTMENUITEM* mi = ( CLISTMENUITEM* )lParam;
- if ( mi->cbSize != sizeof( CLISTMENUITEM ))
- return NULL;
+ TMO_MenuItem tmi;
+ CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
+ if ( !cli.pfnConvertMenu(mi, &tmi))
+ return 0;
- TMO_MenuItem tmi = { 0 };
- tmi.cbSize = sizeof(tmi);
- tmi.flags = mi->flags;
- tmi.hIcon = mi->hIcon;
- tmi.hotKey = mi->hotKey;
- tmi.ptszName = mi->ptszName;
- tmi.position = mi->position;
-
- //pszPopupName for new system mean root level
- //pszPopupName for old system mean that exists popup
- tmi.root = ( HGENMENU )mi->pszPopupName;
- {
- lpMainMenuExecParam mmep;
- mmep = ( lpMainMenuExecParam )mir_alloc( sizeof( MainMenuExecParam ));
- if ( mmep == NULL )
- return 0;
-
- //we need just one parametr.
- mmep->szServiceName = mir_strdup(mi->pszService);
- mmep->Param1 = mi->popupPosition;
- mmep->szMenuName = tmi.ptszName;
- tmi.ownerdata=mmep;
- }
+ lpMainMenuExecParam mmep;
+ mmep = ( lpMainMenuExecParam )mir_alloc( sizeof( MainMenuExecParam ));
+ if ( mmep == NULL )
+ return 0;
+
+ //we need just one parametr.
+ mmep->szServiceName = mir_strdup(mi->pszService);
+ mmep->Param1 = mi->popupPosition;
+ mmep->szMenuName = tmi.ptszName;
+ tmi.ownerdata = mmep;
PMO_IntMenuItem pimi = MO_AddNewMenuItem( hMainMenuObject, &tmi );
@@ -249,8 +237,7 @@ static INT_PTR AddMainMenuItem(WPARAM, LPARAM lParam)
name = mir_t2a( mi->ptszName );
needFree = true;
}
- else
- name = mi->pszName;
+ else name = mi->pszName;
MO_SetOptionsMenuItem( pimi, OPT_MENUITEMSETUNIQNAME, ( INT_PTR )name );
if (needFree) mir_free(name);
@@ -300,19 +287,11 @@ static INT_PTR RemoveContactMenuItem(WPARAM wParam, LPARAM)
static INT_PTR AddContactMenuItem(WPARAM, LPARAM lParam)
{
- CLISTMENUITEM *mi=(CLISTMENUITEM*)lParam;
- if ( mi->cbSize != sizeof( CLISTMENUITEM ))
+ TMO_MenuItem tmi;
+ CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
+ if ( !cli.pfnConvertMenu(mi, &tmi))
return 0;
- TMO_MenuItem tmi = { 0 };
- tmi.cbSize = sizeof(tmi);
- tmi.flags = mi->flags;
- tmi.hIcon = mi->hIcon;
- tmi.hotKey = mi->hotKey;
- tmi.position = mi->position;
- tmi.ptszName = mi->ptszName;
- tmi.root = ( HGENMENU )mi->pszPopupName;
-
if ( !( mi->flags & CMIF_ROOTHANDLE )) {
//old system
tmi.flags |= CMIF_ROOTHANDLE;
@@ -387,18 +366,14 @@ INT_PTR ContactMenuExecService(WPARAM wParam, LPARAM lParam)
INT_PTR ContactMenuCheckService(WPARAM wParam, LPARAM)
{
PCheckProcParam pcpp = ( PCheckProcParam )wParam;
- BuildContactParam *bcp=NULL;
- lpContactMenuExecParam cmep=NULL;
- TMO_MenuItem mi;
-
if ( pcpp == NULL )
return FALSE;
- bcp = ( BuildContactParam* )pcpp->wParam;
+ BuildContactParam *bcp = ( BuildContactParam* )pcpp->wParam;
if ( bcp == NULL )
return FALSE;
- cmep = ( lpContactMenuExecParam )pcpp->MenuItemOwnerData;
+ lpContactMenuExecParam cmep = ( lpContactMenuExecParam )pcpp->MenuItemOwnerData;
if ( cmep == NULL ) //this is root...build it
return TRUE;
@@ -406,6 +381,8 @@ INT_PTR ContactMenuCheckService(WPARAM wParam, LPARAM)
if ( bcp->szProto == NULL ) return FALSE;
if ( strcmp( cmep->pszContactOwner, bcp->szProto )) return FALSE;
}
+
+ TMO_MenuItem mi;
if ( MO_GetMenuItem(( WPARAM )pcpp->MenuItemHandle, ( LPARAM )&mi ) == 0 ) {
if ( mi.flags & CMIF_HIDDEN ) return FALSE;
if ( mi.flags & CMIF_NOTONLIST && bcp->isOnList ) return FALSE;
@@ -432,25 +409,24 @@ INT_PTR FreeOwnerDataContactMenu (WPARAM, LPARAM lParam)
BOOL FindMenuHandleByGlobalID(HMENU hMenu, PMO_IntMenuItem id, MenuItemData* itdat)
{
- int i;
- PMO_IntMenuItem pimi;
- MENUITEMINFO mii={0};
- BOOL inSub=FALSE;
if (!itdat)
return FALSE;
+ MENUITEMINFO mii = {0};
mii.cbSize = MENUITEMINFO_V4_SIZE;
mii.fMask = MIIM_SUBMENU | MIIM_DATA;
- for ( i = GetMenuItemCount( hMenu )-1; i >= 0; i-- ) {
+ for ( int i = GetMenuItemCount( hMenu )-1; i >= 0; i-- ) {
GetMenuItemInfo(hMenu, i, TRUE, &mii);
if ( mii.fType == MFT_SEPARATOR )
continue;
+
+ BOOL inSub = FALSE;
if ( mii.hSubMenu )
inSub = FindMenuHandleByGlobalID(mii.hSubMenu, id, itdat);
if ( inSub )
return inSub;
- pimi = MO_GetIntMenuItem(( HGENMENU )mii.dwItemData );
+ PMO_IntMenuItem pimi = MO_GetIntMenuItem(( HGENMENU )mii.dwItemData );
if ( pimi != NULL ) {
if ( pimi == id ) {
itdat->OwnerMenu = hMenu;
@@ -472,10 +448,8 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM)
return TRUE;
StatusMenuExecParam *smep = ( StatusMenuExecParam* )pcpp->MenuItemOwnerData;
- if (smep && !smep->status && smep->custom )
- {
- if (wildcmp(smep->svc, "*XStatus*"))
- {
+ if (smep && !smep->status && smep->custom ) {
+ if ( wildcmp(smep->svc, "*XStatus*")) {
int XStatus = CallProtoService(smep->proto, "/GetXStatus", 0, 0);
char buf[255];
mir_snprintf( buf, sizeof(buf), "*XStatus%d", XStatus );
@@ -488,11 +462,9 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM)
else
timi->mi.flags &= ~CMIF_CHECKED;
- if ( reset || check )
- {
+ if ( reset || check ) {
PMO_IntMenuItem timiParent = MO_GetIntMenuItem( timi->mi.root );
- if (timiParent)
- {
+ if (timiParent) {
CLISTMENUITEM mi2 = {0};
mi2.cbSize = sizeof(mi2);
mi2.flags = CMIM_NAME | CMIF_TCHAR;
@@ -502,24 +474,20 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM)
MenuItemData it = {0};
- if (FindMenuHandleByGlobalID(hStatusMenu, timiParent, &it))
- {
+ if (FindMenuHandleByGlobalID(hStatusMenu, timiParent, &it)) {
MENUITEMINFO mi ={0};
TCHAR d[100];
GetMenuString(it.OwnerMenu, it.position, d, SIZEOF(d), MF_BYPOSITION);
- if (!IsWinVer98Plus())
- {
+ if (!IsWinVer98Plus()) {
mi.cbSize = MENUITEMINFO_V4_SIZE;
mi.fMask = MIIM_TYPE | MIIM_STATE;
mi.fType = MFT_STRING;
}
- else
- {
+ else {
mi.cbSize = sizeof( mi );
mi.fMask = MIIM_STRING | MIIM_STATE;
- if ( timi->iconId != -1 )
- {
+ if ( timi->iconId != -1 ) {
mi.fMask |= MIIM_BITMAP;
if (IsWinVerVistaPlus() && isThemeActive()) {
if (timi->hBmp == NULL)
@@ -685,19 +653,11 @@ INT_PTR FreeOwnerDataStatusMenu(WPARAM, LPARAM lParam)
//wparam MenuItemHandle
static INT_PTR ModifyCustomMenuItem(WPARAM wParam, LPARAM lParam)
{
- CLISTMENUITEM *mi=(CLISTMENUITEM*)lParam;
TMO_MenuItem tmi;
+ CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
+ if ( !cli.pfnConvertMenu(mi, &tmi))
+ return 0;
- if ( lParam == 0 )
- return -1;
- if ( mi->cbSize != sizeof( CLISTMENUITEM ))
- return 1;
-
- tmi.cbSize = sizeof(tmi);
- tmi.flags = mi->flags;
- tmi.hIcon = mi->hIcon;
- tmi.hotKey = mi->hotKey;
- tmi.ptszName = mi->ptszName;
return MO_ModifyMenuItem(( PMO_IntMenuItem )wParam, &tmi );
}
@@ -718,7 +678,7 @@ INT_PTR MenuProcessCommand(WPARAM wParam, LPARAM lParam)
//process old menu sys
if ( HIWORD(wParam) & MPCF_CONTACTMENU )
- return MO_ProcessCommandBySubMenuIdent( (int)hContactMenuObject, LOWORD(wParam), lParam );
+ return MO_ProcessCommandBySubMenuIdent((int)hContactMenuObject, LOWORD(wParam), lParam );
//unknown old menu
return MO_ProcessCommandByMenuIdent( LOWORD(wParam), lParam );
@@ -1034,15 +994,14 @@ void RebuildMenuOrder( void )
tmi.hIcon = LoadSkinIcon( skinIconStatusList[j] );
tmi.position = pos++;
tmi.hotKey = MAKELPARAM(MOD_CONTROL, '0'+j);
- {
- //owner data
- lpStatusMenuExecParam smep = ( lpStatusMenuExecParam )mir_alloc( sizeof( StatusMenuExecParam ));
- smep->custom = FALSE;
- smep->status = statusModeList[j];
- smep->proto = NULL;
- smep->svc = NULL;
- tmi.ownerdata = smep;
- }
+
+ //owner data
+ lpStatusMenuExecParam smep = ( lpStatusMenuExecParam )mir_alloc( sizeof( StatusMenuExecParam ));
+ smep->custom = FALSE;
+ smep->status = statusModeList[j];
+ smep->proto = NULL;
+ smep->svc = NULL;
+ tmi.ownerdata = smep;
{
TCHAR buf[ 256 ], hotkeyName[ 100 ];
WORD hotKey = GetHotkeyValue( statusHotkeys[j] );
@@ -1144,28 +1103,28 @@ static int MenuProtoAck(WPARAM, LPARAM lParam)
tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE;
MO_ModifyMenuItem( hStatusMainMenuHandles[pos], &tmi );
}
- //SetMenuDefaultItem(hStatusMenu, -1, FALSE);
+
cli.currentStatusMenuItem=0;
}
for ( i=0; i < accounts.getCount(); i++ ) {
if ( !lstrcmpA( accounts[i]->szModuleName, ack->szModule )) {
- //hProcess is previous mode, lParam is new mode
- if ((( int )ack->hProcess >= ID_STATUS_OFFLINE || ( int )ack->hProcess == 0 ) && ( int )ack->hProcess < ID_STATUS_OFFLINE + SIZEOF(statusModeList)) {
- int pos = statustopos(( int )ack->hProcess);
- if ( pos == -1 )
- pos = 0;
- for ( pos = 0; pos < SIZEOF(statusModeList); pos++ ) {
- tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE;
- MO_ModifyMenuItem( hStatusMenuHandles[i].menuhandle[pos], &tmi );
- } }
-
- if ( ack->lParam >= ID_STATUS_OFFLINE && ack->lParam < ID_STATUS_OFFLINE + SIZEOF(statusModeList)) {
- int pos = statustopos(( int )ack->lParam );
- if ( pos >= 0 && pos < SIZEOF(statusModeList)) {
- tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE | CMIF_CHECKED;
- MO_ModifyMenuItem( hStatusMenuHandles[i].menuhandle[pos], &tmi );
- } }
+ if ((( int )ack->hProcess >= ID_STATUS_OFFLINE || ( int )ack->hProcess == 0 ) && ( int )ack->hProcess < ID_STATUS_OFFLINE + SIZEOF(statusModeList)) {
+ int pos = statustopos(( int )ack->hProcess);
+ if ( pos == -1 )
+ pos = 0;
+ for ( pos = 0; pos < SIZEOF(statusModeList); pos++ ) {
+ tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE;
+ MO_ModifyMenuItem( hStatusMenuHandles[i].menuhandle[pos], &tmi );
+ } }
+
+ if ( ack->lParam >= ID_STATUS_OFFLINE && ack->lParam < ID_STATUS_OFFLINE + SIZEOF(statusModeList)) {
+ int pos = statustopos(( int )ack->lParam );
+ if ( pos >= 0 && pos < SIZEOF(statusModeList)) {
+ tmi.flags = CMIM_FLAGS | CMIF_ROOTHANDLE | CMIF_CHECKED;
+ MO_ModifyMenuItem( hStatusMenuHandles[i].menuhandle[pos], &tmi );
+ }
+ }
break;
} }
@@ -1173,6 +1132,32 @@ static int MenuProtoAck(WPARAM, LPARAM lParam)
return 0;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
+int fnConvertMenu( CLISTMENUITEM* mi, TMO_MenuItem* pmi )
+{
+ if (mi == NULL || pmi == NULL)
+ return FALSE;
+
+ if (mi->cbSize != sizeof(CLISTMENUITEM) && mi->cbSize != CLISTMENUITEM_OLDSIZE_V1)
+ return FALSE;
+
+ memset(pmi, 0, sizeof(TMO_MenuItem));
+ pmi->cbSize = sizeof(tmi);
+ pmi->root = mi->hParentMenu;
+ pmi->flags = mi->flags;
+ pmi->hIcon = mi->hIcon;
+ pmi->hotKey = mi->hotKey;
+ pmi->pszName = mi->pszName;
+ pmi->position = mi->position;
+ if (mi->cbSize == sizeof(CLISTMENUITEM))
+ pmi->hLangpack = mi->hLangpack;
+
+ return TRUE;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////
+
static MenuProto* FindProtocolMenu( const char* proto )
{
for (int i=0; i < cli.menuProtoCount; i++)
@@ -1195,25 +1180,17 @@ HGENMENU fnGetProtocolMenu( const char* proto )
return NULL;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam)
{
- CLISTMENUITEM *mi = ( CLISTMENUITEM* )lParam;
- if ( mi->cbSize != sizeof( CLISTMENUITEM ))
+ TMO_MenuItem tmi;
+ CLISTMENUITEM *mi = (CLISTMENUITEM*)lParam;
+ if ( !cli.pfnConvertMenu(mi, &tmi))
return 0;
- PMO_IntMenuItem pRoot = NULL;
- lpStatusMenuExecParam smep = NULL;
-
- TMO_MenuItem tmi = { 0 };
- tmi.cbSize = sizeof(tmi);
- tmi.hIcon = mi->hIcon;
- tmi.hotKey = mi->hotKey;
- tmi.position = mi->position;
- tmi.pszName = mi->pszName;
- tmi.flags = mi->flags;
- tmi.root = mi->hParentMenu;
-
// for new style menus the pszPopupName contains the root menu handle
+ PMO_IntMenuItem pRoot = NULL;
if ( mi->flags & CMIF_ROOTHANDLE )
pRoot = MO_GetIntMenuItem( mi->hParentMenu );
@@ -1251,6 +1228,7 @@ static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam)
}
//owner data
+ lpStatusMenuExecParam smep = NULL;
if ( mi->pszService ) {
smep = ( lpStatusMenuExecParam )mir_calloc(sizeof(StatusMenuExecParam));
smep->custom = TRUE;
@@ -1284,6 +1262,8 @@ static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam)
return ( INT_PTR )menuHandle;
}
+/////////////////////////////////////////////////////////////////////////////////////////
+
static INT_PTR HotkeySetStatus(WPARAM wParam, LPARAM lParam)
{
return SetStatusMode( lParam, 0 );
diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp
index 13e9d61e46..e0fc7b34e3 100644
--- a/src/modules/clist/genmenu.cpp
+++ b/src/modules/clist/genmenu.cpp
@@ -208,7 +208,7 @@ INT_PTR MO_ProcessHotKeys( HANDLE menuHandle, INT_PTR vKey )
EnterCriticalSection( &csMenuHook );
- int objidx = GetMenuObjbyId( (int)menuHandle );
+ int objidx = GetMenuObjbyId((int)menuHandle );
if ( objidx == -1 ) {
LeaveCriticalSection( &csMenuHook );
return FALSE;
@@ -318,22 +318,17 @@ int MO_ModifyMenuItem( PMO_IntMenuItem menuHandle, PMO_MenuItem pmi )
FreeAndNil(( void** )&pimi->mi.pszName );
if ( pmi->flags & CMIF_UNICODE )
- pimi->mi.ptszName = mir_tstrdup(( pmi->flags & CMIF_KEEPUNTRANSLATED ) ? pmi->ptszName : TranslateTS( pmi->ptszName ));
- else {
- if ( pmi->flags & CMIF_KEEPUNTRANSLATED ) {
- int len = lstrlenA( pmi->pszName );
- pimi->mi.ptszName = ( TCHAR* )mir_alloc( sizeof( TCHAR )*( len+1 ));
- MultiByteToWideChar( CP_ACP, 0, pmi->pszName, -1, pimi->mi.ptszName, len+1 );
- pimi->mi.ptszName[ len ] = 0;
- }
- else pimi->mi.ptszName = LangPackPcharToTchar( pmi->pszName );
- }
+ pimi->mi.ptszName = mir_tstrdup(pmi->ptszName);
+ else
+ pimi->mi.ptszName = mir_a2t(pmi->pszName);
}
+
if ( pmi->flags & CMIM_FLAGS ) {
oldflags = pimi->mi.flags & ( CMIF_ROOTHANDLE | CMIF_ICONFROMICOLIB );
pimi->mi.flags = (pmi->flags & ~CMIM_ALL) | oldflags;
}
- if ( (pmi->flags & CMIM_ICON) && !bIconsDisabled ) {
+
+ if ((pmi->flags & CMIM_ICON) && !bIconsDisabled ) {
if ( pimi->mi.flags & CMIF_ICONFROMICOLIB ) {
HICON hIcon = IcoLib_GetIconByHandle( pmi->hIcolibItem, false );
if ( hIcon != NULL ) {
@@ -350,7 +345,10 @@ int MO_ModifyMenuItem( PMO_IntMenuItem menuHandle, PMO_MenuItem pmi )
else
pimi->iconId = -1; //fixme, should remove old icon & shuffle all iconIds
}
- if (pimi->hBmp) DeleteObject(pimi->hBmp); pimi->hBmp = NULL;
+ if (pimi->hBmp) {
+ DeleteObject(pimi->hBmp);
+ pimi->hBmp = NULL;
+ }
}
if ( pmi->flags & CMIM_HOTKEY )
@@ -504,7 +502,7 @@ int MO_SetOptionsMenuObject( HANDLE handle, int setting, INT_PTR value )
EnterCriticalSection( &csMenuHook );
__try
{
- pimoidx = GetMenuObjbyId( (int)handle );
+ pimoidx = GetMenuObjbyId((int)handle );
res = pimoidx != -1;
if ( res ) {
TIntMenuObject* pmo = g_menus[pimoidx];
@@ -637,7 +635,7 @@ PMO_IntMenuItem MO_AddNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi )
return MO_AddOldNewMenuItem( menuobjecthandle, pmi );
EnterCriticalSection( &csMenuHook );
- int objidx = GetMenuObjbyId( (int)menuobjecthandle );
+ int objidx = GetMenuObjbyId((int)menuobjecthandle );
if ( objidx == -1 ) {
LeaveCriticalSection( &csMenuHook );
return NULL;
@@ -655,13 +653,9 @@ PMO_IntMenuItem MO_AddNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi )
p->originalPosition = pmi->position;
if ( pmi->flags & CMIF_UNICODE )
- p->mi.ptszName = mir_tstrdup(( pmi->flags & CMIF_KEEPUNTRANSLATED ) ? pmi->ptszName : TranslateTS( pmi->ptszName ));
- else {
- if ( pmi->flags & CMIF_KEEPUNTRANSLATED )
- p->mi.ptszName = mir_a2u(pmi->pszName);
- else
- p->mi.ptszName = LangPackPcharToTchar( pmi->pszName );
- }
+ p->mi.ptszName = mir_tstrdup(pmi->ptszName);
+ else
+ p->mi.ptszName = mir_a2u(pmi->pszName);
if ( pmi->hIcon != NULL && !bIconsDisabled ) {
if ( pmi->flags & CMIF_ICONFROMICOLIB ) {
@@ -715,7 +709,7 @@ PMO_IntMenuItem MO_AddOldNewMenuItem( HANDLE menuobjecthandle, PMO_MenuItem pmi
if ( !bIsGenMenuInited || pmi == NULL )
return NULL;
- int objidx = GetMenuObjbyId( (int)menuobjecthandle );
+ int objidx = GetMenuObjbyId((int)menuobjecthandle );
if ( objidx == -1 )
return NULL;
@@ -873,7 +867,7 @@ INT_PTR MO_BuildMenu(WPARAM wParam, LPARAM lParam)
EnterCriticalSection( &csMenuHook );
ListParam *lp = ( ListParam* )lParam;
- int pimoidx = GetMenuObjbyId( (int)lp->MenuObjectHandle );
+ int pimoidx = GetMenuObjbyId((int)lp->MenuObjectHandle );
if ( pimoidx == -1 ) {
LeaveCriticalSection( &csMenuHook );
return 0;
@@ -1073,7 +1067,7 @@ int OnIconLibChanges(WPARAM, LPARAM)
{
EnterCriticalSection( &csMenuHook );
for ( int mo=0; mo < g_menus.getCount(); mo++ )
- if ( (int)hStatusMenuObject != g_menus[mo]->id ) //skip status menu
+ if ((int)hStatusMenuObject != g_menus[mo]->id ) //skip status menu
MO_RecursiveWalkMenu( g_menus[mo]->m_items.first, MO_ReloadIcon, 0 );
LeaveCriticalSection( &csMenuHook );
@@ -1151,7 +1145,7 @@ int RegisterAllIconsInIconLib()
{
//register all icons
for ( int mo=0; mo < g_menus.getCount(); mo++ ) {
- if ( (int)hStatusMenuObject == g_menus[mo]->id ) //skip status menu
+ if ((int)hStatusMenuObject == g_menus[mo]->id ) //skip status menu
continue;
MO_RecursiveWalkMenu( g_menus[mo]->m_items.first, MO_RegisterIcon, 0 );
@@ -1162,7 +1156,7 @@ int RegisterAllIconsInIconLib()
int TryProcessDoubleClick( HANDLE hContact )
{
- int iMenuID = GetMenuObjbyId( (int)hContactMenuObject );
+ int iMenuID = GetMenuObjbyId((int)hContactMenuObject );
if ( iMenuID != -1 ) {
NotifyEventHooks(hPreBuildContactMenuEvent, (WPARAM)hContact, 0);
diff --git a/src/modules/clist/genmenu.h b/src/modules/clist/genmenu.h
index 14d820575e..1ae6c00b52 100644
--- a/src/modules/clist/genmenu.h
+++ b/src/modules/clist/genmenu.h
@@ -48,6 +48,7 @@ typedef struct _tagIntMenuItem
HANDLE hIcolibItem; // handle of iconlib item
HBITMAP hBmp;
int originalPosition;
+ int hLangpack;
struct _tagIntMenuItem *next; // next item in list
struct TIntMenuObject *parent;