Delete all Trailing spaces in code.

svn path=/trunk/; revision=29688
This commit is contained in:
Daniel Reimer 2007-10-19 23:01:40 +00:00
parent dd02e006bb
commit 622c29bffb
161 changed files with 1944 additions and 1944 deletions

View file

@ -6,7 +6,7 @@
// Created by Damon Chandler <dmc27@ee.cornell.edu>
// Updates can be downloaded at: <www.coriolis.com>
//
// Please do not hesistate to e-mail me at dmc27@ee.cornell.edu
// Please do not hesistate to e-mail me at dmc27@ee.cornell.edu
// if you have any questions about this code.
// ------------------------------------------------------------------
@ -29,18 +29,18 @@ const int ID_LISTBOX = 101;
HINSTANCE hInst;
const char* WndClassName = "GMainWnd";
LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
LPARAM lParam);
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR,
int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR,
int nCmdShow)
{
hInst = hInstance;
WNDCLASS wc;
memset(&wc, 0, sizeof(WNDCLASS));
wc.style = CS_VREDRAW | CS_HREDRAW;
wc.lpszClassName = WndClassName;
wc.lpfnWndProc = MainWndProc;
@ -52,17 +52,17 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR,
if (RegisterClass(&wc))
{
HWND hWnd =
HWND hWnd =
CreateWindow(
WndClassName, TEXT("Font Enumeration Demo"),
WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION |
WS_OVERLAPPED | WS_SYSMENU | WS_CAPTION |
WS_VISIBLE | WS_CLIPCHILDREN,
CW_USEDEFAULT, CW_USEDEFAULT, 295, 285,
NULL, NULL, hInst, NULL
);
if (hWnd)
{
{
ShowWindow(hWnd, nCmdShow);
UpdateWindow(hWnd);
@ -71,10 +71,10 @@ int APIENTRY WinMain(HINSTANCE hInstance, HINSTANCE, LPTSTR,
{
TranslateMessage(&msg);
DispatchMessage(&msg);
}
}
}
}
return 0;
return 0;
}
//-------------------------------------------------------------------------
@ -87,78 +87,78 @@ int CALLBACK MyEnumFontFamExProc(ENUMLOGFONTEX *lpelfe,
// if the typeface name is not already in the list
LPARAM name = reinterpret_cast<LPARAM>(lpelfe->elfFullName);
if (SNDMSG(hListBox, LB_FINDSTRINGEXACT, (ULONG)-1, name) == LB_ERR)
{
// add each font to the list box
{
// add each font to the list box
int index = SNDMSG(hListBox, LB_ADDSTRING, 0, name);
// fix the size of the font
lpelfe->elfLogFont.lfHeight = -20;
lpelfe->elfLogFont.lfWidth = 0;
// create a new font and store its handle
// as the data of the newly added item
HFONT hFont = CreateFontIndirect(&lpelfe->elfLogFont);
SNDMSG(hListBox, LB_SETITEMDATA, index,
SNDMSG(hListBox, LB_SETITEMDATA, index,
reinterpret_cast<LPARAM>(hFont));
}
}
return TRUE;
return TRUE;
}
//-------------------------------------------------------------------------
void AddScreenFonts()
{
// grab a handle to the screen's DC
HDC hScreenDC = GetDC(NULL);
try
{
//
// grab a handle to the screen's DC
HDC hScreenDC = GetDC(NULL);
try
{
//
// NOTE: Windows 95, 98 and Me requires that the lpLogfont
// (second) parameter of the EnumFontFamiliesEx function is
// (second) parameter of the EnumFontFamiliesEx function is
// non-NULL. This parameter can be NULL on Windows NT/2000.
//
//
LOGFONT lf = {0};
lf.lfCharSet = DEFAULT_CHARSET;
// enumerate the current screen fonts
// enumerate the current screen fonts
EnumFontFamiliesEx(
hScreenDC, &lf,
hScreenDC, &lf,
(FONTENUMPROC)MyEnumFontFamExProc,
0, 0
);
}
catch (...)
{
// release the screen's DC
ReleaseDC(NULL, hScreenDC);
}
// release the screen's DC
);
}
catch (...)
{
// release the screen's DC
ReleaseDC(NULL, hScreenDC);
}
// release the screen's DC
ReleaseDC(NULL, hScreenDC);
}
//-------------------------------------------------------------------------
LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
LPARAM lParam)
{
switch (msg)
{
case WM_CREATE:
{
hListBox =
{
hListBox =
CreateWindowEx(
WS_EX_CLIENTEDGE, TEXT("LISTBOX"), TEXT(""),
WS_CHILD | WS_VISIBLE | LBS_STANDARD |
LBS_HASSTRINGS | LBS_OWNERDRAWFIXED,
20, 10, 250, 250,
WS_CHILD | WS_VISIBLE | LBS_STANDARD |
LBS_HASSTRINGS | LBS_OWNERDRAWFIXED,
20, 10, 250, 250,
hWnd, reinterpret_cast<HMENU>(ID_LISTBOX),
hInst, NULL
);
);
if (hListBox)
{
AddScreenFonts();
}
}
}
case WM_MEASUREITEM:
{
@ -193,14 +193,14 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
// if the item is currently selected
if (lpdis->itemState & ODS_SELECTED)
{
// set the text color to white and
// set the text color to white and
// the background color to black
COLORREF clrWhite = PALETTERGB(255, 255, 255);
OldColor = SetTextColor(lpdis->hDC, clrWhite);
stock = BLACK_BRUSH;
}
FillRect(
lpdis->hDC, &lpdis->rcItem,
lpdis->hDC, &lpdis->rcItem,
static_cast<HBRUSH>(GetStockObject(stock))
);
@ -209,7 +209,7 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
// extract the item's text
char text[MAX_PATH];
SNDMSG(hListBox, LB_GETTEXT, lpdis->itemID,
reinterpret_cast<LPARAM>(text));
reinterpret_cast<LPARAM>(text));
// extract the corresponding font handle
DWORD value =
@ -228,11 +228,11 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
// render the text
RECT RText = lpdis->rcItem;
InflateRect(&RText, -2, -2);
DrawText(lpdis->hDC, text, strlen(text), &RText,
DrawText(lpdis->hDC, text, strlen(text), &RText,
DT_LEFT | DT_VCENTER | DT_SINGLELINE);
// restore the previous font
SelectObject(lpdis->hDC, HOldFont);
SelectObject(lpdis->hDC, HOldFont);
}
// render the focus rectangle
@ -251,13 +251,13 @@ LRESULT CALLBACK MainWndProc(HWND hWnd, UINT msg, WPARAM wParam,
}
case WM_DESTROY:
{
// delete each created font object
// delete each created font object
int count = SNDMSG(hListBox, LB_GETCOUNT, 0, 0);
for (int index = 0; index < count; ++index)
{
DWORD value = SNDMSG(hListBox, LB_GETITEMDATA, index, 0);
DeleteObject(reinterpret_cast<HFONT>(value));
}
}
PostQuitMessage(0);
break;