summaryrefslogtreecommitdiff
path: root/plugins/CountryFlags/src/extraimg.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2012-10-21 14:14:22 +0000
committerGeorge Hazan <george.hazan@gmail.com>2012-10-21 14:14:22 +0000
commit0999d9f9a1654c4fcbd1fc4f4fcf27080dd979e2 (patch)
tree5ab8420935b0ee704430e9659a857411148ff621 /plugins/CountryFlags/src/extraimg.cpp
parentd8eb1ed0d9f8a694629af5251840e9c6347c9eb3 (diff)
- a bit less crazy implementation of flags;
- fix for icons' names in icolib git-svn-id: http://svn.miranda-ng.org/main/trunk@2023 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/CountryFlags/src/extraimg.cpp')
-rw-r--r--plugins/CountryFlags/src/extraimg.cpp226
1 files changed, 105 insertions, 121 deletions
diff --git a/plugins/CountryFlags/src/extraimg.cpp b/plugins/CountryFlags/src/extraimg.cpp
index ccf26b517e..7a31ae8175 100644
--- a/plugins/CountryFlags/src/extraimg.cpp
+++ b/plugins/CountryFlags/src/extraimg.cpp
@@ -39,17 +39,16 @@ static INT_PTR ServiceDetectContactOriginCountry(WPARAM wParam,LPARAM lParam)
{
int countryNumber=0xFFFF;
char *pszProto;
- UNREFERENCED_PARAMETER(lParam);
pszProto=(char*)CallService(MS_PROTO_GETCONTACTBASEPROTO,wParam,0);
/* ip detect */
- if(DBGetContactSettingByte(NULL,"Flags","UseIpToCountry",SETTING_USEIPTOCOUNTRY_DEFAULT))
+ if ( db_get_b(NULL,"Flags","UseIpToCountry",SETTING_USEIPTOCOUNTRY_DEFAULT))
countryNumber=ServiceIpToCountry(DBGetContactSettingDword((HANDLE)wParam,pszProto,"RealIP",0),0);
/* fallback */
- if(countryNumber==0xFFFF)
+ if (countryNumber == 0xFFFF)
countryNumber=DBGetContactSettingWord((HANDLE)wParam,pszProto,"Country",0);
- if(countryNumber==0 || countryNumber==0xFFFF)
+ if (countryNumber == 0 || countryNumber == 0xFFFF)
countryNumber=DBGetContactSettingWord((HANDLE)wParam,pszProto,"CompanyCountry",0);
- return (countryNumber==0)?0xFFFF:countryNumber;
+ return (countryNumber == 0)?0xFFFF:countryNumber;
}
/************************* Extra Image ****************************/
@@ -61,103 +60,96 @@ static BYTE idExtraColumn;
static void CALLBACK SetExtraImage(LPARAM lParam)
{
+ if ( !db_get_b(NULL, "Flags", "ShowExtraImgFlag", SETTING_SHOWEXTRAIMGFLAG_DEFAULT))
+ return;
+
+ /* get contact's country */
IconExtraColumn iec;
- int countryNumber,index;
- if(DBGetContactSettingByte(NULL,"Flags","ShowExtraImgFlag",SETTING_SHOWEXTRAIMGFLAG_DEFAULT)) {
- /* get contact's country */
- iec.hImage=INVALID_HANDLE_VALUE;
- countryNumber=ServiceDetectContactOriginCountry((WPARAM)lParam,0);
- /* get icon */
- if(phExtraImages!=NULL) /* too early? */
- if(countryNumber!=0xFFFF || DBGetContactSettingByte(NULL,"Flags","UseUnknownFlag",SETTING_USEUNKNOWNFLAG_DEFAULT)) {
- index=CountryNumberToIndex(countryNumber);
- /* icon not yet loaded? */
- if(phExtraImages[index]==INVALID_HANDLE_VALUE) {
- HICON hIcon;
- hIcon=LoadFlagIcon(countryNumber);
- if(hIcon!=NULL) phExtraImages[index]=(HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON,(WPARAM)hIcon,0);
- CallService(MS_SKIN2_RELEASEICON,(WPARAM)hIcon,0); /* does NULL check */
- }
- iec.hImage=phExtraImages[index];
- }
- /* choose column */
- iec.cbSize=sizeof(iec);
- iec.ColumnType=idExtraColumn;
- CallService(MS_CLIST_EXTRA_SET_ICON,(WPARAM)lParam,(LPARAM)&iec);
+ iec.hImage = INVALID_HANDLE_VALUE;
+ int countryNumber = ServiceDetectContactOriginCountry((WPARAM)lParam,0);
+ /* get icon */
+ if (phExtraImages != NULL) /* too early? */
+ if (countryNumber != 0xFFFF || db_get_b(NULL,"Flags","UseUnknownFlag",SETTING_USEUNKNOWNFLAG_DEFAULT)) {
+ int index=CountryNumberToIndex(countryNumber);
+ /* icon not yet loaded? */
+ if (phExtraImages[index] == INVALID_HANDLE_VALUE) {
+ HICON hIcon = LoadFlagIcon(countryNumber);
+ if (hIcon != NULL)
+ phExtraImages[index]=(HANDLE)CallService(MS_CLIST_EXTRA_ADD_ICON,(WPARAM)hIcon,0);
+ CallService(MS_SKIN2_RELEASEICON,(WPARAM)hIcon,0); /* does NULL check */
+ }
+ iec.hImage=phExtraImages[index];
}
+ /* choose column */
+ iec.cbSize=sizeof(iec);
+ iec.ColumnType=idExtraColumn;
+ CallService(MS_CLIST_EXTRA_SET_ICON,(WPARAM)lParam,(LPARAM)&iec);
}
// always call in context of main thread
static void RemoveExtraImages(void)
{
- IconExtraColumn iec;
- register HANDLE hContact;
/* choose column */
- iec.cbSize=sizeof(iec);
- iec.ColumnType=idExtraColumn;
- iec.hImage=INVALID_HANDLE_VALUE;
+ IconExtraColumn iec;
+ iec.cbSize = sizeof(iec);
+ iec.ColumnType = idExtraColumn;
+ iec.hImage = INVALID_HANDLE_VALUE;
/* enum all contacts */
- hContact=db_find_first();
- while(hContact!=NULL) {
+ HANDLE hContact = db_find_first();
+ while (hContact != NULL) {
/* invalidate icon */
CallService(MS_CLIST_EXTRA_SET_ICON,(WPARAM)hContact,(LPARAM)&iec);
- hContact=db_find_next(hContact);
+ hContact = db_find_next(hContact);
}
}
// always call in context of main thread
static void EnsureExtraImages(void)
{
- register HANDLE hContact;
BYTE idMaxExtraCol,idExtraColumnNew;
/* choose column */
idMaxExtraCol=(BYTE)CallService(MS_CLUI_GETCAPS,0,CLUIF2_EXTRACOLUMNCOUNT); /* 1-based count */
- if(idMaxExtraCol==(BYTE)CallService(MS_CLUI_GETCAPS,0,CLUIF2_USEREXTRASTART)) /* same flags if not present */
+ if (idMaxExtraCol == (BYTE)CallService(MS_CLUI_GETCAPS,0,CLUIF2_USEREXTRASTART)) /* same flags if not present */
idMaxExtraCol=EXTRA_ICON_ADV2; /* zero if not present */
idExtraColumnNew=DBGetContactSettingRangedByte(NULL,"Flags","ExtraImgFlagColumn",SETTING_EXTRAIMGFLAGCOLUMN_DEFAULT,1,idMaxExtraCol);
/* clear previous column */
- if(idExtraColumnNew!=idExtraColumn) RemoveExtraImages();
+ if (idExtraColumnNew != idExtraColumn) RemoveExtraImages();
idExtraColumn=idExtraColumnNew;
/* enum all contacts */
- hContact=db_find_first();
- while(hContact!=NULL) {
+ HANDLE hContact = db_find_first();
+ while (hContact != NULL) {
CallFunctionBuffered(SetExtraImage,(LPARAM)hContact,TRUE,EXTRAIMAGE_REFRESHDELAY);
- hContact=db_find_next(hContact);
+ hContact = db_find_next(hContact);
}
}
static void CALLBACK UpdateExtraImages(LPARAM lParam)
{
- UNREFERENCED_PARAMETER(lParam);
- if(DBGetContactSettingByte(NULL,"Flags","ShowExtraImgFlag",SETTING_SHOWEXTRAIMGFLAG_DEFAULT))
+ if ( db_get_b(NULL,"Flags","ShowExtraImgFlag",SETTING_SHOWEXTRAIMGFLAG_DEFAULT))
EnsureExtraImages();
- else RemoveExtraImages();
+ else
+ RemoveExtraImages();
}
static int ExtraListRebuild(WPARAM wParam,LPARAM lParam)
{
- BYTE idMaxExtraCol;
- int i;
- UNREFERENCED_PARAMETER(wParam);
- UNREFERENCED_PARAMETER(lParam);
OutputDebugStringA("REBUILD EXTRA\n");
/* invalidate icons */
- if(phExtraImages!=NULL)
- for(i=0;i<nCountriesCount;++i)
- phExtraImages[i]=INVALID_HANDLE_VALUE;
+ if (phExtraImages != NULL)
+ for(int i=0; i < nCountriesCount; ++i)
+ phExtraImages[i] = INVALID_HANDLE_VALUE;
/* choose column */
- idMaxExtraCol=(BYTE)CallService(MS_CLUI_GETCAPS,0,CLUIF2_EXTRACOLUMNCOUNT); /* 1-based count */
- if(idMaxExtraCol==(BYTE)CallService(MS_CLUI_GETCAPS,0,CLUIF2_USEREXTRASTART)) /* same flags if not present */
+ BYTE idMaxExtraCol = (BYTE)CallService(MS_CLUI_GETCAPS,0,CLUIF2_EXTRACOLUMNCOUNT); /* 1-based count */
+ if (idMaxExtraCol == (BYTE)CallService(MS_CLUI_GETCAPS,0,CLUIF2_USEREXTRASTART)) /* same flags if not present */
idMaxExtraCol=EXTRA_ICON_ADV2; /* zero if not present */
- idExtraColumn=DBGetContactSettingRangedByte(NULL,"Flags","ExtraImgFlagColumn",SETTING_EXTRAIMGFLAGCOLUMN_DEFAULT,1,idMaxExtraCol);
+ idExtraColumn = DBGetContactSettingRangedByte(NULL,"Flags","ExtraImgFlagColumn",SETTING_EXTRAIMGFLAGCOLUMN_DEFAULT,1,idMaxExtraCol);
return 0;
}
static int ExtraImageApply(WPARAM wParam,LPARAM lParam)
{
- UNREFERENCED_PARAMETER(lParam);
OutputDebugStringA("APPLY EXTRA\n");
- if(DBGetContactSettingByte(NULL,"Flags","ShowExtraImgFlag",SETTING_SHOWEXTRAIMGFLAG_DEFAULT))
+ if ( db_get_b(NULL,"Flags","ShowExtraImgFlag",SETTING_SHOWEXTRAIMGFLAG_DEFAULT))
SetExtraImage((LPARAM)wParam); /* unbuffered */
return 0;
}
@@ -169,35 +161,35 @@ static int ExtraImageApply(WPARAM wParam,LPARAM lParam)
// always call in context of main thread
static void FASTCALL SetStatusIcon(HANDLE hContact,int countryNumber)
{
- int i;
- HICON hIcon=NULL;
- StatusIconData sid;
+ HICON hIcon = NULL;
+
+ StatusIconData sid = { sizeof(sid) };
+ sid.szModule = "Flags";
- if(countryNumber!=0xFFFF || DBGetContactSettingByte(NULL,"Flags","UseUnknownFlag",SETTING_USEUNKNOWNFLAG_DEFAULT)) {
+ if (countryNumber != 0xFFFF || db_get_b(NULL, "Flags", "UseUnknownFlag", SETTING_USEUNKNOWNFLAG_DEFAULT)) {
/* copy icon as status icon API will call DestroyIcon() on it */
- hIcon=LoadFlagIcon(countryNumber);
- sid.hIcon=(hIcon!=NULL)?CopyIcon(hIcon):NULL;
+ hIcon = LoadFlagIcon(countryNumber);
+ sid.hIcon = (hIcon != NULL) ? CopyIcon(hIcon) : NULL;
CallService(MS_SKIN2_RELEASEICON,(WPARAM)hIcon,0); /* does NULL check */
- hIcon=sid.hIcon;
+ hIcon = sid.hIcon;
/* ensure status icon is registered */
- sid.cbSize=sizeof(sid);
- sid.szModule="Flags";
- sid.dwId=countryNumber;
- sid.hIconDisabled=NULL;
- sid.flags=0;
- sid.szTooltip=Translate((char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER,countryNumber,0));
- if(CallService(MS_MSG_MODIFYICON,0,(LPARAM)&sid)) /* not yet registered? */
- CallService(MS_MSG_ADDICON,0,(LPARAM)&sid);
+ sid.dwId = countryNumber;
+ sid.szTooltip = Translate((char*)CallService(MS_UTILS_GETCOUNTRYBYNUMBER,countryNumber,0));
+ if (CallService(MS_MSG_MODIFYICON, 0, (LPARAM)&sid)) /* not yet registered? */
+ CallService(MS_MSG_ADDICON, 0, (LPARAM)&sid);
}
+
/* disable all other flags for this contact */
- sid.hIcon=NULL;
- sid.szTooltip=NULL;
- sid.flags=MBF_HIDDEN;
- for(i=0;i<nCountriesCount;++i) {
- sid.dwId=countries[i].id;
- if(countryNumber==countries[i].id && hIcon!=NULL) sid.flags=0;
- else sid.flags=MBF_HIDDEN;
- CallService(MS_MSG_MODIFYICON,(WPARAM)hContact,(LPARAM)&sid);
+ sid.hIcon = NULL;
+ sid.szTooltip = NULL;
+ sid.flags = MBF_HIDDEN;
+ for (int i=0; i < nCountriesCount; ++i) {
+ sid.dwId = countries[i].id;
+ if (countryNumber == countries[i].id && hIcon != NULL)
+ sid.flags = 0;
+ else
+ sid.flags = MBF_HIDDEN;
+ CallService(MS_MSG_MODIFYICON, (WPARAM)hContact, (LPARAM)&sid);
}
}
@@ -219,15 +211,14 @@ static void FASTCALL UnsetStatusIcon(HANDLE hContact,int countryNumber)
static int MsgWndEvent(WPARAM wParam,LPARAM lParam)
{
MessageWindowEventData *msgwe=(MessageWindowEventData*)lParam;
- UNREFERENCED_PARAMETER(wParam);
switch(msgwe->uType) {
case MSG_WINDOW_EVT_OPENING:
case MSG_WINDOW_EVT_CLOSE:
{ int countryNumber;
- if(msgwe->hContact==NULL || !ServiceExists(MS_MSG_ADDICON)) break; /* sanity check */
+ if (msgwe->hContact == NULL || !ServiceExists(MS_MSG_ADDICON)) break; /* sanity check */
countryNumber=ServiceDetectContactOriginCountry((WPARAM)msgwe->hContact,0);
- if(DBGetContactSettingByte(NULL,"Flags","ShowStatusIconFlag",SETTING_SHOWSTATUSICONFLAG_DEFAULT)) {
- if(msgwe->uType==MSG_WINDOW_EVT_OPENING) SetStatusIcon(msgwe->hContact,countryNumber);
+ if ( db_get_b(NULL,"Flags","ShowStatusIconFlag",SETTING_SHOWSTATUSICONFLAG_DEFAULT)) {
+ if (msgwe->uType == MSG_WINDOW_EVT_OPENING) SetStatusIcon(msgwe->hContact,countryNumber);
else UnsetStatusIcon(msgwe->hContact,countryNumber);
}
/* ensure it is hidden, RemoveStatusIcons() only enums currently opened ones */
@@ -243,19 +234,18 @@ static void CALLBACK UpdateStatusIcons(LPARAM lParam)
MessageWindowData msgw; /* output */
BOOL fShow;
int countryNumber;
- UNREFERENCED_PARAMETER(lParam);
msgwi.cbSize=sizeof(msgwi);
msgw.cbSize=sizeof(msgw);
msgwi.uFlags=MSG_WINDOW_UFLAG_MSG_BOTH;
/* enum all opened message windows */
- fShow=DBGetContactSettingByte(NULL,"Flags","ShowStatusIconFlag",SETTING_SHOWSTATUSICONFLAG_DEFAULT);
+ fShow=db_get_b(NULL,"Flags","ShowStatusIconFlag",SETTING_SHOWSTATUSICONFLAG_DEFAULT);
msgwi.hContact=db_find_first();
- while(msgwi.hContact!=NULL) {
+ while (msgwi.hContact != NULL) {
/* is a message window opened for this contact? */
if (!CallService(MS_MSG_GETWINDOWDATA,(WPARAM)&msgwi,(LPARAM)&msgw) && msgw.uState&MSG_WINDOW_STATE_EXISTS) {
countryNumber=ServiceDetectContactOriginCountry((WPARAM)msgwi.hContact,0);
- if(fShow) SetStatusIcon(msgwi.hContact,countryNumber);
+ if (fShow) SetStatusIcon(msgwi.hContact,countryNumber);
else UnsetStatusIcon(msgwi.hContact,countryNumber);
}
msgwi.hContact = db_find_next(msgw.hContact);
@@ -264,10 +254,8 @@ static void CALLBACK UpdateStatusIcons(LPARAM lParam)
static int StatusIconsChanged(WPARAM wParam,LPARAM lParam)
{
- UNREFERENCED_PARAMETER(wParam);
- UNREFERENCED_PARAMETER(lParam);
- if(ServiceExists(MS_MSG_ADDICON))
- if(DBGetContactSettingByte(NULL,"Flags","ShowStatusIconFlag",SETTING_SHOWSTATUSICONFLAG_DEFAULT))
+ if (ServiceExists(MS_MSG_ADDICON))
+ if ( db_get_b(NULL,"Flags","ShowStatusIconFlag",SETTING_SHOWSTATUSICONFLAG_DEFAULT))
CallFunctionBuffered(UpdateStatusIcons,0,FALSE,STATUSICON_REFRESHDELAY);
return 0;
}
@@ -278,25 +266,24 @@ static int StatusIconsChanged(WPARAM wParam,LPARAM lParam)
static INT_PTR CALLBACK ExtraImgOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,LPARAM lParam)
{
- UNREFERENCED_PARAMETER(wParam);
switch(msg) {
case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
/* init checkboxes */
{ BOOL val;
/* Status Icon */
- if(ServiceExists(MS_MSG_ADDICON)) val=DBGetContactSettingByte(NULL,"Flags","ShowStatusIconFlag",SETTING_SHOWSTATUSICONFLAG_DEFAULT)!=0;
+ if (ServiceExists(MS_MSG_ADDICON)) val=db_get_b(NULL,"Flags","ShowStatusIconFlag",SETTING_SHOWSTATUSICONFLAG_DEFAULT) != 0;
else EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG),val=FALSE);
CheckDlgButton(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG,val);
/* Extra Image */
- if(ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) val=DBGetContactSettingByte(NULL,"Flags","ShowExtraImgFlag",SETTING_SHOWEXTRAIMGFLAG_DEFAULT)!=0;
+ if (ServiceExists(MS_CLIST_EXTRA_ADD_ICON)) val=db_get_b(NULL,"Flags","ShowExtraImgFlag",SETTING_SHOWEXTRAIMGFLAG_DEFAULT) != 0;
else EnableWindow(GetDlgItem(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG),val=FALSE);
CheckDlgButton(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG,val);
/* Unknown Flag */
- val=DBGetContactSettingByte(NULL,"Flags","UseUnknownFlag",SETTING_USEUNKNOWNFLAG_DEFAULT)!=0;
+ val=db_get_b(NULL,"Flags","UseUnknownFlag",SETTING_USEUNKNOWNFLAG_DEFAULT) != 0;
CheckDlgButton(hwndDlg,IDC_CHECK_USEUNKNOWNFLAG,val);
/* IP-to-country */
- val=DBGetContactSettingByte(NULL,"Flags","UseIpToCountry",SETTING_USEIPTOCOUNTRY_DEFAULT)!=0;
+ val=db_get_b(NULL,"Flags","UseIpToCountry",SETTING_USEIPTOCOUNTRY_DEFAULT) != 0;
CheckDlgButton(hwndDlg,IDC_CHECK_USEIPTOCOUNTRY,val);
}
/* init combobox */
@@ -306,7 +293,7 @@ static INT_PTR CALLBACK ExtraImgOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,L
BYTE idMaxExtraCol,idAdvExtraColStart;
int index;
hwndCombo=GetDlgItem(hwndDlg,IDC_COMBO_EXTRAIMGFLAGCOLUMN);
- idSavedColumn=DBGetContactSettingByte(NULL,"Flags","ExtraImgFlagColumn",SETTING_EXTRAIMGFLAGCOLUMN_DEFAULT);
+ idSavedColumn=db_get_b(NULL,"Flags","ExtraImgFlagColumn",SETTING_EXTRAIMGFLAGCOLUMN_DEFAULT);
idMaxExtraCol=(BYTE)CallService(MS_CLUI_GETCAPS,0,CLUIF2_EXTRACOLUMNCOUNT); /* 1-based count */
idAdvExtraColStart=(BYTE)CallService(MS_CLUI_GETCAPS,0,CLUIF2_USEREXTRASTART); /* 1-based id */
/* init */
@@ -317,20 +304,20 @@ static INT_PTR CALLBACK ExtraImgOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,L
for(idColumn=0;idColumn<SIZEOF(columnIds);++idColumn) {
mir_sntprintf(szItem,SIZEOF(szItem),TranslateT("Advanced #%u"),idColumn+1); /* buffer safe */
index=SendMessage(hwndCombo,CB_ADDSTRING,0,(LPARAM)szItem);
- if(index!=LB_ERR) {
+ if (index != LB_ERR) {
SendMessage(hwndCombo,CB_SETITEMDATA,index,columnIds[idColumn]);
- if(idColumn==0 || columnIds[idColumn]==idSavedColumn) SendMessage(hwndCombo,CB_SETCURSEL,index,0);
+ if (idColumn == 0 || columnIds[idColumn] == idSavedColumn) SendMessage(hwndCombo,CB_SETCURSEL,index,0);
}
}
}
/* Advanced #3+: clist_modern */
- if(idMaxExtraCol!=idAdvExtraColStart) /* same flags if not present */
+ if (idMaxExtraCol != idAdvExtraColStart) /* same flags if not present */
for(idColumn=idAdvExtraColStart;idColumn<=idMaxExtraCol;++idColumn) {
mir_sntprintf(szItem,SIZEOF(szItem),TranslateT("Advanced #%u"),idColumn-idAdvExtraColStart+3); /* buffer safe */
index=SendMessage(hwndCombo,CB_ADDSTRING,0,(LPARAM)szItem);
- if(index!=LB_ERR) {
+ if (index != LB_ERR) {
SendMessage(hwndCombo,CB_SETITEMDATA,index,idColumn);
- if(idColumn==idSavedColumn) SendMessage(hwndCombo,CB_SETCURSEL,index,0);
+ if (idColumn == idSavedColumn) SendMessage(hwndCombo,CB_SETCURSEL,index,0);
}
}
}
@@ -352,17 +339,17 @@ static INT_PTR CALLBACK ExtraImgOptDlgProc(HWND hwndDlg,UINT msg,WPARAM wParam,L
case WM_NOTIFY:
switch(((NMHDR*)lParam)->code) {
case PSN_APPLY: /* setting change hook will pick these up */
- DBWriteContactSettingByte(NULL,"Flags","UseUnknownFlag",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_USEUNKNOWNFLAG)!=0));
- DBWriteContactSettingByte(NULL,"Flags","UseIpToCountry",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_USEIPTOCOUNTRY)!=0));
+ DBWriteContactSettingByte(NULL,"Flags","UseUnknownFlag",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_USEUNKNOWNFLAG) != 0));
+ DBWriteContactSettingByte(NULL,"Flags","UseIpToCountry",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_USEIPTOCOUNTRY) != 0));
/* Status Icon */
- if(IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG)))
- DBWriteContactSettingByte(NULL,"Flags","ShowStatusIconFlag",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG)!=0));
+ if (IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG)))
+ DBWriteContactSettingByte(NULL,"Flags","ShowStatusIconFlag",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWSTATUSICONFLAG) != 0));
/* Extra Image */
- if(IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG)))
- DBWriteContactSettingByte(NULL,"Flags","ShowExtraImgFlag",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG)!=0));
+ if (IsWindowEnabled(GetDlgItem(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG)))
+ DBWriteContactSettingByte(NULL,"Flags","ShowExtraImgFlag",(BYTE)(IsDlgButtonChecked(hwndDlg,IDC_CHECK_SHOWEXTRAIMGFLAG) != 0));
{ int index;
index=SendDlgItemMessage(hwndDlg,IDC_COMBO_EXTRAIMGFLAGCOLUMN,CB_GETCURSEL,0,0);
- if(index!=LB_ERR) DBWriteContactSettingByte(NULL,"Flags","ExtraImgFlagColumn",(BYTE)SendDlgItemMessage(hwndDlg,IDC_COMBO_EXTRAIMGFLAGCOLUMN,CB_GETITEMDATA,index,0));
+ if (index != LB_ERR) DBWriteContactSettingByte(NULL,"Flags","ExtraImgFlagColumn",(BYTE)SendDlgItemMessage(hwndDlg,IDC_COMBO_EXTRAIMGFLAGCOLUMN,CB_GETITEMDATA,index,0));
}
return TRUE;
}
@@ -375,7 +362,6 @@ static UINT expertOnlyControls[]={IDC_CHECK_USEIPTOCOUNTRY};
static int ExtraImgOptInit(WPARAM wParam,LPARAM lParam)
{
OPTIONSDIALOGPAGE odp = { 0 };
- UNREFERENCED_PARAMETER(lParam);
odp.cbSize = sizeof(odp);
odp.hInstance = hInst;
odp.pszTemplate = MAKEINTRESOURCEA(IDD_OPT_EXTRAIMG);
@@ -394,20 +380,20 @@ static int ExtraImgOptInit(WPARAM wParam,LPARAM lParam)
static int ExtraImgSettingChanged(WPARAM wParam,LPARAM lParam)
{
DBCONTACTWRITESETTING *dbcws=(DBCONTACTWRITESETTING*)lParam;
- if ((HANDLE)wParam==NULL) {
+ if ((HANDLE)wParam == NULL) {
if (!lstrcmpA(dbcws->szModule,"Flags")) {
/* Extra Image */
if (!lstrcmpA(dbcws->szSetting,"ShowExtraImgFlag") ||
!lstrcmpA(dbcws->szSetting,"ExtraImgFlagColumn") ||
!lstrcmpA(dbcws->szSetting,"UseUnknownFlag") ||
!lstrcmpA(dbcws->szSetting,"UseIpToCountry"))
- if(ServiceExists(MS_CLIST_EXTRA_SET_ICON))
+ if (ServiceExists(MS_CLIST_EXTRA_SET_ICON))
CallFunctionBuffered(UpdateExtraImages,0,FALSE,EXTRAIMAGE_REFRESHDELAY);
/* Status Icon */
if (!lstrcmpA(dbcws->szSetting,"ShowStatusIconFlag") ||
!lstrcmpA(dbcws->szSetting,"UseUnknownFlag") ||
!lstrcmpA(dbcws->szSetting,"UseIpToCountry"))
- if(ServiceExists(MS_MSG_ADDICON))
+ if (ServiceExists(MS_MSG_ADDICON))
CallFunctionBuffered(UpdateStatusIcons,0,FALSE,STATUSICON_REFRESHDELAY);
}
}
@@ -416,10 +402,10 @@ static int ExtraImgSettingChanged(WPARAM wParam,LPARAM lParam)
!lstrcmpA(dbcws->szSetting,"Country") ||
!lstrcmpA(dbcws->szSetting,"CompanyCountry")) {
/* Extra Image */
- if(ServiceExists(MS_CLIST_EXTRA_SET_ICON))
+ if (ServiceExists(MS_CLIST_EXTRA_SET_ICON))
CallFunctionBuffered(SetExtraImage,(LPARAM)wParam,TRUE,EXTRAIMAGE_REFRESHDELAY);
/* Status Icon */
- if(ServiceExists(MS_MSG_ADDICON))
+ if (ServiceExists(MS_MSG_ADDICON))
CallFunctionBuffered(UpdateStatusIcons,0,FALSE,STATUSICON_REFRESHDELAY);
}
return 0;
@@ -429,23 +415,21 @@ static int ExtraImgSettingChanged(WPARAM wParam,LPARAM lParam)
static int ExtraImgModulesLoaded(WPARAM wParam,LPARAM lParam)
{
- UNREFERENCED_PARAMETER(wParam);
- UNREFERENCED_PARAMETER(lParam);
/* Options */
- if(ServiceExists("DBEditorpp/RegisterSingleModule"))
+ if (ServiceExists("DBEditorpp/RegisterSingleModule"))
CallService("DBEditorpp/RegisterSingleModule",(WPARAM)"Flags",0);
/* Extra Image */
- if(ServiceExists(MS_CLIST_EXTRA_SET_ICON)) {
+ if (ServiceExists(MS_CLIST_EXTRA_SET_ICON)) {
int i;
BYTE idMaxExtraCol;
phExtraImages=(HANDLE*)mir_alloc(nCountriesCount*sizeof(HANDLE));
/* invalidate icons */
- if(phExtraImages!=NULL)
+ if (phExtraImages != NULL)
for(i=0;i<nCountriesCount;++i)
phExtraImages[i]=INVALID_HANDLE_VALUE;
/* choose column */
idMaxExtraCol=(BYTE)CallService(MS_CLUI_GETCAPS,0,CLUIF2_EXTRACOLUMNCOUNT); /* 1-based count */
- if(idMaxExtraCol==(BYTE)CallService(MS_CLUI_GETCAPS,0,CLUIF2_USEREXTRASTART)) /* same flags if not present */
+ if (idMaxExtraCol == (BYTE)CallService(MS_CLUI_GETCAPS,0,CLUIF2_USEREXTRASTART)) /* same flags if not present */
idMaxExtraCol=EXTRA_ICON_ADV2; /* zero if not present */
idExtraColumn=DBGetContactSettingRangedByte(NULL,"Flags","ExtraImgFlagColumn",SETTING_EXTRAIMGFLAGCOLUMN_DEFAULT,1,idMaxExtraCol);
/* hook */