summaryrefslogtreecommitdiff
path: root/tipper/popwin.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'tipper/popwin.cpp')
-rw-r--r--tipper/popwin.cpp59
1 files changed, 31 insertions, 28 deletions
diff --git a/tipper/popwin.cpp b/tipper/popwin.cpp
index d0f8055..4311789 100644
--- a/tipper/popwin.cpp
+++ b/tipper/popwin.cpp
@@ -70,8 +70,8 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
a2t(pwd->clcit.proto, pwd->swzTitle, TITLE_TEXT_LEN);
WORD status = CallProtoService(pwd->clcit.proto, PS_GETSTATUS, 0, 0);
- char *strptr = (char *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)status, (LPARAM)0);
- if(strptr) {
+ char *strptr = (char *)CallService(MS_CLIST_GETSTATUSMODEDESCRIPTION, (WPARAM)status, (LPARAM)0);
+ if(strptr) {
TCHAR *swzText = a2t(strptr);
pwd->rows = (RowData *) realloc(pwd->rows, sizeof(RowData) * (pwd->row_count + 1));
@@ -104,17 +104,17 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
pwd->indent = 0;
pwd->sb_width = 0;
-
- //MessageBox(0, swzText, _T("tip"), MB_OK);
+
+ //MessageBox(0, swzText, _T("tip"), MB_OK);
TCHAR buff[2048], *swzText = pwd->clcit.text;
int buff_pos, i = 0, size = _tcslen(pwd->clcit.text);
bool top_message = false;
if(swzText[0] != _T('<')) {
- while(swzText[i] != _T('\n') && swzText[i] != _T('\r') && i < size && i < 2048) {
- buff[i] = swzText[i];
- i++;
+ while(swzText[i] != _T('\n') && swzText[i] != _T('\r') && i < size && i < 2048) {
+ buff[i] = swzText[i];
+ i++;
}
buff[i] = 0;
@@ -123,7 +123,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
pwd->rows[pwd->row_count].line_above = false;
pwd->rows[pwd->row_count].value_newline = true;
pwd->rows[pwd->row_count].swzLabel = _tcsdup(_T(""));
- pwd->rows[pwd->row_count].swzValue = _tcsdup(buff);
+ pwd->rows[pwd->row_count].swzValue = _tcsdup(buff);
pwd->row_count++;
top_message = true;
}
@@ -314,7 +314,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
// text background
//SetBkColor(ps.hdc, options.bg_col);
- SetBkMode(hdc, TRANSPARENT);
+ SetBkMode(hdc, TRANSPARENT);
// avatar
if(!pwd->text_tip && options.av_layout != PAV_NONE && pwd->av_height) {
@@ -381,7 +381,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
SetTextColor(ps.hdc, options.title_col);
tr.top = r.top + options.padding; tr.bottom = tr.top + pwd->tb_height - options.padding;
- DrawText(ps.hdc, pwd->swzTitle, _tcslen(pwd->swzTitle), &tr, DT_VCENTER | DT_LEFT | DT_END_ELLIPSIS | DT_SINGLELINE | DT_NOPREFIX);
+ DrawText(ps.hdc, pwd->swzTitle, _tcslen(pwd->swzTitle), &tr, DT_VCENTER | DT_LEFT | DT_END_ELLIPSIS | DT_SINGLELINE | DT_NOPREFIX);
}
// values
@@ -465,25 +465,27 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
}
return 0;
case WM_DESTROY:
- KillTimer(hwnd, ID_TIMER_CHECKMOUSE);
- KillTimer(hwnd, ID_TIMER_ANIMATE);
- ShowWindow(hwnd, SW_HIDE);
-
- DeleteObject(pwd->bkBrush);
- DeleteObject(pwd->barBrush);
- DeleteObject(pwd->bPen);
- DeleteObject(pwd->dPen);
-
- for(int i = 0; i < pwd->row_count; i++) {
- free(pwd->rows[i].swzLabel);
- free(pwd->rows[i].swzValue);
- }
- free(pwd->rows);
+ {
+ KillTimer(hwnd, ID_TIMER_CHECKMOUSE);
+ KillTimer(hwnd, ID_TIMER_ANIMATE);
+ ShowWindow(hwnd, SW_HIDE);
+
+ DeleteObject(pwd->bkBrush);
+ DeleteObject(pwd->barBrush);
+ DeleteObject(pwd->bPen);
+ DeleteObject(pwd->dPen);
- free(pwd); pwd = 0;
- SetWindowLong(hwnd, GWL_USERDATA, 0);
+ for(int i = 0; i < pwd->row_count; i++) {
+ free(pwd->rows[i].swzLabel);
+ free(pwd->rows[i].swzValue);
+ }
+ free(pwd->rows);
+ free(pwd); pwd = 0;
+ SetWindowLong(hwnd, GWL_USERDATA, 0);
+ }
break;
+
case WM_TIMER:
if(wParam == ID_TIMER_ANIMATE) {
pwd->anim_step++;
@@ -671,7 +673,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
smr.left = r.left + options.padding + pwd->indent;
smr.right = r.right;
if(pwd->tb_height + pwd->text_height + options.text_padding < pwd->av_height)
- smr.right -= pwd->real_av_width + 2 * options.av_padding;
+ smr.right -= pwd->real_av_width + 2 * options.av_padding;
else
smr.right -= options.padding;
if(!pwd->rows[i].value_newline) smr.right -= pwd->label_width + options.padding;
@@ -699,7 +701,7 @@ LRESULT CALLBACK PopupWindowProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lPa
else
width = max(width, wid + options.padding);
}
-
+
pwd->text_height += pwd->rows[i].total_height;
}
}
@@ -827,3 +829,4 @@ int AvatarChanged(WPARAM wParam, LPARAM lParam) {
return 0;
}
+