Added updateAll() and resolved WM_SETFONT to begin the final reasoning-through of update().
This commit is contained in:
parent
592ae7a987
commit
ce64650aad
|
@ -15,22 +15,17 @@ static void addColumn(struct table *t, WPARAM wParam, LPARAM lParam)
|
||||||
HANDLER(apiHandlers)
|
HANDLER(apiHandlers)
|
||||||
{
|
{
|
||||||
intptr_t *rcp;
|
intptr_t *rcp;
|
||||||
BOOL tfbool;
|
|
||||||
|
|
||||||
switch (uMsg) {
|
switch (uMsg) {
|
||||||
case WM_SETFONT:
|
case WM_SETFONT:
|
||||||
// don't free the old font; see http://blogs.msdn.com/b/oldnewthing/archive/2008/09/12/8945692.aspx
|
// don't free the old font; see http://blogs.msdn.com/b/oldnewthing/archive/2008/09/12/8945692.aspx
|
||||||
t->font = (HFONT) wParam;
|
t->font = (HFONT) wParam;
|
||||||
SendMessageW(t->header, WM_SETFONT, wParam, lParam);
|
SendMessageW(t->header, WM_SETFONT, wParam, lParam);
|
||||||
// let's ensure the values are strictly TRUE and FALSE just to be safe
|
// if we redraw, we have to redraw ALL of it; after all, the font changed!
|
||||||
tfbool = FALSE;
|
|
||||||
if (LOWORD(lParam) != FALSE)
|
if (LOWORD(lParam) != FALSE)
|
||||||
tfbool = TRUE;
|
updateAll(t); // DONE
|
||||||
update(t, tfbool);
|
else
|
||||||
// TODO is this needed?
|
update(t, FALSE); // DONE
|
||||||
if (tfbool != FALSE)
|
|
||||||
// TODO check error
|
|
||||||
InvalidateRect(t->hwnd, NULL, TRUE);
|
|
||||||
*lResult = 0;
|
*lResult = 0;
|
||||||
return TRUE;
|
return TRUE;
|
||||||
case WM_GETFONT:
|
case WM_GETFONT:
|
||||||
|
|
|
@ -103,8 +103,9 @@ struct table {
|
||||||
// forward declaration (TODO needed?)
|
// forward declaration (TODO needed?)
|
||||||
static LRESULT notify(struct table *, UINT, intptr_t, intptr_t, uintptr_t);
|
static LRESULT notify(struct table *, UINT, intptr_t, intptr_t, uintptr_t);
|
||||||
|
|
||||||
// necessary forward declaration
|
// necessary forward declarations
|
||||||
static void update(struct table *, BOOL);
|
static void update(struct table *, BOOL);
|
||||||
|
static void updateAll(struct table *);
|
||||||
|
|
||||||
#include "util.h"
|
#include "util.h"
|
||||||
#include "coord.h"
|
#include "coord.h"
|
||||||
|
|
|
@ -3,6 +3,8 @@
|
||||||
// Whenever a number of things in the Table changes, the update() function needs to be called to update any metrics and scrolling positions.
|
// Whenever a number of things in the Table changes, the update() function needs to be called to update any metrics and scrolling positions.
|
||||||
// The control font changing is the big one, as that comes with a flag that decides whether or not to redraw everything. We'll need to respect that here.
|
// The control font changing is the big one, as that comes with a flag that decides whether or not to redraw everything. We'll need to respect that here.
|
||||||
|
|
||||||
|
// For my personal convenience, each invocation of update() and updateAll() will be suffixed with a DONE comment once I have reasoned that the chosen function is correct and that no additional redrawing is necessary.
|
||||||
|
|
||||||
// TODO actually use redraw here
|
// TODO actually use redraw here
|
||||||
static void update(struct table *t, BOOL redraw)
|
static void update(struct table *t, BOOL redraw)
|
||||||
{
|
{
|
||||||
|
@ -39,6 +41,13 @@ static void update(struct table *t, BOOL redraw)
|
||||||
t->vpagesize = height / rowht(t);
|
t->vpagesize = height / rowht(t);
|
||||||
// and do a dummy vertical scroll to apply that
|
// and do a dummy vertical scroll to apply that
|
||||||
vscrollby(t, 0);
|
vscrollby(t, 0);
|
||||||
|
}
|
||||||
// TODO invalidate /everything/?
|
|
||||||
|
// this is the same as update(), but also redraws /everything/
|
||||||
|
// as such, redraw is TRUE
|
||||||
|
static void updateAll(struct table *t)
|
||||||
|
{
|
||||||
|
update(t, TRUE);
|
||||||
|
if (InvalidateRect(t, NULL, TRUE) == 0)
|
||||||
|
panic("error queueing all of Table for redraw in updateAll()");
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue