summaryrefslogtreecommitdiff
path: root/src/modules/clist
diff options
context:
space:
mode:
authorVadim Dashevskiy <watcherhd@gmail.com>2012-06-15 14:13:45 +0000
committerVadim Dashevskiy <watcherhd@gmail.com>2012-06-15 14:13:45 +0000
commit4aa6229698b946e52ce19018aaf13f8b92fb168e (patch)
tree29334e8c5ee492a80f11a97fedab2373b8fbb392 /src/modules/clist
parent5e8e561a80d1ac9ca1c2f1c3d388105733ed4e4e (diff)
another portion of "#ifsef Unicode" removal
git-svn-id: http://svn.miranda-ng.org/main/trunk@426 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'src/modules/clist')
-rw-r--r--src/modules/clist/clcmsgs.cpp16
-rw-r--r--src/modules/clist/clistevents.cpp12
-rw-r--r--src/modules/clist/clistmenus.cpp26
-rw-r--r--src/modules/clist/clistmod.cpp19
-rw-r--r--src/modules/clist/clistsettings.cpp45
-rw-r--r--src/modules/clist/clisttray.cpp9
-rw-r--r--src/modules/clist/genmenu.cpp15
-rw-r--r--src/modules/clist/groups.cpp12
8 files changed, 49 insertions, 105 deletions
diff --git a/src/modules/clist/clcmsgs.cpp b/src/modules/clist/clcmsgs.cpp
index 116beb3486..6757f7ae41 100644
--- a/src/modules/clist/clcmsgs.cpp
+++ b/src/modules/clist/clcmsgs.cpp
@@ -61,16 +61,12 @@ LRESULT fnProcessExternalMessages(HWND hwnd, struct ClcData *dat, UINT msg, WPAR
return (LRESULT) (HANDLE) NULL;
group = groupContact->group;
}
- #if defined( _UNICODE )
- if ( msg == CLM_ADDINFOITEMA )
- { WCHAR* wszText = mir_a2u(( char* )cii->pszText );
- i = cli.pfnAddInfoItemToGroup(group, cii->flags, wszText);
- mir_free( wszText );
- }
- else i = cli.pfnAddInfoItemToGroup(group, cii->flags, cii->pszText);
- #else
- i = cli.pfnAddInfoItemToGroup(group, cii->flags, cii->pszText);
- #endif
+ if ( msg == CLM_ADDINFOITEMA )
+ { WCHAR* wszText = mir_a2u(( char* )cii->pszText );
+ i = cli.pfnAddInfoItemToGroup(group, cii->flags, wszText);
+ mir_free( wszText );
+ }
+ else i = cli.pfnAddInfoItemToGroup(group, cii->flags, cii->pszText);
cli.pfnRecalcScrollBar(hwnd, dat);
return (LRESULT) group->cl.items[i]->hContact | HCONTACT_ISINFO;
}
diff --git a/src/modules/clist/clistevents.cpp b/src/modules/clist/clistevents.cpp
index 9ccaa40c09..4a82c21ea8 100644
--- a/src/modules/clist/clistevents.cpp
+++ b/src/modules/clist/clistevents.cpp
@@ -171,14 +171,10 @@ struct CListEvent* fnAddEvent( CLISTEVENT *cle )
p->imlIconIndex = fnGetImlIconIndex(cli.events.items[i]->cle.hIcon);
p->flashesDone = 12;
p->cle.pszService = mir_strdup(cli.events.items[i]->cle.pszService);
- #if defined( _UNICODE )
- if (p->cle.flags & CLEF_UNICODE)
- p->cle.ptszTooltip = mir_tstrdup((TCHAR*)p->cle.ptszTooltip);
- else
- p->cle.ptszTooltip = mir_a2u((char*)p->cle.pszTooltip); //if no flag defined it handled as unicode
- #else
- p->cle.ptszTooltip = mir_tstrdup(p->cle.ptszTooltip);
- #endif
+ if (p->cle.flags & CLEF_UNICODE)
+ p->cle.ptszTooltip = mir_tstrdup((TCHAR*)p->cle.ptszTooltip);
+ else
+ p->cle.ptszTooltip = mir_a2u((char*)p->cle.pszTooltip); //if no flag defined it handled as unicode
if (cli.events.count == 1) {
char *szProto;
if (cle->hContact == NULL)
diff --git a/src/modules/clist/clistmenus.cpp b/src/modules/clist/clistmenus.cpp
index 12b8d75761..e26ca5f13f 100644
--- a/src/modules/clist/clistmenus.cpp
+++ b/src/modules/clist/clistmenus.cpp
@@ -524,13 +524,9 @@ INT_PTR StatusMenuCheckService(WPARAM wParam, LPARAM)
prot = smep->proto;
else
{
- #ifdef UNICODE
- char *prn=mir_u2a(timi->mi.ptszName);
- prot = NEWSTR_ALLOCA( prn );
- if (prn) mir_free(prn);
- #else
- prot = timi->mi.ptszName;
- #endif
+ char *prn=mir_u2a(timi->mi.ptszName);
+ prot = NEWSTR_ALLOCA( prn );
+ if (prn) mir_free(prn);
}
if ( Proto_GetAccount( prot ) == NULL )
return TRUE;
@@ -1192,13 +1188,9 @@ static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam)
MenuProto* mp = FindProtocolMenu( mi->pszContactOwner );
if ( mp && mi->pszPopupName ) {
if ( mp->pMenu ) {
- #if defined _UNICODE
- TCHAR* ptszName = ( mi->flags & CMIF_UNICODE ) ? mir_tstrdup(mi->ptszPopupName) : mir_a2t(mi->pszPopupName);
- pRoot = MO_RecursiveWalkMenu( mp->pMenu->submenu.first, FindRoot, ptszName );
- mir_free( ptszName );
- #else
- pRoot = MO_RecursiveWalkMenu( mp->pMenu->submenu.first, FindRoot, mi->pszPopupName );
- #endif
+ TCHAR* ptszName = ( mi->flags & CMIF_UNICODE ) ? mir_tstrdup(mi->ptszPopupName) : mir_a2t(mi->pszPopupName);
+ pRoot = MO_RecursiveWalkMenu( mp->pMenu->submenu.first, FindRoot, ptszName );
+ mir_free( ptszName );
}
if ( pRoot == NULL ) {
TMO_MenuItem tmi = { 0 };
@@ -1241,15 +1233,13 @@ static INT_PTR AddStatusMenuItem(WPARAM wParam, LPARAM lParam)
smep->hMenuItem = menuHandle;
char buf[MAX_PATH+64];
- #if defined( _UNICODE )
+
{
char* p = ( pRoot ) ? mir_t2a( pRoot->mi.ptszName ) : NULL;
mir_snprintf( buf, SIZEOF(buf), "%s/%s", ( p ) ? p : "", mi->pszService ? mi->pszService : "" );
mir_free( p );
}
- #else
- mir_snprintf( buf, SIZEOF(buf), "%s/%s", pRoot ? pRoot->mi.ptszName : _T(""), mi->pszService ? mi->pszService : "" );
- #endif
+
MO_SetOptionsMenuItem( menuHandle, OPT_MENUITEMSETUNIQNAME, ( INT_PTR )buf );
return ( INT_PTR )menuHandle;
diff --git a/src/modules/clist/clistmod.cpp b/src/modules/clist/clistmod.cpp
index ff667bcb38..4c8df451d0 100644
--- a/src/modules/clist/clistmod.cpp
+++ b/src/modules/clist/clistmod.cpp
@@ -123,16 +123,15 @@ static INT_PTR GetStatusModeDescription(WPARAM wParam, LPARAM lParam)
{
TCHAR* buf1 = cli.pfnGetStatusModeDescription( wParam, lParam );
- #ifdef UNICODE
- if ( !( lParam & GSMDF_TCHAR ))
- {
- static char szMode[64];
- char *buf2 = mir_u2a(buf1);
- mir_snprintf(szMode, SIZEOF(szMode), "%s", buf2);
- mir_free(buf2);
- return (INT_PTR)szMode;
- }
- #endif
+ if ( !( lParam & GSMDF_TCHAR ))
+ {
+ static char szMode[64];
+ char *buf2 = mir_u2a(buf1);
+ mir_snprintf(szMode, SIZEOF(szMode), "%s", buf2);
+ mir_free(buf2);
+ return (INT_PTR)szMode;
+ }
+
return (INT_PTR)buf1;
}
diff --git a/src/modules/clist/clistsettings.cpp b/src/modules/clist/clistsettings.cpp
index f8a0501358..07684d5c0a 100644
--- a/src/modules/clist/clistsettings.cpp
+++ b/src/modules/clist/clistsettings.cpp
@@ -80,9 +80,7 @@ void fnCheckCacheItem( ClcCacheEntryBase* p )
void fnFreeCacheItem( ClcCacheEntryBase* p )
{
if ( p->name ) { mir_free( p->name ); p->name = NULL; }
- #if defined( _UNICODE )
- if ( p->szName ) { mir_free( p->szName); p->szName = NULL; }
- #endif
+ if ( p->szName ) { mir_free( p->szName); p->szName = NULL; }
if ( p->group ) { mir_free( p->group ); p->group = NULL; }
p->isHidden = -1;
}
@@ -141,9 +139,7 @@ TCHAR* fnGetContactDisplayName( HANDLE hContact, int mode )
return ci.pszVal;
cacheEntry->name = ci.pszVal;
- #if defined( _UNICODE )
- cacheEntry->szName = mir_u2a( ci.pszVal );
- #endif
+ cacheEntry->szName = mir_u2a( ci.pszVal );
return ci.pszVal;
}
@@ -157,9 +153,7 @@ TCHAR* fnGetContactDisplayName( HANDLE hContact, int mode )
buffer = (TCHAR*) mir_alloc(15 * sizeof( TCHAR ));
_ltot(ci.dVal, buffer, 10 );
cacheEntry->name = buffer;
- #if defined( _UNICODE )
- cacheEntry->szName = mir_u2a( buffer );
- #endif
+ cacheEntry->szName = mir_u2a( buffer );
return buffer;
} } }
@@ -180,13 +174,8 @@ INT_PTR GetContactDisplayName(WPARAM wParam, LPARAM lParam)
if ((int) lParam != GCDNF_NOMYHANDLE) {
cacheEntry = cli.pfnGetCacheEntry(hContact);
- #if defined( _UNICODE )
- if ( cacheEntry->szName )
- return (INT_PTR)cacheEntry->szName;
- #else
- if ( cacheEntry->name )
- return (INT_PTR)cacheEntry->name;
- #endif
+ if ( cacheEntry->szName )
+ return (INT_PTR)cacheEntry->szName;
}
ZeroMemory(&ci, sizeof(ci));
ci.cbSize = sizeof(ci);
@@ -197,22 +186,14 @@ INT_PTR GetContactDisplayName(WPARAM wParam, LPARAM lParam)
if (!CallService(MS_CONTACT_GETCONTACTINFO, 0, (LPARAM) & ci)) {
if (ci.type == CNFT_ASCIIZ) {
if (cacheEntry == NULL) {
- #if defined( _UNICODE )
- buffer = mir_u2a( ci.pszVal );
- mir_free(ci.pszVal);
- #else
- buffer = ci.pszVal;
- #endif
+ buffer = mir_u2a( ci.pszVal );
+ mir_free(ci.pszVal);
return (INT_PTR) buffer;
}
else {
cacheEntry->name = ci.pszVal;
- #if defined( _UNICODE )
- cacheEntry->szName = mir_u2a( ci.pszVal );
- return (INT_PTR)cacheEntry->szName;
- #else
- return (INT_PTR)cacheEntry->name;
- #endif
+ cacheEntry->szName = mir_u2a( ci.pszVal );
+ return (INT_PTR)cacheEntry->szName;
}
}
if (ci.type == CNFT_DWORD) {
@@ -224,12 +205,8 @@ INT_PTR GetContactDisplayName(WPARAM wParam, LPARAM lParam)
else {
buffer = ( char* )mir_alloc(15);
_ltoa(ci.dVal, buffer, 10 );
- #if defined( _UNICODE )
- cacheEntry->szName = buffer;
- cacheEntry->name = mir_a2u( buffer );
- #else
- cacheEntry->name = buffer;
- #endif
+ cacheEntry->szName = buffer;
+ cacheEntry->name = mir_a2u( buffer );
return (INT_PTR) buffer;
} } }
diff --git a/src/modules/clist/clisttray.cpp b/src/modules/clist/clisttray.cpp
index 519cf0f875..50707c5de7 100644
--- a/src/modules/clist/clisttray.cpp
+++ b/src/modules/clist/clisttray.cpp
@@ -692,16 +692,12 @@ static void CALLBACK TrayToolTipTimerProc(HWND hwnd, UINT, UINT_PTR id, DWORD)
ti.rcItem.bottom = pt.y + 10;
ti.cbSize = sizeof( ti );
ti.isTreeFocused = GetFocus() == cli.hwndContactList ? 1 : 0;
- #if defined( _UNICODE )
- if (CallService( "mToolTip/ShowTipW", (WPARAM)szTipCur, (LPARAM)&ti ) == CALLSERVICE_NOTFOUND)
+ if (CallService( "mToolTip/ShowTipW", (WPARAM)szTipCur, (LPARAM)&ti ) == CALLSERVICE_NOTFOUND)
{
char* p = mir_u2a( szTipCur );
CallService( "mToolTip/ShowTip", (WPARAM)p, (LPARAM)&ti );
mir_free( p );
}
- #else
- CallService( "mToolTip/ShowTip", (WPARAM)szTipCur, (LPARAM)&ti );
- #endif
GetCursorPos( &tray_hover_pos );
SetTimer( cli.hwndContactList, TIMERID_TRAYHOVER_2, 600, TrayHideToolTipTimerProc );
g_trayTooltipActive = TRUE;
@@ -884,7 +880,6 @@ int fnCListTrayNotify( MIRANDASYSTRAYNOTIFY* msn )
}
else iconId = cli.trayIcon[0].id;
-#if defined(_UNICODE)
if ( msn->dwInfoFlags & NIIF_INTERN_UNICODE ) {
NOTIFYICONDATAW nid = {0};
nid.cbSize = ( cli.shellVersion >= 5 ) ? sizeof(nid) : NOTIFYICONDATAW_V1_SIZE;
@@ -900,7 +895,7 @@ int fnCListTrayNotify( MIRANDASYSTRAYNOTIFY* msn )
return Shell_NotifyIconW( NIM_MODIFY, &nid ) == 0;
}
else
-#endif
+
{
NOTIFYICONDATAA nid = { 0 };
nid.cbSize = ( cli.shellVersion >= 5 ) ? sizeof(nid) : NOTIFYICONDATAA_V1_SIZE;
diff --git a/src/modules/clist/genmenu.cpp b/src/modules/clist/genmenu.cpp
index 9395bb1588..c6413ee556 100644
--- a/src/modules/clist/genmenu.cpp
+++ b/src/modules/clist/genmenu.cpp
@@ -1062,14 +1062,9 @@ static int MO_RegisterIcon( PMO_IntMenuItem pmi, void* )
char *uname, *descr;
uname = pmi->UniqName;
if ( uname == NULL )
- #ifdef UNICODE
- uname = mir_u2a(pmi->CustomName);
- descr = mir_u2a(pmi->mi.ptszName);
- #else
- uname = pmi->CustomName;
- descr = pmi->mi.pszName;
- #endif
-
+ uname = mir_u2a(pmi->CustomName);
+ descr = mir_u2a(pmi->mi.ptszName);
+
if ( !uname && !descr )
return FALSE;
@@ -1110,11 +1105,11 @@ static int MO_RegisterIcon( PMO_IntMenuItem pmi, void* )
IconLib_ReleaseIcon( hIcon, 0 );
} }
- #ifdef UNICODE
+
if ( !pmi->UniqName )
mir_free( uname );
mir_free( descr );
- #endif
+
return FALSE;
}
diff --git a/src/modules/clist/groups.cpp b/src/modules/clist/groups.cpp
index c958823ebb..75e18e0a4e 100644
--- a/src/modules/clist/groups.cpp
+++ b/src/modules/clist/groups.cpp
@@ -342,14 +342,10 @@ int fnRenameGroup( int groupID, TCHAR* newName )
static INT_PTR RenameGroup(WPARAM wParam, LPARAM lParam)
{
- #if defined( _UNICODE )
- WCHAR* temp = mir_a2u(( char* )lParam );
- int result = ( -1 != RenameGroupWithMove(wParam - 1, temp, 1));
- mir_free( temp );
- return result;
- #else
- return -1 != RenameGroupWithMove(wParam - 1, (TCHAR*) lParam, 1);
- #endif
+ WCHAR* temp = mir_a2u(( char* )lParam );
+ int result = ( -1 != RenameGroupWithMove(wParam - 1, temp, 1));
+ mir_free( temp );
+ return result;
}
static INT_PTR SetGroupExpandedState(WPARAM wParam, LPARAM lParam)