X-Git-Url: https://git.saurik.com/apple/icu.git/blobdiff_plain/b75a7d8f3b4adbae880cab104ce2c6a50eee4db2..ef6cf650f4a75c3f97de06b51fa104f2069b9ea2:/icuSources/samples/layout/layout.cpp?ds=inline diff --git a/icuSources/samples/layout/layout.cpp b/icuSources/samples/layout/layout.cpp index b9ee8823..8501757e 100644 --- a/icuSources/samples/layout/layout.cpp +++ b/icuSources/samples/layout/layout.cpp @@ -1,7 +1,7 @@ /* ******************************************************************************* * - * Copyright (C) 1999-2003, International Business Machines + * Copyright (C) 1999-2007, International Business Machines * Corporation and others. All Rights Reserved. * ******************************************************************************* @@ -63,7 +63,7 @@ void InitParagraph(HWND hwnd, Context *context) si.nMin = 0; si.nMax = context->paragraph->getLineCount() - 1; si.nPage = context->height / context->paragraph->getLineHeight(); - SetScrollInfo(hwnd, SB_VERT, &si, true); + SetScrollInfo(hwnd, SB_VERT, &si, TRUE); } } @@ -137,7 +137,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) if (LE_FAILURE(fontStatus)) { ReleaseDC(hwnd, hdc); - return 0; + return -1; } context = new Context(); @@ -146,7 +146,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) context->height = 400; context->paragraph = Paragraph::paragraphFactory("Sample.txt", font, guiSupport); - SetWindowLong(hwnd, 0, (LONG) context); + SetWindowLongPtr(hwnd, GWLP_USERDATA, (LONG_PTR) context); windowCount += 1; ReleaseDC(hwnd, hdc); @@ -157,7 +157,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_SIZE: { - context = (Context *) GetWindowLong(hwnd, 0); + context = (Context *) GetWindowLongPtr(hwnd, GWLP_USERDATA); context->width = LOWORD(lParam); context->height = HIWORD(lParam); @@ -211,10 +211,10 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) } si.fMask = SIF_POS; - SetScrollInfo(hwnd, SB_VERT, &si, true); + SetScrollInfo(hwnd, SB_VERT, &si, TRUE); GetScrollInfo(hwnd, SB_VERT, &si); - context = (Context *) GetWindowLong(hwnd, 0); + context = (Context *) GetWindowLongPtr(hwnd, GWLP_USERDATA); if (context->paragraph != NULL && si.nPos != vertPos) { ScrollWindow(hwnd, 0, context->paragraph->getLineHeight() * (vertPos - si.nPos), NULL, NULL); @@ -239,7 +239,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) firstLine = si.nPos; - context = (Context *) GetWindowLong(hwnd, 0); + context = (Context *) GetWindowLongPtr(hwnd, GWLP_USERDATA); if (context->paragraph != NULL) { surface->setHDC(hdc); @@ -295,7 +295,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) Paragraph *newParagraph = Paragraph::paragraphFactory(szFileName, font, guiSupport); if (newParagraph != NULL) { - context = (Context *) GetWindowLong(hwnd, 0); + context = (Context *) GetWindowLongPtr(hwnd, GWLP_USERDATA); if (context->paragraph != NULL) { delete context->paragraph; @@ -304,7 +304,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) context->paragraph = newParagraph; InitParagraph(hwnd, context); PrettyTitle(hwnd, szTitleName); - InvalidateRect(hwnd, NULL, true); + InvalidateRect(hwnd, NULL, TRUE); } } @@ -321,7 +321,7 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case IDM_HELP_ABOUTLAYOUTSAMPLE: MessageBox(hwnd, TEXT("Windows Layout Sample 0.1\n") - TEXT("Copyright (C) 1998-2002 By International Business Machines Corporation and others.\n") + TEXT("Copyright (C) 1998-2005 By International Business Machines Corporation and others.\n") TEXT("Author: Eric Mader"), szAppName, MB_ICONINFORMATION | MB_OK); return 0; @@ -332,9 +332,9 @@ LRESULT CALLBACK WndProc(HWND hwnd, UINT message, WPARAM wParam, LPARAM lParam) case WM_DESTROY: { - context = (Context *) GetWindowLong(hwnd, 0); + context = (Context *) GetWindowLongPtr(hwnd, GWLP_USERDATA); - if (context->paragraph != NULL) { + if (context != NULL && context->paragraph != NULL) { delete context->paragraph; }