diff options
author | Ben Murdoch <benm@google.com> | 2011-05-05 14:36:32 +0100 |
---|---|---|
committer | Ben Murdoch <benm@google.com> | 2011-05-10 15:38:30 +0100 |
commit | f05b935882198ccf7d81675736e3aeb089c5113a (patch) | |
tree | 4ea0ca838d9ef1b15cf17ddb3928efb427c7e5a1 /Tools/WinLauncher | |
parent | 60fbdcc62bced8db2cb1fd233cc4d1e4ea17db1b (diff) | |
download | external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.zip external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.gz external_webkit-f05b935882198ccf7d81675736e3aeb089c5113a.tar.bz2 |
Merge WebKit at r74534: Initial merge by git.
Change-Id: I6ccd1154fa1b19c2ec2a66878eb675738735f1eb
Diffstat (limited to 'Tools/WinLauncher')
-rw-r--r-- | Tools/WinLauncher/PrintWebUIDelegate.cpp | 194 | ||||
-rw-r--r-- | Tools/WinLauncher/PrintWebUIDelegate.h | 109 | ||||
-rw-r--r-- | Tools/WinLauncher/WinLauncher.cpp | 500 | ||||
-rw-r--r-- | Tools/WinLauncher/WinLauncher.h | 119 | ||||
-rw-r--r-- | Tools/WinLauncher/WinLauncher.ico | bin | 0 -> 23558 bytes | |||
-rw-r--r-- | Tools/WinLauncher/WinLauncher.rc | 137 | ||||
-rw-r--r-- | Tools/WinLauncher/WinLauncher.vcproj | 498 | ||||
-rw-r--r-- | Tools/WinLauncher/WinLauncherCommon.vsprops | 16 | ||||
-rw-r--r-- | Tools/WinLauncher/WinLauncherPostBuild.cmd | 1 | ||||
-rw-r--r-- | Tools/WinLauncher/WinLauncherPreBuild.cmd | 6 | ||||
-rw-r--r-- | Tools/WinLauncher/resource.h | 28 | ||||
-rw-r--r-- | Tools/WinLauncher/small.ico | bin | 0 -> 23558 bytes | |||
-rw-r--r-- | Tools/WinLauncher/stdafx.cpp | 33 | ||||
-rw-r--r-- | Tools/WinLauncher/stdafx.h | 69 |
14 files changed, 1710 insertions, 0 deletions
diff --git a/Tools/WinLauncher/PrintWebUIDelegate.cpp b/Tools/WinLauncher/PrintWebUIDelegate.cpp new file mode 100644 index 0000000..ccc267b --- /dev/null +++ b/Tools/WinLauncher/PrintWebUIDelegate.cpp @@ -0,0 +1,194 @@ +/* + * Copyright (C) 2009 Apple Inc. All Rights Reserved. + * Copyright (C) 2009 Brent Fulgham. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "stdafx.h" +#include "PrintWebUIDelegate.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) +{ + *ppvObject = 0; + if (IsEqualIID(riid, IID_IUnknown)) + *ppvObject = static_cast<IWebUIDelegate*>(this); + else if (IsEqualIID(riid, IID_IWebUIDelegate)) + *ppvObject = static_cast<IWebUIDelegate*>(this); + else + return E_NOINTERFACE; + + AddRef(); + return S_OK; +} + +ULONG PrintWebUIDelegate::AddRef(void) +{ + return ++m_refCount; +} + +ULONG PrintWebUIDelegate::Release(void) +{ + ULONG newRef = --m_refCount; + if (!newRef) + delete this; + + return newRef; +} + +HRESULT PrintWebUIDelegate::webViewPrintingMarginRect(IWebView* view, RECT* rect) +{ + if (!view || !rect) + return E_POINTER; + + IWebFrame* mainFrame = 0; + if (FAILED(view->mainFrame(&mainFrame))) + return E_FAIL; + + IWebFramePrivate* privateFrame = 0; + if (FAILED(mainFrame->QueryInterface(&privateFrame))) { + mainFrame->Release(); + return E_FAIL; + } + + privateFrame->frameBounds(rect); + + rect->left += MARGIN; + rect->top += MARGIN; + HDC dc = ::GetDC(0); + rect->right = (::GetDeviceCaps(dc, LOGPIXELSX) * 6.5) - MARGIN; + rect->bottom = (::GetDeviceCaps(dc, LOGPIXELSY) * 11) - MARGIN; + ::ReleaseDC(0, dc); + + privateFrame->Release(); + mainFrame->Release(); + + return S_OK; +} + +HRESULT PrintWebUIDelegate::webViewHeaderHeight(IWebView* webView, float* height) +{ + if (!webView || !height) + return E_POINTER; + + HDC dc = ::GetDC(0); + + TEXTMETRIC textMetric; + ::GetTextMetrics(dc, &textMetric); + ::ReleaseDC(0, dc); + + *height = 1.1 * textMetric.tmHeight; + + return S_OK; +} + +HRESULT PrintWebUIDelegate::webViewFooterHeight(IWebView* webView, float* height) +{ + if (!webView || !height) + return E_POINTER; + + HDC dc = ::GetDC(0); + + TEXTMETRIC textMetric; + ::GetTextMetrics(dc, &textMetric); + ::ReleaseDC(0, dc); + + *height = 1.1 * textMetric.tmHeight; + + return S_OK; +} + +HRESULT PrintWebUIDelegate::drawHeaderInRect( + /* [in] */ IWebView *webView, + /* [in] */ RECT *rect, + /* [in] */ OLE_HANDLE drawingContext) +{ + if (!webView || !rect) + return E_POINTER; + + // Turn off header for now. + HDC dc = reinterpret_cast<HDC>(drawingContext); + + HFONT hFont = (HFONT)::GetStockObject(ANSI_VAR_FONT); + HFONT hOldFont = (HFONT)::SelectObject(dc, hFont); + + LPCTSTR header(_T("[Sample Header]")); + int length = _tcslen(header); + + int rc = ::DrawText(dc, header, length, rect, DT_LEFT | DT_NOCLIP | DT_VCENTER | DT_SINGLELINE); + ::SelectObject(dc, hOldFont); + + 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); + + return S_OK; +} + +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; + + HDC dc = reinterpret_cast<HDC>(drawingContext); + + HFONT hFont = (HFONT)::GetStockObject(ANSI_VAR_FONT); + HFONT hOldFont = (HFONT)::SelectObject(dc, hFont); + + LPCTSTR footer(_T("[Sample Footer]")); + int length = _tcslen(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); + + int rc = ::DrawText(dc, footer, length, rect, DT_LEFT | DT_NOCLIP | DT_VCENTER | DT_SINGLELINE); + ::SelectObject(dc, hOldFont); + + if (!rc) + return E_FAIL; + + return S_OK; +} diff --git a/Tools/WinLauncher/PrintWebUIDelegate.h b/Tools/WinLauncher/PrintWebUIDelegate.h new file mode 100644 index 0000000..9749a98 --- /dev/null +++ b/Tools/WinLauncher/PrintWebUIDelegate.h @@ -0,0 +1,109 @@ +/* + * Copyright (C) 2009 Apple Inc. All Rights Reserved. + * Copyright (C) 2009 Brent Fulgham. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#ifndef PrintWebUIDelegate_h +#define PrintWebUIDelegate_h + +#include <WebKit/WebKit.h> + +class PrintWebUIDelegate : public IWebUIDelegate { +public: + PrintWebUIDelegate() : m_refCount(1) {} + + // IUnknown + virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); + virtual ULONG STDMETHODCALLTYPE AddRef(void); + virtual ULONG STDMETHODCALLTYPE Release(void); + + virtual HRESULT STDMETHODCALLTYPE createWebViewWithRequest(IWebView*, IWebURLRequest*, IWebView**) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE webViewShow(IWebView*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE webViewClose(IWebView*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE webViewFocus(IWebView*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE webViewUnfocus(IWebView*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE webViewFirstResponder(IWebView*, OLE_HANDLE*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE makeFirstResponder(IWebView*, OLE_HANDLE) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE setStatusText(IWebView*, BSTR) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE webViewStatusText(IWebView*, BSTR*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE webViewAreToolbarsVisible(IWebView*, BOOL*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE setToolbarsVisible(IWebView*, BOOL) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE webViewIsStatusBarVisible(IWebView*, BOOL*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE setStatusBarVisible(IWebView*, BOOL) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE webViewIsResizable(IWebView*, BOOL*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE setResizable(IWebView*, BOOL) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE setFrame(IWebView*, RECT*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE webViewFrame(IWebView*, RECT*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE setContentRect(IWebView*, RECT*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE webViewContentRect(IWebView*, RECT*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE runJavaScriptAlertPanelWithMessage(IWebView*, BSTR) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE runJavaScriptConfirmPanelWithMessage(IWebView*, BSTR, BOOL*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE runJavaScriptTextInputPanelWithPrompt(IWebView*, BSTR, BSTR, BSTR*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE runBeforeUnloadConfirmPanelWithMessage(IWebView*, BSTR, IWebFrame*, BOOL*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE runOpenPanelForFileButtonWithResultListener(IWebView*, IWebOpenPanelResultListener*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE mouseDidMoveOverElement(IWebView*, IPropertyBag*, UINT) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE contextMenuItemsForElement(IWebView*, IPropertyBag*, OLE_HANDLE, OLE_HANDLE*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE validateUserInterfaceItem(IWebView*, UINT, BOOL, BOOL*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE shouldPerformAction(IWebView*, UINT, UINT) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE dragDestinationActionMaskForDraggingInfo(IWebView*, IDataObject*, WebDragDestinationAction*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE willPerformDragDestinationAction(IWebView*, WebDragDestinationAction, IDataObject*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE dragSourceActionMaskForPoint(IWebView*, LPPOINT, WebDragSourceAction*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE willPerformDragSourceAction(IWebView*, WebDragSourceAction, LPPOINT, IDataObject*, IDataObject**) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE contextMenuItemSelected(IWebView*, void*, IPropertyBag*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE hasCustomMenuImplementation(BOOL*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE trackCustomPopupMenu(IWebView*, OLE_HANDLE, LPPOINT) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE measureCustomMenuItem(IWebView*, void*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE drawCustomMenuItem(IWebView*, void*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE addCustomMenuDrawingData(IWebView*, OLE_HANDLE) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE cleanUpCustomMenuDrawingData(IWebView*, OLE_HANDLE) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE canTakeFocus(IWebView*, BOOL, BOOL*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE takeFocus(IWebView*, BOOL) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE registerUndoWithTarget(IWebUndoTarget*, BSTR, IUnknown*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE removeAllActionsWithTarget(IWebUndoTarget*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE setActionTitle(BSTR) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE undo() { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE redo() { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE canUndo(BOOL*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE canRedo(BOOL*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE printFrame(IWebView*, IWebFrame *) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE ftpDirectoryTemplatePath(IWebView*, BSTR*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE webViewHeaderHeight(IWebView*, float*); + virtual HRESULT STDMETHODCALLTYPE webViewFooterHeight(IWebView*, float*); + virtual HRESULT STDMETHODCALLTYPE drawHeaderInRect(IWebView*, RECT*, OLE_HANDLE); + virtual HRESULT STDMETHODCALLTYPE drawFooterInRect(IWebView*, RECT*, OLE_HANDLE, UINT, UINT); + virtual HRESULT STDMETHODCALLTYPE webViewPrintingMarginRect(IWebView*, RECT*); + virtual HRESULT STDMETHODCALLTYPE canRunModal(IWebView*, BOOL*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE createModalDialog(IWebView*, IWebURLRequest*, IWebView**) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE runModal(IWebView*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE isMenuBarVisible(IWebView*, BOOL*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE setMenuBarVisible(IWebView*, BOOL) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE runDatabaseSizeLimitPrompt(IWebView*, BSTR, IWebFrame*, BOOL*) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE paintCustomScrollbar(IWebView*, HDC, RECT, WebScrollBarControlSize, WebScrollbarControlState, WebScrollbarControlPart, BOOL, float, float, WebScrollbarControlPartMask) { return E_NOTIMPL; } + virtual HRESULT STDMETHODCALLTYPE paintCustomScrollCorner(IWebView*, HDC, RECT) { return E_NOTIMPL; } + +private: + int m_refCount; +}; + +#endif diff --git a/Tools/WinLauncher/WinLauncher.cpp b/Tools/WinLauncher/WinLauncher.cpp new file mode 100644 index 0000000..5caf230 --- /dev/null +++ b/Tools/WinLauncher/WinLauncher.cpp @@ -0,0 +1,500 @@ +/* + * Copyright (C) 2006, 2008 Apple Computer, Inc. All rights reserved. + * Copyright (C) 2009 Brent Fulgha. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "stdafx.h" +#include "WinLauncher.h" +#include <WebKit/WebKitCOMAPI.h> + +#include <commctrl.h> +#include <commdlg.h> +#include <objbase.h> +#include <shlwapi.h> +#include <wininet.h> + +#include "PrintWebUIDelegate.h" + +#define MAX_LOADSTRING 100 +#define URLBAR_HEIGHT 24 + +// Global Variables: +HINSTANCE hInst; // current instance +HWND hMainWnd; +HWND hURLBarWnd; +long DefEditProc; +IWebView* gWebView = 0; +HWND gViewWindow = 0; +WinLauncherWebHost* gWebHost = 0; +PrintWebUIDelegate* gPrintDelegate = 0; +TCHAR szTitle[MAX_LOADSTRING]; // The title bar text +TCHAR szWindowClass[MAX_LOADSTRING]; // the main window class name + +// Forward declarations of functions included in this code module: +ATOM MyRegisterClass(HINSTANCE hInstance); +BOOL InitInstance(HINSTANCE, int); +LRESULT CALLBACK WndProc(HWND, UINT, WPARAM, LPARAM); +INT_PTR CALLBACK About(HWND, UINT, WPARAM, LPARAM); +LRESULT CALLBACK MyEditProc(HWND, UINT, WPARAM, LPARAM); + +static void loadURL(BSTR urlBStr); + +HRESULT WinLauncherWebHost::updateAddressBar(IWebView* webView) +{ + IWebFrame* mainFrame = 0; + IWebDataSource* dataSource = 0; + IWebMutableURLRequest* request = 0; + BSTR frameURL = 0; + + HRESULT hr = S_OK; + + hr = webView->mainFrame(&mainFrame); + if (FAILED(hr)) + goto exit; + + hr = mainFrame->dataSource(&dataSource); + if (FAILED(hr) || !dataSource) + hr = mainFrame->provisionalDataSource(&dataSource); + if (FAILED(hr) || !dataSource) + goto exit; + + hr = dataSource->request(&request); + if (FAILED(hr) || !request) + goto exit; + + hr = request->mainDocumentURL(&frameURL); + if (FAILED(hr)) + goto exit; + + SendMessage(hURLBarWnd, (UINT)WM_SETTEXT, 0, (LPARAM)frameURL); + +exit: + if (mainFrame) + mainFrame->Release(); + if (dataSource) + dataSource->Release(); + if (request) + request->Release(); + SysFreeString(frameURL); + return 0; +} + +HRESULT STDMETHODCALLTYPE WinLauncherWebHost::QueryInterface(REFIID riid, void** ppvObject) +{ + *ppvObject = 0; + if (IsEqualGUID(riid, IID_IUnknown)) + *ppvObject = static_cast<IWebFrameLoadDelegate*>(this); + else if (IsEqualGUID(riid, IID_IWebFrameLoadDelegate)) + *ppvObject = static_cast<IWebFrameLoadDelegate*>(this); + else + return E_NOINTERFACE; + + AddRef(); + return S_OK; +} + +ULONG STDMETHODCALLTYPE WinLauncherWebHost::AddRef(void) +{ + return ++m_refCount; +} + +ULONG STDMETHODCALLTYPE WinLauncherWebHost::Release(void) +{ + ULONG newRef = --m_refCount; + if (!newRef) + delete(this); + + return newRef; +} + +static void resizeSubViews() +{ + RECT rcClient; + GetClientRect(hMainWnd, &rcClient); + MoveWindow(hURLBarWnd, 0, 0, rcClient.right, URLBAR_HEIGHT, TRUE); + MoveWindow(gViewWindow, 0, URLBAR_HEIGHT, rcClient.right, rcClient.bottom - URLBAR_HEIGHT, TRUE); +} + +int APIENTRY _tWinMain(HINSTANCE hInstance, + HINSTANCE hPrevInstance, + LPTSTR lpCmdLine, + int nCmdShow) +{ +#ifdef _CRTDBG_MAP_ALLOC + _CrtSetReportFile(_CRT_WARN, _CRTDBG_FILE_STDERR); + _CrtSetReportMode(_CRT_WARN, _CRTDBG_MODE_FILE); +#endif + + UNREFERENCED_PARAMETER(hPrevInstance); + UNREFERENCED_PARAMETER(lpCmdLine); + + // TODO: Place code here. + MSG msg = {0}; + HACCEL hAccelTable; + + INITCOMMONCONTROLSEX InitCtrlEx; + + InitCtrlEx.dwSize = sizeof(INITCOMMONCONTROLSEX); + InitCtrlEx.dwICC = 0x00004000; //ICC_STANDARD_CLASSES; + InitCommonControlsEx(&InitCtrlEx); + + // Initialize global strings + LoadString(hInstance, IDS_APP_TITLE, szTitle, MAX_LOADSTRING); + LoadString(hInstance, IDC_WINLAUNCHER, szWindowClass, MAX_LOADSTRING); + MyRegisterClass(hInstance); + + // Perform application initialization: + if (!InitInstance (hInstance, nCmdShow)) + return FALSE; + + // Init COM + OleInitialize(NULL); + + hURLBarWnd = CreateWindow(L"EDIT", 0, + WS_CHILD | WS_VISIBLE | WS_BORDER | ES_LEFT | ES_AUTOVSCROLL, + 0, 0, 0, 0, + hMainWnd, + 0, + hInstance, 0); + + DefEditProc = GetWindowLong(hURLBarWnd, GWL_WNDPROC); + SetWindowLong(hURLBarWnd, GWL_WNDPROC,(long)MyEditProc); + SetFocus(hURLBarWnd); + + HRESULT hr = WebKitCreateInstance(CLSID_WebView, 0, IID_IWebView, (void**)&gWebView); + if (FAILED(hr)) + goto exit; + + gWebHost = new WinLauncherWebHost(); + gWebHost->AddRef(); + hr = gWebView->setFrameLoadDelegate(gWebHost); + if (FAILED(hr)) + goto exit; + + gPrintDelegate = new PrintWebUIDelegate; + gPrintDelegate->AddRef(); + hr = gWebView->setUIDelegate(gPrintDelegate); + if (FAILED (hr)) + goto exit; + + hr = gWebView->setHostWindow((OLE_HANDLE) hMainWnd); + if (FAILED(hr)) + goto exit; + + RECT clientRect; + GetClientRect(hMainWnd, &clientRect); + hr = gWebView->initWithFrame(clientRect, 0, 0); + if (FAILED(hr)) + goto exit; + + IWebFrame* frame; + hr = gWebView->mainFrame(&frame); + if (FAILED(hr)) + goto exit; + + static BSTR defaultHTML = SysAllocString(TEXT("<p style=\"background-color: #00FF00\">Testing</p><img src=\"http://webkit.org/images/icon-gold.png\" alt=\"Face\"><div style=\"border: solid blue\" contenteditable=\"true\">div with blue border</div><ul><li>foo<li>bar<li>baz</ul>")); + frame->loadHTMLString(defaultHTML, 0); + frame->Release(); + + IWebViewPrivate* viewExt; + hr = gWebView->QueryInterface(IID_IWebViewPrivate, (void**)&viewExt); + if (FAILED(hr)) + goto exit; + + hr = viewExt->viewWindow((OLE_HANDLE*) &gViewWindow); + viewExt->Release(); + if (FAILED(hr) || !gViewWindow) + goto exit; + + resizeSubViews(); + + ShowWindow(gViewWindow, nCmdShow); + UpdateWindow(gViewWindow); + + hAccelTable = LoadAccelerators(hInstance, MAKEINTRESOURCE(IDC_WINLAUNCHER)); + + // Main message loop: + while (GetMessage(&msg, NULL, 0, 0)) { + if (!TranslateAccelerator(msg.hwnd, hAccelTable, &msg)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + +exit: + gPrintDelegate->Release(); + gWebView->Release(); + shutDownWebKit(); +#ifdef _CRTDBG_MAP_ALLOC + _CrtDumpMemoryLeaks(); +#endif + + // Shut down COM. + OleUninitialize(); + + return static_cast<int>(msg.wParam); +} + +ATOM MyRegisterClass(HINSTANCE hInstance) +{ + WNDCLASSEX wcex; + + wcex.cbSize = sizeof(WNDCLASSEX); + + wcex.style = CS_HREDRAW | CS_VREDRAW; + wcex.lpfnWndProc = WndProc; + wcex.cbClsExtra = 0; + wcex.cbWndExtra = 0; + wcex.hInstance = hInstance; + wcex.hIcon = LoadIcon(hInstance, MAKEINTRESOURCE(IDI_WINLAUNCHER)); + wcex.hCursor = LoadCursor(NULL, IDC_ARROW); + wcex.hbrBackground = 0; + wcex.lpszMenuName = MAKEINTRESOURCE(IDC_WINLAUNCHER); + wcex.lpszClassName = szWindowClass; + wcex.hIconSm = LoadIcon(wcex.hInstance, MAKEINTRESOURCE(IDI_SMALL)); + + return RegisterClassEx(&wcex); +} + +BOOL InitInstance(HINSTANCE hInstance, int nCmdShow) +{ + hInst = hInstance; // Store instance handle in our global variable + + hMainWnd = CreateWindow(szWindowClass, szTitle, WS_OVERLAPPEDWINDOW, + CW_USEDEFAULT, 0, CW_USEDEFAULT, 0, NULL, NULL, hInstance, NULL); + + if (!hMainWnd) + return FALSE; + + ShowWindow(hMainWnd, nCmdShow); + UpdateWindow(hMainWnd); + + return TRUE; +} + +static BOOL CALLBACK AbortProc(HDC hDC, int Error) +{ + MSG msg; + while (::PeekMessage(&msg, 0, 0, 0, PM_REMOVE)) { + ::TranslateMessage(&msg); + ::DispatchMessage(&msg); + } + + return TRUE; +} + +static HDC getPrinterDC() +{ + PRINTDLG pdlg; + memset(&pdlg, 0, sizeof(PRINTDLG)); + pdlg.lStructSize = sizeof(PRINTDLG); + pdlg.Flags = PD_PRINTSETUP | PD_RETURNDC; + + ::PrintDlg(&pdlg); + + return pdlg.hDC; +} + +static void initDocStruct(DOCINFO* di, TCHAR* docname) +{ + memset(di, 0, sizeof(DOCINFO)); + di->cbSize = sizeof(DOCINFO); + di->lpszDocName = docname; +} + +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); + return; + } + + if (::SetAbortProc(printDC, AbortProc) == SP_ERROR) { + ::MessageBox(0, _T("Error setting up AbortProc"), _T("Error"), MB_APPLMODAL | MB_OK); + return; + } + + IWebFrame* frame = 0; + IWebFramePrivate* framePrivate = 0; + if (FAILED(gWebView->mainFrame(&frame))) + goto exit; + + if (FAILED(frame->QueryInterface(&framePrivate))) + goto exit; + + framePrivate->setInPrintingMode(TRUE, printDC); + + UINT pageCount = 0; + framePrivate->getPrintedPageCount(printDC, &pageCount); + + DOCINFO di; + initDocStruct(&di, _T("WebKit Doc")); + ::StartDoc(printDC, &di); + + // FIXME: Need CoreGraphics implementation + void* graphicsContext = 0; + for (size_t page = 1; page <= pageCount; ++page) { + ::StartPage(printDC); + framePrivate->spoolPages(printDC, page, page, graphicsContext); + ::EndPage(printDC); + } + + framePrivate->setInPrintingMode(FALSE, printDC); + + ::EndDoc(printDC); + ::DeleteDC(printDC); + +exit: + if (frame) + frame->Release(); + if (framePrivate) + framePrivate->Release(); +} + +LRESULT CALLBACK WndProc(HWND hWnd, UINT message, WPARAM wParam, LPARAM lParam) +{ + int wmId, wmEvent; + + switch (message) { + case WM_COMMAND: + wmId = LOWORD(wParam); + wmEvent = HIWORD(wParam); + // Parse the menu selections: + switch (wmId) { + case IDM_ABOUT: + DialogBox(hInst, MAKEINTRESOURCE(IDD_ABOUTBOX), hWnd, About); + break; + case IDM_EXIT: + DestroyWindow(hWnd); + break; + case IDM_PRINT: + PrintView(hWnd, message, wParam, lParam); + break; + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + break; + case WM_DESTROY: + PostQuitMessage(0); + break; + case WM_SIZE: + if (!gWebView) + break; + resizeSubViews(); + break; + default: + return DefWindowProc(hWnd, message, wParam, lParam); + } + return 0; +} + + +#define MAX_URL_LENGTH 1024 + +LRESULT CALLBACK MyEditProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + switch (message) { + case WM_CHAR: + if (wParam == 13) { // Enter Key + wchar_t strPtr[MAX_URL_LENGTH]; + *((LPWORD)strPtr) = MAX_URL_LENGTH; + int strLen = SendMessage(hDlg, EM_GETLINE, 0, (LPARAM)strPtr); + + BSTR bstr = SysAllocStringLen(strPtr, strLen); + loadURL(bstr); + SysFreeString(bstr); + + return 0; + } else + return (LRESULT)CallWindowProc((WNDPROC)DefEditProc,hDlg,message,wParam,lParam); + break; + default: + return (LRESULT)CallWindowProc((WNDPROC)DefEditProc,hDlg,message,wParam,lParam); + break; + } +} + + +// Message handler for about box. +INT_PTR CALLBACK About(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + UNREFERENCED_PARAMETER(lParam); + switch (message) { + case WM_INITDIALOG: + return (INT_PTR)TRUE; + + case WM_COMMAND: + if (LOWORD(wParam) == IDOK || LOWORD(wParam) == IDCANCEL) { + EndDialog(hDlg, LOWORD(wParam)); + return (INT_PTR)TRUE; + } + break; + } + return (INT_PTR)FALSE; +} + +static void loadURL(BSTR urlBStr) +{ + IWebFrame* frame = 0; + IWebMutableURLRequest* request = 0; + + static BSTR methodBStr = SysAllocString(TEXT("GET")); + + if (urlBStr && urlBStr[0] && (PathFileExists(urlBStr) || PathIsUNC(urlBStr))) { + TCHAR fileURL[INTERNET_MAX_URL_LENGTH]; + DWORD fileURLLength = sizeof(fileURL)/sizeof(fileURL[0]); + + if (SUCCEEDED(UrlCreateFromPath(urlBStr, fileURL, &fileURLLength, 0))) + SysReAllocString(&urlBStr, fileURL); + } + + HRESULT hr = gWebView->mainFrame(&frame); + if (FAILED(hr)) + goto exit; + + hr = WebKitCreateInstance(CLSID_WebMutableURLRequest, 0, IID_IWebMutableURLRequest, (void**)&request); + if (FAILED(hr)) + goto exit; + + hr = request->initWithURL(urlBStr, WebURLRequestUseProtocolCachePolicy, 60); + if (FAILED(hr)) + goto exit; + + hr = request->setHTTPMethod(methodBStr); + if (FAILED(hr)) + goto exit; + + hr = frame->loadRequest(request); + if (FAILED(hr)) + goto exit; + + SetFocus(gViewWindow); + +exit: + if (frame) + frame->Release(); + if (request) + request->Release(); +} diff --git a/Tools/WinLauncher/WinLauncher.h b/Tools/WinLauncher/WinLauncher.h new file mode 100644 index 0000000..a82d7b1 --- /dev/null +++ b/Tools/WinLauncher/WinLauncher.h @@ -0,0 +1,119 @@ +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#pragma once + +#include "resource.h" +#include <WebKit/WebKit.h> + +class WinLauncherWebHost : public IWebFrameLoadDelegate +{ +public: + WinLauncherWebHost() : m_refCount(1) {} + + // IUnknown + virtual HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, void** ppvObject); + virtual ULONG STDMETHODCALLTYPE AddRef(void); + virtual ULONG STDMETHODCALLTYPE Release(void); + + // IWebFrameLoadDelegate + virtual HRESULT STDMETHODCALLTYPE didStartProvisionalLoadForFrame( + /* [in] */ IWebView* webView, + /* [in] */ IWebFrame* /*frame*/) { return S_OK; } + + virtual HRESULT STDMETHODCALLTYPE didReceiveServerRedirectForProvisionalLoadForFrame( + /* [in] */ IWebView *webView, + /* [in] */ IWebFrame *frame) { return S_OK; } + + virtual HRESULT STDMETHODCALLTYPE didFailProvisionalLoadWithError( + /* [in] */ IWebView *webView, + /* [in] */ IWebError *error, + /* [in] */ IWebFrame *frame) { return S_OK; } + + virtual HRESULT STDMETHODCALLTYPE didCommitLoadForFrame( + /* [in] */ IWebView *webView, + /* [in] */ IWebFrame *frame) { return updateAddressBar(webView); } + + virtual HRESULT STDMETHODCALLTYPE didReceiveTitle( + /* [in] */ IWebView *webView, + /* [in] */ BSTR title, + /* [in] */ IWebFrame *frame) { return S_OK; } + + virtual HRESULT STDMETHODCALLTYPE didChangeIcons( + /* [in] */ IWebView *webView, + /* [in] */ IWebFrame *frame) { return S_OK; } + + virtual HRESULT STDMETHODCALLTYPE didReceiveIcon( + /* [in] */ IWebView *webView, + /* [in] */ OLE_HANDLE hBitmap, + /* [in] */ IWebFrame *frame) { return S_OK; } + + virtual HRESULT STDMETHODCALLTYPE didFinishLoadForFrame( + /* [in] */ IWebView* webView, + /* [in] */ IWebFrame* /*frame*/) { return S_OK; } + + virtual HRESULT STDMETHODCALLTYPE didFailLoadWithError( + /* [in] */ IWebView *webView, + /* [in] */ IWebError *error, + /* [in] */ IWebFrame *forFrame) { return S_OK; } + + virtual HRESULT STDMETHODCALLTYPE didChangeLocationWithinPageForFrame( + /* [in] */ IWebView *webView, + /* [in] */ IWebFrame *frame) { return S_OK; } + + virtual HRESULT STDMETHODCALLTYPE willPerformClientRedirectToURL( + /* [in] */ IWebView *webView, + /* [in] */ BSTR url, + /* [in] */ double delaySeconds, + /* [in] */ DATE fireDate, + /* [in] */ IWebFrame *frame) { return S_OK; } + + virtual HRESULT STDMETHODCALLTYPE didCancelClientRedirectForFrame( + /* [in] */ IWebView *webView, + /* [in] */ IWebFrame *frame) { return S_OK; } + + virtual HRESULT STDMETHODCALLTYPE willCloseFrame( + /* [in] */ IWebView *webView, + /* [in] */ IWebFrame *frame) { return S_OK; } + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE windowScriptObjectAvailable( + /* [in] */ IWebView *webView, + /* [in] */ JSContextRef context, + /* [in] */ JSObjectRef windowScriptObject) { return S_OK; } + + virtual /* [local] */ HRESULT STDMETHODCALLTYPE didClearWindowObject( + /* [in] */ IWebView *webView, + /* [in] */ JSContextRef context, + /* [in] */ JSObjectRef windowScriptObject, + /* [in] */ IWebFrame *frame) { return S_OK; } + + // WinLauncherWebHost + +protected: + HRESULT updateAddressBar(IWebView* webView); + +protected: + ULONG m_refCount; +}; diff --git a/Tools/WinLauncher/WinLauncher.ico b/Tools/WinLauncher/WinLauncher.ico Binary files differnew file mode 100644 index 0000000..d551aa3 --- /dev/null +++ b/Tools/WinLauncher/WinLauncher.ico diff --git a/Tools/WinLauncher/WinLauncher.rc b/Tools/WinLauncher/WinLauncher.rc new file mode 100644 index 0000000..172ed4a --- /dev/null +++ b/Tools/WinLauncher/WinLauncher.rc @@ -0,0 +1,137 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#define APSTUDIO_HIDDEN_SYMBOLS +#include "windows.h" +#undef APSTUDIO_HIDDEN_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (U.S.) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +#ifdef _WIN32 +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) +#endif //_WIN32 + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_WINLAUNCHER ICON "WinLauncher.ico" +IDI_SMALL ICON "small.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// Menu +// + +IDC_WINLAUNCHER MENU +BEGIN + POPUP "&File" + BEGIN + MENUITEM "&Print\tCtrl-P", IDM_PRINT + MENUITEM "E&xit", IDM_EXIT + END + POPUP "&Help" + BEGIN + MENUITEM "&About ...", IDM_ABOUT + END +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Accelerator +// + +IDC_WINLAUNCHER ACCELERATORS +BEGIN + "?", IDM_ABOUT, ASCII, ALT + "/", IDM_ABOUT, ASCII, ALT +END + + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_ABOUTBOX DIALOGEX 22, 17, 230, 75 +STYLE DS_SETFONT | DS_MODALFRAME | WS_CAPTION | WS_SYSMENU +CAPTION "About" +FONT 8, "System", 0, 0, 0x0 +BEGIN + ICON IDI_WINLAUNCHER,IDC_MYICON,14,9,20,20 + LTEXT "WinLauncher Version 1.2",IDC_STATIC,49,10,119,8,SS_NOPREFIX + LTEXT "Copyright (C) 2009",IDC_STATIC,49,20,119,8 + DEFPUSHBUTTON "OK",IDOK,195,6,30,11,WS_GROUP +END + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#define APSTUDIO_HIDDEN_SYMBOLS\r\n" + "#include ""windows.h""\r\n" + "#undef APSTUDIO_HIDDEN_SYMBOLS\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// String Table +// + +STRINGTABLE +BEGIN + IDS_APP_TITLE "WinLauncher" + IDC_WINLAUNCHER "WINLAUNCHER" +END + +#endif // English (U.S.) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/Tools/WinLauncher/WinLauncher.vcproj b/Tools/WinLauncher/WinLauncher.vcproj new file mode 100644 index 0000000..2f23abe --- /dev/null +++ b/Tools/WinLauncher/WinLauncher.vcproj @@ -0,0 +1,498 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioProject + ProjectType="Visual C++" + Version="8.00" + Name="WinLauncher" + ProjectGUID="{114FCA11-216B-4C8C-957E-30A75AE80443}" + RootNamespace="WinLauncher" + Keyword="Win32Proj" + > + <Platforms> + <Platform + Name="Win32" + /> + </Platforms> + <ToolFiles> + </ToolFiles> + <Configurations> + <Configuration + Name="Debug|Win32" + ConfigurationType="1" + InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;.\WinLauncherCommon.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release|Win32" + ConfigurationType="1" + InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\WinLauncherCommon.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug_Cairo_CFLite|Win32" + ConfigurationType="1" + InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\debug_wincairo.vsprops;.\WinLauncherCommon.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Debug_All|Win32" + ConfigurationType="1" + InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\debug.vsprops;$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\debug_all.vsprops;.\WinLauncherCommon.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release_LTCG|Win32" + ConfigurationType="1" + InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;.\WinLauncherCommon.vsprops" + CharacterSet="1" + WholeProgramOptimization="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + <Configuration + Name="Release_Cairo_CFLite|Win32" + ConfigurationType="1" + InheritedPropertySheets="$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\common.vsprops;$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\release.vsprops;$(WebKitVSPropsRedirectionDir)..\..\WebKitLibraries\win\tools\vsprops\WinCairo.vsprops;.\WinLauncherCommon.vsprops" + CharacterSet="1" + > + <Tool + Name="VCPreBuildEventTool" + /> + <Tool + Name="VCCustomBuildTool" + /> + <Tool + Name="VCXMLDataGeneratorTool" + /> + <Tool + Name="VCWebServiceProxyGeneratorTool" + /> + <Tool + Name="VCMIDLTool" + /> + <Tool + Name="VCCLCompilerTool" + /> + <Tool + Name="VCManagedResourceCompilerTool" + /> + <Tool + Name="VCResourceCompilerTool" + /> + <Tool + Name="VCPreLinkEventTool" + /> + <Tool + Name="VCLinkerTool" + /> + <Tool + Name="VCALinkTool" + /> + <Tool + Name="VCManifestTool" + /> + <Tool + Name="VCXDCMakeTool" + /> + <Tool + Name="VCBscMakeTool" + /> + <Tool + Name="VCFxCopTool" + /> + <Tool + Name="VCAppVerifierTool" + /> + <Tool + Name="VCWebDeploymentTool" + /> + <Tool + Name="VCPostBuildEventTool" + /> + </Configuration> + </Configurations> + <References> + </References> + <Files> + <Filter + Name="Source Files" + Filter="cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx" + UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}" + > + <File + RelativePath=".\PrintWebUIDelegate.cpp" + > + </File> + <File + RelativePath=".\stdafx.cpp" + > + <FileConfiguration + Name="Debug|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="1" + /> + </FileConfiguration> + <FileConfiguration + Name="Release|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="1" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_Cairo_CFLite|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="1" + /> + </FileConfiguration> + <FileConfiguration + Name="Debug_All|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="1" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_LTCG|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="1" + /> + </FileConfiguration> + <FileConfiguration + Name="Release_Cairo_CFLite|Win32" + > + <Tool + Name="VCCLCompilerTool" + UsePrecompiledHeader="1" + /> + </FileConfiguration> + </File> + <File + RelativePath=".\WinLauncher.cpp" + > + </File> + </Filter> + <Filter + Name="Header Files" + Filter="h;hpp;hxx;hm;inl;inc;xsd" + UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}" + > + <File + RelativePath=".\PrintWebUIDelegate.h" + > + </File> + <File + RelativePath=".\Resource.h" + > + </File> + <File + RelativePath=".\stdafx.h" + > + </File> + <File + RelativePath=".\WinLauncher.h" + > + </File> + </Filter> + <Filter + Name="Resource Files" + Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav" + UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}" + > + <File + RelativePath=".\small.ico" + > + </File> + <File + RelativePath=".\WinLauncher.ico" + > + </File> + <File + RelativePath=".\WinLauncher.rc" + > + </File> + </Filter> + </Files> + <Globals> + </Globals> +</VisualStudioProject> diff --git a/Tools/WinLauncher/WinLauncherCommon.vsprops b/Tools/WinLauncher/WinLauncherCommon.vsprops new file mode 100644 index 0000000..70c1c6d --- /dev/null +++ b/Tools/WinLauncher/WinLauncherCommon.vsprops @@ -0,0 +1,16 @@ +<?xml version="1.0" encoding="Windows-1252"?> +<VisualStudioPropertySheet + ProjectType="Visual C++" + Version="8.00" + Name="WinLauncherCommon" + > + <Tool + Name="VCCLCompilerTool" + AdditionalIncludeDirectories=""$(WebKitOutputDir)\include\WebKit";"$(WebKitOutputDir)\Include";"$(WebKitLibrariesDir)\Include";"$(WebKitOutputDir)\Include\WebCore";"$(WebKitLibrariesDir)\Include\WebCore";"$(WebKitOutputDir)\Include\WebCore\ForwardingHeaders";"$(WebKitLibrariesDir)\Include\WebCore\ForwardingHeaders";"$(WebKitOutputDir)\Include\JavaScriptCore";"$(WebKitLibrariesDir)\Include\JavaScriptCore";"$(ProjectDir)\..";"$(ProjectDir)";"$(IntDir)\Include";"$(WebKitOutputDir)\obj\WebKit\DerivedSources"" + UsePrecompiledHeader="2" + /> + <Tool + Name="VCLinkerTool" + AdditionalDependencies="comdlg32.lib gdi32.lib comctl32.lib shlwapi.lib user32.lib ole32.lib oleaut32.lib WebKitGUID$(WebKitConfigSuffix).lib WebKit$(WebKitDLLConfigSuffix).lib" + /> +</VisualStudioPropertySheet> diff --git a/Tools/WinLauncher/WinLauncherPostBuild.cmd b/Tools/WinLauncher/WinLauncherPostBuild.cmd new file mode 100644 index 0000000..f011495 --- /dev/null +++ b/Tools/WinLauncher/WinLauncherPostBuild.cmd @@ -0,0 +1 @@ +if exist "%WEBKITOUTPUTDIR%\buildfailed" del "%WEBKITOUTPUTDIR%\buildfailed" diff --git a/Tools/WinLauncher/WinLauncherPreBuild.cmd b/Tools/WinLauncher/WinLauncherPreBuild.cmd new file mode 100644 index 0000000..3a84c26 --- /dev/null +++ b/Tools/WinLauncher/WinLauncherPreBuild.cmd @@ -0,0 +1,6 @@ +%SystemDrive%\cygwin\bin\which.exe bash +if errorlevel 1 set PATH=%SystemDrive%\cygwin\bin;%PATH% +cmd /c +if exist "%WEBKITOUTPUTDIR%\buildfailed" grep XX%PROJECTNAME%XX "%WEBKITOUTPUTDIR%\buildfailed" +if errorlevel 1 exit 1 +echo XX%PROJECTNAME%XX > "%WEBKITOUTPUTDIR%\buildfailed" diff --git a/Tools/WinLauncher/resource.h b/Tools/WinLauncher/resource.h new file mode 100644 index 0000000..c98fac7 --- /dev/null +++ b/Tools/WinLauncher/resource.h @@ -0,0 +1,28 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Visual C++ generated include file. +// Used by WinLauncher.rc +// +#define IDC_MYICON 2 +#define IDD_WINLAUNCHER_DIALOG 102 +#define IDS_APP_TITLE 103 +#define IDD_ABOUTBOX 103 +#define IDM_ABOUT 104 +#define IDM_EXIT 105 +#define IDM_PRINT 106 +#define IDI_WINLAUNCHER 107 +#define IDI_SMALL 108 +#define IDC_WINLAUNCHER 109 +#define IDR_MAINFRAME 128 +#define IDC_STATIC -1 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NO_MFC 1 +#define _APS_NEXT_RESOURCE_VALUE 129 +#define _APS_NEXT_COMMAND_VALUE 32771 +#define _APS_NEXT_CONTROL_VALUE 1000 +#define _APS_NEXT_SYMED_VALUE 110 +#endif +#endif diff --git a/Tools/WinLauncher/small.ico b/Tools/WinLauncher/small.ico Binary files differnew file mode 100644 index 0000000..d551aa3 --- /dev/null +++ b/Tools/WinLauncher/small.ico diff --git a/Tools/WinLauncher/stdafx.cpp b/Tools/WinLauncher/stdafx.cpp new file mode 100644 index 0000000..541dcb1 --- /dev/null +++ b/Tools/WinLauncher/stdafx.cpp @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// stdafx.cpp : source file that includes just the standard includes +// Spinneret.pch will be the pre-compiled header +// stdafx.obj will contain the pre-compiled type information + +#include "stdafx.h" + +// TODO: reference any additional headers you need in STDAFX.H +// and not in this file diff --git a/Tools/WinLauncher/stdafx.h b/Tools/WinLauncher/stdafx.h new file mode 100644 index 0000000..86f76cc --- /dev/null +++ b/Tools/WinLauncher/stdafx.h @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY APPLE COMPUTER, INC. ``AS IS'' AND ANY + * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL APPLE COMPUTER, INC. OR + * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, + * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, + * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR + * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY + * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE + * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +// stdafx.h : include file for standard system include files, +// or project specific include files that are used frequently, but +// are changed infrequently +// + +#pragma once + +// Modify the following defines if you have to target a platform prior to the ones specified below. +// Refer to MSDN for the latest info on corresponding values for different platforms. +#ifndef WINVER // Allow use of features specific to Windows XP or later. +#define WINVER 0x0501 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINNT // Allow use of features specific to Windows XP or later. +#define _WIN32_WINNT 0x0501 // Change this to the appropriate value to target other versions of Windows. +#endif + +#ifndef _WIN32_WINDOWS // Allow use of features specific to Windows 98 or later. +#define _WIN32_WINDOWS 0x0410 // Change this to the appropriate value to target Windows Me or later. +#endif + +#ifndef _WIN32_IE // Allow use of features specific to IE 6.0 or later. +#define _WIN32_IE 0x0600 // Change this to the appropriate value to target other versions of IE. +#endif + +#define WIN32_LEAN_AND_MEAN // Exclude rarely-used stuff from Windows headers +// Windows Header Files: +#include <windows.h> + +// C RunTime Header Files +#include <stdlib.h> +#include <malloc.h> +#include <memory.h> +#include <tchar.h> + +#if 0 +// Visual Studio Leak Detection +// <http://msdn2.microsoft.com/en-US/library/e5ewb1h3.aspx> +#if defined(_MSC_VER) && defined(_DEBUG) +#define _CRTDBG_MAP_ALLOC +#include <stdlib.h> +#include <crtdbg.h> +#endif +#endif |