summaryrefslogtreecommitdiff
path: root/plugins/Weather/src/weather_userinfo.cpp
diff options
context:
space:
mode:
authorGeorge Hazan <george.hazan@gmail.com>2014-01-22 20:30:18 +0000
committerGeorge Hazan <george.hazan@gmail.com>2014-01-22 20:30:18 +0000
commita5f52c9e4d4eb819ede04e55899e5699269e8397 (patch)
tree6f75e65fcfa503a66014729685cee6ce51f5904a /plugins/Weather/src/weather_userinfo.cpp
parentab5cc6ac36ed37b7c44d8d74d6906af17ac5be61 (diff)
- more correct version of settings initialization
- code cleaning git-svn-id: http://svn.miranda-ng.org/main/trunk@7830 1316c22d-e87f-b044-9b9b-93d7a3e3ba9c
Diffstat (limited to 'plugins/Weather/src/weather_userinfo.cpp')
-rw-r--r--plugins/Weather/src/weather_userinfo.cpp71
1 files changed, 26 insertions, 45 deletions
diff --git a/plugins/Weather/src/weather_userinfo.cpp b/plugins/Weather/src/weather_userinfo.cpp
index 7d06772caa..955b46639b 100644
--- a/plugins/Weather/src/weather_userinfo.cpp
+++ b/plugins/Weather/src/weather_userinfo.cpp
@@ -115,20 +115,15 @@ INT_PTR CALLBACK DlgProcUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
case WM_COMMAND:
switch(LOWORD(wParam)) {
case IDC_MOREDETAIL:
- {
- HWND hMoreDataDlg = WindowList_Find(hDataWindowList, hContact);
- if (hMoreDataDlg == NULL)
- hMoreDataDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_BRIEF), NULL,
- DlgProcMoreData, (LPARAM)hContact);
- else
- {
- SetForegroundWindow(hMoreDataDlg);
- SetFocus(hMoreDataDlg);
- }
- ShowWindow(GetDlgItem(hMoreDataDlg, IDC_MTEXT), 0);
- ShowWindow(GetDlgItem(hMoreDataDlg, IDC_DATALIST), 1);
- break;
+ HWND hMoreDataDlg = WindowList_Find(hDataWindowList, hContact);
+ if (hMoreDataDlg == NULL)
+ hMoreDataDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_BRIEF), NULL, DlgProcMoreData, (LPARAM)hContact);
+ else {
+ SetForegroundWindow(hMoreDataDlg);
+ SetFocus(hMoreDataDlg);
}
+ ShowWindow(GetDlgItem(hMoreDataDlg, IDC_MTEXT), 0);
+ ShowWindow(GetDlgItem(hMoreDataDlg, IDC_DATALIST), 1);
}
break;
}
@@ -139,8 +134,7 @@ INT_PTR CALLBACK DlgProcUIPage(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lPa
static int BriefDlgResizer(HWND hwnd, LPARAM lParam, UTILRESIZECONTROL *urc)
{
- switch(urc->wId)
- {
+ switch (urc->wId) {
case IDC_HEADERBAR:
return RD_ANCHORX_LEFT | RD_ANCHORY_TOP | RD_ANCHORX_WIDTH;
@@ -156,11 +150,9 @@ static int BriefDlgResizer(HWND hwnd, LPARAM lParam, UTILRESIZECONTROL *urc)
case IDCANCEL:
return RD_ANCHORX_RIGHT | RD_ANCHORY_BOTTOM;
}
- return RD_ANCHORX_LEFT|RD_ANCHORY_TOP;
+ return RD_ANCHORX_LEFT | RD_ANCHORY_TOP;
}
-
-
// dialog process for more data in the user info window
// lParam = contact handle
INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM lParam)
@@ -168,8 +160,7 @@ INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
static const unsigned tabstops = 48;
HANDLE hContact = (HANDLE)GetWindowLongPtr(hwndDlg, GWLP_USERDATA);
- switch (msg)
- {
+ switch (msg) {
case WM_INITDIALOG:
// save the contact handle for later use
hContact = (HANDLE)lParam;
@@ -222,7 +213,6 @@ INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
// set icons
{
WORD statusIcon = db_get_w(hContact, WEATHERPROTONAME, "StatusIcon", 0);
-
ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_BIG, (LPARAM)LoadSkinnedProtoIconBig(WEATHERPROTONAME, statusIcon)));
ReleaseIconEx((HICON)SendMessage(hwndDlg, WM_SETICON, ICON_SMALL, (LPARAM)LoadSkinnedProtoIcon(WEATHERPROTONAME, statusIcon)));
}
@@ -236,12 +226,10 @@ INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
GetWindowRect(hList, &rc);
ListView_SetColumnWidth(hList, 1, ListView_GetColumnWidth(hList, 1) +
(int)LOWORD(lParam) - (rc.right - rc.left));
- }
- {
- UTILRESIZEDIALOG urd = {0};
- urd.cbSize = sizeof(urd);
- urd.hwndDlg = hwndDlg;
- urd.hInstance = hInst;
+
+ UTILRESIZEDIALOG urd = { sizeof(urd) };
+ urd.hwndDlg = hwndDlg;
+ urd.hInstance = hInst;
urd.lpTemplate = MAKEINTRESOURCEA(IDD_BRIEF);
urd.pfnResizer = BriefDlgResizer;
CallService(MS_UTILS_RESIZEDIALOG, 0, (LPARAM)&urd);
@@ -260,8 +248,7 @@ INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
break;
case WM_COMMAND:
- switch(LOWORD(wParam))
- {
+ switch(LOWORD(wParam)) {
case IDCANCEL:
// close the info window
DestroyWindow(hwndDlg);
@@ -269,13 +256,14 @@ INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
case IDC_MUPDATE:
{
- LV_ITEM lvi = {0};
HWND hList = GetDlgItem(hwndDlg, IDC_DATALIST);
// update current data
// set the text to "updating"
SetDlgItemText(hwndDlg, IDC_MTEXT, TranslateT("Retrieving new data, please wait..."));
ListView_DeleteAllItems(hList);
+
+ LV_ITEM lvi = { 0 };
lvi.mask = LVIF_TEXT | LVIF_PARAM;
lvi.lParam = 1;
lvi.pszText = _T("");
@@ -305,13 +293,11 @@ INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
case WM_NOTIFY:
{
LPNMHDR pNmhdr = (LPNMHDR)lParam;
- if (pNmhdr->idFrom == IDC_MTEXT && pNmhdr->code == EN_LINK)
- {
+ if (pNmhdr->idFrom == IDC_MTEXT && pNmhdr->code == EN_LINK) {
ENLINK *enlink = (ENLINK *) lParam;
- TEXTRANGE tr;
- switch (enlink->msg)
- {
+ switch (enlink->msg) {
case WM_LBUTTONUP:
+ TEXTRANGE tr;
tr.chrg = enlink->chrg;
tr.lpstrText = ( LPTSTR )mir_alloc( sizeof(TCHAR)*(tr.chrg.cpMax - tr.chrg.cpMin + 8));
SendMessage(pNmhdr->hwndFrom, EM_GETTEXTRANGE, 0, (LPARAM)&tr);
@@ -320,8 +306,8 @@ INT_PTR CALLBACK DlgProcMoreData(HWND hwndDlg, UINT msg, WPARAM wParam, LPARAM l
break;
}
}
- break;
}
+ break;
case WM_CLOSE:
DestroyWindow(hwndDlg);
@@ -368,19 +354,14 @@ void LoadBriefInfoText(HWND hwndDlg, HANDLE hContact)
int BriefInfo(WPARAM wParam, LPARAM lParam)
{
// make sure that the contact is actually a weather one
- if (IsMyContact((HANDLE)wParam))
- {
+ if (IsMyContact((HANDLE)wParam)) {
HWND hMoreDataDlg = WindowList_Find(hDataWindowList,(HANDLE)wParam);
- if (hMoreDataDlg != NULL)
- {
+ if (hMoreDataDlg != NULL) {
SetForegroundWindow(hMoreDataDlg);
SetFocus(hMoreDataDlg);
}
- else
- {
- hMoreDataDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_BRIEF), NULL, DlgProcMoreData,
- (LPARAM)wParam);
- }
+ else hMoreDataDlg = CreateDialogParam(hInst, MAKEINTRESOURCE(IDD_BRIEF), NULL, DlgProcMoreData, (LPARAM)wParam);
+
ShowWindow(GetDlgItem(hMoreDataDlg, IDC_DATALIST), 0);
ShowWindow(GetDlgItem(hMoreDataDlg, IDC_MTEXT), 1);
SetDlgItemText(hMoreDataDlg, IDC_MTOGGLE, TranslateT("More Info"));