MCPcopy Create free account
hub / github.com/NetHack/NetHack / CalculateCellSize

Function CalculateCellSize

outdated/sys/wince/mhcmd.c:1152–1181  ·  view source on GitHub ↗

-------------------------------------------------------------------------*/

Source from the content-addressed store, hash-verified

1150}
1151/*-------------------------------------------------------------------------*/
1152void
1153CalculateCellSize(HWND hWnd, LPSIZE pSize, LPSIZE pWindowSize)
1154{
1155 HDC hdc;
1156 PNHCmdWindow data;
1157 data = (PNHCmdWindow) GetWindowLong(hWnd, GWL_USERDATA);
1158 if (!data)
1159 return;
1160
1161 hdc = GetDC(hWnd);
1162
1163 /* if windows size is specified - attempt ro stretch cells across
1164 the window size. If not - make default cell size based on
1165 10 points font. Make sure that cell cesize does not exceeds 20 points
1166 */
1167 if (pWindowSize->cx > 0)
1168 pSize->cx =
1169 pWindowSize->cx / nhcmdlayout_columns(data->layout_current);
1170 else
1171 pSize->cx = 10 * GetDeviceCaps(hdc, LOGPIXELSX) / 72;
1172 pSize->cx = min(pSize->cx, 20 * GetDeviceCaps(hdc, LOGPIXELSX) / 72);
1173
1174 if (pWindowSize->cy > 0)
1175 pSize->cy = pWindowSize->cy / nhcmdlayout_rows(data->layout_current);
1176 else
1177 pSize->cy = 10 * GetDeviceCaps(hdc, LOGPIXELSY) / 72;
1178 pSize->cy = min(pSize->cy, 20 * GetDeviceCaps(hdc, LOGPIXELSY) / 72);
1179
1180 ReleaseDC(hWnd, hdc);
1181}
1182/*-------------------------------------------------------------------------*/
1183void
1184HighlightCell(HWND hWnd, int cell, BOOL isSelected)

Callers 2

LayoutCmdWindowFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected