Rename TextWindow::CHAR_WIDTH to CHAR_WIDTH_.

glibc defines a CHAR_WIDTH macro in limits.h since about 6.3.*.
This is apparently added as a part of ISO TS 18661-1:2014, which
I cannot read because it is not publicly available, and which covers
some sort of floating-point extensions. This is one of those changes
that should never have been done yet here we are.
pull/238/head
whitequark 2017-04-06 06:54:07 +00:00
parent b0ea9d8eb4
commit 7eb6574f90
3 changed files with 13 additions and 13 deletions

View File

@ -171,7 +171,7 @@ void SolveSpace::DoMessageBox(const char *str, int rows, int cols, bool error)
MessageString = str; MessageString = str;
RECT r; RECT r;
GetWindowRect(GraphicsWnd, &r); GetWindowRect(GraphicsWnd, &r);
int width = cols*SS.TW.CHAR_WIDTH + 20, int width = cols*SS.TW.CHAR_WIDTH_ + 20,
height = rows*SS.TW.LINE_HEIGHT + 60; height = rows*SS.TW.LINE_HEIGHT + 60;
MessageWidth = width; MessageWidth = width;
MessageHeight = height; MessageHeight = height;
@ -595,7 +595,7 @@ LRESULT CALLBACK TextWndProc(HWND hwnd, UINT msg, WPARAM wParam, LPARAM lParam)
r->top += extra; r->top += extra;
break; break;
} }
int tooNarrow = (SS.TW.MIN_COLS*SS.TW.CHAR_WIDTH) - int tooNarrow = (SS.TW.MIN_COLS*SS.TW.CHAR_WIDTH_) -
(r->right - r->left); (r->right - r->left);
if(tooNarrow >= 0) { if(tooNarrow >= 0) {
switch(wParam) { switch(wParam) {
@ -1499,7 +1499,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
InitCommonControls(); InitCommonControls();
// A monospaced font // A monospaced font
FixedFont = CreateFontW(SS.TW.CHAR_HEIGHT, SS.TW.CHAR_WIDTH, 0, 0, FixedFont = CreateFontW(SS.TW.CHAR_HEIGHT, SS.TW.CHAR_WIDTH_, 0, 0,
FW_REGULAR, false, FW_REGULAR, false,
false, false, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, false, false, ANSI_CHARSET, OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS,
DEFAULT_QUALITY, FF_DONTCARE, L"Lucida Console"); DEFAULT_QUALITY, FF_DONTCARE, L"Lucida Console");

View File

@ -259,7 +259,7 @@ void TextWindow::ShowEditControl(int col, const std::string &str, int halfRow) {
editControl.halfRow = halfRow; editControl.halfRow = halfRow;
editControl.col = col; editControl.col = col;
int x = LEFT_MARGIN + CHAR_WIDTH*col; int x = LEFT_MARGIN + CHAR_WIDTH_*col;
int y = (halfRow - SS.TW.scrollPos)*(LINE_HEIGHT/2); int y = (halfRow - SS.TW.scrollPos)*(LINE_HEIGHT/2);
ShowTextEditControl(x, y + 18, str); ShowTextEditControl(x, y + 18, str);
@ -574,7 +574,7 @@ void TextWindow::DrawOrHitTestIcons(UiCanvas *uiCanvas, TextWindow::DrawOrHitHow
int ox = (int)oldMousePos.x, oy = (int)oldMousePos.y - LINE_HEIGHT; int ox = (int)oldMousePos.x, oy = (int)oldMousePos.y - LINE_HEIGHT;
ox += 3; ox += 3;
oy -= 3; oy -= 3;
int tw = (tooltip.length() + 1) * (CHAR_WIDTH - 1); int tw = (tooltip.length() + 1) * (CHAR_WIDTH_ - 1);
ox = min(ox, (width - 25) - tw); ox = min(ox, (width - 25) - tw);
oy = max(oy, 5); oy = max(oy, 5);
@ -697,7 +697,7 @@ bool TextWindow::DrawOrHitTestColorPicker(UiCanvas *uiCanvas, DrawOrHitHow how,
int width, height; int width, height;
GetTextWindowSize(&width, &height); GetTextWindowSize(&width, &height);
int px = LEFT_MARGIN + CHAR_WIDTH*editControl.col; int px = LEFT_MARGIN + CHAR_WIDTH_*editControl.col;
int py = (editControl.halfRow - SS.TW.scrollPos)*(LINE_HEIGHT/2); int py = (editControl.halfRow - SS.TW.scrollPos)*(LINE_HEIGHT/2);
py += LINE_HEIGHT + 5; py += LINE_HEIGHT + 5;
@ -895,8 +895,8 @@ void TextWindow::Paint() {
if(ltop < (scrollPos-1)) continue; if(ltop < (scrollPos-1)) continue;
if(ltop > scrollPos+halfRows) break; if(ltop > scrollPos+halfRows) break;
for(c = 0; c < min((width/CHAR_WIDTH)+1, (int) MAX_COLS); c++) { for(c = 0; c < min((width/CHAR_WIDTH_)+1, (int) MAX_COLS); c++) {
int x = LEFT_MARGIN + c*CHAR_WIDTH; int x = LEFT_MARGIN + c*CHAR_WIDTH_;
int y = (ltop-scrollPos)*(LINE_HEIGHT/2) + 4; int y = (ltop-scrollPos)*(LINE_HEIGHT/2) + 4;
int fg = meta[r][c].fg; int fg = meta[r][c].fg;
@ -919,7 +919,7 @@ void TextWindow::Paint() {
if(bg != 'd') { if(bg != 'd') {
// Move the quad down a bit, so that the descenders // Move the quad down a bit, so that the descenders
// still have the correct background. // still have the correct background.
uiCanvas.DrawRect(x, x + CHAR_WIDTH, y + adj, y + adj + bh, uiCanvas.DrawRect(x, x + CHAR_WIDTH_, y + adj, y + adj + bh,
/*fillColor=*/bgRgb, /*outlineColor=*/{}); /*fillColor=*/bgRgb, /*outlineColor=*/{});
} }
} else if(a == 1) { } else if(a == 1) {
@ -966,8 +966,8 @@ void TextWindow::Paint() {
fgColorTable[fg*3+1], fgColorTable[fg*3+1],
fgColorTable[fg*3+2]); fgColorTable[fg*3+2]);
int yp = y + CHAR_HEIGHT; int yp = y + CHAR_HEIGHT;
uiCanvas.DrawLine(LEFT_MARGIN + cs*CHAR_WIDTH, yp, uiCanvas.DrawLine(LEFT_MARGIN + cs*CHAR_WIDTH_, yp,
LEFT_MARGIN + cf*CHAR_WIDTH, yp, LEFT_MARGIN + cf*CHAR_WIDTH_, yp,
fgRgb); fgRgb);
} }
} }
@ -1029,7 +1029,7 @@ void TextWindow::MouseEvent(bool leftClick, bool leftDown, double x, double y) {
hoveredCol = 0; hoveredCol = 0;
// Find the corresponding character in the text buffer // Find the corresponding character in the text buffer
int c = (int)((x - LEFT_MARGIN) / CHAR_WIDTH); int c = (int)((x - LEFT_MARGIN) / CHAR_WIDTH_);
int hh = (LINE_HEIGHT)/2; int hh = (LINE_HEIGHT)/2;
y += scrollPos*hh; y += scrollPos*hh;
int r; int r;

View File

@ -276,7 +276,7 @@ public:
float fgColorTable[256*3]; float fgColorTable[256*3];
enum { enum {
CHAR_WIDTH = 9, CHAR_WIDTH_ = 9,
CHAR_HEIGHT = 16, CHAR_HEIGHT = 16,
LINE_HEIGHT = 20, LINE_HEIGHT = 20,
LEFT_MARGIN = 6, LEFT_MARGIN = 6,