Some programs switch their status bar back and forth from simple mode

while running. This fix corrects drawing and text setting problems that
result from this behavior.
This commit is contained in:
Aric Stewart 2000-05-10 01:33:20 +00:00 committed by Alexandre Julliard
parent 62030ff465
commit 7b6ed869db
1 changed files with 18 additions and 36 deletions

View File

@ -185,7 +185,7 @@ STATUSBAR_Refresh (HWND hwnd, HDC hdc)
hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont); hOldFont = SelectObject (hdc, infoPtr->hFont ? infoPtr->hFont : infoPtr->hDefaultFont);
if (infoPtr->simple) { if (infoPtr->simple) {
STATUSBAR_DrawPart (hdc, &infoPtr->part0); STATUSBAR_RefreshPart (hwnd, &infoPtr->part0,hdc,0);
} }
else { else {
for (i = 0; i < infoPtr->numParts; i++) { for (i = 0; i < infoPtr->numParts; i++) {
@ -202,7 +202,7 @@ STATUSBAR_Refresh (HWND hwnd, HDC hdc)
(WPARAM)dis.CtlID, (LPARAM)&dis); (WPARAM)dis.CtlID, (LPARAM)&dis);
} }
else else
STATUSBAR_DrawPart (hdc, &infoPtr->parts[i]); STATUSBAR_RefreshPart (hwnd, &infoPtr->parts[i], hdc,i);
} }
} }
@ -486,13 +486,10 @@ STATUSBAR_SetBkColor (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (hwnd); STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (hwnd);
COLORREF oldBkColor; COLORREF oldBkColor;
HDC hdc;
oldBkColor = self->clrBk; oldBkColor = self->clrBk;
self->clrBk = (COLORREF)lParam; self->clrBk = (COLORREF)lParam;
hdc = GetDC (hwnd); RedrawWindow(hwnd,(RECT*)NULL,(HRGN)NULL,RDW_INVALIDATE|RDW_UPDATENOW);
STATUSBAR_Refresh (hwnd, hdc);
ReleaseDC (hwnd, hdc);
return oldBkColor; return oldBkColor;
} }
@ -512,12 +509,14 @@ STATUSBAR_SetIcon (HWND hwnd, WPARAM wParam, LPARAM lParam)
if (nPart == -1) { if (nPart == -1) {
self->part0.hIcon = (HICON)lParam; self->part0.hIcon = (HICON)lParam;
if (self->simple) if (self->simple)
STATUSBAR_RefreshPart (hwnd, &self->part0, hdc, 0); RedrawWindow(hwnd, &self->part0.bound,(HRGN)NULL,
RDW_INVALIDATE|RDW_UPDATENOW);
} }
else { else {
self->parts[nPart].hIcon = (HICON)lParam; self->parts[nPart].hIcon = (HICON)lParam;
if (!(self->simple)) if (!(self->simple))
STATUSBAR_RefreshPart (hwnd, &self->parts[nPart], hdc, nPart); RedrawWindow(hwnd,&self->parts[nPart].bound,(HRGN)NULL,
RDW_INVALIDATE|RDW_UPDATENOW);
} }
ReleaseDC (hwnd, hdc); ReleaseDC (hwnd, hdc);
@ -555,7 +554,6 @@ STATUSBAR_SetParts (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (hwnd); STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (hwnd);
STATUSWINDOWPART *tmp; STATUSWINDOWPART *tmp;
HDC hdc;
LPINT parts; LPINT parts;
int i; int i;
int oldNumParts; int oldNumParts;
@ -619,9 +617,7 @@ STATUSBAR_SetParts (HWND hwnd, WPARAM wParam, LPARAM lParam)
STATUSBAR_SetPartBounds (hwnd); STATUSBAR_SetPartBounds (hwnd);
hdc = GetDC (hwnd); RedrawWindow(hwnd,(RECT*)NULL,(HRGN)NULL,RDW_INVALIDATE|RDW_UPDATENOW);
STATUSBAR_Refresh (hwnd, hdc);
ReleaseDC (hwnd, hdc);
return TRUE; return TRUE;
} }
@ -631,20 +627,19 @@ static LRESULT
STATUSBAR_SetTextA (HWND hwnd, WPARAM wParam, LPARAM lParam) STATUSBAR_SetTextA (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (hwnd); STATUSWINDOWINFO *self = STATUSBAR_GetInfoPtr (hwnd);
STATUSWINDOWPART *part; STATUSWINDOWPART *part=NULL;
int part_num; int part_num;
int style; int style;
LPSTR text; LPSTR text;
int len; int len;
HDC hdc;
text = (LPSTR) lParam; text = (LPSTR) lParam;
part_num = ((INT) wParam) & 0x00ff; part_num = ((INT) wParam) & 0x00ff;
style = ((INT) wParam) & 0xff00; style = ((INT) wParam) & 0xff00;
if ((self->simple) || (self->parts==NULL) || (part_num==255)) if (part_num==255)
part = &self->part0; part = &self->part0;
else else if (!self->simple && self->parts!=NULL)
part = &self->parts[part_num]; part = &self->parts[part_num];
if (!part) return FALSE; if (!part) return FALSE;
@ -664,9 +659,7 @@ STATUSBAR_SetTextA (HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
part->style = style; part->style = style;
hdc = GetDC (hwnd); RedrawWindow(hwnd,&part->bound,(HRGN)NULL,RDW_INVALIDATE|RDW_UPDATENOW);
STATUSBAR_RefreshPart (hwnd, part, hdc, part_num);
ReleaseDC (hwnd, hdc);
return TRUE; return TRUE;
} }
@ -679,7 +672,6 @@ STATUSBAR_SetTextW (HWND hwnd, WPARAM wParam, LPARAM lParam)
STATUSWINDOWPART *part; STATUSWINDOWPART *part;
INT part_num, style, len; INT part_num, style, len;
LPWSTR text; LPWSTR text;
HDC hdc;
text = (LPWSTR) lParam; text = (LPWSTR) lParam;
part_num = ((INT) wParam) & 0x00ff; part_num = ((INT) wParam) & 0x00ff;
@ -707,9 +699,7 @@ STATUSBAR_SetTextW (HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
part->style = style; part->style = style;
hdc = GetDC (hwnd); RedrawWindow(hwnd,&part->bound,(HRGN)NULL,RDW_INVALIDATE|RDW_UPDATENOW);
STATUSBAR_RefreshPart (hwnd, part, hdc, part_num);
ReleaseDC (hwnd, hdc);
return TRUE; return TRUE;
} }
@ -774,7 +764,6 @@ static LRESULT
STATUSBAR_Simple (HWND hwnd, WPARAM wParam, LPARAM lParam) STATUSBAR_Simple (HWND hwnd, WPARAM wParam, LPARAM lParam)
{ {
STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (hwnd); STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (hwnd);
HDC hdc;
NMHDR nmhdr; NMHDR nmhdr;
infoPtr->simple = (BOOL)wParam; infoPtr->simple = (BOOL)wParam;
@ -785,9 +774,7 @@ STATUSBAR_Simple (HWND hwnd, WPARAM wParam, LPARAM lParam)
nmhdr.code = SBN_SIMPLEMODECHANGE; nmhdr.code = SBN_SIMPLEMODECHANGE;
SendMessageA (GetParent (hwnd), WM_NOTIFY, 0, (LPARAM)&nmhdr); SendMessageA (GetParent (hwnd), WM_NOTIFY, 0, (LPARAM)&nmhdr);
hdc = GetDC (hwnd); RedrawWindow(hwnd,(RECT*)NULL,(HRGN)NULL,RDW_INVALIDATE|RDW_UPDATENOW);
STATUSBAR_Refresh (hwnd, hdc);
ReleaseDC (hwnd, hdc);
return TRUE; return TRUE;
} }
@ -1021,11 +1008,9 @@ STATUSBAR_WMSetFont (HWND hwnd, WPARAM wParam, LPARAM lParam)
STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (hwnd); STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (hwnd);
infoPtr->hFont = (HFONT)wParam; infoPtr->hFont = (HFONT)wParam;
if (LOWORD(lParam) == TRUE) { if (LOWORD(lParam) == TRUE)
HDC hdc = GetDC (hwnd); RedrawWindow(hwnd,(RECT*)NULL,(HRGN)NULL,
STATUSBAR_Refresh (hwnd, hdc); RDW_INVALIDATE|RDW_UPDATENOW);
ReleaseDC (hwnd, hdc);
}
return 0; return 0;
} }
@ -1037,7 +1022,6 @@ STATUSBAR_WMSetText (HWND hwnd, WPARAM wParam, LPARAM lParam)
STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (hwnd); STATUSWINDOWINFO *infoPtr = STATUSBAR_GetInfoPtr (hwnd);
STATUSWINDOWPART *part; STATUSWINDOWPART *part;
int len; int len;
HDC hdc;
if (infoPtr->numParts == 0) if (infoPtr->numParts == 0)
return FALSE; return FALSE;
@ -1060,9 +1044,7 @@ STATUSBAR_WMSetText (HWND hwnd, WPARAM wParam, LPARAM lParam)
} }
} }
hdc = GetDC (hwnd); RedrawWindow(hwnd,&part->bound,(HRGN)NULL,RDW_INVALIDATE|RDW_UPDATENOW);
STATUSBAR_RefreshPart (hwnd, part, hdc, 0);
ReleaseDC (hwnd, hdc);
return TRUE; return TRUE;
} }