diff options
Diffstat (limited to 'Tools/WinLauncher')
-rw-r--r-- | Tools/WinLauncher/PrintWebUIDelegate.cpp | 121 | ||||
-rw-r--r-- | Tools/WinLauncher/WinLauncher.cpp | 6 | ||||
-rw-r--r-- | Tools/WinLauncher/WinLauncherProduction.vsprops | 2 | ||||
-rw-r--r-- | Tools/WinLauncher/WinLauncherRelease.vsprops | 1 | ||||
-rw-r--r-- | Tools/WinLauncher/WinLauncherReleaseCairoCFLite.vsprops | 1 |
5 files changed, 66 insertions, 65 deletions
diff --git a/Tools/WinLauncher/PrintWebUIDelegate.cpp b/Tools/WinLauncher/PrintWebUIDelegate.cpp index ccc267b..3e92144 100644 --- a/Tools/WinLauncher/PrintWebUIDelegate.cpp +++ b/Tools/WinLauncher/PrintWebUIDelegate.cpp @@ -27,14 +27,13 @@ #include "stdafx.h" #include "PrintWebUIDelegate.h" +#include <WebKit/WebKitCOMAPI.h> #include <commctrl.h> #include <commdlg.h> #include <objbase.h> #include <shlwapi.h> #include <wininet.h> -#include <WebKit/WebKitCOMAPI.h> - static const int MARGIN = 20; HRESULT PrintWebUIDelegate::QueryInterface(REFIID riid, void** ppvObject) @@ -97,98 +96,98 @@ HRESULT PrintWebUIDelegate::webViewPrintingMarginRect(IWebView* view, RECT* rect HRESULT PrintWebUIDelegate::webViewHeaderHeight(IWebView* webView, float* height) { - if (!webView || !height) - return E_POINTER; - - HDC dc = ::GetDC(0); + if (!webView || !height) + return E_POINTER; - TEXTMETRIC textMetric; - ::GetTextMetrics(dc, &textMetric); - ::ReleaseDC(0, dc); + HDC dc = ::GetDC(0); - *height = 1.1 * textMetric.tmHeight; + TEXTMETRIC textMetric; + ::GetTextMetrics(dc, &textMetric); + ::ReleaseDC(0, dc); + + *height = 1.1 * textMetric.tmHeight; - return S_OK; + return S_OK; } HRESULT PrintWebUIDelegate::webViewFooterHeight(IWebView* webView, float* height) { - if (!webView || !height) - return E_POINTER; + if (!webView || !height) + return E_POINTER; - HDC dc = ::GetDC(0); + HDC dc = ::GetDC(0); - TEXTMETRIC textMetric; - ::GetTextMetrics(dc, &textMetric); - ::ReleaseDC(0, dc); + TEXTMETRIC textMetric; + ::GetTextMetrics(dc, &textMetric); + ::ReleaseDC(0, dc); - *height = 1.1 * textMetric.tmHeight; + *height = 1.1 * textMetric.tmHeight; - return S_OK; + return S_OK; } -HRESULT PrintWebUIDelegate::drawHeaderInRect( - /* [in] */ IWebView *webView, - /* [in] */ RECT *rect, +HRESULT PrintWebUIDelegate::drawHeaderInRect( + /* [in] */ IWebView* webView, + /* [in] */ RECT* rect, /* [in] */ OLE_HANDLE drawingContext) { - if (!webView || !rect) - return E_POINTER; + if (!webView || !rect) + return E_POINTER; - // Turn off header for now. - HDC dc = reinterpret_cast<HDC>(drawingContext); + // Turn off header for now. + HDC dc = reinterpret_cast<HDC>(drawingContext); - HFONT hFont = (HFONT)::GetStockObject(ANSI_VAR_FONT); - HFONT hOldFont = (HFONT)::SelectObject(dc, hFont); + HGDIOBJ hFont = ::GetStockObject(ANSI_VAR_FONT); + HGDIOBJ hOldFont = ::SelectObject(dc, hFont); - LPCTSTR header(_T("[Sample Header]")); - int length = _tcslen(header); + LPCWSTR header = L"[Sample Header]"; + size_t length = wcslen(header); - int rc = ::DrawText(dc, header, length, rect, DT_LEFT | DT_NOCLIP | DT_VCENTER | DT_SINGLELINE); - ::SelectObject(dc, hOldFont); + int rc = ::DrawTextW(dc, header, length, rect, DT_LEFT | DT_NOCLIP | DT_VCENTER | DT_SINGLELINE); + ::SelectObject(dc, hOldFont); - if (!rc) - return E_FAIL; + if (!rc) + return E_FAIL; - ::MoveToEx(dc, rect->left, rect->bottom, 0); - HPEN hPen = (HPEN)::GetStockObject(BLACK_PEN); - HPEN hOldPen = (HPEN)::SelectObject(dc, hPen); - ::LineTo(dc, rect->right, rect->bottom); - ::SelectObject(dc, hOldPen); + ::MoveToEx(dc, rect->left, rect->bottom, 0); + HGDIOBJ hPen = ::GetStockObject(BLACK_PEN); + HGDIOBJ hOldPen = ::SelectObject(dc, hPen); + ::LineTo(dc, rect->right, rect->bottom); + ::SelectObject(dc, hOldPen); - return S_OK; + return S_OK; } -HRESULT PrintWebUIDelegate::drawFooterInRect( - /* [in] */ IWebView *webView, - /* [in] */ RECT *rect, +HRESULT PrintWebUIDelegate::drawFooterInRect( + /* [in] */ IWebView* webView, + /* [in] */ RECT* rect, /* [in] */ OLE_HANDLE drawingContext, /* [in] */ UINT pageIndex, /* [in] */ UINT pageCount) { - if (!webView || !rect) - return E_POINTER; + if (!webView || !rect) + return E_POINTER; - HDC dc = reinterpret_cast<HDC>(drawingContext); + HDC dc = reinterpret_cast<HDC>(drawingContext); - HFONT hFont = (HFONT)::GetStockObject(ANSI_VAR_FONT); - HFONT hOldFont = (HFONT)::SelectObject(dc, hFont); + HGDIOBJ hFont = ::GetStockObject(ANSI_VAR_FONT); + HGDIOBJ hOldFont = ::SelectObject(dc, hFont); - LPCTSTR footer(_T("[Sample Footer]")); - int length = _tcslen(footer); + LPCWSTR footer = L"[Sample Footer]"; + size_t length = wcslen(footer); - // Add a line, 1/10th inch above the footer text from left margin to right margin. - ::MoveToEx(dc, rect->left, rect->top, 0); - HPEN hPen = (HPEN)::GetStockObject(BLACK_PEN); - HPEN hOldPen = (HPEN)::SelectObject(dc, hPen); - ::LineTo(dc, rect->right, rect->top); - ::SelectObject(dc, hOldPen); + // Add a line, 1/10th inch above the footer text from left margin to right margin. + ::MoveToEx(dc, rect->left, rect->top, 0); + HGDIOBJ hPen = ::GetStockObject(BLACK_PEN); + HGDIOBJ hOldPen = ::SelectObject(dc, hPen); + ::LineTo(dc, rect->right, rect->top); + ::SelectObject(dc, hOldPen); - int rc = ::DrawText(dc, footer, length, rect, DT_LEFT | DT_NOCLIP | DT_VCENTER | DT_SINGLELINE); - ::SelectObject(dc, hOldFont); + int rc = ::DrawTextW(dc, footer, length, rect, DT_LEFT | DT_NOCLIP | DT_VCENTER | DT_SINGLELINE); + ::SelectObject(dc, hOldFont); - if (!rc) - return E_FAIL; + if (!rc) + return E_FAIL; - return S_OK; + return S_OK; } diff --git a/Tools/WinLauncher/WinLauncher.cpp b/Tools/WinLauncher/WinLauncher.cpp index 5caf230..f572b15 100644 --- a/Tools/WinLauncher/WinLauncher.cpp +++ b/Tools/WinLauncher/WinLauncher.cpp @@ -327,12 +327,12 @@ void PrintView(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) { HDC printDC = getPrinterDC(); if (!printDC) { - ::MessageBox(0, _T("Error creating printing DC"), _T("Error"), MB_APPLMODAL | MB_OK); + ::MessageBoxW(0, L"Error creating printing DC", L"Error", MB_APPLMODAL | MB_OK); return; } if (::SetAbortProc(printDC, AbortProc) == SP_ERROR) { - ::MessageBox(0, _T("Error setting up AbortProc"), _T("Error"), MB_APPLMODAL | MB_OK); + ::MessageBoxW(0, L"Error setting up AbortProc", L"Error", MB_APPLMODAL | MB_OK); return; } @@ -350,7 +350,7 @@ void PrintView(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) framePrivate->getPrintedPageCount(printDC, &pageCount); DOCINFO di; - initDocStruct(&di, _T("WebKit Doc")); + initDocStruct(&di, L"WebKit Doc"); ::StartDoc(printDC, &di); // FIXME: Need CoreGraphics implementation diff --git a/Tools/WinLauncher/WinLauncherProduction.vsprops b/Tools/WinLauncher/WinLauncherProduction.vsprops index 83292fe..1069f4a 100644 --- a/Tools/WinLauncher/WinLauncherProduction.vsprops +++ b/Tools/WinLauncher/WinLauncherProduction.vsprops @@ -5,7 +5,7 @@ Name="WinLauncherProduction" InheritedPropertySheets=" $(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; - $(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; $(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\production.vsprops; .\WinLauncherCommon.vsprops" > diff --git a/Tools/WinLauncher/WinLauncherRelease.vsprops b/Tools/WinLauncher/WinLauncherRelease.vsprops index 2b41482..8639931 100644 --- a/Tools/WinLauncher/WinLauncherRelease.vsprops +++ b/Tools/WinLauncher/WinLauncherRelease.vsprops @@ -5,6 +5,7 @@ Name="WinLauncherRelease" InheritedPropertySheets=" $(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; $(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; .\WinLauncherCommon.vsprops" > diff --git a/Tools/WinLauncher/WinLauncherReleaseCairoCFLite.vsprops b/Tools/WinLauncher/WinLauncherReleaseCairoCFLite.vsprops index 351ac49..58aef68 100644 --- a/Tools/WinLauncher/WinLauncherReleaseCairoCFLite.vsprops +++ b/Tools/WinLauncher/WinLauncherReleaseCairoCFLite.vsprops @@ -5,6 +5,7 @@ Name="WinLauncherReleaseCairoCFLite" InheritedPropertySheets=" $(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\common.vsprops; + $(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\releaseproduction.vsprops; $(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\release.vsprops; $(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops; .\WinLauncherCommon.vsprops" |