diff options
author | George Hazan <george.hazan@gmail.com> | 2012-06-14 17:17:39 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2012-06-14 17:17:39 +0000 |
commit | 37e1f0cb88e2344c288064b7d88963ba7ea26955 (patch) | |
tree | 5841101832e4c2a95a571c46ea6281c4018d09bf /src/modules | |
parent | d5d023f683b23fe26ddea93738cb721d532804f0 (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')
-rw-r--r-- | src/modules/autoaway/autoaway.cpp | 2 | ||||
-rw-r--r-- | src/modules/clist/clc.cpp | 2 | ||||
-rw-r--r-- | src/modules/clist/clc.h | 1 | ||||
-rw-r--r-- | src/modules/clist/clistcore.cpp | 1 | ||||
-rw-r--r-- | src/modules/clist/clistmenus.cpp | 218 | ||||
-rw-r--r-- | src/modules/clist/genmenu.cpp | 48 | ||||
-rw-r--r-- | src/modules/clist/genmenu.h | 1 | ||||
-rw-r--r-- | src/modules/database/dbutils.cpp | 4 | ||||
-rw-r--r-- | src/modules/database/profilemanager.cpp | 2 | ||||
-rw-r--r-- | src/modules/fonts/services.cpp | 4 | ||||
-rw-r--r-- | src/modules/icolib/skin2icons.cpp | 2 | ||||
-rw-r--r-- | src/modules/idle/idle.cpp | 2 | ||||
-rw-r--r-- | src/modules/netlib/netlib.cpp | 4 | ||||
-rw-r--r-- | src/modules/netlib/netliblog.cpp | 4 | ||||
-rw-r--r-- | src/modules/options/options.cpp | 4 | ||||
-rw-r--r-- | src/modules/plugins/newplugins.cpp | 2 | ||||
-rw-r--r-- | src/modules/protocols/protocols.cpp | 10 | ||||
-rw-r--r-- | src/modules/skin/skinicons.cpp | 4 | ||||
-rw-r--r-- | src/modules/xml/xmlApi.cpp | 2 |
19 files changed, 147 insertions, 170 deletions
diff --git a/src/modules/autoaway/autoaway.cpp b/src/modules/autoaway/autoaway.cpp index af774200d9..055313736b 100644 --- a/src/modules/autoaway/autoaway.cpp +++ b/src/modules/autoaway/autoaway.cpp @@ -53,7 +53,7 @@ static int AutoAwayEvent(WPARAM, LPARAM lParam) continue;
}
if ( currentstatus >= ID_STATUS_ONLINE && currentstatus != ID_STATUS_INVISIBLE ) {
- if ( (lParam&IDF_ISIDLE) && ( currentstatus == ID_STATUS_ONLINE || currentstatus == ID_STATUS_FREECHAT )) {
+ if ((lParam&IDF_ISIDLE) && ( currentstatus == ID_STATUS_ONLINE || currentstatus == ID_STATUS_FREECHAT )) {
DBWriteContactSettingByte( NULL, AA_MODULE, pa->szModuleName, 1 );
Proto_SetStatus( pa->szModuleName, status );
}
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;
diff --git a/src/modules/database/dbutils.cpp b/src/modules/database/dbutils.cpp index 6cbf8ca781..cd4168884d 100644 --- a/src/modules/database/dbutils.cpp +++ b/src/modules/database/dbutils.cpp @@ -93,7 +93,7 @@ static INT_PTR DbEventGetText(WPARAM wParam, LPARAM lParam) BOOL bIsDenyUnicode = (egt->datatype & DBVTF_DENYUNICODE);
DBEVENTINFO* dbei = egt->dbei;
- DBEVENTTYPEDESCR* et = ( DBEVENTTYPEDESCR* )DbEventTypeGet( ( WPARAM )dbei->szModule, ( LPARAM )dbei->eventType );
+ DBEVENTTYPEDESCR* et = ( DBEVENTTYPEDESCR* )DbEventTypeGet(( WPARAM )dbei->szModule, ( LPARAM )dbei->eventType );
if ( et && ServiceExists( et->textService ))
return CallService( et->textService, wParam, lParam );
@@ -163,7 +163,7 @@ static INT_PTR DbEventGetIcon( WPARAM wParam, LPARAM lParam ) {
DBEVENTINFO* dbei = ( DBEVENTINFO* )lParam;
HICON icon = NULL;
- DBEVENTTYPEDESCR* et = ( DBEVENTTYPEDESCR* )DbEventTypeGet( ( WPARAM )dbei->szModule, ( LPARAM )dbei->eventType );
+ DBEVENTTYPEDESCR* et = ( DBEVENTTYPEDESCR* )DbEventTypeGet(( WPARAM )dbei->szModule, ( LPARAM )dbei->eventType );
if ( et && ServiceExists( et->iconService )) {
icon = ( HICON )CallService( et->iconService, wParam, lParam );
diff --git a/src/modules/database/profilemanager.cpp b/src/modules/database/profilemanager.cpp index cf1521872d..3ee38c754c 100644 --- a/src/modules/database/profilemanager.cpp +++ b/src/modules/database/profilemanager.cpp @@ -89,7 +89,7 @@ static int findProfiles(TCHAR * szProfileDir, ENUMPROFILECALLBACK callback, LPAR do {
// find all subfolders except "." and ".."
- if ( (ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && _tcscmp(ffd.cFileName, _T(".")) && _tcscmp(ffd.cFileName, _T("..")) ) {
+ if ((ffd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) && _tcscmp(ffd.cFileName, _T(".")) && _tcscmp(ffd.cFileName, _T("..")) ) {
TCHAR buf[MAX_PATH], profile[MAX_PATH];
mir_sntprintf(buf, SIZEOF(buf), _T("%s\\%s\\%s.dat"), szProfileDir, ffd.cFileName, ffd.cFileName);
if (_taccess(buf, 0) == 0) {
diff --git a/src/modules/fonts/services.cpp b/src/modules/fonts/services.cpp index 0a00198d66..1ffed036c2 100644 --- a/src/modules/fonts/services.cpp +++ b/src/modules/fonts/services.cpp @@ -312,7 +312,7 @@ INT_PTR RegisterFont(WPARAM wParam, LPARAM) {
#if defined( _UNICODE )
TFontID temp;
- ConvertFontID( ( FontID* )wParam, &temp );
+ ConvertFontID(( FontID* )wParam, &temp );
return sttRegisterFontWorker( &temp );
#else
return sttRegisterFontWorker(( TFontID* )wParam );
@@ -486,7 +486,7 @@ INT_PTR RegisterEffect(WPARAM wParam, LPARAM lParam) {
#if defined( _UNICODE )
TEffectID temp;
- ConvertEffectID( ( EffectID* )wParam, &temp );
+ ConvertEffectID(( EffectID* )wParam, &temp );
return sttRegisterEffectWorker( &temp );
#else
return sttRegisterEffectWorker(( TEffectID* )wParam );
diff --git a/src/modules/icolib/skin2icons.cpp b/src/modules/icolib/skin2icons.cpp index 10e1ef58dc..0993e7ef10 100644 --- a/src/modules/icolib/skin2icons.cpp +++ b/src/modules/icolib/skin2icons.cpp @@ -42,7 +42,7 @@ struct IcoLibOptsData { CRITICAL_SECTION csIconList;
-#define SECTIONPARAM_MAKE(index, level, flags) MAKELONG( (index)&0xFFFF, MAKEWORD( level, flags ) )
+#define SECTIONPARAM_MAKE(index, level, flags) MAKELONG((index)&0xFFFF, MAKEWORD( level, flags ) )
#define SECTIONPARAM_INDEX(lparam) LOWORD( lparam )
#define SECTIONPARAM_LEVEL(lparam) LOBYTE( HIWORD(lparam) )
#define SECTIONPARAM_FLAGS(lparam) HIBYTE( HIWORD(lparam) )
diff --git a/src/modules/idle/idle.cpp b/src/modules/idle/idle.cpp index 96c71161da..dbd684b675 100644 --- a/src/modules/idle/idle.cpp +++ b/src/modules/idle/idle.cpp @@ -420,7 +420,7 @@ static INT_PTR CALLBACK IdleOptsDlgProc(HWND hwndDlg, UINT msg, WPARAM wParam, L case IDC_IDLE1STTIME:
{
int min;
- if ( (HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE ) return FALSE;
+ if ((HWND)lParam != GetFocus() || HIWORD(wParam) != EN_CHANGE ) return FALSE;
min=GetDlgItemInt(hwndDlg, IDC_IDLE1STTIME, NULL, FALSE);
if ( min == 0 && GetWindowTextLength(GetDlgItem(hwndDlg, IDC_IDLE1STTIME)) )
SendDlgItemMessage(hwndDlg, IDC_IDLESPIN, UDM_SETPOS, 0, MAKELONG((short) 1, 0));
diff --git a/src/modules/netlib/netlib.cpp b/src/modules/netlib/netlib.cpp index cb46c6d14d..d1c0579c37 100644 --- a/src/modules/netlib/netlib.cpp +++ b/src/modules/netlib/netlib.cpp @@ -420,7 +420,7 @@ INT_PTR NetlibHttpUrlEncode(WPARAM, LPARAM lParam) return (INT_PTR)(char*)NULL;
}
for (outputLen=0, pszIn=szInput;*pszIn;pszIn++) {
- if ( (48 <= *pszIn && *pszIn <= 57) ||//0-9
+ if ((48 <= *pszIn && *pszIn <= 57) ||//0-9
(65 <= *pszIn && *pszIn <= 90) ||//ABC...XYZ
(97 <= *pszIn && *pszIn <= 122) ||//abc...xyz
*pszIn == '-' || *pszIn == '_' || *pszIn == '.' || *pszIn == ' ') outputLen++;
@@ -432,7 +432,7 @@ INT_PTR NetlibHttpUrlEncode(WPARAM, LPARAM lParam) return (INT_PTR)(unsigned char*)NULL;
}
for (pszOut=szOutput, pszIn=szInput;*pszIn;pszIn++) {
- if ( (48 <= *pszIn && *pszIn <= 57) ||
+ if ((48 <= *pszIn && *pszIn <= 57) ||
(65 <= *pszIn && *pszIn <= 90) ||
(97 <= *pszIn && *pszIn <= 122) ||
*pszIn == '-' || *pszIn == '_' || *pszIn == '.') *pszOut++=*pszIn;
diff --git a/src/modules/netlib/netliblog.cpp b/src/modules/netlib/netliblog.cpp index 586d160baf..8991f6ff24 100644 --- a/src/modules/netlib/netliblog.cpp +++ b/src/modules/netlib/netliblog.cpp @@ -111,12 +111,12 @@ static INT_PTR CALLBACK LogOptionsDlgProc(HWND hwndDlg, UINT message, WPARAM wPa {
tvis.item.pszText=netlibUser[i]->user.ptszDescriptiveName;
tvis.item.lParam=i;
- tvis.item.state=INDEXTOSTATEIMAGEMASK( (netlibUser[i]->toLog) ? 2 : 1 );
+ tvis.item.state=INDEXTOSTATEIMAGEMASK((netlibUser[i]->toLog) ? 2 : 1 );
TreeView_InsertItem(hwndFilter, &tvis);
}
tvis.item.lParam=-1;
tvis.item.pszText=TranslateT("(Miranda Core Logging)");
- tvis.item.state=INDEXTOSTATEIMAGEMASK( (logOptions.toLog) ? 2 : 1 );
+ tvis.item.state=INDEXTOSTATEIMAGEMASK((logOptions.toLog) ? 2 : 1 );
TreeView_InsertItem(hwndFilter, &tvis);
}
return TRUE;
diff --git a/src/modules/options/options.cpp b/src/modules/options/options.cpp index c417b4b6e4..d168a6f2c7 100644 --- a/src/modules/options/options.cpp +++ b/src/modules/options/options.cpp @@ -437,7 +437,7 @@ static void CALLBACK FilterSearchTimerFunc( HWND hwnd, UINT, UINT_PTR, DWORD ) FindFilterStrings( TRUE, dat->currentPage == FilterPage, hFilterSearchWnd, &( dat->opd[FilterPage]) );
FilterPage++;
- FilterLoadProgress = FilterPage*100/( (dat->pageCount) ? dat->pageCount : FilterPage );
+ FilterLoadProgress = FilterPage*100/((dat->pageCount) ? dat->pageCount : FilterPage );
if ( FilterPage >= dat->pageCount )
{
KillTimer( hwnd, FilterTimerId );
@@ -1086,7 +1086,7 @@ static INT_PTR CALLBACK OptionsDlgProc(HWND hdlg, UINT message, WPARAM wParam, L switch(LOWORD(wParam)) {
case IDC_KEYWORD_FILTER:
//add a timer - when the timer elapses filter the option pages
- if ( (HIWORD(wParam) == CBN_SELCHANGE) || (HIWORD(wParam) == CBN_EDITCHANGE))
+ if ((HIWORD(wParam) == CBN_SELCHANGE) || (HIWORD(wParam) == CBN_EDITCHANGE))
if (!SetTimer(hdlg, FILTER_TIMEOUT_TIMER, 400, NULL))
MessageBeep(MB_ICONSTOP);
diff --git a/src/modules/plugins/newplugins.cpp b/src/modules/plugins/newplugins.cpp index 5dc90a2750..022120379a 100644 --- a/src/modules/plugins/newplugins.cpp +++ b/src/modules/plugins/newplugins.cpp @@ -649,7 +649,7 @@ char **GetServiceModePluginsList(void) p = p->nextclass;
}
if ( i ) {
- list = (char**)mir_calloc( (i + 1) * sizeof(char*) );
+ list = (char**)mir_calloc((i + 1) * sizeof(char*) );
p = pluginListSM;
i = 0;
while ( p != NULL ) {
diff --git a/src/modules/protocols/protocols.cpp b/src/modules/protocols/protocols.cpp index 1da7f0b4dd..80eefddc7c 100644 --- a/src/modules/protocols/protocols.cpp +++ b/src/modules/protocols/protocols.cpp @@ -248,7 +248,7 @@ static INT_PTR Proto_RecvMessage(WPARAM, LPARAM lParam) if ( pre->flags & PREF_UTF )
dbei.flags |= DBEF_UTF;
if ( pre->flags & PREF_UNICODE )
- dbei.cbBlob += sizeof( wchar_t )*( (DWORD)wcslen(( wchar_t* )&pre->szMessage[dbei.cbBlob+1] )+1 );
+ dbei.cbBlob += sizeof( wchar_t )*((DWORD)wcslen(( wchar_t* )&pre->szMessage[dbei.cbBlob+1] )+1 );
dbei.pBlob = ( PBYTE ) pre->szMessage;
return CallService( MS_DB_EVENT_ADD, ( WPARAM ) ccs->hContact, ( LPARAM )&dbei );
@@ -436,7 +436,7 @@ INT_PTR CallProtoServiceInt( HANDLE hContact, const char *szModule, const char * return ( INT_PTR )ppi->AddToList( wParam, (PROTOSEARCHRESULT*)lParam );
#endif
case 2: return ( INT_PTR )ppi->AddToListByEvent( LOWORD(wParam), HIWORD(wParam), (HANDLE)lParam );
- case 3: return ( INT_PTR )ppi->Authorize( ( HANDLE )wParam );
+ case 3: return ( INT_PTR )ppi->Authorize(( HANDLE )wParam );
case 4:
if ( ppi->m_iVersion > 1 )
return ( INT_PTR )ppi->AuthDeny(( HANDLE )wParam, StrConvT(( char* )lParam ));
@@ -496,8 +496,8 @@ INT_PTR CallProtoServiceInt( HANDLE hContact, const char *szModule, const char * else
return ( INT_PTR )ppi->SearchByName( psbn->pszNick, psbn->pszFirstName, psbn->pszLastName );
}
- case 18: return ( INT_PTR )ppi->SearchAdvanced( ( HWND )lParam );
- case 19: return ( INT_PTR )ppi->CreateExtendedSearchUI ( ( HWND )lParam );
+ case 18: return ( INT_PTR )ppi->SearchAdvanced(( HWND )lParam );
+ case 19: return ( INT_PTR )ppi->CreateExtendedSearchUI (( HWND )lParam );
case 20: return ( INT_PTR )ppi->RecvContacts( hContact, ( PROTORECVEVENT* )lParam );
case 21: return ( INT_PTR )ppi->RecvFile( hContact, ( PROTOFILEEVENT* )lParam );
case 22: return ( INT_PTR )ppi->RecvMsg( hContact, ( PROTORECVEVENT* )lParam );
@@ -527,7 +527,7 @@ INT_PTR CallProtoServiceInt( HANDLE hContact, const char *szModule, const char * return ( INT_PTR )ppi->SetAwayMsg( wParam, StrConvT(( char* )lParam ));
else
return ( INT_PTR )ppi->SetAwayMsg( wParam, ( TCHAR* )lParam );
- case 34: return ( INT_PTR )ppi->UserIsTyping( ( HANDLE )wParam, lParam );
+ case 34: return ( INT_PTR )ppi->UserIsTyping(( HANDLE )wParam, lParam );
case 35: lstrcpynA(( char* )lParam, ppi->m_szModuleName, wParam ); return 0;
case 36: return ppi->m_iStatus;
diff --git a/src/modules/skin/skinicons.cpp b/src/modules/skin/skinicons.cpp index 8dd3d47a68..11b8ff3a4b 100644 --- a/src/modules/skin/skinicons.cpp +++ b/src/modules/skin/skinicons.cpp @@ -396,12 +396,12 @@ static INT_PTR sttLoadSkinIcon( WPARAM wParam, LPARAM lParam ) static INT_PTR sttLoadSkinProtoIcon( WPARAM wParam, LPARAM lParam )
{
- return (INT_PTR)LoadSkinProtoIcon( (char*)wParam, (int)lParam, false );
+ return (INT_PTR)LoadSkinProtoIcon((char*)wParam, (int)lParam, false );
}
static INT_PTR sttLoadSkinProtoIconBig( WPARAM wParam, LPARAM lParam )
{
- return (INT_PTR)LoadSkinProtoIcon( (char*)wParam, (int)lParam, true );
+ return (INT_PTR)LoadSkinProtoIcon((char*)wParam, (int)lParam, true );
}
int LoadSkinIcons(void)
diff --git a/src/modules/xml/xmlApi.cpp b/src/modules/xml/xmlApi.cpp index 16cb936090..c574da4f6d 100644 --- a/src/modules/xml/xmlApi.cpp +++ b/src/modules/xml/xmlApi.cpp @@ -240,7 +240,7 @@ static int xmlapiGetElement( HXML _n, XML_ELEMENT_POS pos, XML_ELEMENT_TYPE *typ if ( !type || pos >= XMLNode(_n).nElement())
return false;
- XMLNodeContents c( XMLNode(_n).enumContents( ( XMLElementPosition )pos ));
+ XMLNodeContents c( XMLNode(_n).enumContents(( XMLElementPosition )pos ));
switch ( c.etype ) {
case eNodeChild:
{
|