From ac7bf920f219a7aed7eb163c8b3195e66c12e4da Mon Sep 17 00:00:00 2001 From: George Hazan Date: Sat, 16 Jun 2012 12:19:24 +0000 Subject: fix for menu items' translation in the editor git-svn-id: http://svn.miranda-ng.org/main/trunk@445 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c --- src/modules/clist/genmenu.cpp | 24 +++++++++++++++--------- src/modules/clist/genmenu.h | 5 +++-- src/modules/clist/genmenuopt.cpp | 4 ++-- 3 files changed, 20 insertions(+), 13 deletions(-) (limited to 'src/modules/clist') diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp index 2399286f72..59fe7a84b2 100644 --- a/src/modules/clist/genmenu.cpp +++ b/src/modules/clist/genmenu.cpp @@ -72,6 +72,14 @@ int GetMenuObjbyId( const int id ) return -1; } +LPTSTR GetMenuItemText(PMO_IntMenuItem pimi) +{ + if (pimi->mi.flags & CMIF_KEEPUNTRANSLATED) + return pimi->mi.ptszName; + + return LangPackTranslateStringT(pimi->mi.hLangpack, pimi->mi.ptszName); +} + PMO_IntMenuItem MO_RecursiveWalkMenu( PMO_IntMenuItem parent, pfnWalkFunc func, void* param ) { if ( parent == NULL ) @@ -825,16 +833,14 @@ static void InsertMenuItemWithSeparators(HMENU hMenu, int uItem, MENUITEMINFO *l mii = *lpmii; int count = GetMenuItemCount( hMenu ); - if (count != 0 && (count % 33 ) == 0) - if ( pimi->mi.root != NULL ) { - if ( !( mii.fMask & MIIM_FTYPE )) - mii.fType = 0; - mii.fMask |= MIIM_FTYPE; - mii.fType |= MFT_MENUBARBREAK; - } + if (count != 0 && (count % 33 ) == 0 && pimi->mi.root != NULL ) { + if ( !( mii.fMask & MIIM_FTYPE )) + mii.fType = 0; + mii.fMask |= MIIM_FTYPE; + mii.fType |= MFT_MENUBARBREAK; + } - if ( !( pimi->mi.flags & CMIF_KEEPUNTRANSLATED)) - mii.dwTypeData = LangPackTranslateStringT(pimi->mi.hLangpack, mii.dwTypeData); + mii.dwTypeData = GetMenuItemText(pimi); InsertMenuItem( hMenu, uItem, TRUE, &mii); } diff --git a/src/modules/clist/genmenu.h b/src/modules/clist/genmenu.h index 1ae6c00b52..b67ca92e39 100644 --- a/src/modules/clist/genmenu.h +++ b/src/modules/clist/genmenu.h @@ -137,11 +137,12 @@ int FindRoot( PMO_IntMenuItem pimi, void* param ); TMO_IntMenuItem * GetMenuItemByGlobalID(int globalMenuID); BOOL FindMenuHanleByGlobalID(HMENU hMenu, int globalID, struct _MenuItemHandles * dat); //GenMenu.c +LPTSTR GetMenuItemText(PMO_IntMenuItem); + int GenMenuOptInit(WPARAM wParam, LPARAM lParam); int GetMenuObjbyId(const int id); int GetMenuItembyId(const int objpos, const int id); + INT_PTR MO_GetMenuItem(WPARAM wParam, LPARAM lParam); void FreeAndNil(void **p); -static int RemoveFromList(int pos, void **lpList, int *ListElemCount, int ElemSize); -static int RemoveFromList(int pos, void **lpList, int *ListElemCount, int ElemSize); #endif diff --git a/src/modules/clist/genmenuopt.cpp b/src/modules/clist/genmenuopt.cpp index 3937306464..ed58a53145 100644 --- a/src/modules/clist/genmenuopt.cpp +++ b/src/modules/clist/genmenuopt.cpp @@ -265,11 +265,11 @@ static int BuildTree(HWND hwndDlg, int MenuObjectId, BOOL bReread) PD->name = mir_tstrdup( dbv.ptszVal ); DBFreeVariant( &dbv ); } - else PD->name = mir_tstrdup( p->mi.ptszName ); + else PD->name = mir_tstrdup( GetMenuItemText(p)); } PD->pimi = p; - PD->defname = mir_tstrdup( p->mi.ptszName ); + PD->defname = mir_tstrdup( GetMenuItemText(p)); mir_snprintf( buf, SIZEOF(buf), "%s_visible", menuItemName ); PD->show = DBGetContactSettingByte( NULL, MenuNameItems, buf, 1 ); -- cgit v1.2.3