diff options
Diffstat (limited to 'plugins/UserInfoEx/src/Flags')
-rw-r--r-- | plugins/UserInfoEx/src/Flags/svc_flags.cpp | 44 | ||||
-rw-r--r-- | plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp | 52 |
2 files changed, 48 insertions, 48 deletions
diff --git a/plugins/UserInfoEx/src/Flags/svc_flags.cpp b/plugins/UserInfoEx/src/Flags/svc_flags.cpp index 19375c7fb7..55c56e2bdc 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flags.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flags.cpp @@ -89,9 +89,9 @@ static void CALLBACK BufferedProcTimer(HWND hwnd, UINT msg, UINT idTimer, DWORD MoveMemory(&callList[i],&callList[i+1],((nCallListCount-i-1)*sizeof(struct BufferedCallData)));
--nCallListCount;
--i; /* reiterate current */
- if(nCallListCount) {
+ if (nCallListCount) {
buf=(struct BufferedCallData*)mir_realloc(callList,nCallListCount*sizeof(struct BufferedCallData));
- if(buf!=NULL) callList=buf;
+ if (buf!=NULL) callList=buf;
} else {
mir_free(callList);
callList=NULL;
@@ -108,7 +108,7 @@ static void CALLBACK BufferedProcTimer(HWND hwnd, UINT msg, UINT idTimer, DWORD }
/* set next timer */
- if(nCallListCount) {
+ if (nCallListCount) {
#ifdef _DEBUG
mir_snprintf(szDbgLine,sizeof(szDbgLine),"next buffered timeout: %ums\n",uElapseNext); /* all ascii */
OutputDebugStringA(szDbgLine);
@@ -135,16 +135,16 @@ void _CallFunctionBuffered(BUFFEREDPROC pfnBuffProc,LPARAM lParam,BOOL fAccumula /* find existing */
for(i=0;i<nCallListCount;++i)
- if(callList[i].pfnBuffProc==pfnBuffProc)
+ if (callList[i].pfnBuffProc==pfnBuffProc)
if (!fAccumulateSameParam || callList[i].lParam==lParam) {
data=&callList[i];
break;
}
/* append new */
- if(data==NULL) {
+ if (data==NULL) {
/* resize storage array */
data=(struct BufferedCallData*)mir_realloc(callList,(nCallListCount+1)*sizeof(struct BufferedCallData));
- if(data==NULL) return;
+ if (data==NULL) return;
callList=data;
data=&callList[nCallListCount];
++nCallListCount;
@@ -166,7 +166,7 @@ void _CallFunctionBuffered(BUFFEREDPROC pfnBuffProc,LPARAM lParam,BOOL fAccumula }
#endif
/* set next timer */
- if(idBufferedTimer) uElapse=USER_TIMER_MINIMUM; /* will get recalculated */
+ if (idBufferedTimer) uElapse=USER_TIMER_MINIMUM; /* will get recalculated */
idBufferedTimer=SetTimer(NULL,idBufferedTimer,uElapse,(TIMERPROC)BufferedProcTimer);
}
@@ -181,7 +181,7 @@ void PrepareBufferedFunctions() // assumes to be called in context of main thread
void KillBufferedFunctions()
{
- if(idBufferedTimer) KillTimer(NULL,idBufferedTimer);
+ if (idBufferedTimer) KillTimer(NULL,idBufferedTimer);
nCallListCount=0;
mir_free(callList); /* does NULL check */
}
@@ -207,7 +207,7 @@ static INT_PTR ServiceDetectContactOriginCountry(WPARAM wParam,LPARAM lParam) else if (countryNumber = (int)DB::Setting::GetWord((HANDLE)wParam,pszProto,"CompanyCountry",0))
return (INT_PTR)countryNumber;
/* fallback ip detect
- else if(countryNumber==0xFFFF && db_get_b(NULL,"Flags","UseIpToCountry",SETTING_USEIPTOCOUNTRY_DEFAULT)) {
+ else if (countryNumber==0xFFFF && db_get_b(NULL,"Flags","UseIpToCountry",SETTING_USEIPTOCOUNTRY_DEFAULT)) {
countryNumber=ServiceIpToCountry(db_get_dw((HANDLE)wParam,pszProto,"RealIP",0),0);
}*/
@@ -275,10 +275,10 @@ static int OnExtraIconSvcChanged(WPARAM wParam,LPARAM lParam) bEnable = -1;
break;
}
- if(bEnable == -1)
+ if (bEnable == -1)
return 0;
- if(bEnable && !hApplyIconHook)
+ if (bEnable && !hApplyIconHook)
hApplyIconHook = HookEvent(ME_CLIST_EXTRA_IMAGE_APPLY, OnCListApplyIcons);
else if (!bEnable && hApplyIconHook)
UnhookEvent(hApplyIconHook); hApplyIconHook = NULL;
@@ -350,7 +350,7 @@ void MsgWndData::FlagsIconSet() sid.szModule = MODNAMEFLAGS;
sid.hIconDisabled = sid.hIcon = LoadFlagIcon(m_countryID);
sid.szTooltip = Translate((char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER,m_countryID,0));
- CallService(MS_MSG_MODIFYICON, (WPARAM)m_hContact, (LPARAM)&sid);
+ Srmm_ModifyIcon(m_hContact, &sid);
}
}
@@ -359,7 +359,7 @@ void MsgWndData::FlagsIconUnset() StatusIconData sid = { sizeof(sid) };
sid.szModule = MODNAMEFLAGS;
sid.flags = MBF_HIDDEN;
- CallService(MS_MSG_MODIFYICON,(WPARAM)m_hContact,(LPARAM)&sid);
+ Srmm_ModifyIcon(m_hContact, &sid);
}
static int CompareMsgWndData(const MsgWndData* p1, const MsgWndData* p2)
@@ -413,7 +413,7 @@ static __inline int MessageAPI_AddIcon(const char* pszName, const char* szModul/ IconList* p = new IconList(&sid);
if (!p->m_ID)delete p;
else res = gIListMW.insert(p);
- if(res == -1)delete p;
+ if (res == -1)delete p;
return res;
}
@@ -433,14 +433,14 @@ void CALLBACK UpdateStatusIcons(LPARAM lParam) { static int OnMsgWndEvent(WPARAM wParam,LPARAM lParam) {
MessageWindowEventData *msgwe=(MessageWindowEventData*)lParam;
/* sanity check */
- if(msgwe->hContact==NULL)
+ if (msgwe->hContact==NULL)
return 0;
switch(msgwe->uType) {
case MSG_WINDOW_EVT_OPENING:
{
MsgWndData* msgwnd = gMsgWndList.find((MsgWndData*)&msgwe->hContact);
- if(msgwnd == NULL) {
+ if (msgwnd == NULL) {
msgwnd = new MsgWndData(msgwe->hwndWindow, msgwe->hContact);
gMsgWndList.insert(msgwnd);
}
@@ -461,8 +461,9 @@ static int OnMsgWndEvent(WPARAM wParam,LPARAM lParam) { }
//hookProc ME_SKIN2_ICONSCHANGED
-static int OnStatusIconsChanged(WPARAM wParam,LPARAM lParam) {
- if(myGlobals.MsgAddIconExist && gFlagsOpts.bShowStatusIconFlag)
+static int OnStatusIconsChanged(WPARAM wParam,LPARAM lParam)
+{
+ if (gFlagsOpts.bShowStatusIconFlag)
CallFunctionBuffered(UpdateStatusIcons,0,FALSE,STATUSICON_REFRESHDELAY);
return 0;
}
@@ -499,7 +500,7 @@ static int OnContactSettingChanged(WPARAM wParam,LPARAM lParam) { /* Extra Image */
CallFunctionBuffered(SetExtraImage,(LPARAM)wParam,TRUE,EXTRAIMAGE_REFRESHDELAY);
/* Status Icon */
- if(hMsgWndEventHook) {
+ if (hMsgWndEventHook) {
int i = gMsgWndList.getIndex((MsgWndData*)&wParam);
if (i != -1) {
gMsgWndList[i]->ContryIDchange((int)ServiceDetectContactOriginCountry(wParam,0));
@@ -525,7 +526,7 @@ static int OnContactSettingChanged(WPARAM wParam,LPARAM lParam) { void SvcFlagsLoadModule()
{
PrepareBufferedFunctions();
- if(CallService(MS_UTILS_GETCOUNTRYLIST,(WPARAM)&nCountriesCount,(LPARAM)&countries))
+ if (CallService(MS_UTILS_GETCOUNTRYLIST,(WPARAM)&nCountriesCount,(LPARAM)&countries))
nCountriesCount=0;
InitIcons(); /* load in iconlib */
//InitIpToCountry(); /* not implementet */
@@ -551,8 +552,7 @@ void SvcFlagsOnModulesLoaded() SvcFlagsEnableExtraIcons(DB::Setting::GetByte(SET_CLIST_EXTRAICON_FLAGS2, 0), FALSE);
/* Status Icon */
- if(myGlobals.MsgAddIconExist)
- hMsgWndEventHook = HookEvent(ME_MSG_WINDOWEVENT, OnMsgWndEvent);
+ hMsgWndEventHook = HookEvent(ME_MSG_WINDOWEVENT, OnMsgWndEvent);
}
/**
diff --git a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp index 2dd4b1ce73..7bc1e5a0ba 100644 --- a/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp +++ b/plugins/UserInfoEx/src/Flags/svc_flagsicons.cpp @@ -106,17 +106,17 @@ static int CountryNumberToBitmapIndex(int countryNumber) int i,high/*,low=0*/;
high=SIZEOF(BitmapIndexMap);
/*old code need sortet BitmapIndexMap*/
- /*if(countryNumber<=BitmapIndexMap[high])
+ /*if (countryNumber<=BitmapIndexMap[high])
while(low<=high) {
i=low+((high-low)/2);
// never happens
- if(i<0 || i>=SIZEOF(BitmapIndexMap)) DebugBreak();
- if(BitmapIndexMap[i]==countryNumber) return i;
- if(countryNumber>BitmapIndexMap[i]) low=i+1;
+ if (i<0 || i>=SIZEOF(BitmapIndexMap)) DebugBreak();
+ if (BitmapIndexMap[i]==countryNumber) return i;
+ if (countryNumber>BitmapIndexMap[i]) low=i+1;
else high=i-1;
}*/
for ( i=0; i < high; i++ ) {
- if(BitmapIndexMap[i]==countryNumber) return i;
+ if (BitmapIndexMap[i]==countryNumber) return i;
}
}
/* Other,Unknown,Unspecified */
@@ -149,8 +149,8 @@ int CountryNumberToIndex(int countryNumber) {
int nf=0;
for(int i=0; i < nCountriesCount; i++) {
- if(countries[i].id == countryNumber) return i;
- if(countries[i].id == 0xFFFF) nf=i;
+ if (countries[i].id == countryNumber) return i;
+ if (countries[i].id == 0xFFFF) nf=i;
}
return nf; /* Unknown */
}
@@ -161,12 +161,12 @@ FIBITMAP* ConvertTo(FIBITMAP* dib, UINT destBits, bool greyscale) switch (destBits) {
case 8:
// convert to 8Bits
- if(greyscale) {
+ if (greyscale) {
dib_res = FIP->FI_ConvertTo8Bits(dib);
}
else {
FIBITMAP* dib_tmp = FIP->FI_ConvertTo24Bits(dib);
- if(dib_tmp) {
+ if (dib_tmp) {
dib_res = FIP->FI_ColorQuantize(dib_tmp, FIQ_WUQUANT/*FIQ_NNQUANT*/);
FIP->FI_Unload(dib_tmp);
}
@@ -193,7 +193,7 @@ FIBITMAP* ConvertTo(FIBITMAP* dib, UINT destBits, bool greyscale) FIBITMAP* LoadResource(UINT ID, LPTSTR lpType)
{
FIBITMAP *dib = NULL;
- if(lpType) {
+ if (lpType) {
HRSRC hResInfo = FindResource(ghInst,MAKEINTRESOURCE(ID),lpType);
DWORD ResSize = SizeofResource(ghInst,hResInfo);
HGLOBAL hRes = LoadResource(ghInst,hResInfo);
@@ -215,7 +215,7 @@ FIBITMAP* LoadResource(UINT ID, LPTSTR lpType) }
else {
HBITMAP hScrBM = 0;
- if(NULL == (hScrBM = (HBITMAP)LoadImage(ghInst,MAKEINTRESOURCE(ID), IMAGE_BITMAP, 0, 0,LR_SHARED)))
+ if (NULL == (hScrBM = (HBITMAP)LoadImage(ghInst,MAKEINTRESOURCE(ID), IMAGE_BITMAP, 0, 0,LR_SHARED)))
return dib;
dib = FIP->FI_CreateDIBFromHBITMAP(hScrBM);
DeleteObject(hScrBM);
@@ -229,7 +229,7 @@ static INT_PTR ServiceLoadFlagIcon(WPARAM wParam,LPARAM lParam) {
/* return handle */
if ((BOOL)lParam) {
- if(phIconHandles==NULL) return NULL;
+ if (phIconHandles==NULL) return NULL;
return (INT_PTR)phIconHandles[CountryNumberToIndex((int)wParam)];
}
/* return icon */
@@ -248,24 +248,24 @@ static INT_PTR ServiceCreateMergedFlagIcon(WPARAM wParam,LPARAM lParam) HRGN hrgn;
HBITMAP hbmPrev;
/* load both icons */
- if(NULL == (hLowerIcon=(HICON)ServiceLoadFlagIcon((WPARAM)lParam,0))) return NULL;
+ if (NULL == (hLowerIcon=(HICON)ServiceLoadFlagIcon((WPARAM)lParam,0))) return NULL;
hUpperIcon=(HICON)ServiceLoadFlagIcon(wParam,0);
/* merge them */
- if(GetIconInfo(hLowerIcon,&icoi)) {
- if(hUpperIcon!=NULL && GetObject(icoi.hbmColor,sizeof(bm),&bm)) {
+ if (GetIconInfo(hLowerIcon,&icoi)) {
+ if (hUpperIcon!=NULL && GetObject(icoi.hbmColor,sizeof(bm),&bm)) {
hdc=CreateCompatibleDC(NULL);
- if(hdc!=NULL) {
+ if (hdc!=NULL) {
ZeroMemory(&aptTriangle,sizeof(aptTriangle));
aptTriangle[1].y=bm.bmHeight-1;
aptTriangle[2].x=bm.bmWidth-1;
hrgn=CreatePolygonRgn(aptTriangle,SIZEOF(aptTriangle),WINDING);
- if(hrgn!=NULL) {
+ if (hrgn!=NULL) {
SelectClipRgn(hdc,hrgn);
DeleteObject(hrgn);
hbmPrev=(HBITMAP)SelectObject(hdc,icoi.hbmColor);
- if(hbmPrev!=NULL) { /* error on select? */
- if(DrawIconEx(hdc,0,0,hUpperIcon,bm.bmWidth,bm.bmHeight,0,NULL,DI_NOMIRROR|DI_IMAGE)) {
- if(SelectObject(hdc,icoi.hbmMask)!=NULL) /* error on select? */
+ if (hbmPrev!=NULL) { /* error on select? */
+ if (DrawIconEx(hdc,0,0,hUpperIcon,bm.bmWidth,bm.bmHeight,0,NULL,DI_NOMIRROR|DI_IMAGE)) {
+ if (SelectObject(hdc,icoi.hbmMask)!=NULL) /* error on select? */
DrawIconEx(hdc,0,0,hUpperIcon,bm.bmWidth,bm.bmHeight,0,NULL,DI_NOMIRROR|DI_MASK);
}
SelectObject(hdc,hbmPrev);
@@ -299,7 +299,7 @@ void InitIcons() // FREE_IMAGE_FORMAT fif = FIP->FI_GetFIFFromFilename("dummy.bmp");
/* all those flag icons storing in a large 24bit opaque bitmap to reduce file size */
- if(NULL == (dib = LoadResource(IDB_FLAGSPNG,_T("PNG"))))
+ if (NULL == (dib = LoadResource(IDB_FLAGSPNG,_T("PNG"))))
return;
if (IsWinVerXPPlus()) bitDest = bit = ILC_COLOR32;
@@ -321,7 +321,7 @@ void InitIcons() }
// res = FIP->FI_IsTransparent(dib_ico);
- if(bit<32) {
+ if (bit<32) {
//disable transparency
FIP->FI_SetTransparent(dib, FALSE);
FIP->FI_SetTransparent(dib_ico, FALSE);
@@ -333,7 +333,7 @@ void InitIcons() UINT b = t + FIP->FI_GetHeight(dib);
//copy dib to new dib_ico (centered)
- if(FIP->FI_Paste(dib_ico, dib, 0, t-1, 255+1)) {
+ if (FIP->FI_Paste(dib_ico, dib, 0, t-1, 255+1)) {
FIP->FI_Unload(dib); dib = NULL;
switch (bitDest) {
case 8:
@@ -342,7 +342,7 @@ void InitIcons() {//transparency by 1bit monocrome icon mask (for bit < 32)
BYTE value;
FIBITMAP *dib_mask;
- if(NULL == (dib_mask = FIP->FI_Allocate(w, h, 1, 0, 0, 0))) {
+ if (NULL == (dib_mask = FIP->FI_Allocate(w, h, 1, 0, 0, 0))) {
FIP->FI_Unload(dib_ico);
return;
}
@@ -357,7 +357,7 @@ void InitIcons() //convert to target resolution
if (!hbmMask || !(dib_ico = ConvertTo(dib_ico, bitDest, 0))) {
FIP->FI_Unload(dib_ico);
- if(hbmMask) DeleteObject(hbmMask);
+ if (hbmMask) DeleteObject(hbmMask);
return;
}
} break;
@@ -421,7 +421,7 @@ void InitIcons() index = CountryNumberToIndex(countries[i].id);
phIconHandles[index] = Skin_AddIcon(&sid);
- if(sid.hDefaultIcon!=NULL) DestroyIcon(sid.hDefaultIcon);
+ if (sid.hDefaultIcon!=NULL) DestroyIcon(sid.hDefaultIcon);
mir_free(sid.ptszDescription); sid.ptszDescription = NULL;
}
}
|