mirror of
git://git.tartarus.org/simon/puzzles.git
synced 2025-04-20 23:51:29 -07:00
Replace TRUE/FALSE with C99 true/false throughout.
This commit removes the old #defines of TRUE and FALSE from puzzles.h, and does a mechanical search-and-replace throughout the code to replace them with the C99 standard lowercase spellings.
This commit is contained in:
112
windows.c
112
windows.c
@ -114,7 +114,7 @@ LPCSTR getenv(LPCSTR buf)
|
||||
|
||||
BOOL GetKeyboardState(PBYTE pb)
|
||||
{
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
|
||||
static TCHAR wClassName[256], wGameName[256];
|
||||
@ -656,7 +656,7 @@ static void win_draw_rect(void *handle, int x, int y, int w, int h, int colour)
|
||||
SetPixel(fe->hdc, x, y, fe->colours[colour]);
|
||||
} else {
|
||||
win_set_brush(fe, colour);
|
||||
win_set_pen(fe, colour, TRUE);
|
||||
win_set_pen(fe, colour, true);
|
||||
p = win_transform_point(fe, x, y);
|
||||
q = win_transform_point(fe, x+w, y+h);
|
||||
Rectangle(fe->hdc, p.x, p.y, q.x, q.y);
|
||||
@ -673,7 +673,7 @@ static void win_draw_line(void *handle, int x1, int y1, int x2, int y2, int colo
|
||||
if (fe->drawstatus == NOTHING)
|
||||
return;
|
||||
|
||||
win_set_pen(fe, colour, FALSE);
|
||||
win_set_pen(fe, colour, false);
|
||||
pp[0] = win_transform_point(fe, x1, y1);
|
||||
pp[1] = win_transform_point(fe, x2, y2);
|
||||
Polyline(fe->hdc, pp, 2);
|
||||
@ -698,7 +698,7 @@ static void win_draw_circle(void *handle, int cx, int cy, int radius,
|
||||
else
|
||||
fe->oldbr = SelectObject(fe->hdc, GetStockObject(NULL_BRUSH));
|
||||
|
||||
win_set_pen(fe, outlinecolour, FALSE);
|
||||
win_set_pen(fe, outlinecolour, false);
|
||||
p = win_transform_point(fe, cx - radius, cy - radius);
|
||||
q = win_transform_point(fe, cx + radius, cy + radius);
|
||||
Ellipse(fe->hdc, p.x, p.y, q.x+1, q.y+1);
|
||||
@ -727,12 +727,12 @@ static void win_draw_polygon(void *handle, int *coords, int npoints,
|
||||
|
||||
if (fillcolour >= 0) {
|
||||
win_set_brush(fe, fillcolour);
|
||||
win_set_pen(fe, outlinecolour, FALSE);
|
||||
win_set_pen(fe, outlinecolour, false);
|
||||
Polygon(fe->hdc, pts, npoints);
|
||||
win_reset_brush(fe);
|
||||
win_reset_pen(fe);
|
||||
} else {
|
||||
win_set_pen(fe, outlinecolour, FALSE);
|
||||
win_set_pen(fe, outlinecolour, false);
|
||||
Polyline(fe->hdc, pts, npoints+1);
|
||||
win_reset_pen(fe);
|
||||
}
|
||||
@ -772,7 +772,7 @@ static void win_draw_update(void *handle, int x, int y, int w, int h)
|
||||
r.bottom = y + h;
|
||||
|
||||
OffsetRect(&r, fe->bitmapPosition.left, fe->bitmapPosition.top);
|
||||
InvalidateRect(fe->hwnd, &r, FALSE);
|
||||
InvalidateRect(fe->hwnd, &r, false);
|
||||
}
|
||||
|
||||
static void win_end_draw(void *handle)
|
||||
@ -900,7 +900,7 @@ static void win_begin_puzzle(void *handle, float xm, float xc,
|
||||
fe->printpixelscale = scale;
|
||||
|
||||
fe->linewidth = 1;
|
||||
fe->linedotted = FALSE;
|
||||
fe->linedotted = false;
|
||||
}
|
||||
|
||||
static void win_end_puzzle(void *handle)
|
||||
@ -1222,9 +1222,9 @@ static void init_help(void)
|
||||
strcpy(r, HELP_CNT_NAME);
|
||||
if ( (fp = fopen(b, "r")) != NULL) {
|
||||
fclose(fp);
|
||||
help_has_contents = TRUE;
|
||||
help_has_contents = true;
|
||||
} else
|
||||
help_has_contents = FALSE;
|
||||
help_has_contents = false;
|
||||
|
||||
return;
|
||||
}
|
||||
@ -1256,7 +1256,7 @@ static void start_help(frontend *fe, const char *topic)
|
||||
cmd = HELP_CONTENTS;
|
||||
}
|
||||
WinHelp(fe->hwnd, help_path, cmd, (DWORD)str);
|
||||
fe->help_running = TRUE;
|
||||
fe->help_running = true;
|
||||
break;
|
||||
case CHM:
|
||||
#ifndef NO_HTMLHELP
|
||||
@ -1269,7 +1269,7 @@ static void start_help(frontend *fe, const char *topic)
|
||||
str = dupstr(help_path);
|
||||
}
|
||||
htmlhelp(fe->hwnd, str, HH_DISPLAY_TOPIC, 0);
|
||||
fe->help_running = TRUE;
|
||||
fe->help_running = true;
|
||||
break;
|
||||
#endif /* NO_HTMLHELP */
|
||||
case NONE:
|
||||
@ -1300,7 +1300,7 @@ static void stop_help(frontend *fe)
|
||||
assert(!"This shouldn't happen");
|
||||
break;
|
||||
}
|
||||
fe->help_running = FALSE;
|
||||
fe->help_running = false;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1376,7 +1376,7 @@ static int check_window_resize(frontend *fe, int cx, int cy,
|
||||
* See if we actually got the window size we wanted, and adjust
|
||||
* the puzzle size if not.
|
||||
*/
|
||||
midend_size(fe->me, &x, &y, TRUE);
|
||||
midend_size(fe->me, &x, &y, true);
|
||||
if (x != cx || y != cy) {
|
||||
/*
|
||||
* Resize the window, now we know what size we _really_
|
||||
@ -1385,7 +1385,7 @@ static int check_window_resize(frontend *fe, int cx, int cy,
|
||||
r.left = r.top = 0;
|
||||
r.right = x;
|
||||
r.bottom = y + sy;
|
||||
AdjustWindowRectEx(&r, WINFLAGS, TRUE, 0);
|
||||
AdjustWindowRectEx(&r, WINFLAGS, true, 0);
|
||||
*wx = r.right - r.left;
|
||||
*wy = r.bottom - r.top;
|
||||
changed = 1;
|
||||
@ -1430,14 +1430,14 @@ static void get_max_puzzle_size(frontend *fe, int *x, int *y)
|
||||
{
|
||||
RECT r, sr;
|
||||
|
||||
if (SystemParametersInfo(SPI_GETWORKAREA, 0, &sr, FALSE)) {
|
||||
if (SystemParametersInfo(SPI_GETWORKAREA, 0, &sr, false)) {
|
||||
*x = sr.right - sr.left;
|
||||
*y = sr.bottom - sr.top;
|
||||
r.left = 100;
|
||||
r.right = 200;
|
||||
r.top = 100;
|
||||
r.bottom = 200;
|
||||
AdjustWindowRectEx(&r, WINFLAGS, TRUE, 0);
|
||||
AdjustWindowRectEx(&r, WINFLAGS, true, 0);
|
||||
*x -= r.right - r.left - 100;
|
||||
*y -= r.bottom - r.top - 100;
|
||||
} else {
|
||||
@ -1485,7 +1485,7 @@ static frontend *frontend_new(HINSTANCE inst)
|
||||
fe->timer = 0;
|
||||
fe->hwnd = NULL;
|
||||
|
||||
fe->help_running = FALSE;
|
||||
fe->help_running = false;
|
||||
|
||||
fe->drawstatus = NOTHING;
|
||||
fe->dr = NULL;
|
||||
@ -1523,7 +1523,7 @@ static frontend *frontend_new(HINSTANCE inst)
|
||||
GetWindowRect(fe->hwnd, &rc);
|
||||
GetWindowRect(mbi.hwndMB, &rcBar);
|
||||
rc.bottom -= rcBar.bottom - rcBar.top;
|
||||
MoveWindow(fe->hwnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, FALSE);
|
||||
MoveWindow(fe->hwnd, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, false);
|
||||
|
||||
fe->numpad = NULL;
|
||||
}
|
||||
@ -1757,12 +1757,12 @@ static int fe_set_midend(frontend *fe, midend *me)
|
||||
fe->statusbar = NULL;
|
||||
|
||||
get_max_puzzle_size(fe, &x, &y);
|
||||
midend_size(fe->me, &x, &y, FALSE);
|
||||
midend_size(fe->me, &x, &y, false);
|
||||
|
||||
r.left = r.top = 0;
|
||||
r.right = x;
|
||||
r.bottom = y;
|
||||
AdjustWindowRectEx(&r, WINFLAGS, TRUE, 0);
|
||||
AdjustWindowRectEx(&r, WINFLAGS, true, 0);
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
if (fe->numpad)
|
||||
@ -1781,7 +1781,7 @@ static int fe_set_midend(frontend *fe, midend *me)
|
||||
rcClient.bottom - (rcTB.bottom - rcTB.top) - 1,
|
||||
rcClient.right,
|
||||
rcTB.bottom - rcTB.top,
|
||||
FALSE);
|
||||
false);
|
||||
SendMessage(fe->numpad, TB_SETINDENT, (rcClient.right - (10 * 21)) / 2, 0);
|
||||
}
|
||||
else {
|
||||
@ -1803,7 +1803,7 @@ static int fe_set_midend(frontend *fe, midend *me)
|
||||
fe->hwnd, NULL, fe->inst, NULL);
|
||||
#ifdef _WIN32_WCE
|
||||
/* Flat status bar looks better on the Pocket PC */
|
||||
SendMessage(fe->statusbar, SB_SIMPLE, (WPARAM) TRUE, 0);
|
||||
SendMessage(fe->statusbar, SB_SIMPLE, (WPARAM) true, 0);
|
||||
SendMessage(fe->statusbar, SB_SETTEXT,
|
||||
(WPARAM) 255 | SBT_NOBORDERS,
|
||||
(LPARAM) L"");
|
||||
@ -2013,7 +2013,7 @@ static int CALLBACK AboutDlgProc(HWND hwnd, UINT msg,
|
||||
SetDlgItemTextA(hwnd, IDC_ABOUT_VERSION, ver);
|
||||
}
|
||||
#endif
|
||||
return TRUE;
|
||||
return true;
|
||||
|
||||
case WM_COMMAND:
|
||||
if (LOWORD(wParam) == IDOK)
|
||||
@ -2078,18 +2078,18 @@ static config_item *frontend_get_config(frontend *fe, int which,
|
||||
|
||||
ret[i].name = "Include currently shown puzzle";
|
||||
ret[i].type = C_BOOLEAN;
|
||||
ret[i].u.boolean.bval = TRUE;
|
||||
ret[i].u.boolean.bval = true;
|
||||
i++;
|
||||
|
||||
ret[i].name = "Print solutions";
|
||||
ret[i].type = C_BOOLEAN;
|
||||
ret[i].u.boolean.bval = FALSE;
|
||||
ret[i].u.boolean.bval = false;
|
||||
i++;
|
||||
|
||||
if (fe->game->can_print_in_colour) {
|
||||
ret[i].name = "Print in colour";
|
||||
ret[i].type = C_BOOLEAN;
|
||||
ret[i].u.boolean.bval = FALSE;
|
||||
ret[i].u.boolean.bval = false;
|
||||
i++;
|
||||
}
|
||||
|
||||
@ -2270,7 +2270,7 @@ static int CALLBACK ConfigDlgProc(HWND hwnd, UINT msg,
|
||||
create_config_controls(fe);
|
||||
}
|
||||
#endif
|
||||
return TRUE;
|
||||
return true;
|
||||
|
||||
case WM_COMMAND:
|
||||
/*
|
||||
@ -2352,7 +2352,7 @@ HWND mkctrl(frontend *fe, int x1, int x2, int y1, int y2,
|
||||
ret = CreateWindowEx(exstyle, wclass, wtext,
|
||||
wstyle | WS_CHILD | WS_VISIBLE, x1, y1, x2-x1, y2-y1,
|
||||
fe->cfgbox, (HMENU) wid, fe->inst, NULL);
|
||||
SendMessage(ret, WM_SETFONT, (WPARAM)fe->cfgfont, MAKELPARAM(TRUE, 0));
|
||||
SendMessage(ret, WM_SETFONT, (WPARAM)fe->cfgfont, MAKELPARAM(true, 0));
|
||||
return ret;
|
||||
}
|
||||
#endif
|
||||
@ -2398,11 +2398,11 @@ static void about(frontend *fe)
|
||||
hdc = GetDC(fe->hwnd);
|
||||
SetMapMode(hdc, MM_TEXT);
|
||||
|
||||
fe->dlg_done = FALSE;
|
||||
fe->dlg_done = false;
|
||||
|
||||
fe->cfgfont = CreateFont(-MulDiv(8, GetDeviceCaps(hdc, LOGPIXELSY), 72),
|
||||
0, 0, 0, 0,
|
||||
FALSE, FALSE, FALSE, DEFAULT_CHARSET,
|
||||
false, false, false, DEFAULT_CHARSET,
|
||||
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
|
||||
DEFAULT_QUALITY,
|
||||
FF_SWISS,
|
||||
@ -2453,7 +2453,7 @@ static void about(frontend *fe)
|
||||
DS_MODALFRAME | WS_POPUP | WS_VISIBLE |
|
||||
WS_CAPTION | WS_SYSMENU*/) &~
|
||||
(WS_MAXIMIZEBOX | WS_OVERLAPPED),
|
||||
FALSE, 0);
|
||||
false, 0);
|
||||
|
||||
/*
|
||||
* Centre the dialog on its parent window.
|
||||
@ -2474,7 +2474,7 @@ static void about(frontend *fe)
|
||||
fe->hwnd, NULL, fe->inst, NULL);
|
||||
}
|
||||
|
||||
SendMessage(fe->cfgbox, WM_SETFONT, (WPARAM)fe->cfgfont, FALSE);
|
||||
SendMessage(fe->cfgbox, WM_SETFONT, (WPARAM)fe->cfgfont, false);
|
||||
|
||||
SetWindowLongPtr(fe->cfgbox, GWLP_USERDATA, (LONG_PTR)fe);
|
||||
SetWindowLongPtr(fe->cfgbox, DWLP_DLGPROC, (LONG_PTR)AboutDlgProc);
|
||||
@ -2498,7 +2498,7 @@ static void about(frontend *fe)
|
||||
|
||||
SendMessage(fe->cfgbox, WM_INITDIALOG, 0, 0);
|
||||
|
||||
EnableWindow(fe->hwnd, FALSE);
|
||||
EnableWindow(fe->hwnd, false);
|
||||
ShowWindow(fe->cfgbox, SW_SHOWNORMAL);
|
||||
while ((gm=GetMessage(&msg, NULL, 0, 0)) > 0) {
|
||||
if (!IsDialogMessage(fe->cfgbox, &msg))
|
||||
@ -2506,7 +2506,7 @@ static void about(frontend *fe)
|
||||
if (fe->dlg_done)
|
||||
break;
|
||||
}
|
||||
EnableWindow(fe->hwnd, TRUE);
|
||||
EnableWindow(fe->hwnd, true);
|
||||
SetForegroundWindow(fe->hwnd);
|
||||
DestroyWindow(fe->cfgbox);
|
||||
DeleteObject(fe->cfgfont);
|
||||
@ -2552,11 +2552,11 @@ static int get_config(frontend *fe, int which)
|
||||
hdc = GetDC(fe->hwnd);
|
||||
SetMapMode(hdc, MM_TEXT);
|
||||
|
||||
fe->dlg_done = FALSE;
|
||||
fe->dlg_done = false;
|
||||
|
||||
fe->cfgfont = CreateFont(-MulDiv(8, GetDeviceCaps(hdc, LOGPIXELSY), 72),
|
||||
0, 0, 0, 0,
|
||||
FALSE, FALSE, FALSE, DEFAULT_CHARSET,
|
||||
false, false, false, DEFAULT_CHARSET,
|
||||
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
|
||||
DEFAULT_QUALITY,
|
||||
FF_SWISS,
|
||||
@ -2633,7 +2633,7 @@ static int get_config(frontend *fe, int which)
|
||||
DS_MODALFRAME | WS_POPUP | WS_VISIBLE |
|
||||
WS_CAPTION | WS_SYSMENU*/) &~
|
||||
(WS_MAXIMIZEBOX | WS_OVERLAPPED),
|
||||
FALSE, 0);
|
||||
false, 0);
|
||||
|
||||
/*
|
||||
* Centre the dialog on its parent window.
|
||||
@ -2655,7 +2655,7 @@ static int get_config(frontend *fe, int which)
|
||||
sfree(title);
|
||||
}
|
||||
|
||||
SendMessage(fe->cfgbox, WM_SETFONT, (WPARAM)fe->cfgfont, FALSE);
|
||||
SendMessage(fe->cfgbox, WM_SETFONT, (WPARAM)fe->cfgfont, false);
|
||||
|
||||
SetWindowLongPtr(fe->cfgbox, GWLP_USERDATA, (LONG_PTR)fe);
|
||||
SetWindowLongPtr(fe->cfgbox, DWLP_DLGPROC, (LONG_PTR)ConfigDlgProc);
|
||||
@ -2745,7 +2745,7 @@ static int get_config(frontend *fe, int which)
|
||||
|
||||
SendMessage(fe->cfgbox, WM_INITDIALOG, 0, 0);
|
||||
|
||||
EnableWindow(fe->hwnd, FALSE);
|
||||
EnableWindow(fe->hwnd, false);
|
||||
ShowWindow(fe->cfgbox, SW_SHOWNORMAL);
|
||||
while ((gm=GetMessage(&msg, NULL, 0, 0)) > 0) {
|
||||
if (!IsDialogMessage(fe->cfgbox, &msg))
|
||||
@ -2753,7 +2753,7 @@ static int get_config(frontend *fe, int which)
|
||||
if (fe->dlg_done)
|
||||
break;
|
||||
}
|
||||
EnableWindow(fe->hwnd, TRUE);
|
||||
EnableWindow(fe->hwnd, true);
|
||||
SetForegroundWindow(fe->hwnd);
|
||||
DestroyWindow(fe->cfgbox);
|
||||
DeleteObject(fe->cfgfont);
|
||||
@ -2822,19 +2822,19 @@ static void new_game_size(frontend *fe, float scale)
|
||||
int x, y;
|
||||
|
||||
get_max_puzzle_size(fe, &x, &y);
|
||||
midend_size(fe->me, &x, &y, FALSE);
|
||||
midend_size(fe->me, &x, &y, false);
|
||||
|
||||
if (scale != 1.0) {
|
||||
x = (int)((float)x * fe->puzz_scale);
|
||||
y = (int)((float)y * fe->puzz_scale);
|
||||
midend_size(fe->me, &x, &y, TRUE);
|
||||
midend_size(fe->me, &x, &y, true);
|
||||
}
|
||||
fe->ymin = (fe->xmin * y) / x;
|
||||
|
||||
r.left = r.top = 0;
|
||||
r.right = x;
|
||||
r.bottom = y;
|
||||
AdjustWindowRectEx(&r, WINFLAGS, TRUE, 0);
|
||||
AdjustWindowRectEx(&r, WINFLAGS, true, 0);
|
||||
|
||||
if (fe->statusbar != NULL) {
|
||||
GetWindowRect(fe->statusbar, &sr);
|
||||
@ -2859,7 +2859,7 @@ static void new_game_size(frontend *fe, float scale)
|
||||
new_bitmap(fe, x, y);
|
||||
|
||||
#ifdef _WIN32_WCE
|
||||
InvalidateRect(fe->hwnd, NULL, TRUE);
|
||||
InvalidateRect(fe->hwnd, NULL, true);
|
||||
#endif
|
||||
midend_redraw(fe->me);
|
||||
}
|
||||
@ -2881,7 +2881,7 @@ static void adjust_game_size(frontend *fe, RECT *proposed, int isedge,
|
||||
* difference in size we're asking for. */
|
||||
GetClientRect(fe->hwnd, &cr);
|
||||
wr = cr;
|
||||
AdjustWindowRectEx(&wr, WINFLAGS, TRUE, 0);
|
||||
AdjustWindowRectEx(&wr, WINFLAGS, true, 0);
|
||||
|
||||
xdiff = (proposed->right - proposed->left) - (wr.right - wr.left);
|
||||
ydiff = (proposed->bottom - proposed->top) - (wr.bottom - wr.top);
|
||||
@ -2963,12 +2963,12 @@ static int is_alt_pressed(void)
|
||||
BYTE keystate[256];
|
||||
int r = GetKeyboardState(keystate);
|
||||
if (!r)
|
||||
return FALSE;
|
||||
return false;
|
||||
if (keystate[VK_MENU] & 0x80)
|
||||
return TRUE;
|
||||
return true;
|
||||
if (keystate[VK_RMENU] & 0x80)
|
||||
return TRUE;
|
||||
return FALSE;
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
||||
@ -3139,7 +3139,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
||||
"supported by this program";
|
||||
} else {
|
||||
me = midend_for_new_game(fe, gamelist[i], NULL,
|
||||
FALSE, FALSE, &err_w);
|
||||
false, false, &err_w);
|
||||
err = err_w;
|
||||
rewind(fp); /* for the actual load */
|
||||
}
|
||||
@ -3181,7 +3181,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
||||
int p = wParam - IDM_GAMES;
|
||||
char *error = NULL;
|
||||
fe_set_midend(fe, midend_for_new_game(fe, gamelist[p], NULL,
|
||||
FALSE, FALSE, &error));
|
||||
false, false, &error));
|
||||
sfree(error);
|
||||
} else
|
||||
#endif
|
||||
@ -3456,7 +3456,7 @@ static LRESULT CALLBACK WndProc(HWND hwnd, UINT message,
|
||||
} else {
|
||||
sr->right = sr->left + wx;
|
||||
}
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
#endif
|
||||
@ -3475,10 +3475,10 @@ static int FindPreviousInstance()
|
||||
if (hOtherWnd)
|
||||
{
|
||||
SetForegroundWindow (hOtherWnd);
|
||||
return TRUE;
|
||||
return true;
|
||||
}
|
||||
|
||||
return FALSE;
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
@ -3785,7 +3785,7 @@ int WINAPI WinMain(HINSTANCE inst, HINSTANCE prev, LPSTR cmdline, int show)
|
||||
|
||||
fe = frontend_new(inst);
|
||||
me = midend_for_new_game(fe, gg, argc > 0 ? argv[0] : NULL,
|
||||
TRUE, TRUE, &error);
|
||||
true, true, &error);
|
||||
if (!me) {
|
||||
char buf[128];
|
||||
#ifdef COMBINED
|
||||
|
Reference in New Issue
Block a user