diff options
author | George Hazan <george.hazan@gmail.com> | 2015-08-18 11:49:54 +0000 |
---|---|---|
committer | George Hazan <george.hazan@gmail.com> | 2015-08-18 11:49:54 +0000 |
commit | 878d72910cccf4f84c7cb45bb4c11134920f3166 (patch) | |
tree | 251fba89632c389309ff9b2451850aa949efb8d0 /plugins/WebView | |
parent | 871410044ecbac0d2dd67a7c98f8bcd2df9410eb (diff) |
- naming conflict;
- warning fixes;
- code cleaning
git-svn-id: http://svn.miranda-ng.org/main/trunk@14988 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/WebView')
-rw-r--r-- | plugins/WebView/src/webview.cpp | 108 | ||||
-rw-r--r-- | plugins/WebView/src/webview.h | 2 | ||||
-rw-r--r-- | plugins/WebView/src/webview_getdata.cpp | 14 | ||||
-rw-r--r-- | plugins/WebView/src/webview_opts.cpp | 85 |
4 files changed, 95 insertions, 114 deletions
diff --git a/plugins/WebView/src/webview.cpp b/plugins/WebView/src/webview.cpp index 6eba2c8d56..dc2adfdbf9 100644 --- a/plugins/WebView/src/webview.cpp +++ b/plugins/WebView/src/webview.cpp @@ -35,7 +35,7 @@ COLORREF BackgoundClr, TextClr; UINT_PTR timerId;
UINT_PTR Countdown;
-LOGFONT lf;
+LOGFONT g_lf;
HFONT h_font;
HWND ContactHwnd;
HINSTANCE hInst;
@@ -63,8 +63,8 @@ void ChangeMenuItemCountdown() // countdown
HICON hIcon = LoadIcon(hInst, MAKEINTRESOURCE(IDI_UPDATEALL));
- TCHAR countername[100];
- mir_sntprintf(countername,_countof(countername), TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0));
+ TCHAR countername[100];
+ mir_sntprintf(countername, _countof(countername), TranslateT("%d minutes to update"), db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 0));
Menu_ModifyItem(hMenuItemCountdown, countername, hIcon, CMIF_KEEPUNTRANSLATED);
}
@@ -72,10 +72,10 @@ void ChangeMenuItemCountdown() /*****************************************************************************/
static int CALLBACK EnumFontsProc(ENUMLOGFONTEX *lpelfe, NEWTEXTMETRICEX*, int, LPARAM lParam)
{
- if (!IsWindow((HWND) lParam))
+ if (!IsWindow((HWND)lParam))
return FALSE;
- if (SendMessage((HWND) lParam, CB_FINDSTRINGEXACT, -1, (LPARAM) lpelfe->elfLogFont.lfFaceName) == CB_ERR)
- SendMessage((HWND) lParam, CB_ADDSTRING, 0, (LPARAM) lpelfe->elfLogFont.lfFaceName);
+ if (SendMessage((HWND)lParam, CB_FINDSTRINGEXACT, -1, (LPARAM)lpelfe->elfLogFont.lfFaceName) == CB_ERR)
+ SendMessage((HWND)lParam, CB_ADDSTRING, 0, (LPARAM)lpelfe->elfLogFont.lfFaceName);
return TRUE;
}
@@ -83,11 +83,11 @@ void FillFontListThread(void *param) {
HDC hdc = GetDC((HWND)param);
- LOGFONT lf = {0};
- lf.lfCharSet = DEFAULT_CHARSET;
- lf.lfFaceName[0] = 0;
- lf.lfPitchAndFamily = 0;
- EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC) EnumFontsProc, (LPARAM) GetDlgItem((HWND)param, IDC_TYPEFACE), 0);
+ LOGFONT lf = { 0 };
+ g_lf.lfCharSet = DEFAULT_CHARSET;
+ g_lf.lfFaceName[0] = 0;
+ g_lf.lfPitchAndFamily = 0;
+ EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC)EnumFontsProc, (LPARAM)GetDlgItem((HWND)param, IDC_TYPEFACE), 0);
ReleaseDC((HWND)param, hdc);
}
@@ -168,7 +168,7 @@ int Doubleclick(WPARAM wParam, LPARAM) {
MCONTACT hContact = wParam;
char *szProto = GetContactProto(hContact);
- if ( mir_strcmp(MODULENAME, szProto))
+ if (mir_strcmp(MODULENAME, szProto))
return 0;
int action = db_get_b(hContact, MODULENAME, DBLE_WIN_KEY, 1);
@@ -176,7 +176,7 @@ int Doubleclick(WPARAM wParam, LPARAM) ptrT url(db_get_tsa(hContact, MODULENAME, "URL"));
Utils_OpenUrlT(url);
- db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE);
+ db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE);
}
else if (action == 1) {
HWND hwndDlg = WindowList_Find(hWindowList, hContact);
@@ -185,11 +185,11 @@ int Doubleclick(WPARAM wParam, LPARAM) SetFocus(hwndDlg);
}
else {
- hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), NULL, DlgProcDisplayData, (LPARAM) hContact);
+ hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), NULL, DlgProcDisplayData, (LPARAM)hContact);
HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST;
- SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) ((HICON) LoadImage(hInst, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0)));
+ SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)((HICON)LoadImage(hInst, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0)));
- if ( db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
+ if (db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
SetWindowPos(hwndDlg, hTopmost,
db_get_dw(hContact, MODULENAME, "WVx", 100), // Xposition,
db_get_dw(hContact, MODULENAME, "WVy", 100), // Yposition,
@@ -207,7 +207,7 @@ int Doubleclick(WPARAM wParam, LPARAM) mir_forkthread(ReadFromFile, (void*)hContact);
else
mir_forkthread(GetData, (void*)hContact);
- db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE);
+ db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE);
}
}
@@ -229,13 +229,13 @@ int SendToRichEdit(HWND hWindow, char *truncated, COLORREF rgbText, COLORREF rgb cfFM.cbSize = sizeof(CHARFORMAT2);
cfFM.dwMask = CFM_COLOR | CFM_CHARSET | CFM_FACE | ENM_LINK | ENM_MOUSEEVENTS | CFM_BOLD | CFM_ITALIC | CFM_UNDERLINE | CFM_SIZE;
- if ( db_get_b(NULL, MODULENAME, FONT_BOLD_KEY, 0))
+ if (db_get_b(NULL, MODULENAME, FONT_BOLD_KEY, 0))
bold = CFE_BOLD;
- if ( db_get_b(NULL, MODULENAME, FONT_ITALIC_KEY, 0))
+ if (db_get_b(NULL, MODULENAME, FONT_ITALIC_KEY, 0))
italic = CFE_ITALIC;
- if ( db_get_b(NULL, MODULENAME, FONT_UNDERLINE_KEY, 0))
+ if (db_get_b(NULL, MODULENAME, FONT_UNDERLINE_KEY, 0))
underline = CFE_UNDERLINE;
cfFM.dwEffects = bold | italic | underline;
@@ -247,14 +247,14 @@ int SendToRichEdit(HWND hWindow, char *truncated, COLORREF rgbText, COLORREF rgb else mir_tstrcpy(cfFM.szFaceName, Def_font_face);
HDC hDC = GetDC(hWindow);
- cfFM.yHeight = (BYTE)MulDiv(abs(lf.lfHeight), 120, GetDeviceCaps(GetDC(hWindow), LOGPIXELSY)) * (db_get_b(NULL, MODULENAME, FONT_SIZE_KEY, 14));
+ cfFM.yHeight = (BYTE)MulDiv(abs(g_lf.lfHeight), 120, GetDeviceCaps(GetDC(hWindow), LOGPIXELSY)) * (db_get_b(NULL, MODULENAME, FONT_SIZE_KEY, 14));
ReleaseDC(hWindow, hDC);
cfFM.bCharSet = db_get_b(NULL, MODULENAME, FONT_SCRIPT_KEY, 0);
cfFM.bPitchAndFamily = DEFAULT_PITCH | FF_DONTCARE;
cfFM.crTextColor = rgbText;
cfFM.crBackColor = rgbBack;
- SendDlgItemMessage(hWindow, IDC_DATA, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM) & cfFM);
+ SendDlgItemMessage(hWindow, IDC_DATA, EM_SETCHARFORMAT, SCF_SELECTION, (LPARAM)& cfFM);
SendDlgItemMessage(hWindow, IDC_DATA, EM_SETSEL, 0, -1);
SendDlgItemMessageA(hWindow, IDC_DATA, EM_REPLACESEL, FALSE, (LPARAM)truncated);
@@ -278,12 +278,12 @@ void CALLBACK timerfunc(HWND, UINT, UINT_PTR, DWORD) void CALLBACK Countdownfunc(HWND, UINT, UINT_PTR, DWORD)
{
DWORD timetemp = db_get_dw(NULL, MODULENAME, COUNTDOWN_KEY, 100);
- if(timetemp <= 0) {
+ if (timetemp <= 0) {
timetemp = db_get_dw(NULL, MODULENAME, REFRESH_KEY, TIME);
db_set_dw(NULL, MODULENAME, COUNTDOWN_KEY, timetemp);
}
- db_set_dw(NULL, MODULENAME, COUNTDOWN_KEY, timetemp-1);
+ db_set_dw(NULL, MODULENAME, COUNTDOWN_KEY, timetemp - 1);
ChangeMenuItemCountdown();
}
@@ -298,7 +298,7 @@ static int OptInitialise(WPARAM wParam, LPARAM) odp.ptszGroup = LPGENT("Network");
odp.ptszTitle = _T(MODULENAME);
odp.pfnDlgProc = DlgProcOpt;
- odp.flags = ODPF_BOLDGROUPS|ODPF_TCHAR;
+ odp.flags = ODPF_BOLDGROUPS | ODPF_TCHAR;
Options_AddPage(wParam, &odp);
// if popup service exists
@@ -314,20 +314,20 @@ static int OptInitialise(WPARAM wParam, LPARAM) /*****************************************************************************/
void FontSettings(void)
{
- lf.lfHeight = 16;
- lf.lfWidth = 0;
- lf.lfEscapement = 0;
- lf.lfOrientation = 0;
- lf.lfWeight = FW_NORMAL;
- lf.lfItalic = FALSE;
- lf.lfUnderline = FALSE;
- lf.lfStrikeOut = 0;
- lf.lfCharSet = ANSI_CHARSET;
- lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
- lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
- lf.lfQuality = DEFAULT_QUALITY;
- lf.lfPitchAndFamily = FIXED_PITCH | FF_MODERN;
- mir_tstrcpy(lf.lfFaceName, Def_font_face);
+ g_lf.lfHeight = 16;
+ g_lf.lfWidth = 0;
+ g_lf.lfEscapement = 0;
+ g_lf.lfOrientation = 0;
+ g_lf.lfWeight = FW_NORMAL;
+ g_lf.lfItalic = FALSE;
+ g_lf.lfUnderline = FALSE;
+ g_lf.lfStrikeOut = 0;
+ g_lf.lfCharSet = ANSI_CHARSET;
+ g_lf.lfOutPrecision = OUT_DEFAULT_PRECIS;
+ g_lf.lfClipPrecision = CLIP_DEFAULT_PRECIS;
+ g_lf.lfQuality = DEFAULT_QUALITY;
+ g_lf.lfPitchAndFamily = FIXED_PITCH | FF_MODERN;
+ mir_tstrcpy(g_lf.lfFaceName, Def_font_face);
}
/*****************************************************************************/
@@ -348,10 +348,10 @@ int ModulesLoaded(WPARAM, LPARAM) HookEvent(ME_OSD_ALERT, OSDAlert);
FontSettings();
- h_font = CreateFontIndirect(&lf);
+ h_font = CreateFontIndirect(&g_lf);
// get data on startup
- if ( db_get_b(NULL, MODULENAME, UPDATE_ONSTART_KEY, 0))
+ if (db_get_b(NULL, MODULENAME, UPDATE_ONSTART_KEY, 0))
mir_forkthread(StartUpdate, NULL);
return 0;
@@ -368,9 +368,9 @@ INT_PTR DataWndMenuCommand(WPARAM wParam, LPARAM) }
HWND hTopmost = db_get_b(hContact, MODULENAME, ON_TOP_KEY, 0) ? HWND_TOPMOST : HWND_NOTOPMOST;
- hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), NULL, DlgProcDisplayData, (LPARAM) hContact);
- SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM) LoadImage(hInst, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
- if ( db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
+ hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_DISPLAY_DATA), NULL, DlgProcDisplayData, (LPARAM)hContact);
+ SendDlgItemMessage(hwndDlg, IDC_STICK_BUTTON, BM_SETIMAGE, IMAGE_ICON, (LPARAM)LoadImage(hInst, MAKEINTRESOURCE(IDI_STICK), IMAGE_ICON, GetSystemMetrics(SM_CXSMICON), GetSystemMetrics(SM_CYSMICON), 0));
+ if (db_get_b(NULL, MODULENAME, SAVE_INDIVID_POS_KEY, 0))
SetWindowPos(hwndDlg, hTopmost,
db_get_dw(hContact, MODULENAME, "WVx", 100), // Xposition,
db_get_dw(hContact, MODULENAME, "WVy", 100), // Yposition,
@@ -382,12 +382,12 @@ INT_PTR DataWndMenuCommand(WPARAM wParam, LPARAM) ShowWindow(hwndDlg, SW_SHOW);
SetActiveWindow(hwndDlg);
- if ( db_get_b(NULL, MODULENAME, UPDATE_ON_OPEN_KEY, 0)) {
- if ( db_get_b(hContact, MODULENAME, ENABLE_ALERTS_KEY, 0))
+ if (db_get_b(NULL, MODULENAME, UPDATE_ON_OPEN_KEY, 0)) {
+ if (db_get_b(hContact, MODULENAME, ENABLE_ALERTS_KEY, 0))
mir_forkthread(ReadFromFile, (void*)hContact);
else
mir_forkthread(GetData, (void*)hContact);
- db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE);
+ db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE);
}
return 0;
@@ -426,14 +426,12 @@ int OnTopMenuCommand(WPARAM, LPARAM, MCONTACT singlecontact) int ontop = 0;
int done = 0;
- if (((db_get_b(singlecontact, MODULENAME, ON_TOP_KEY, 0))) && done == 0)
- {
+ if (((db_get_b(singlecontact, MODULENAME, ON_TOP_KEY, 0))) && done == 0) {
db_set_b(singlecontact, MODULENAME, ON_TOP_KEY, 0);
ontop = 0;
done = 1;
}
- if ((!(db_get_b(singlecontact, MODULENAME, ON_TOP_KEY, 0))) && done == 0)
- {
+ if ((!(db_get_b(singlecontact, MODULENAME, ON_TOP_KEY, 0))) && done == 0) {
db_set_b(singlecontact, MODULENAME, ON_TOP_KEY, 1);
ontop = 1;
done = 1;
@@ -449,7 +447,7 @@ INT_PTR WebsiteMenuCommand(WPARAM wParam, LPARAM) if (url)
Utils_OpenUrlT(url);
- db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE);
+ db_set_w(hContact, MODULENAME, "Status", ID_STATUS_ONLINE);
return 0;
}
@@ -476,7 +474,7 @@ INT_PTR CntOptionsMenuCommand(WPARAM wParam, LPARAM) return 0;
}
- hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONTACT_OPT), NULL, DlgProcContactOpt, (LPARAM) wParam);
+ hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_CONTACT_OPT), NULL, DlgProcContactOpt, (LPARAM)wParam);
ShowWindow(hwndDlg, SW_SHOW);
SetActiveWindow(hwndDlg);
return 0;
@@ -485,13 +483,13 @@ INT_PTR CntOptionsMenuCommand(WPARAM wParam, LPARAM) /*****************************************************************************/
INT_PTR CntAlertMenuCommand(WPARAM wParam, LPARAM)
{
- HWND hwndDlg = WindowList_Find(hWindowList, (MCONTACT) wParam);
+ HWND hwndDlg = WindowList_Find(hWindowList, (MCONTACT)wParam);
if (hwndDlg) {
DestroyWindow(hwndDlg);
return 0;
}
- hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ALRT_OPT), NULL, DlgProcAlertOpt, (LPARAM) wParam);
+ hwndDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_ALRT_OPT), NULL, DlgProcAlertOpt, (LPARAM)wParam);
ShowWindow(hwndDlg, SW_SHOW);
SetActiveWindow(hwndDlg);
return 0;
diff --git a/plugins/WebView/src/webview.h b/plugins/WebView/src/webview.h index 1767911e88..c09e9f88b8 100644 --- a/plugins/WebView/src/webview.h +++ b/plugins/WebView/src/webview.h @@ -138,7 +138,7 @@ void ReadFromFile(void *hContact); extern int Xposition, Yposition, WindowHeight, WindowWidth;
extern COLORREF BackgoundClr, TextClr;
extern UINT_PTR timerId, Countdown;
-extern LOGFONT lf;
+extern LOGFONT g_lf;
extern HFONT h_font;
extern HWND ContactHwnd;
extern HINSTANCE hInst;
diff --git a/plugins/WebView/src/webview_getdata.cpp b/plugins/WebView/src/webview_getdata.cpp index 9e38568dfa..ab59060515 100644 --- a/plugins/WebView/src/webview_getdata.cpp +++ b/plugins/WebView/src/webview_getdata.cpp @@ -29,7 +29,7 @@ int AlreadyDownloading = 0; /*******************/
void GetData(void *param)
{
- MCONTACT hContact = (MCONTACT)param;
+ MCONTACT hContact = (DWORD_PTR)param;
int statpos = 0, dispos = 0, statposend = 0;
char*pos;
DBVARIANT dbv;
@@ -140,7 +140,6 @@ void GetData(void *param) db_set_w(hContact, MODULENAME, "Status", ID_STATUS_AWAY);
TCHAR *statusText = TranslateT("The server replied with a failure code");
- HWND hwndDlg = WindowList_Find(hWindowList, hContact);
SetDlgItemText(hwndDlg, IDC_STATUSBAR, statusText);
WErrorPopup(hContact, statusText);
db_set_ts(hContact, "CList", "StatusMsg", statusText);
@@ -155,7 +154,6 @@ void GetData(void *param) if (!nlhrReply) {
db_set_w(hContact, MODULENAME, "Status", ID_STATUS_NA);
- HWND hwndDlg = (WindowList_Find(hWindowList, hContact));
TCHAR *statusText = TranslateT("The server is down or lagging.");
SetDlgItemText(hwndDlg, IDC_STATUSBAR, statusText);
@@ -173,11 +171,8 @@ void GetData(void *param) CallService(MS_NETLIB_FREEHTTPREQUESTSTRUCT, 0, (LPARAM) nlhrReply);
- if (DownloadSuccess) {
- HWND hwndDlg = (WindowList_Find(hWindowList, hContact));
+ if (DownloadSuccess)
SetDlgItemText(hwndDlg, IDC_STATUSBAR, TranslateT("Download successful; about to process data..."));
- }
- ///get data in desired range
// download successful
if (DownloadSuccess) {
@@ -239,7 +234,6 @@ void GetData(void *param) else if (db_get_b(hContact, MODULENAME, U_ALLSITE_KEY, 0) == 0) {
TCHAR *szStatusText = TranslateT("Invalid search parameters.");
WErrorPopup(hContact, szStatusText);
- HWND hwndDlg = WindowList_Find(hWindowList, hContact);
DownloadSuccess = 0;
SetDlgItemText(hwndDlg, IDC_STATUSBAR, szStatusText);
@@ -256,7 +250,6 @@ void GetData(void *param) WErrorPopup(hContact, statusText);
db_set_ts(hContact, "CList", "StatusMsg", statusText);
- HWND hwndDlg = WindowList_Find(hWindowList, hContact);
DownloadSuccess = 0;
SetDlgItemText(hwndDlg, IDC_STATUSBAR, statusText);
TherewasAlert = ProcessAlerts(hContact, _T2A(statusText), contactname, contactname, 1);
@@ -358,8 +351,6 @@ void GetData(void *param) RemoveTabs(truncated);
if ( db_get_b(hContact, MODULENAME, CLEAR_DISPLAY_KEY, 0)) {
- HWND hwndDlg = (WindowList_Find(hWindowList, hContact));
-
SendToRichEdit(hwndDlg, truncated, TextClr, BackgoundClr);
SetDlgItemText(hwndDlg, IDC_STATUSBAR, TranslateT("Processing data (Stage 1)"));
@@ -478,7 +469,6 @@ LBL_Stop: TCHAR *statusText = TranslateT("Processing data stopped by user."); if (DownloadSuccess) { // download success
char BytesString[128];
- HWND hwndDlg = (WindowList_Find(hWindowList, hContact));
// update window if the update only on alert option isn't ticked or
// there was an alert or the update button was clicked
diff --git a/plugins/WebView/src/webview_opts.cpp b/plugins/WebView/src/webview_opts.cpp index bc5bab421e..b4b45bd99e 100644 --- a/plugins/WebView/src/webview_opts.cpp +++ b/plugins/WebView/src/webview_opts.cpp @@ -31,19 +31,19 @@ const TCHAR *szTrackerBarDescr[] = { LPGENT("Remove all whitespace")
};
-static char *fontSizes[] = {"8", "10", "14", "16", "18", "20", "24", "28"};
+static char *fontSizes[] = { "8", "10", "14", "16", "18", "20", "24", "28" };
static TCHAR *AlertTypes[] = { LPGENT("Popup plugin"), LPGENT("Log to file"), LPGENT("Open data display window"), LPGENT("Use OSD plugin") };
static TCHAR *EventTypes[] = { LPGENT("A string is present"), LPGENT("The web page changes"), LPGENT("A specific part of web page changes") };
#define M_FILLSCRIPTCOMBO (WM_USER+16)
-void strdel(TCHAR *parBuffer, int len )
+void strdel(TCHAR *parBuffer, int len)
{
TCHAR* p;
- for (p = parBuffer+len; *p != 0; p++)
- p[ -len ] = *p;
+ for (p = parBuffer + len; *p != 0; p++)
+ p[-len] = *p;
- p[ -len ] = '\0';
+ p[-len] = '\0';
}
TCHAR* FixButtonText(TCHAR *url, size_t len)
@@ -52,9 +52,9 @@ TCHAR* FixButtonText(TCHAR *url, size_t len) _tcsncpy_s(buttontext, url, _TRUNCATE);
_tcsncpy_s(newbuttontext, url, _TRUNCATE);
- if ( _tcschr(newbuttontext, '&') != 0) {
+ if (_tcschr(newbuttontext, '&') != 0) {
while (true) {
- if ( _tcschr(newbuttontext, '&') == 0)
+ if (_tcschr(newbuttontext, '&') == 0)
break;
_tcsncpy_s(buttontext, newbuttontext, _TRUNCATE);
@@ -71,12 +71,12 @@ TCHAR* FixButtonText(TCHAR *url, size_t len) }
while (true) {
- if ( _tcschr(newbuttontext, '!') != 0) {
+ if (_tcschr(newbuttontext, '!') != 0) {
TCHAR *stringafter = _tcschr(newbuttontext, '!');
int pos = (stringafter - newbuttontext);
newbuttontext[pos] = '&';
}
- if ( _tcschr(newbuttontext, '!') == 0)
+ if (_tcschr(newbuttontext, '!') == 0)
break;
}
}
@@ -88,11 +88,10 @@ TCHAR* FixButtonText(TCHAR *url, size_t len) /*****************************************************************************/
static int CALLBACK EnumFontScriptsProc(ENUMLOGFONTEX * lpelfe, NEWTEXTMETRICEX*, int, LPARAM lParam)
{
- if (SendMessage((HWND) lParam, CB_FINDSTRINGEXACT, -1, (LPARAM) lpelfe->elfScript) == CB_ERR)
- {
- int i = SendMessage((HWND) lParam, CB_ADDSTRING, 0, (LPARAM) lpelfe->elfScript);
+ if (SendMessage((HWND)lParam, CB_FINDSTRINGEXACT, -1, (LPARAM)lpelfe->elfScript) == CB_ERR) {
+ int i = SendMessage((HWND)lParam, CB_ADDSTRING, 0, (LPARAM)lpelfe->elfScript);
- SendMessage((HWND) lParam, CB_SETITEMDATA, i, lpelfe->elfLogFont.lfCharSet);
+ SendMessage((HWND)lParam, CB_SETITEMDATA, i, lpelfe->elfLogFont.lfCharSet);
}
return TRUE;
}
@@ -147,7 +146,7 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) case WM_COMMAND:
// enable the "apply" button
- if (HIWORD(wParam) == BN_CLICKED && GetFocus() == (HWND) lParam)
+ if (HIWORD(wParam) == BN_CLICKED && GetFocus() == (HWND)lParam)
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
// These are simple clicks: we don't save, but we tell the Options Page
// to enable the "Apply" button.
@@ -190,8 +189,7 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) case IDC_DELAY:
if (HIWORD(wParam) == EN_CHANGE)
test++;
- if (test > 1)
- {
+ if (test > 1) {
//CheckRadioButton(hdlg, IDC_PD1, IDC_PD3, IDC_PD3);
SendMessage(GetParent(hdlg), PSM_CHANGED, 0, 0);
}
@@ -231,7 +229,7 @@ INT_PTR CALLBACK DlgPopUpOpts(HWND hdlg, UINT msg, WPARAM wParam, LPARAM lParam) break;
case WM_NOTIFY: // Here we have pressed either the OK or the APPLY button.
- switch (((LPNMHDR) lParam)->code) {
+ switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
{
int popupdelayval = 0;
@@ -286,12 +284,11 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l test = 0;
TranslateDialogDefault(hwndDlg);
hContact = lParam;
-
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) hContact);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, lParam);
SetWindowText(hwndDlg, TranslateT("Alert options"));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(hInst, MAKEINTRESOURCE(IDI_ALERT)));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(IDI_ALERT)));
EnableWindow(GetDlgItem(hwndDlg, IDC_ALERT_APPLY), 0);
@@ -437,7 +434,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l else
CheckRadioButton(hwndDlg, IDC_PREFIX, IDC_SUFFIX, IDC_SUFFIX);
- if ( db_get_b(hContact, MODULENAME, ALWAYS_LOG_KEY, 0)) {
+ if (db_get_b(hContact, MODULENAME, ALWAYS_LOG_KEY, 0)) {
if (IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_APPEND), 1);
EnableWindow(GetDlgItem(hwndDlg, IDC_FILENAME), 1);
@@ -512,7 +509,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
EnableWindow(GetDlgItem(hwndDlg, IDC_ADD_DATE_NAME), (IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS)));
- if ( IsDlgButtonChecked(hwndDlg, IDC_ADD_DATE_NAME)) {
+ if (IsDlgButtonChecked(hwndDlg, IDC_ADD_DATE_NAME)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_PREFIX), (IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS)));
EnableWindow(GetDlgItem(hwndDlg, IDC_SUFFIX), (IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS)));
EnableWindow(GetDlgItem(hwndDlg, IDC_24_HOUR), (IsDlgButtonChecked(hwndDlg, IDC_ENABLE_ALERTS)));
@@ -631,8 +628,8 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case IDC_ALERT_TYPE:
if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE) {
- hContact = (MCONTACT) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- int alertIndex = SendDlgItemMessage(hwndDlg, IDC_ALERT_TYPE, CB_GETCURSEL, 0, 0);
+ hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ alertIndex = SendDlgItemMessage(hwndDlg, IDC_ALERT_TYPE, CB_GETCURSEL, 0, 0);
if (HIWORD(wParam) == CBN_SELCHANGE) {
db_set_b(hContact, MODULENAME, ALRT_INDEX_KEY, alertIndex);
@@ -678,8 +675,8 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case IDC_EVENT_TYPE:
if (HIWORD(wParam) == CBN_SELCHANGE || HIWORD(wParam) == CBN_EDITCHANGE) {
- MCONTACT hContact = (MCONTACT) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- int eventIndex = SendDlgItemMessage(hwndDlg, IDC_EVENT_TYPE, CB_GETCURSEL, 0, 0);
+ hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ eventIndex = SendDlgItemMessage(hwndDlg, IDC_EVENT_TYPE, CB_GETCURSEL, 0, 0);
if (HIWORD(wParam) == CBN_SELCHANGE) {
db_set_b(hContact, MODULENAME, EVNT_INDEX_KEY, eventIndex);
@@ -709,7 +706,7 @@ INT_PTR CALLBACK DlgProcAlertOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l case IDC_ALERT_APPLY:
case IDC_OK2:
{
- hContact = (MCONTACT) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
TCHAR buf[MAX_PATH];
eventIndex = db_get_b(hContact, MODULENAME, EVNT_INDEX_KEY, 0);
@@ -821,17 +818,17 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case WM_INITDIALOG:
TranslateDialogDefault(hwndDlg);
- hContact = (MCONTACT) lParam;
+ hContact = (MCONTACT)lParam;
test = 0;
test2 = 0;
- SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR) hContact);
+ SetWindowLongPtr(hwndDlg, GWLP_USERDATA, (LONG_PTR)hContact);
WindowList_Add(hWindowList, hwndDlg, hContact);
SetWindowText(hwndDlg, TranslateT("Contact options"));
- SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM) LoadIcon(hInst, MAKEINTRESOURCE(IDI_OPTIONS)));
+ SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadIcon(hInst, MAKEINTRESOURCE(IDI_OPTIONS)));
EnableWindow(GetDlgItem(hwndDlg, IDC_OPT_APPLY), 0);
@@ -927,7 +924,7 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM case IDC_CPY_STRINGS:
{
TCHAR string[128];
- hContact = (MCONTACT) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
GetDlgItemText(hwndDlg, IDC_START, string, _countof(string));
db_set_ts(hContact, MODULENAME, ALRT_S_STRING_KEY, string);
@@ -1022,7 +1019,7 @@ INT_PTR CALLBACK DlgProcContactOpt(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM break;
}
- hContact = (MCONTACT) GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
+ hContact = (MCONTACT)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
GetDlgItemText(hwndDlg, IDC_URL, url, _countof(url));
db_set_ts(hContact, MODULENAME, URL_KEY, url);
@@ -1139,7 +1136,7 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara */
oldcolor = BackgoundClr;
- if ( db_get_b(NULL, MODULENAME, SUPPRESS_ERR_KEY, 0)) {
+ if (db_get_b(NULL, MODULENAME, SUPPRESS_ERR_KEY, 0)) {
CheckDlgButton(hwndDlg, IDC_SUPPRESS, BST_CHECKED);
EnableWindow(GetDlgItem(hwndDlg, IDC_ERROR_POPUP), 0);
}
@@ -1152,7 +1149,7 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara if (ServiceExists(MS_POPUP_ADDPOPUPT) == 0)
EnableWindow(GetDlgItem(hwndDlg, IDC_ERROR_POPUP), 0);
- if ( db_get_b(NULL, MODULENAME, UPDATE_ONSTART_KEY, 0)) {
+ if (db_get_b(NULL, MODULENAME, UPDATE_ONSTART_KEY, 0)) {
EnableWindow(GetDlgItem(hwndDlg, IDC_START_DELAY), 1);
EnableWindow(GetDlgItem(hwndDlg, IDC_SPIN2), 1);
EnableWindow(GetDlgItem(hwndDlg, IDC_STARTDELAYTXT), 1);
@@ -1171,7 +1168,7 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara // selection to the value for fontid wParam
{
- LOGFONT lf = {0};
+ LOGFONT lf = { 0 };
int i;
HDC hdc = GetDC(hwndDlg);
@@ -1179,12 +1176,10 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara GetDlgItemText(hwndDlg, IDC_TYPEFACE, lf.lfFaceName, _countof(lf.lfFaceName));
lf.lfPitchAndFamily = 0;
SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_RESETCONTENT, 0, 0);
- EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC) EnumFontScriptsProc, (LPARAM) GetDlgItem(hwndDlg, IDC_SCRIPT), 0);
+ EnumFontFamiliesEx(hdc, &lf, (FONTENUMPROC)EnumFontScriptsProc, (LPARAM)GetDlgItem(hwndDlg, IDC_SCRIPT), 0);
ReleaseDC(hwndDlg, hdc);
- for (i = SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETCOUNT, 0, 0) - 1; i >= 0; i--)
- {
- if (SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETITEMDATA, i, 0) == (BYTE)((db_get_b(NULL, MODULENAME, FONT_SCRIPT_KEY, 0))))
- {
+ for (i = SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETCOUNT, 0, 0) - 1; i >= 0; i--) {
+ if (SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_GETITEMDATA, i, 0) == (BYTE)((db_get_b(NULL, MODULENAME, FONT_SCRIPT_KEY, 0)))) {
SendDlgItemMessage(hwndDlg, IDC_SCRIPT, CB_SETCURSEL, i, 0);
break;
}
@@ -1195,7 +1190,7 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara break;
case WM_COMMAND:
- if (HIWORD(wParam) == BN_CLICKED && GetFocus() == (HWND) lParam)
+ if (HIWORD(wParam) == BN_CLICKED && GetFocus() == (HWND)lParam)
SendMessage(GetParent(hwndDlg), PSM_CHANGED, 0, 0);
switch (LOWORD(wParam)) {
@@ -1266,7 +1261,7 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara break;
case WM_NOTIFY:
- switch (((LPNMHDR) lParam)->code) {
+ switch (((LPNMHDR)lParam)->code) {
case PSN_APPLY:
db_set_b(NULL, MODULENAME, MENU_OFF, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_DISABLEMENU));
db_set_b(NULL, MODULENAME, SUPPRESS_ERR_KEY, (BYTE)IsDlgButtonChecked(hwndDlg, IDC_SUPPRESS));
@@ -1301,15 +1296,13 @@ INT_PTR CALLBACK DlgProcOpt(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lPara BackgoundClr = (SendDlgItemMessage(hwndDlg, IDC_BGCOLOR, CPM_GETCOLOUR, 0, 0));
TextClr = (SendDlgItemMessage(hwndDlg, IDC_TXTCOLOR, CPM_GETCOLOUR, 0, 0));
- if ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, 0) != 0))
- {
+ if ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, 0) != 0)) {
KillTimer(NULL, timerId);
KillTimer(NULL, Countdown);
timerId = SetTimer(NULL, 0, ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, 0)) * MINUTE), timerfunc);
Countdown = SetTimer(NULL, 0, MINUTE, Countdownfunc);
}
- if ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, 0) == 0))
- {
+ if ((db_get_dw(NULL, MODULENAME, REFRESH_KEY, 0) == 0)) {
KillTimer(NULL, timerId);
KillTimer(NULL, Countdown);
}
|