diff options
author | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:41 -0800 |
---|---|---|
committer | The Android Open Source Project <initial-contribution@android.com> | 2009-03-03 18:28:41 -0800 |
commit | 648161bb0edfc3d43db63caed5cc5213bc6cb78f (patch) | |
tree | 4b825dc642cb6eb9a060e54bf8d69288fbee4904 /WebCore/platform/wx | |
parent | a65af38181ac7d34544586bdb5cd004de93897ad (diff) | |
download | external_webkit-648161bb0edfc3d43db63caed5cc5213bc6cb78f.zip external_webkit-648161bb0edfc3d43db63caed5cc5213bc6cb78f.tar.gz external_webkit-648161bb0edfc3d43db63caed5cc5213bc6cb78f.tar.bz2 |
auto import from //depot/cupcake/@135843
Diffstat (limited to 'WebCore/platform/wx')
34 files changed, 0 insertions, 4792 deletions
diff --git a/WebCore/platform/wx/ClipboardWx.cpp b/WebCore/platform/wx/ClipboardWx.cpp deleted file mode 100644 index 461cc66..0000000 --- a/WebCore/platform/wx/ClipboardWx.cpp +++ /dev/null @@ -1,128 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com> - * - * 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 "config.h" -#include "ClipboardWx.h" -#include "HashTable.h" -#include "IntPoint.h" -#include "NotImplemented.h" -#include "Pasteboard.h" -#include "PlatformString.h" -#include "StringHash.h" - - -namespace WebCore { - -ClipboardWx::ClipboardWx(ClipboardAccessPolicy policy, bool forDragging) - : Clipboard(policy, forDragging) -{ -} - -void ClipboardWx::clearData(const String& type) -{ - notImplemented(); -} - -void ClipboardWx::clearAllData() -{ - Pasteboard::generalPasteboard()->clear(); -} - -String ClipboardWx::getData(const String& type, bool& success) const -{ - notImplemented(); - return ""; -} - -bool ClipboardWx::setData(const String& type, const String& data) -{ - notImplemented(); - return false; -} - -// extensions beyond IE's API -HashSet<String> ClipboardWx::types() const -{ - notImplemented(); - HashSet<String> result; - return result; -} - -IntPoint ClipboardWx::dragLocation() const -{ - notImplemented(); - return IntPoint(0,0); -} - -CachedImage* ClipboardWx::dragImage() const -{ - notImplemented(); - return 0; -} - -void ClipboardWx::setDragImage(CachedImage*, const IntPoint&) -{ - notImplemented(); -} - -Node* ClipboardWx::dragImageElement() -{ - notImplemented(); - return 0; -} - -void ClipboardWx::setDragImageElement(Node*, const IntPoint&) -{ - notImplemented(); -} - -DragImageRef ClipboardWx::createDragImage(IntPoint& dragLoc) const -{ - notImplemented(); - return 0; -} - -void ClipboardWx::declareAndWriteDragImage(Element*, const KURL&, const String&, Frame*) -{ - notImplemented(); -} - -void ClipboardWx::writeURL(const KURL& url, const String& string, Frame* frame) -{ - Pasteboard::generalPasteboard()->writeURL(url, string, frame); -} - -void ClipboardWx::writeRange(Range*, Frame*) -{ - notImplemented(); -} - -bool ClipboardWx::hasData() -{ - notImplemented(); - return false; -} - -} diff --git a/WebCore/platform/wx/ClipboardWx.h b/WebCore/platform/wx/ClipboardWx.h deleted file mode 100644 index db5f7a8..0000000 --- a/WebCore/platform/wx/ClipboardWx.h +++ /dev/null @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com> - * - * 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. - */ - -#ifndef ClipboardWx_h -#define ClipboardWx_h - -#include "Clipboard.h" - -namespace WebCore { - - class CachedImage; - - // State available during IE's events for drag and drop and copy/paste - class ClipboardWx : public Clipboard { - public: - static PassRefPtr<ClipboardWx> create(ClipboardAccessPolicy policy, bool forDragging) - { - return adoptRef(new ClipboardWx(policy, forDragging)); - } - - void clearData(const String& type); - void clearAllData(); - String getData(const String& type, bool& success) const; - bool setData(const String& type, const String& data); - - // extensions beyond IE's API - HashSet<String> types() const; - - IntPoint dragLocation() const; - CachedImage* dragImage() const; - void setDragImage(CachedImage*, const IntPoint&); - Node* dragImageElement(); - void setDragImageElement(Node*, const IntPoint&); - - virtual DragImageRef createDragImage(IntPoint& dragLoc) const; - virtual void declareAndWriteDragImage(Element*, const KURL&, const String& title, Frame*); - virtual void writeURL(const KURL&, const String&, Frame*); - virtual void writeRange(Range*, Frame*); - - virtual bool hasData(); - - private: - ClipboardWx(ClipboardAccessPolicy, bool forDragging); - }; -} - -#endif // ClipboardWx_h diff --git a/WebCore/platform/wx/CursorWx.cpp b/WebCore/platform/wx/CursorWx.cpp deleted file mode 100644 index 7175b01..0000000 --- a/WebCore/platform/wx/CursorWx.cpp +++ /dev/null @@ -1,301 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com> - * - * 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 "config.h" -#include "Cursor.h" -#include "Image.h" - -#include <wx/defs.h> -#include <wx/cursor.h> -#include <wx/image.h> - -namespace WebCore { - -Cursor::Cursor(const Cursor& other) - : m_impl(other.m_impl) -{ -} - -Cursor::Cursor(Image* image, const IntPoint&) -{ - m_impl = 0; - // FIXME: figure out why the below code causes a crash - //m_impl = new wxCursor( image->getWxBitmap()->ConvertToImage() ); -} - -Cursor::~Cursor() -{ -} - -Cursor& Cursor::operator=(const Cursor& other) -{ - m_impl = other.m_impl; - return *this; -} - -Cursor::Cursor(wxCursor* c) - : m_impl(c) -{ -} - -const Cursor& pointerCursor() -{ - static Cursor c = new wxCursor(wxCURSOR_ARROW); - return c; -} - -const Cursor& crossCursor() -{ - static Cursor c = new wxCursor(wxCURSOR_CROSS); - return c; -} - -const Cursor& handCursor() -{ - static Cursor c = new wxCursor(wxCURSOR_HAND); - return c; -} - -const Cursor& iBeamCursor() -{ - static Cursor c = new wxCursor(wxCURSOR_IBEAM); - return c; -} - -const Cursor& waitCursor() -{ - static Cursor c = new wxCursor(wxCURSOR_WAIT); - return c; -} - -const Cursor& helpCursor() -{ - static Cursor c = new wxCursor(wxCURSOR_QUESTION_ARROW); - return c; -} - -const Cursor& eastResizeCursor() -{ - static Cursor c = new wxCursor(wxCURSOR_SIZEWE); - return c; -} - -const Cursor& northResizeCursor() -{ - static Cursor c = new wxCursor(wxCURSOR_SIZENS); - return c; -} - -const Cursor& northEastResizeCursor() -{ - static Cursor c = new wxCursor(wxCURSOR_SIZENESW); - return c; -} - -const Cursor& northWestResizeCursor() -{ - static Cursor c = new wxCursor(wxCURSOR_SIZENWSE); - return c; -} - -const Cursor& southResizeCursor() -{ - static Cursor c = northResizeCursor(); - return c; -} - -const Cursor& southEastResizeCursor() -{ - static Cursor c = northWestResizeCursor(); - return c; -} - -const Cursor& southWestResizeCursor() -{ - static Cursor c = northEastResizeCursor(); - return c; -} - -const Cursor& westResizeCursor() -{ - static Cursor c = eastResizeCursor(); - return c; -} - -const Cursor& northSouthResizeCursor() -{ - static Cursor c = northResizeCursor(); - return c; -} - -const Cursor& eastWestResizeCursor() -{ - static Cursor c = eastResizeCursor(); - return c; -} - -const Cursor& northEastSouthWestResizeCursor() -{ - static Cursor c = northEastResizeCursor(); - return c; -} - -const Cursor& northWestSouthEastResizeCursor() -{ - static Cursor c = northWestResizeCursor(); - return c; -} - -const Cursor& columnResizeCursor() -{ - // FIXME: Windows does not have a standard column resize cursor - static Cursor c = new wxCursor(wxCURSOR_SIZING); - return c; -} - -const Cursor& rowResizeCursor() -{ - // FIXME: Windows does not have a standard row resize cursor - static Cursor c = new wxCursor(wxCURSOR_SIZING); - return c; -} - -const Cursor& middlePanningCursor() -{ - return moveCursor(); -} - -const Cursor& eastPanningCursor() -{ - return eastResizeCursor(); -} - -const Cursor& northPanningCursor() -{ - return northResizeCursor(); -} - -const Cursor& northEastPanningCursor() -{ - return northEastResizeCursor(); -} - -const Cursor& northWestPanningCursor() -{ - return northWestResizeCursor(); -} - -const Cursor& southPanningCursor() -{ - return southResizeCursor(); -} - -const Cursor& southEastPanningCursor() -{ - return southEastResizeCursor(); -} - -const Cursor& southWestPanningCursor() -{ - return southWestResizeCursor(); -} - -const Cursor& westPanningCursor() -{ - return westResizeCursor(); -} - -const Cursor& verticalTextCursor() -{ - return iBeamCursor(); -} - -const Cursor& cellCursor() -{ - return pointerCursor(); -} - -const Cursor& contextMenuCursor() -{ - return handCursor(); -} - -const Cursor& noDropCursor() -{ - return pointerCursor(); -} - -const Cursor& progressCursor() -{ - return waitCursor(); -} - -const Cursor& aliasCursor() -{ - return pointerCursor(); -} - -const Cursor& copyCursor() -{ - return pointerCursor(); -} - -const Cursor& noneCursor() -{ - // TODO: Determine if we can find a better cursor for this. - return pointerCursor(); -} - -const Cursor& notAllowedCursor() -{ - static Cursor c = new wxCursor(wxCURSOR_NO_ENTRY); - return c; -} - -const Cursor& zoomInCursor() -{ - static Cursor c = new wxCursor(wxCURSOR_MAGNIFIER); - return c; -} - -const Cursor& zoomOutCursor() -{ - // TODO: Find a way to implement in/out magnifiers in wx. - return zoomInCursor(); -} - -const Cursor& grabCursor() -{ - // TODO: Determine if we can find a better cursor for this. - return pointerCursor(); -} - -const Cursor& grabbingCursor() -{ - // TODO: Determine if we can find a better cursor for this. - return pointerCursor(); -} - -} diff --git a/WebCore/platform/wx/DragDataWx.cpp b/WebCore/platform/wx/DragDataWx.cpp deleted file mode 100644 index 97ea38c..0000000 --- a/WebCore/platform/wx/DragDataWx.cpp +++ /dev/null @@ -1,96 +0,0 @@ -/* - * Copyright (C) 2007, 2008 Apple 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. - */ - -#include "config.h" -#include "DragData.h" - -#include "Clipboard.h" -#include "Document.h" -#include "DocumentFragment.h" - -namespace WebCore { - -bool DragData::canSmartReplace() const -{ - return false; -} - -bool DragData::containsColor() const -{ - return false; -} - -bool DragData::containsFiles() const -{ - return false; -} - -void DragData::asFilenames(Vector<String>& result) const -{ -} - -bool DragData::containsPlainText() const -{ - return false; -} - -String DragData::asPlainText() const -{ - return String(); -} - -Color DragData::asColor() const -{ - return Color(); -} - -PassRefPtr<Clipboard> DragData::createClipboard(ClipboardAccessPolicy) const -{ - return 0; -} - -bool DragData::containsCompatibleContent() const -{ - return false; -} - -bool DragData::containsURL() const -{ - return false; -} - -String DragData::asURL(String* title) const -{ - return String(); -} - - -PassRefPtr<DocumentFragment> DragData::asFragment(Document*) const -{ - return 0; -} - -} - diff --git a/WebCore/platform/wx/DragImageWx.cpp b/WebCore/platform/wx/DragImageWx.cpp deleted file mode 100644 index df2dcee..0000000 --- a/WebCore/platform/wx/DragImageWx.cpp +++ /dev/null @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2007 Apple 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. - */ - -#include "config.h" -#include "DragImage.h" -#include "CachedImage.h" -#include "FloatSize.h" -#include "Image.h" - -namespace WebCore { - -IntSize dragImageSize(DragImageRef) -{ - return IntSize(0, 0); -} - -void deleteDragImage(DragImageRef) -{ -} - -DragImageRef scaleDragImage(DragImageRef image, FloatSize) -{ - return image; -} - -DragImageRef dissolveDragImageToFraction(DragImageRef image, float) -{ - return image; -} - -DragImageRef createDragImageFromImage(Image*) -{ - return 0; -} - -DragImageRef createDragImageIconForCachedImage(CachedImage*) -{ - return 0; -} - -} diff --git a/WebCore/platform/wx/EventLoopWx.cpp b/WebCore/platform/wx/EventLoopWx.cpp deleted file mode 100644 index 99090ca..0000000 --- a/WebCore/platform/wx/EventLoopWx.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2008 Kevin Ollivier <kevino@theolliviers.com> 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 "config.h" -#include "EventLoop.h" - -#include <wx/defs.h> -#include <wx/app.h> - -namespace WebCore { - -void EventLoop::cycle() -{ - if (wxTheApp) { - if (wxTheApp->IsMainLoopRunning()) - wxTheApp->Dispatch(); - else - m_ended = true; - } -} - -} // namespace WebCore diff --git a/WebCore/platform/wx/FileSystemWx.cpp b/WebCore/platform/wx/FileSystemWx.cpp deleted file mode 100644 index 7de425e..0000000 --- a/WebCore/platform/wx/FileSystemWx.cpp +++ /dev/null @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Ollivier - * Copyright (C) 2008 Collabora, Ltd. - * - * 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 "config.h" -#include "FileSystem.h" - -#include "CString.h" -#include "NotImplemented.h" -#include "PlatformString.h" - -#include <wx/wx.h> -#include <wx/filename.h> - -namespace WebCore { - -bool fileExists(const String& path) -{ - notImplemented(); - return true; -} - -bool deleteFile(const String& path) -{ - notImplemented(); - return false; -} - -bool deleteEmptyDirectory(const String& path) -{ - notImplemented(); - return false; -} - -bool getFileSize(const String& path, long long& resultSize) -{ - notImplemented(); - return false; -} - -bool getFileModificationTime(const String&, time_t&) -{ - notImplemented(); - return false; -} - -bool makeAllDirectories(const String& path) -{ - notImplemented(); - return false; -} - -String pathByAppendingComponent(const String& path, const String& component) -{ - notImplemented(); - return String(); -} - -String homeDirectoryPath() -{ - notImplemented(); - return String(); -} - -String pathGetFileName(const String& path) -{ - return wxFileName(path).GetFullName(); -} - -String directoryName(const String& path) -{ - notImplemented(); - return String(); -} - -CString openTemporaryFile(const char* prefix, PlatformFileHandle& handle) -{ - notImplemented(); - handle = invalidPlatformFileHandle; - return CString(); -} - -void closeFile(PlatformFileHandle&) -{ - notImplemented(); -} - -int writeToFile(PlatformFileHandle, const char* data, int length) -{ - notImplemented(); - return 0; -} - -bool unloadModule(PlatformModule) -{ - notImplemented(); - return false; -} - -Vector<String> listDirectory(const String& path, const String& filter) -{ - Vector<String> entries; - notImplemented(); - return entries; -} - -} diff --git a/WebCore/platform/wx/KeyEventWin.cpp b/WebCore/platform/wx/KeyEventWin.cpp deleted file mode 100644 index f8f0155..0000000 --- a/WebCore/platform/wx/KeyEventWin.cpp +++ /dev/null @@ -1,157 +0,0 @@ -/* - * 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. - */ - -#include "config.h" -#include "PlatformKeyboardEvent.h" -#include <windows.h> - -#define REPEAT_COUNT_MASK 0x0000FFFF -#define NEW_RELEASE_STATE_MASK 0x80000000 -#define PREVIOUS_DOWN_STATE_MASK 0x40000000 -#define ALT_KEY_DOWN_MASK 0x20000000 - -#define HIGH_BIT_MASK_SHORT 0x8000 - -namespace WebCore { - -// FIXME: This is incomplete. We should change this to mirror -// more like what Firefox does, and generate these switch statements -// at build time. -static String keyIdentifierForWindowsKeyCode(short keyCode) -{ - switch (keyCode) { - case VK_MENU: - return "Alt"; - case VK_CLEAR: - return "Clear"; - case VK_DOWN: - return "Down"; - // "End" - case VK_END: - return "End"; - // "Enter" - case VK_RETURN: - return "Enter"; - case VK_EXECUTE: - return "Execute"; - case VK_F1: - return "F1"; - case VK_F2: - return "F2"; - case VK_F3: - return "F3"; - case VK_F4: - return "F4"; - case VK_F5: - return "F5"; - case VK_F6: - return "F6"; - case VK_F7: - return "F7"; - case VK_F8: - return "F8"; - case VK_F9: - return "F9"; - case VK_F10: - return "F11"; - case VK_F12: - return "F12"; - case VK_F13: - return "F13"; - case VK_F14: - return "F14"; - case VK_F15: - return "F15"; - case VK_F16: - return "F16"; - case VK_F17: - return "F17"; - case VK_F18: - return "F18"; - case VK_F19: - return "F19"; - case VK_F20: - return "F20"; - case VK_F21: - return "F21"; - case VK_F22: - return "F22"; - case VK_F23: - return "F23"; - case VK_F24: - return "F24"; - case VK_HELP: - return "Help"; - case VK_HOME: - return "Home"; - case VK_INSERT: - return "Insert"; - case VK_LEFT: - return "Left"; - case VK_NEXT: - return "PageDown"; - case VK_PRIOR: - return "PageUp"; - case VK_PAUSE: - return "Pause"; - case VK_SNAPSHOT: - return "PrintScreen"; - case VK_RIGHT: - return "Right"; - case VK_SCROLL: - return "Scroll"; - case VK_SELECT: - return "Select"; - case VK_UP: - return "Up"; - // Standard says that DEL becomes U+007F. - case VK_DELETE: - return "U+007F"; - default: - return String::sprintf("U+%04X", toupper(keyCode)); - } -} - -static String singleCharacterString(UChar c) { return String(&c, 1); } - -PlatformKeyboardEvent::PlatformKeyboardEvent(HWND hWnd, WPARAM wParam, LPARAM lParam) - : m_text(singleCharacterString(wParam)) - , m_unmodifiedText(singleCharacterString(wParam)) - , m_keyIdentifier(keyIdentifierForWindowsKeyCode(wParam)) - , m_isKeyUp((lParam & NEW_RELEASE_STATE_MASK)) - , m_autoRepeat(lParam & REPEAT_COUNT_MASK) - , m_WindowsKeyCode(wParam) - , m_isKeypad(false) // FIXME - , m_shiftKey(GetAsyncKeyState(VK_SHIFT) & HIGH_BIT_MASK_SHORT) - , m_ctrlKey(GetAsyncKeyState(VK_CONTROL) & HIGH_BIT_MASK_SHORT) - , m_altKey(lParam & ALT_KEY_DOWN_MASK) - , m_metaKey(lParam & ALT_KEY_DOWN_MASK) // FIXME: Is this right? - , m_isModifierKeyPress(false) -{ - if (!m_shiftKey) - m_text = String(singleCharacterString(tolower(wParam))); -} - -} diff --git a/WebCore/platform/wx/KeyboardCodes.h b/WebCore/platform/wx/KeyboardCodes.h deleted file mode 100644 index 86ee48c..0000000 --- a/WebCore/platform/wx/KeyboardCodes.h +++ /dev/null @@ -1,544 +0,0 @@ -/* - * Copyright (C) 2006 Michael Emmel mike.emmel@gmail.com - * - * 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. - */ - -#ifndef KeyboardCodes_h -#define KeyboardCodes_h - -namespace WebCore { - -// VK_LBUTTON (01) Left mouse button -// VK_RBUTTON (02) Right mouse button -// VK_CANCEL (03) Control-break processing -// VK_MBUTTON (04) Middle mouse button (three-button mouse) -// VK_XBUTTON1 (05) -// VK_XBUTTON2 (06) - -// VK_BACK (08) BACKSPACE key -const int VK_BACK = 0x08; - -// VK_TAB (09) TAB key -const int VK_TAB = 0x09; - -// VK_CLEAR (0C) CLEAR key -const int VK_CLEAR = 0x0C; - -// VK_RETURN (0D) -const int VK_RETURN = 0x0D; - -// VK_SHIFT (10) SHIFT key -const int VK_SHIFT = 0x10; - -// VK_CONTROL (11) CTRL key -const int VK_CONTROL = 0x11; - -// VK_MENU (12) ALT key -const int VK_MENU = 0x12; - -// VK_PAUSE (13) PAUSE key -const int VK_PAUSE = 0x13; - -// VK_CAPITAL (14) CAPS LOCK key -const int VK_CAPITAL = 0x14; - -// VK_KANA (15) Input Method Editor (IME) Kana mode -const int VK_KANA = 0x15; - -// VK_HANGUEL (15) IME Hanguel mode (maintained for compatibility; use VK_HANGUL) -// VK_HANGUL (15) IME Hangul mode -const int VK_HANGUL = 0x15; - -// VK_JUNJA (17) IME Junja mode -const int VK_JUNJA = 0x17; - -// VK_FINAL (18) IME final mode -const int VK_FINAL = 0x18; - -// VK_HANJA (19) IME Hanja mode -const int VK_HANJA = 0x19; - -// VK_KANJI (19) IME Kanji mode -const int VK_KANJI = 0x19; - -// VK_ESCAPE (1B) ESC key -const int VK_ESCAPE = 0x1B; - -// VK_CONVERT (1C) IME convert -const int VK_CONVERT = 0x1C; - -// VK_NONCONVERT (1D) IME nonconvert -const int VK_NONCONVERT = 0x1D; - -// VK_ACCEPT (1E) IME accept -const int VK_ACCEPT = 0x1E; - -// VK_MODECHANGE (1F) IME mode change request -const int VK_MODECHANGE = 0x1F; - -// VK_SPACE (20) SPACEBAR -const int VK_SPACE = 0x20; - -// VK_PRIOR (21) PAGE UP key -const int VK_PRIOR = 0x21; - -// VK_NEXT (22) PAGE DOWN key -const int VK_NEXT = 0x22; - -// VK_END (23) END key -const int VK_END = 0x23; - -// VK_HOME (24) HOME key -const int VK_HOME = 0x24; - -// VK_LEFT (25) LEFT ARROW key -const int VK_LEFT = 0x25; - -// VK_UP (26) UP ARROW key -const int VK_UP = 0x26; - -// VK_RIGHT (27) RIGHT ARROW key -const int VK_RIGHT = 0x27; - -// VK_DOWN (28) DOWN ARROW key -const int VK_DOWN = 0x28; - -// VK_SELECT (29) SELECT key -const int VK_SELECT = 0x29; - -// VK_PRINT (2A) PRINT key -const int VK_PRINT = 0x2A; - -// VK_EXECUTE (2B) EXECUTE key -const int VK_EXECUTE = 0x2B; - -// VK_SNAPSHOT (2C) PRINT SCREEN key -const int VK_SNAPSHOT = 0x2C; - -// VK_INSERT (2D) INS key -const int VK_INSERT = 0x2D; - -// VK_DELETE (2E) DEL key -const int VK_DELETE = 0x2E; - -// VK_HELP (2F) HELP key -const int VK_HELP = 0x2F; - -// (30) 0 key -const int VK_0 = 0x30; - -// (31) 1 key -const int VK_1 = 0x31; - -// (32) 2 key -const int VK_2 = 0x32; - -// (33) 3 key -const int VK_3 = 0x33; - -// (34) 4 key -const int VK_4 = 0x34; - -// (35) 5 key; - -const int VK_5 = 0x35; - -// (36) 6 key -const int VK_6 = 0x36; - -// (37) 7 key -const int VK_7 = 0x37; - -// (38) 8 key -const int VK_8 = 0x38; - -// (39) 9 key -const int VK_9 = 0x39; - -// (41) A key -const int VK_A = 0x41; - -// (42) B key -const int VK_B = 0x42; - -// (43) C key -const int VK_C = 0x43; - -// (44) D key -const int VK_D = 0x44; - -// (45) E key -const int VK_E = 0x45; - -// (46) F key -const int VK_F = 0x46; - -// (47) G key -const int VK_G = 0x47; - -// (48) H key -const int VK_H = 0x48; - -// (49) I key -const int VK_I = 0x49; - -// (4A) J key -const int VK_J = 0x4A; - -// (4B) K key -const int VK_K = 0x4B; - -// (4C) L key -const int VK_L = 0x4C; - -// (4D) M key -const int VK_M = 0x4D; - -// (4E) N key -const int VK_N = 0x4E; - -// (4F) O key -const int VK_O = 0x4F; - -// (50) P key -const int VK_P = 0x50; - -// (51) Q key -const int VK_Q = 0x51; - -// (52) R key -const int VK_R = 0x52; - -// (53) S key -const int VK_S = 0x53; - -// (54) T key -const int VK_T = 0x54; - -// (55) U key -const int VK_U = 0x55; - -// (56) V key -const int VK_V = 0x56; - -// (57) W key -const int VK_W = 0x57; - -// (58) X key -const int VK_X = 0x58; - -// (59) Y key -const int VK_Y = 0x59; - -// (5A) Z key -const int VK_Z = 0x5A; - -// VK_LWIN (5B) Left Windows key (Microsoft Natural keyboard) -const int VK_LWIN = 0x5B; - -// VK_RWIN (5C) Right Windows key (Natural keyboard) -const int VK_RWIN = 0x5C; - -// VK_APPS (5D) Applications key (Natural keyboard) -const int VK_APPS = 0x5D; - -// VK_SLEEP (5F) Computer Sleep key -const int VK_SLEEP = 0x5F; - -// VK_NUMPAD0 (60) Numeric keypad 0 key -const int VK_NUMPAD0 = 0x60; - -// VK_NUMPAD1 (61) Numeric keypad 1 key -const int VK_NUMPAD1 = 0x61; - -// VK_NUMPAD2 (62) Numeric keypad 2 key -const int VK_NUMPAD2 = 0x62; - -// VK_NUMPAD3 (63) Numeric keypad 3 key -const int VK_NUMPAD3 = 0x63; - -// VK_NUMPAD4 (64) Numeric keypad 4 key -const int VK_NUMPAD4 = 0x64; - -// VK_NUMPAD5 (65) Numeric keypad 5 key -const int VK_NUMPAD5 = 0x65; - -// VK_NUMPAD6 (66) Numeric keypad 6 key -const int VK_NUMPAD6 = 0x66; - -// VK_NUMPAD7 (67) Numeric keypad 7 key -const int VK_NUMPAD7 = 0x67; - -// VK_NUMPAD8 (68) Numeric keypad 8 key -const int VK_NUMPAD8 = 0x68; - -// VK_NUMPAD9 (69) Numeric keypad 9 key -const int VK_NUMPAD9 = 0x69; - -// VK_MULTIPLY (6A) Multiply key -const int VK_MULTIPLY = 0x6A; - -// VK_ADD (6B) Add key -const int VK_ADD = 0x6B; - -// VK_SEPARATOR (6C) Separator key -const int VK_SEPARATOR = 0x6C; - -// VK_SUBTRACT (6D) Subtract key -const int VK_SUBTRACT = 0x6D; - -// VK_DECIMAL (6E) Decimal key -const int VK_DECIMAL = 0x6E; - -// VK_DIVIDE (6F) Divide key -const int VK_DIVIDE = 0x6F; - -// VK_F1 (70) F1 key -const int VK_F1 = 0x70; - -// VK_F2 (71) F2 key -const int VK_F2 = 0x71; - -// VK_F3 (72) F3 key -const int VK_F3 = 0x72; - -// VK_F4 (73) F4 key -const int VK_F4 = 0x73; - -// VK_F5 (74) F5 key -const int VK_F5 = 0x74; - -// VK_F6 (75) F6 key -const int VK_F6 = 0x75; - -// VK_F7 (76) F7 key -const int VK_F7 = 0x76; - -// VK_F8 (77) F8 key -const int VK_F8 = 0x77; - -// VK_F9 (78) F9 key -const int VK_F9 = 0x78; - -// VK_F10 (79) F10 key -const int VK_F10 = 0x79; - -// VK_F11 (7A) F11 key -const int VK_F11 = 0x7A; - -// VK_F12 (7B) F12 key -const int VK_F12 = 0x7B; - -// VK_F13 (7C) F13 key -const int VK_F13 = 0x7C; - -// VK_F14 (7D) F14 key -const int VK_F14 = 0x7D; - -// VK_F15 (7E) F15 key -const int VK_F15 = 0x7E; - -// VK_F16 (7F) F16 key -const int VK_F16 = 0x7F; - -// VK_F17 (80H) F17 key -const int VK_F17 = 0x80; - -// VK_F18 (81H) F18 key -const int VK_F18 = 0x81; - -// VK_F19 (82H) F19 key -const int VK_F19 = 0x82; - -// VK_F20 (83H) F20 key -const int VK_F20 = 0x83; - -// VK_F21 (84H) F21 key -const int VK_F21 = 0x84; - -// VK_F22 (85H) F22 key -const int VK_F22 = 0x85; - -// VK_F23 (86H) F23 key -const int VK_F23 = 0x86; - -// VK_F24 (87H) F24 key -const int VK_F24 = 0x87; - -// VK_NUMLOCK (90) NUM LOCK key -const int VK_NUMLOCK = 0x90; - -// VK_SCROLL (91) SCROLL LOCK key -const int VK_SCROLL = 0x91; - -// VK_LSHIFT (A0) Left SHIFT key -const int VK_LSHIFT = 0xA0; - -// VK_RSHIFT (A1) Right SHIFT key -const int VK_RSHIFT = 0xA1; - -// VK_LCONTROL (A2) Left CONTROL key -const int VK_LCONTROL = 0xA2; - -// VK_RCONTROL (A3) Right CONTROL key -const int VK_RCONTROL = 0xA3; - -// VK_LMENU (A4) Left MENU key -const int VK_LMENU = 0xA4; - -// VK_RMENU (A5) Right MENU key -const int VK_RMENU = 0xA5; - -// VK_BROWSER_BACK (A6) Windows 2000/XP: Browser Back key -const int VK_BROWSER_BACK = 0xA6; - -// VK_BROWSER_FORWARD (A7) Windows 2000/XP: Browser Forward key -const int VK_BROWSER_FORWARD = 0xA7; - -// VK_BROWSER_REFRESH (A8) Windows 2000/XP: Browser Refresh key -const int VK_BROWSER_REFRESH = 0xA8; - -// VK_BROWSER_STOP (A9) Windows 2000/XP: Browser Stop key -const int VK_BROWSER_STOP = 0xA9; - -// VK_BROWSER_SEARCH (AA) Windows 2000/XP: Browser Search key -const int VK_BROWSER_SEARCH = 0xAA; - -// VK_BROWSER_FAVORITES (AB) Windows 2000/XP: Browser Favorites key -const int VK_BROWSER_FAVORITES = 0xAB; - -// VK_BROWSER_HOME (AC) Windows 2000/XP: Browser Start and Home key -const int VK_BROWSER_HOME = 0xAC; - -// VK_VOLUME_MUTE (AD) Windows 2000/XP: Volume Mute key -const int VK_VOLUME_MUTE = 0xAD; - -// VK_VOLUME_DOWN (AE) Windows 2000/XP: Volume Down key -const int VK_VOLUME_DOWN = 0xAE; - -// VK_VOLUME_UP (AF) Windows 2000/XP: Volume Up key -const int VK_VOLUME_UP = 0xAF; - -// VK_MEDIA_NEXT_TRACK (B0) Windows 2000/XP: Next Track key -const int VK_MEDIA_NEXT_TRACK = 0xB0; - -// VK_MEDIA_PREV_TRACK (B1) Windows 2000/XP: Previous Track key -const int VK_MEDIA_PREV_TRACK = 0xB1; - -// VK_MEDIA_STOP (B2) Windows 2000/XP: Stop Media key -const int VK_MEDIA_STOP = 0xB2; - -// VK_MEDIA_PLAY_PAUSE (B3) Windows 2000/XP: Play/Pause Media key -const int VK_MEDIA_PLAY_PAUSE = 0xB3; - -// VK_LAUNCH_MAIL (B4) Windows 2000/XP: Start Mail key -const int VK_MEDIA_LAUNCH_MAIL = 0xB4; - -// VK_LAUNCH_MEDIA_SELECT (B5) Windows 2000/XP: Select Media key -const int VK_MEDIA_LAUNCH_MEDIA_SELECT = 0xB5; - -// VK_LAUNCH_APP1 (B6) Windows 2000/XP: Start Application 1 key -const int VK_MEDIA_LAUNCH_APP1 = 0xB6; - -// VK_LAUNCH_APP2 (B7) Windows 2000/XP: Start Application 2 key -const int VK_MEDIA_LAUNCH_APP2 = 0xB7; - -// VK_OEM_1 (BA) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ';:' key -const int VK_OEM_1 = 0xBA; - -// VK_OEM_PLUS (BB) Windows 2000/XP: For any country/region, the '+' key -const int VK_OEM_PLUS = 0xBB; - -// VK_OEM_COMMA (BC) Windows 2000/XP: For any country/region, the ',' key -const int VK_OEM_COMMA = 0xBC; - -// VK_OEM_MINUS (BD) Windows 2000/XP: For any country/region, the '-' key -const int VK_OEM_MINUS = 0xBD; - -// VK_OEM_PERIOD (BE) Windows 2000/XP: For any country/region, the '.' key -const int VK_OEM_PERIOD = 0xBE; - -// VK_OEM_2 (BF) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '/?' key -const int VK_OEM_2 = 0xBF; - -// VK_OEM_3 (C0) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '`~' key -const int VK_OEM_3 = 0xC0; - -// VK_OEM_4 (DB) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '[{' key -const int VK_OEM_4 = 0xDB; - -// VK_OEM_5 (DC) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the '\|' key -const int VK_OEM_5 = 0xDC; - -// VK_OEM_6 (DD) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the ']}' key -const int VK_OEM_6 = 0xDD; - -// VK_OEM_7 (DE) Used for miscellaneous characters; it can vary by keyboard. Windows 2000/XP: For the US standard keyboard, the 'single-quote/double-quote' key -const int VK_OEM_7 = 0xDE; - -// VK_OEM_8 (DF) Used for miscellaneous characters; it can vary by keyboard. -const int VK_OEM_8 = 0xDF; - -// VK_OEM_102 (E2) Windows 2000/XP: Either the angle bracket key or the backslash key on the RT 102-key keyboard -const int VK_OEM_102 = 0xE2; - -// VK_PROCESSKEY (E5) Windows 95/98/Me, Windows NT 4.0, Windows 2000/XP: IME PROCESS key -const int VK_PROCESSKEY = 0xE5; - -// VK_PACKET (E7) Windows 2000/XP: Used to pass Unicode characters as if they were keystrokes. The VK_PACKET key is the low word of a 32-bit Virtual Key value used for non-keyboard input methods. For more information, see Remark in KEYBDINPUT,SendInput, WM_KEYDOWN, and WM_KEYUP -const int VK_PACKET = 0xE7; - -// VK_ATTN (F6) Attn key -const int VK_ATTN = 0xF6; - -// VK_CRSEL (F7) CrSel key -const int VK_CRSEL = 0xF7; - -// VK_EXSEL (F8) ExSel key -const int VK_EXSEL = 0xF8; - -// VK_EREOF (F9) Erase EOF key -const int VK_EREOF = 0xF9; - -// VK_PLAY (FA) Play key -const int VK_PLAY = 0xFA; - -// VK_ZOOM (FB) Zoom key -const int VK_ZOOM = 0xFB; - -// VK_NONAME (FC) Reserved for future use -const int VK_NONAME = 0xFC; - -// VK_PA1 (FD) PA1 key -const int VK_PA1 = 0xFD; - -// VK_OEM_CLEAR (FE) Clear key -const int VK_OEM_CLEAR = 0xFE; - -const int VK_UNKNOWN = 0; - -} - -#endif diff --git a/WebCore/platform/wx/KeyboardEventWx.cpp b/WebCore/platform/wx/KeyboardEventWx.cpp deleted file mode 100644 index 8be87ac..0000000 --- a/WebCore/platform/wx/KeyboardEventWx.cpp +++ /dev/null @@ -1,372 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com> - * - * 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 "config.h" -#include "PlatformKeyboardEvent.h" - -#include "KeyboardCodes.h" -#include "NotImplemented.h" - -#include <wx/defs.h> -#include <wx/event.h> - -namespace WebCore { - -static String keyIdentifierForWxKeyCode(int keyCode) -{ - switch (keyCode) { - case WXK_MENU: - case WXK_ALT: - return "Alt"; - case WXK_CLEAR: - return "Clear"; - case WXK_DOWN: - return "Down"; - case WXK_END: - return "End"; - case WXK_RETURN: - return "Enter"; - case WXK_EXECUTE: - return "Execute"; - case WXK_F1: - return "F1"; - case WXK_F2: - return "F2"; - case WXK_F3: - return "F3"; - case WXK_F4: - return "F4"; - case WXK_F5: - return "F5"; - case WXK_F6: - return "F6"; - case WXK_F7: - return "F7"; - case WXK_F8: - return "F8"; - case WXK_F9: - return "F9"; - case WXK_F10: - return "F10"; - case WXK_F11: - return "F11"; - case WXK_F12: - return "F12"; - case WXK_F13: - return "F13"; - case WXK_F14: - return "F14"; - case WXK_F15: - return "F15"; - case WXK_F16: - return "F16"; - case WXK_F17: - return "F17"; - case WXK_F18: - return "F18"; - case WXK_F19: - return "F19"; - case WXK_F20: - return "F20"; - case WXK_F21: - return "F21"; - case WXK_F22: - return "F22"; - case WXK_F23: - return "F23"; - case WXK_F24: - return "F24"; - case WXK_HELP: - return "Help"; - case WXK_HOME: - return "Home"; - case WXK_INSERT: - return "Insert"; - case WXK_LEFT: - return "Left"; - case WXK_PAGEDOWN: - return "PageDown"; - case WXK_PAGEUP: - return "PageUp"; - case WXK_PAUSE: - return "Pause"; - case WXK_PRINT: - return "PrintScreen"; - case WXK_RIGHT: - return "Right"; - case WXK_SELECT: - return "Select"; - case WXK_UP: - return "Up"; - // Standard says that DEL becomes U+007F. - case WXK_DELETE: - return "U+007F"; - default: - return String::format("U+%04X", toupper(keyCode)); - } -} - -static int windowsKeyCodeForKeyEvent(unsigned int keycode) -{ - switch (keycode) { - /* FIXME: Need to supply a bool in this func, to determine wheter the event comes from the keypad - */ - case WXK_NUMPAD0: - return VK_NUMPAD0;// (60) Numeric keypad 0 key - case WXK_NUMPAD1: - return VK_NUMPAD1;// (61) Numeric keypad 1 key - case WXK_NUMPAD2: - return VK_NUMPAD2; // (62) Numeric keypad 2 key - case WXK_NUMPAD3: - return VK_NUMPAD3; // (63) Numeric keypad 3 key - case WXK_NUMPAD4: - return VK_NUMPAD4; // (64) Numeric keypad 4 key - case WXK_NUMPAD5: - return VK_NUMPAD5; //(65) Numeric keypad 5 key - case WXK_NUMPAD6: - return VK_NUMPAD6; // (66) Numeric keypad 6 key - case WXK_NUMPAD7: - return VK_NUMPAD7; // (67) Numeric keypad 7 key - case WXK_NUMPAD8: - return VK_NUMPAD8; // (68) Numeric keypad 8 key - case WXK_NUMPAD9: - return VK_NUMPAD9; // (69) Numeric keypad 9 key - case WXK_NUMPAD_MULTIPLY: - return VK_MULTIPLY; // (6A) Multiply key - case WXK_NUMPAD_ADD: - return VK_ADD; // (6B) Add key - case WXK_NUMPAD_SUBTRACT: - return VK_SUBTRACT; // (6D) Subtract key - case WXK_NUMPAD_DECIMAL: - return VK_DECIMAL; // (6E) Decimal key - case WXK_DIVIDE: - return VK_DIVIDE; // (6F) Divide key - - - case WXK_BACK: - return VK_BACK; // (08) BACKSPACE key - case WXK_TAB: - return VK_TAB; // (09) TAB key - case WXK_CLEAR: - return VK_CLEAR; // (0C) CLEAR key - case WXK_RETURN: - return VK_RETURN; //(0D) Return key - case WXK_SHIFT: - return VK_SHIFT; // (10) SHIFT key - case WXK_CONTROL: - return VK_CONTROL; // (11) CTRL key - case WXK_MENU: - case WXK_ALT: - return VK_MENU; // (12) ALT key - - case WXK_PAUSE: - return VK_PAUSE; // (13) PAUSE key - case WXK_CAPITAL: - return VK_CAPITAL; // (14) CAPS LOCK key - /* - case WXK_Kana_Lock: - case WXK_Kana_Shift: - return VK_KANA; // (15) Input Method Editor (IME) Kana mode - case WXK_Hangul: - return VK_HANGUL; // VK_HANGUL (15) IME Hangul mode - // VK_JUNJA (17) IME Junja mode - // VK_FINAL (18) IME final mode - case WXK_Hangul_Hanja: - return VK_HANJA; // (19) IME Hanja mode - case WXK_Kanji: - return VK_KANJI; // (19) IME Kanji mode - */ - case WXK_ESCAPE: - return VK_ESCAPE; // (1B) ESC key - // VK_CONVERT (1C) IME convert - // VK_NONCONVERT (1D) IME nonconvert - // VK_ACCEPT (1E) IME accept - // VK_MODECHANGE (1F) IME mode change request - case WXK_SPACE: - return VK_SPACE; // (20) SPACEBAR - case WXK_PAGEUP: - return VK_PRIOR; // (21) PAGE UP key - case WXK_PAGEDOWN: - return VK_NEXT; // (22) PAGE DOWN key - case WXK_END: - return VK_END; // (23) END key - case WXK_HOME: - return VK_HOME; // (24) HOME key - case WXK_LEFT: - return VK_LEFT; // (25) LEFT ARROW key - case WXK_UP: - return VK_UP; // (26) UP ARROW key - case WXK_RIGHT: - return VK_RIGHT; // (27) RIGHT ARROW key - case WXK_DOWN: - return VK_DOWN; // (28) DOWN ARROW key - case WXK_SELECT: - return VK_SELECT; // (29) SELECT key - case WXK_PRINT: - return VK_PRINT; // (2A) PRINT key - case WXK_EXECUTE: - return VK_EXECUTE;// (2B) EXECUTE key - //dunno on this - //case WXK_PrintScreen: - // return VK_SNAPSHOT; // (2C) PRINT SCREEN key - case WXK_INSERT: - return VK_INSERT; // (2D) INS key - case WXK_DELETE: - return VK_DELETE; // (2E) DEL key - case WXK_HELP: - return VK_HELP; // (2F) HELP key - case '0': - return VK_0; // (30) 0) key - case '1': - return VK_1; // (31) 1 ! key - case '2': - return VK_2; // (32) 2 & key - case '3': - return VK_3; //case '3': case '#'; - case '4': // (34) 4 key '$'; - return VK_4; - case '5': - return VK_5; // (35) 5 key '%' - case '6': - return VK_6; // (36) 6 key '^' - case '7': - return VK_7; // (37) 7 key case '&' - case '8': - return VK_8; // (38) 8 key '*' - case '9': - return VK_9; // (39) 9 key '(' - case 'A': - return VK_A; // (41) A key case 'a': case 'A': return 0x41; - case 'B': - return VK_B; // (42) B key case 'b': case 'B': return 0x42; - case 'C': - return VK_C; // (43) C key case 'c': case 'C': return 0x43; - case 'D': - return VK_D; // (44) D key case 'd': case 'D': return 0x44; - case 'E': - return VK_E; // (45) E key case 'e': case 'E': return 0x45; - case 'F': - return VK_F; // (46) F key case 'f': case 'F': return 0x46; - case 'G': - return VK_G; // (47) G key case 'g': case 'G': return 0x47; - case 'H': - return VK_H; // (48) H key case 'h': case 'H': return 0x48; - case 'I': - return VK_I; // (49) I key case 'i': case 'I': return 0x49; - case 'J': - return VK_J; // (4A) J key case 'j': case 'J': return 0x4A; - case 'K': - return VK_K; // (4B) K key case 'k': case 'K': return 0x4B; - case 'L': - return VK_L; // (4C) L key case 'l': case 'L': return 0x4C; - case 'M': - return VK_M; // (4D) M key case 'm': case 'M': return 0x4D; - case 'N': - return VK_N; // (4E) N key case 'n': case 'N': return 0x4E; - case 'O': - return VK_O; // (4F) O key case 'o': case 'O': return 0x4F; - case 'P': - return VK_P; // (50) P key case 'p': case 'P': return 0x50; - case 'Q': - return VK_Q; // (51) Q key case 'q': case 'Q': return 0x51; - case 'R': - return VK_R; // (52) R key case 'r': case 'R': return 0x52; - case 'S': - return VK_S; // (53) S key case 's': case 'S': return 0x53; - case 'T': - return VK_T; // (54) T key case 't': case 'T': return 0x54; - case 'U': - return VK_U; // (55) U key case 'u': case 'U': return 0x55; - case 'V': - return VK_V; // (56) V key case 'v': case 'V': return 0x56; - case 'W': - return VK_W; // (57) W key case 'w': case 'W': return 0x57; - case 'X': - return VK_X; // (58) X key case 'x': case 'X': return 0x58; - case 'Y': - return VK_Y; // (59) Y key case 'y': case 'Y': return 0x59; - case 'Z': - return VK_Z; // (5A) Z key case 'z': case 'Z': return 0x5A; - case WXK_WINDOWS_LEFT: - return VK_LWIN; // (5B) Left Windows key (Microsoft Natural keyboard) - - case WXK_NUMLOCK: - return VK_NUMLOCK; // (90) NUM LOCK key - - case WXK_SCROLL: - return VK_SCROLL; // (91) SCROLL LOCK key - - default: - return 0; - } -} - -PlatformKeyboardEvent::PlatformKeyboardEvent(wxKeyEvent& event) -{ - if (event.GetEventType() == wxEVT_KEY_UP) - m_type = KeyUp; - else if (event.GetEventType() == wxEVT_KEY_DOWN) - m_type = KeyDown; - else if (event.GetEventType() == wxEVT_CHAR) - m_type = Char; - else - ASSERT_NOT_REACHED(); - if (m_type != Char) - m_keyIdentifier = keyIdentifierForWxKeyCode(event.GetKeyCode()); - else { - m_text = wxString(event.GetUnicodeKey()); - m_unmodifiedText = m_text; - } - m_autoRepeat = false; // FIXME: not correct. - m_windowsVirtualKeyCode = windowsKeyCodeForKeyEvent(event.GetKeyCode()); - m_nativeVirtualKeyCode = event.GetKeyCode(); - m_isKeypad = (event.GetKeyCode() >= WXK_NUMPAD_SPACE) && (event.GetKeyCode() <= WXK_NUMPAD_DIVIDE); - m_shiftKey = event.ShiftDown(); - m_ctrlKey = event.CmdDown(); - m_altKey = event.AltDown(); - m_metaKey = event.MetaDown(); -} - -void PlatformKeyboardEvent::disambiguateKeyDownEvent(Type type, bool) -{ - // Can only change type from KeyDown to RawKeyDown or Char, as we lack information for other conversions. - ASSERT(m_type == KeyDown); - m_type = type; - if (type == RawKeyDown) { - m_text = String(); - m_unmodifiedText = String(); - } else { - m_keyIdentifier = String(); - m_windowsVirtualKeyCode = 0; - } -} - -bool PlatformKeyboardEvent::currentCapsLockState() -{ - return wxGetKeyState(WXK_CAPITAL); -} - -} - diff --git a/WebCore/platform/wx/LocalizedStringsWx.cpp b/WebCore/platform/wx/LocalizedStringsWx.cpp deleted file mode 100644 index a315181..0000000 --- a/WebCore/platform/wx/LocalizedStringsWx.cpp +++ /dev/null @@ -1,321 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Ollivier - * 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 "config.h" -#include "LocalizedStrings.h" - -#include "PlatformString.h" - -namespace WebCore { - -String submitButtonDefaultLabel() -{ - return String("Submit"); -} - -String inputElementAltText() -{ - return String(); -} - -String resetButtonDefaultLabel() -{ - return String("Reset"); -} - -String defaultLanguage() -{ - return String("en"); -} - -String searchableIndexIntroduction() -{ - return String("Searchable Index"); -} - -String fileButtonChooseFileLabel() -{ - return String("Choose File"); -} - -String fileButtonNoFileSelectedLabel() -{ - return String("No file selected"); -} - -String contextMenuItemTagOpenLinkInNewWindow() -{ - return String(); -} - -String contextMenuItemTagDownloadLinkToDisk() -{ - return String(); -} - -String contextMenuItemTagCopyLinkToClipboard() -{ - return String(); -} - -String contextMenuItemTagOpenImageInNewWindow() -{ - return String(); -} - -String contextMenuItemTagDownloadImageToDisk() -{ - return String(); -} - -String contextMenuItemTagCopyImageToClipboard() -{ - return String(); -} - -String contextMenuItemTagOpenFrameInNewWindow() -{ - return String(); -} - -String contextMenuItemTagCopy() -{ - return String(); -} - -String contextMenuItemTagGoBack() -{ - return String(); -} - -String contextMenuItemTagGoForward() -{ - return String(); -} - -String contextMenuItemTagStop() -{ - return String(); -} - -String contextMenuItemTagReload() -{ - return String(); -} - -String contextMenuItemTagCut() -{ - return String(); -} - -String contextMenuItemTagPaste() -{ - return String(); -} - -String contextMenuItemTagNoGuessesFound() -{ - return String(); -} - -String contextMenuItemTagIgnoreSpelling() -{ - return String(); -} - -String contextMenuItemTagLearnSpelling() -{ - return String(); -} - -String contextMenuItemTagSearchWeb() -{ - return String(); -} - -String contextMenuItemTagLookUpInDictionary() -{ - return String(); -} - -String contextMenuItemTagOpenLink() -{ - return String(); -} - -String contextMenuItemTagIgnoreGrammar() -{ - return String(); -} - -String contextMenuItemTagSpellingMenu() -{ - return String(); -} - -String contextMenuItemTagShowSpellingPanel(bool show) -{ - return String(); -} - -String contextMenuItemTagCheckSpelling() -{ - return String(); -} - -String contextMenuItemTagCheckSpellingWhileTyping() -{ - return String(); -} - -String contextMenuItemTagCheckGrammarWithSpelling() -{ - return String(); -} - -String contextMenuItemTagFontMenu() -{ - return String(); -} - -String contextMenuItemTagBold() -{ - return String(); -} - -String contextMenuItemTagItalic() -{ - return String(); -} - -String contextMenuItemTagUnderline() -{ - return String(); -} - -String contextMenuItemTagOutline() -{ - return String(); -} - -String contextMenuItemTagWritingDirectionMenu() -{ - return String(); -} - -String contextMenuItemTagDefaultDirection() -{ - return String(); -} - -String contextMenuItemTagLeftToRight() -{ - return String(); -} - -String contextMenuItemTagRightToLeft() -{ - return String(); -} - -String searchMenuNoRecentSearchesText() -{ - return String("No recent searches"); -} - -String searchMenuRecentSearchesText() -{ - return String("Recent searches"); -} - -String searchMenuClearRecentSearchesText() -{ - return String("Clear recent searches"); -} - -String contextMenuItemTagInspectElement() -{ - return String("Inspect Element"); -} - -String multipleFileUploadText(unsigned numberOfFiles) -{ - // FIXME: If this file gets localized, this should really be localized as one string with a wildcard for the number. - return String::number(numberOfFiles) + String(" files"); -} - -String unknownFileSizeText() -{ - return String("Unknown"); -} - -String imageTitle(const String& filename, const IntSize& size) -{ - return String(); -} - -// accessibility related strings -String AXButtonActionVerb() -{ - return String(); -} - -String AXRadioButtonActionVerb() -{ - return String(); -} - -String AXTextFieldActionVerb() -{ - return String(); -} - -String AXCheckedCheckBoxActionVerb() -{ - return String(); -} - -String AXUncheckedCheckBoxActionVerb() -{ - return String(); -} - -String AXLinkActionVerb() -{ - return String(); -} - -String AXDefinitionListTermText() -{ - return String(); -} - -String AXDefinitionListDefinitionText() -{ - return String(); -} - -} // namespace WebCore diff --git a/WebCore/platform/wx/LoggingWx.cpp b/WebCore/platform/wx/LoggingWx.cpp deleted file mode 100644 index 006712c..0000000 --- a/WebCore/platform/wx/LoggingWx.cpp +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com> - * - * 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 "config.h" -#include "Logging.h" - -namespace WebCore { - -void InitializeLoggingChannelsIfNecessary() -{ - LogNotYetImplemented.state = WTFLogChannelOn; -} - -} diff --git a/WebCore/platform/wx/MimeTypeRegistryWx.cpp b/WebCore/platform/wx/MimeTypeRegistryWx.cpp deleted file mode 100644 index c025d02..0000000 --- a/WebCore/platform/wx/MimeTypeRegistryWx.cpp +++ /dev/null @@ -1,72 +0,0 @@ -/* - * Copyright (C) 2006 Zack Rusin <zack@kde.org> - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. - * Copyright (C) 2008 Nokia Corporation and/or its subsidiary(-ies) - * - * 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 "config.h" -#include "MIMETypeRegistry.h" - -namespace WebCore { - -struct ExtensionMap { - const char* extension; - const char* mimeType; -}; -static const ExtensionMap extensionMap [] = { - { "bmp", "image/bmp" }, - { "css", "text/css" }, - { "gif", "image/gif" }, - { "html", "text/html" }, - { "ico", "image/x-icon" }, - { "jpeg", "image/jpeg" }, - { "jpg", "image/jpeg" }, - { "js", "application/x-javascript" }, - { "pdf", "application/pdf" }, - { "png", "image/png" }, - { "rss", "application/rss+xml" }, - { "svg", "image/svg+xml" }, - { "text", "text/plain" }, - { "txt", "text/plain" }, - { "xbm", "image/x-xbitmap" }, - { "xml", "text/xml" }, - { "xsl", "text/xsl" }, - { "xhtml", "application/xhtml+xml" }, - { 0, 0 } -}; - -String MIMETypeRegistry::getMIMETypeForExtension(const String &ext) -{ - String s = ext.lower(); - const ExtensionMap *e = extensionMap; - while (e->extension) { - if (s == e->extension) - return e->mimeType; - ++e; - } - // unknown, let's just assume plain text - return "text/plain"; -} - -} diff --git a/WebCore/platform/wx/MouseEventWx.cpp b/WebCore/platform/wx/MouseEventWx.cpp deleted file mode 100644 index c9468a9..0000000 --- a/WebCore/platform/wx/MouseEventWx.cpp +++ /dev/null @@ -1,75 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com> - * - * 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 "config.h" -#include "Assertions.h" -#include "PlatformMouseEvent.h" -#include "SystemTime.h" - -#include <wx/defs.h> -#include <wx/event.h> - -namespace WebCore { - -PlatformMouseEvent::PlatformMouseEvent(const wxMouseEvent& event, const wxPoint& globalPoint) - : m_position(event.GetPosition()) - , m_globalPosition(globalPoint) - , m_shiftKey(event.ShiftDown()) - , m_ctrlKey(event.CmdDown()) - , m_altKey(event.AltDown()) - , m_metaKey(event.MetaDown()) // FIXME: We'll have to test other browsers -{ - wxEventType type = event.GetEventType(); - m_eventType = MouseEventMoved; - - if (type == wxEVT_LEFT_DOWN || type == wxEVT_MIDDLE_DOWN || type == wxEVT_RIGHT_DOWN) - m_eventType = MouseEventPressed; - - else if (type == wxEVT_LEFT_UP || type == wxEVT_MIDDLE_UP || type == wxEVT_RIGHT_UP || - type == wxEVT_LEFT_DCLICK || type == wxEVT_MIDDLE_DCLICK || type == wxEVT_RIGHT_DCLICK) - m_eventType = MouseEventReleased; - - else if (type == wxEVT_MOTION) - m_eventType = MouseEventMoved; - - if (event.LeftIsDown() || event.Button(wxMOUSE_BTN_LEFT)) - m_button = LeftButton; - else if (event.RightIsDown() || event.Button(wxMOUSE_BTN_RIGHT)) - m_button = RightButton; - else if (event.MiddleIsDown() || event.Button(wxMOUSE_BTN_MIDDLE)) - m_button = MiddleButton; - else if (!m_eventType == MouseEventMoved) - ASSERT_NOT_REACHED(); - - - if (m_eventType == MouseEventMoved) - m_clickCount = 0; - else - m_clickCount = event.ButtonDClick() ? 2 : 1; - - m_timestamp = WebCore::currentTime(); -} - -} diff --git a/WebCore/platform/wx/MouseWheelEventWx.cpp b/WebCore/platform/wx/MouseWheelEventWx.cpp deleted file mode 100644 index 154a710..0000000 --- a/WebCore/platform/wx/MouseWheelEventWx.cpp +++ /dev/null @@ -1,50 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com> - * - * 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 "config.h" -#include "PlatformWheelEvent.h" - -#include <wx/defs.h> -#include <wx/event.h> - -namespace WebCore { - -PlatformWheelEvent::PlatformWheelEvent(const wxMouseEvent& event, const wxPoint& globalPoint) - : m_position(event.GetPosition()) - , m_globalPosition(globalPoint) - , m_granularity(ScrollByLineWheelEvent) - , m_shiftKey(event.ShiftDown()) - , m_ctrlKey(event.ControlDown()) - , m_altKey(event.AltDown()) - , m_metaKey(event.MetaDown()) // FIXME: We'll have to test other browsers - , m_deltaX(0) // wx doesn't support horizontal mouse wheel scrolling - , m_deltaY(event.GetWheelRotation() / event.GetWheelDelta()) - , m_isAccepted(false) -{ - // FIXME: retrieve the user setting for the number of lines to scroll on each wheel event - m_deltaY *= horizontalLineMultiplier(); -} - -} diff --git a/WebCore/platform/wx/PasteboardWx.cpp b/WebCore/platform/wx/PasteboardWx.cpp deleted file mode 100644 index 3b71e9a..0000000 --- a/WebCore/platform/wx/PasteboardWx.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com> - * - * 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 "config.h" - -#include "Pasteboard.h" -#include "DocumentFragment.h" -#include "Editor.h" -#include "Frame.h" -#include "KURL.h" -#include "markup.h" -#include "PlatformString.h" - -#include <wx/defs.h> -#include <wx/dataobj.h> -#include <wx/clipbrd.h> - -namespace WebCore { - -Pasteboard::Pasteboard() -{ -} - -Pasteboard* Pasteboard::generalPasteboard() -{ - static Pasteboard* pasteboard = new Pasteboard(); - return pasteboard; -} - -void Pasteboard::writeSelection(Range* selectedRange, bool canSmartCopyOrDelete, Frame* frame) -{ - if (wxTheClipboard->Open()) - { - String text = frame->selectedText(); - text.replace('\\', frame->backslashAsCurrencySymbol()); - - wxTheClipboard->SetData( new wxTextDataObject(text) ); - wxTheClipboard->Close(); - } -} - -bool Pasteboard::canSmartReplace() -{ - return false; -} - -String Pasteboard::plainText(Frame* frame) -{ - return String(); -} - -PassRefPtr<DocumentFragment> Pasteboard::documentFragment(Frame* frame, PassRefPtr<Range> context, - bool allowPlainText, bool& chosePlainText) -{ - return 0; -} - -void Pasteboard::writeURL(const KURL& url, const String&, Frame*) -{ - if (wxTheClipboard->Open()) - { - wxTheClipboard->SetData( new wxTextDataObject( url.string() ) ); - wxTheClipboard->Close(); - } -} - -void Pasteboard::clear() -{ - wxTheClipboard->Clear(); -} - -void Pasteboard::writeImage(Node*, const KURL&, const String& title) -{ -} - -} diff --git a/WebCore/platform/wx/PopupMenuWx.cpp b/WebCore/platform/wx/PopupMenuWx.cpp deleted file mode 100644 index 4563b77..0000000 --- a/WebCore/platform/wx/PopupMenuWx.cpp +++ /dev/null @@ -1,113 +0,0 @@ -/* - * This file is part of the popup menu implementation for <select> elements in WebCore. - * - * Copyright (C) 2008 Apple Computer, Inc. - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Library General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Library General Public License for more details. - * - * You should have received a copy of the GNU Library General Public License - * along with this library; see the file COPYING.LIB. If not, write to - * the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, - * Boston, MA 02110-1301, USA. - * - */ - -#include "config.h" -#include "PopupMenu.h" - -#include "Frame.h" -#include "FrameView.h" -#include "NotImplemented.h" -#include "PopupMenuClient.h" -#include "PlatformString.h" - -#include <wx/defs.h> -#if __WXMSW__ -#include <wx/msw/winundef.h> -#endif -#include <wx/event.h> -#include <wx/menu.h> - -static int s_menuStartId = wxNewId(); - - - -namespace WebCore { - -PopupMenu::PopupMenu(PopupMenuClient* client) - : m_popupClient(client) - , m_menu(NULL) -{ -} - -PopupMenu::~PopupMenu() -{ - delete m_menu; -} - -void PopupMenu::show(const IntRect& r, FrameView* v, int index) -{ - // just delete and recreate - delete m_menu; - ASSERT(client()); - - wxWindow* nativeWin = v->platformWidget(); - - if (nativeWin) { - // construct the menu - m_menu = new wxMenu(); - int size = client()->listSize(); - for (int i = 0; i < size; i++) { - int id = s_menuStartId + i; - - if (client()->itemIsSeparator(i)) { - m_menu->AppendSeparator(); - } - else { - // FIXME: appending a menu item with an empty label asserts in - // wx. This needs to be fixed at wx level so that we can have - // the concept of "no selection" in choice boxes, etc. - if (!client()->itemText(i).isEmpty()) - m_menu->Append(s_menuStartId + i, client()->itemText(i)); - } - } - nativeWin->Connect(s_menuStartId, s_menuStartId + (size-1), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenu::OnMenuItemSelected), NULL, this); - nativeWin->PopupMenu(m_menu, r.x() - v->scrollX(), r.y() - v->scrollY()); - nativeWin->Disconnect(s_menuStartId, s_menuStartId + (size-1), wxEVT_COMMAND_MENU_SELECTED, wxCommandEventHandler(PopupMenu::OnMenuItemSelected), NULL, this); - } -} - -void PopupMenu::OnMenuItemSelected(wxCommandEvent& event) -{ - if (client()) { - client()->valueChanged(event.GetId() - s_menuStartId); - client()->hidePopup(); - } - // TODO: Do we need to call Disconnect here? Do we have a ref to the native window still? -} - -void PopupMenu::hide() -{ - // we don't need to do anything here, the native control only exists during the time - // show is called -} - -void PopupMenu::updateFromElement() -{ - client()->setTextFromItem(m_popupClient->selectedIndex()); -} - -bool PopupMenu::itemWritingDirectionIsNatural() -{ - return false; -} - -} diff --git a/WebCore/platform/wx/RenderThemeWx.cpp b/WebCore/platform/wx/RenderThemeWx.cpp deleted file mode 100644 index 05ebeb9..0000000 --- a/WebCore/platform/wx/RenderThemeWx.cpp +++ /dev/null @@ -1,382 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com> - * - * 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 "config.h" -#include "RenderTheme.h" - -#include "Document.h" -#include "FrameView.h" -#include "GraphicsContext.h" -#include "NotImplemented.h" -#include "RenderView.h" - -#include "WebKit/wx/WebView.h" - -#include <wx/defs.h> -#include <wx/renderer.h> -#include <wx/dcclient.h> -#include <wx/scrolwin.h> -#include <wx/settings.h> - -namespace WebCore { - -class RenderThemeWx : public RenderTheme { -public: - RenderThemeWx() : RenderTheme() { } - - // A method asking if the theme's controls actually care about redrawing when hovered. - virtual bool supportsHover(const RenderStyle*) const { return true; } - - virtual bool paintCheckbox(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) - { - return paintButton(o, i, r); - } - - virtual void setCheckboxSize(RenderStyle*) const; - - virtual bool paintRadio(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) - { - return paintButton(o, i, r); - } - - virtual void setRadioSize(RenderStyle*) const; - - virtual void adjustRepaintRect(const RenderObject*, IntRect&); - - virtual void adjustButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - - virtual void adjustTextFieldStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintTextField(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - - virtual int minimumMenuListSize(RenderStyle*) const; - - virtual void adjustMenuListStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintMenuList(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - - virtual void adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const; - virtual bool paintMenuListButton(RenderObject*, const RenderObject::PaintInfo&, const IntRect&); - - virtual bool isControlStyled(const RenderStyle*, const BorderData&, - const FillLayer&, const Color&) const; - - virtual bool controlSupportsTints(const RenderObject*) const; - - virtual void systemFont(int propId, FontDescription&) const; - - virtual Color platformActiveSelectionBackgroundColor() const; - virtual Color platformInactiveSelectionBackgroundColor() const; - - virtual Color platformActiveSelectionForegroundColor() const; - virtual Color platformInactiveSelectionForegroundColor() const; - - virtual int popupInternalPaddingLeft(RenderStyle*) const; - virtual int popupInternalPaddingRight(RenderStyle*) const; - virtual int popupInternalPaddingTop(RenderStyle*) const; - virtual int popupInternalPaddingBottom(RenderStyle*) const; - -private: - void addIntrinsicMargins(RenderStyle*) const; - void close(); - - bool supportsFocus(ControlPart) const; -}; - - -// Constants - -#define MINIMUM_MENU_LIST_SIZE 21 -#define POPUP_INTERNAL_PADDING_LEFT 6 -#define POPUP_INTERNAL_PADDING_TOP 2 -#define POPUP_INTERNAL_PADDING_BOTTOM 2 - -#ifdef __WXMAC__ -#define POPUP_INTERNAL_PADDING_RIGHT 22 -#else -#define POPUP_INTERNAL_PADDING_RIGHT 20 -#endif - -RenderTheme* theme() -{ - static RenderThemeWx rt; - return &rt; -} - -bool RenderThemeWx::isControlStyled(const RenderStyle* style, const BorderData& border, - const FillLayer& background, const Color& backgroundColor) const -{ - if (style->appearance() == TextFieldPart || style->appearance() == TextAreaPart) - return style->border() != border; - - return RenderTheme::isControlStyled(style, border, background, backgroundColor); -} - -void RenderThemeWx::adjustRepaintRect(const RenderObject* o, IntRect& r) -{ - switch (o->style()->appearance()) { - case MenulistPart: { - r.setWidth(r.width() + 100); - break; - } - default: - break; - } -} - -bool RenderThemeWx::controlSupportsTints(const RenderObject* o) const -{ - if (!isEnabled(o)) - return false; - - // Checkboxes only have tint when checked. - if (o->style()->appearance() == CheckboxPart) - return isChecked(o); - - // For now assume other controls have tint if enabled. - return true; -} - -void RenderThemeWx::systemFont(int propId, FontDescription& fontDescription) const -{ - // no-op -} - -void RenderThemeWx::addIntrinsicMargins(RenderStyle* style) const -{ - // Cut out the intrinsic margins completely if we end up using a small font size - if (style->fontSize() < 11) - return; - - // Intrinsic margin value. - const int m = 2; - - // FIXME: Using width/height alone and not also dealing with min-width/max-width is flawed. - if (style->width().isIntrinsicOrAuto()) { - if (style->marginLeft().quirk()) - style->setMarginLeft(Length(m, Fixed)); - - if (style->marginRight().quirk()) - style->setMarginRight(Length(m, Fixed)); - } - - if (style->height().isAuto()) { - if (style->marginTop().quirk()) - style->setMarginTop(Length(m, Fixed)); - - if (style->marginBottom().quirk()) - style->setMarginBottom(Length(m, Fixed)); - } -} - -void RenderThemeWx::setCheckboxSize(RenderStyle* style) const -{ - // If the width and height are both specified, then we have nothing to do. - if (!style->width().isIntrinsicOrAuto() && !style->height().isAuto()) - return; - - // FIXME: A hard-coded size of 13 is used. This is wrong but necessary for now. It matches Firefox. - // At different DPI settings on Windows, querying the theme gives you a larger size that accounts for - // the higher DPI. Until our entire engine honors a DPI setting other than 96, we can't rely on the theme's - // metrics. - if (style->width().isIntrinsicOrAuto()) - style->setWidth(Length(13, Fixed)); - - if (style->height().isAuto()) - style->setHeight(Length(13, Fixed)); -} - -void RenderThemeWx::setRadioSize(RenderStyle* style) const -{ - // This is the same as checkboxes. - setCheckboxSize(style); -} - -bool RenderThemeWx::supportsFocus(ControlPart part) const -{ - switch (part) { - case PushButtonPart: - case ButtonPart: - case TextFieldPart: - return true; - default: // No for all others... - return false; - } -} - -void RenderThemeWx::adjustButtonStyle(CSSStyleSelector* selector, RenderStyle* style, Element* e) const -{ - addIntrinsicMargins(style); -} - -bool RenderThemeWx::paintButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) -{ - wxWindow* window = o->view()->frameView()->platformWidget(); - wxDC* dc = static_cast<wxDC*>(i.context->platformContext()); - int flags = 0; - - if (!isEnabled(o)) - flags |= wxCONTROL_DISABLED; - - ControlPart part = o->style()->appearance(); - if (supportsFocus(part) && isFocused(o)) - flags |= wxCONTROL_FOCUSED; - - if (isPressed(o)) - flags |= wxCONTROL_PRESSED; - - if (part == PushButtonPart || part == ButtonPart) - wxRendererNative::Get().DrawPushButton(window, *dc, r, flags); - else if(part == RadioPart) { - if (isChecked(o)) - flags |= wxCONTROL_CHECKED; - wxRenderer_DrawRadioButton(window, *dc, r, flags); - } - else if(part == CheckboxPart) { - if (isChecked(o)) - flags |= wxCONTROL_CHECKED; - wxRendererNative::Get().DrawCheckBox(window, *dc, r, flags); - } - return false; -} - -void RenderThemeWx::adjustTextFieldStyle(CSSStyleSelector*, RenderStyle* style, Element*) const -{ - -} - -bool RenderThemeWx::paintTextField(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) -{ - wxWindow* window = o->view()->frameView()->platformWidget(); - wxDC* dc = static_cast<wxDC*>(i.context->platformContext()); - wxRenderer_DrawTextCtrl(window, *dc, r, 0); - return false; -} - -int RenderThemeWx::minimumMenuListSize(RenderStyle*) const -{ - return MINIMUM_MENU_LIST_SIZE; -} - -void RenderThemeWx::adjustMenuListStyle(CSSStyleSelector*, RenderStyle* style, Element*) const -{ -} - -bool RenderThemeWx::paintMenuList(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) -{ - wxWindow* window = o->view()->frameView()->platformWidget(); - wxDC* dc = static_cast<wxDC*>(i.context->platformContext()); - - int flags = 0; - if (!isEnabled(o)) - flags |= wxCONTROL_DISABLED; - - if (supportsFocus(o->style()->appearance()) && isFocused(o)) - flags |= wxCONTROL_FOCUSED; - - if (isPressed(o)) - flags |= wxCONTROL_PRESSED; - - wxRenderer_DrawChoice(window, *dc, r, flags); - - return false; -} - -void RenderThemeWx::adjustMenuListButtonStyle(CSSStyleSelector*, RenderStyle*, Element*) const -{ - notImplemented(); -} - -bool RenderThemeWx::paintMenuListButton(RenderObject* o, const RenderObject::PaintInfo& i, const IntRect& r) -{ - wxWindow* window = o->view()->frameView()->platformWidget(); - wxDC* dc = static_cast<wxDC*>(i.context->platformContext()); - - int flags = 0; - if (!isEnabled(o)) - flags |= wxCONTROL_DISABLED; - - if (supportsFocus(o->style()->appearance()) && isFocused(o)) - flags |= wxCONTROL_FOCUSED; - - if (isPressed(o)) - flags |= wxCONTROL_PRESSED; - - wxRendererNative::Get().DrawComboBoxDropButton(window, *dc, r, flags); - - return false; -} - - -Color RenderThemeWx::platformActiveSelectionBackgroundColor() const -{ - return wxSystemSettings::GetColour(wxSYS_COLOUR_HIGHLIGHT); -} - -Color RenderThemeWx::platformInactiveSelectionBackgroundColor() const -{ - return wxSystemSettings::GetColour(wxSYS_COLOUR_BTNSHADOW); -} - -Color RenderThemeWx::platformActiveSelectionForegroundColor() const -{ - // FIXME: Get wx to return the correct value for each platform. -#if __WXMAC__ - return Color(); -#else - return Color(255, 255, 255); -#endif -} - -Color RenderThemeWx::platformInactiveSelectionForegroundColor() const -{ -#if __WXMAC__ - return Color(); -#else - return Color(255, 255, 255); -#endif -} - -int RenderThemeWx::popupInternalPaddingLeft(RenderStyle*) const -{ - return POPUP_INTERNAL_PADDING_LEFT; -} - -int RenderThemeWx::popupInternalPaddingRight(RenderStyle*) const -{ - return POPUP_INTERNAL_PADDING_RIGHT; -} - -int RenderThemeWx::popupInternalPaddingTop(RenderStyle*) const -{ - return POPUP_INTERNAL_PADDING_TOP; -} - -int RenderThemeWx::popupInternalPaddingBottom(RenderStyle*) const -{ - return POPUP_INTERNAL_PADDING_BOTTOM; -} - -} - diff --git a/WebCore/platform/wx/ScreenWx.cpp b/WebCore/platform/wx/ScreenWx.cpp deleted file mode 100644 index 5def245..0000000 --- a/WebCore/platform/wx/ScreenWx.cpp +++ /dev/null @@ -1,98 +0,0 @@ -/* - * 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. - */ - -#include "config.h" - -#include "Screen.h" -#include "IntRect.h" -#include "FloatRect.h" -#include "Widget.h" - -#include <wx/defs.h> -#include <wx/display.h> -#include <wx/gdicmn.h> - -namespace WebCore { - -FloatRect scaleScreenRectToWidget(FloatRect rect, Widget*) -{ - return rect; -} - -FloatRect scaleWidgetRectToScreen(FloatRect rect, Widget*) -{ - return rect; -} - -FloatRect screenRect(Widget* widget) -{ -/* - int displayNum; - Widget* widget = widget->widget(); - displayNum = wxDisplay::GetFromWindow(widget->nativeWindow()); - if (displayNum != -1){ - wxDisplay thisDisplay(displayNum); - return thisDisplay.GetGeometry(); - } -*/ - return FloatRect(); -} - -int screenDepth(Widget* widget) -{ - return wxDisplayDepth(); -} - -int screenDepthPerComponent(Widget*) -{ - return wxDisplayDepth(); -} - -bool screenIsMonochrome(Widget* widget) -{ - return wxColourDisplay(); -} - -FloatRect screenAvailableRect(Widget* widget) -{ -/* - Widget* widget = widget->widget(); - displayNum = wxDisplay::GetFromWindow(widget->nativeWindow()); - if (displayNum != -1){ - wxDisplay thisDisplay(displayNum); - // FIXME: In 2.7 this method is gone? - //return thisDisplay.GetClientArea(); - } -*/ - return FloatRect(); -} - -float scaleFactor(Widget*) -{ - return 1.0f; - -} - -} diff --git a/WebCore/platform/wx/ScrollViewWx.cpp b/WebCore/platform/wx/ScrollViewWx.cpp deleted file mode 100644 index 3822cba..0000000 --- a/WebCore/platform/wx/ScrollViewWx.cpp +++ /dev/null @@ -1,352 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com> - * - * 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 "config.h" -#include "ScrollView.h" - -#include "FloatRect.h" -#include "IntRect.h" -#include "NotImplemented.h" -#include "PlatformWheelEvent.h" -#include "Scrollbar.h" - -#include <algorithm> -#include <stdio.h> - -#include <wx/defs.h> -#include <wx/scrolbar.h> -#include <wx/scrolwin.h> -#include <wx/event.h> - -using namespace std; - -namespace WebCore { - -class ScrollView::ScrollViewPrivate : public wxEvtHandler { - -public: - ScrollViewPrivate(ScrollView* scrollView) - : wxEvtHandler() - , m_scrollView(scrollView) - , vScrollbarMode(ScrollbarAuto) - , hScrollbarMode(ScrollbarAuto) - , viewStart(0, 0) - { - } - - void bindEvents(wxWindow* win) - { - // TODO: is there an easier way to Connect to a range of events? these are contiguous. - win->Connect(wxEVT_SCROLLWIN_TOP, wxScrollWinEventHandler(ScrollViewPrivate::OnScrollWinEvents), NULL, this); - win->Connect(wxEVT_SCROLLWIN_BOTTOM, wxScrollWinEventHandler(ScrollViewPrivate::OnScrollWinEvents), NULL, this); - win->Connect(wxEVT_SCROLLWIN_LINEUP, wxScrollWinEventHandler(ScrollViewPrivate::OnScrollWinEvents), NULL, this); - win->Connect(wxEVT_SCROLLWIN_LINEDOWN, wxScrollWinEventHandler(ScrollViewPrivate::OnScrollWinEvents), NULL, this); - win->Connect(wxEVT_SCROLLWIN_PAGEUP, wxScrollWinEventHandler(ScrollViewPrivate::OnScrollWinEvents), NULL, this); - win->Connect(wxEVT_SCROLLWIN_PAGEDOWN, wxScrollWinEventHandler(ScrollViewPrivate::OnScrollWinEvents), NULL, this); - win->Connect(wxEVT_SCROLLWIN_THUMBTRACK, wxScrollWinEventHandler(ScrollViewPrivate::OnScrollWinEvents), NULL, this); - win->Connect(wxEVT_SCROLLWIN_THUMBRELEASE, wxScrollWinEventHandler(ScrollViewPrivate::OnScrollWinEvents), NULL, this); - } - - void OnScrollWinEvents(wxScrollWinEvent& e) - { - wxEventType scrollType(e.GetEventType()); - bool horiz = e.GetOrientation() == wxHORIZONTAL; - - wxPoint pos(viewStart); - - if (scrollType == wxEVT_SCROLLWIN_THUMBTRACK || scrollType == wxEVT_SCROLLWIN_THUMBRELEASE) { - if (horiz) - pos.x = e.GetPosition(); - else - pos.y = e.GetPosition(); - } - else if (scrollType == wxEVT_SCROLLWIN_LINEDOWN) { - if (horiz) - pos.x += cScrollbarPixelsPerLineStep; - else - pos.y += cScrollbarPixelsPerLineStep; - } - else if (scrollType == wxEVT_SCROLLWIN_LINEUP) { - if (horiz) - pos.x -= cScrollbarPixelsPerLineStep; - else - pos.y -= cScrollbarPixelsPerLineStep; - } - else if (scrollType == wxEVT_SCROLLWIN_PAGEUP) { - if (horiz) - pos.x -= m_scrollView->visibleWidth() - cAmountToKeepWhenPaging; - else - pos.y -= m_scrollView->visibleHeight() - cAmountToKeepWhenPaging; - } - else if (scrollType == wxEVT_SCROLLWIN_PAGEDOWN) { - if (horiz) - pos.x += m_scrollView->visibleWidth() - cAmountToKeepWhenPaging; - else - pos.y += m_scrollView->visibleHeight() - cAmountToKeepWhenPaging; - } - else - return e.Skip(); - - m_scrollView->setScrollPosition(IntPoint(pos.x, pos.y)); - } - - ScrollView* m_scrollView; - - ScrollbarMode vScrollbarMode; - ScrollbarMode hScrollbarMode; - wxPoint viewStart; -}; - -void ScrollView::platformInit() -{ - m_data = new ScrollViewPrivate(this); -} - - -void ScrollView::platformDestroy() -{ - delete m_data; -} - -void ScrollView::setPlatformWidget(wxWindow* win) -{ - Widget::setPlatformWidget(win); - m_data->bindEvents(win); -} - -void ScrollView::platformRepaintContentRectangle(const IntRect& updateRect, bool now) -{ - // we need to convert coordinates to scrolled position - wxRect contentsRect = updateRect; - contentsRect.Offset(-scrollX(), -scrollY()); - wxWindow* win = platformWidget(); - if (win) { - win->RefreshRect(contentsRect, true); - if (now) - win->Update(); - } -} - -IntRect ScrollView::platformVisibleContentRect(bool includeScrollbars) const -{ - wxWindow* win = platformWidget(); - if (!win) - return IntRect(); - - int width, height; - - if (includeScrollbars) - win->GetSize(&width, &height); - else - win->GetClientSize(&width, &height); - - return IntRect(m_data->viewStart.x, m_data->viewStart.y, width, height); -} - -IntSize ScrollView::platformContentsSize() const -{ - int width = 0; - int height = 0; - if (platformWidget()) { - platformWidget()->GetVirtualSize(&width, &height); - ASSERT(width >= 0 && height >= 0); - } - return IntSize(width, height); -} - -void ScrollView::platformSetScrollPosition(const IntPoint& scrollPoint) -{ - wxWindow* win = platformWidget(); - - wxPoint scrollOffset = m_data->viewStart; - wxPoint orig(scrollOffset); - wxPoint newScrollOffset(scrollPoint); - - wxRect vRect(win->GetVirtualSize()); - wxRect cRect(win->GetClientSize()); - - // clamp to scroll area - if (newScrollOffset.x < 0) - newScrollOffset.x = 0; - else if (newScrollOffset.x + cRect.width > vRect.width) - newScrollOffset.x = max(0, vRect.width - cRect.width - 1); - - if (newScrollOffset.y < 0) - newScrollOffset.y = 0; - else if (newScrollOffset.y + cRect.height > vRect.height) - newScrollOffset.y = max(0, vRect.height - cRect.height - 1); - - if (newScrollOffset == scrollOffset) - return; - - m_data->viewStart = newScrollOffset; - - wxPoint delta(orig - newScrollOffset); - - if (canBlitOnScroll()) - win->ScrollWindow(delta.x, delta.y); - else - win->Refresh(); - - adjustScrollbars(); -} - -bool ScrollView::platformScroll(ScrollDirection, ScrollGranularity) -{ - notImplemented(); - return true; -} - -void ScrollView::platformSetContentsSize() -{ - wxWindow* win = platformWidget(); - if (!win) - return; - - win->SetVirtualSize(m_contentsSize.width(), m_contentsSize.height()); - adjustScrollbars(); -} - -void ScrollView::adjustScrollbars(int x, int y, bool refresh) -{ - wxWindow* win = platformWidget(); - if (!win) - return; - - wxRect crect(win->GetClientRect()), vrect(win->GetVirtualSize()); - - if (x == -1) x = m_data->viewStart.x; - if (y == -1) y = m_data->viewStart.y; - - long style = win->GetWindowStyle(); - - // by setting the wxALWAYS_SHOW_SB wxWindow flag before - // each SetScrollbar call, we can control the scrollbars - // visibility individually. - - // horizontal scrollbar - switch (m_data->hScrollbarMode) { - case ScrollbarAlwaysOff: - win->SetWindowStyleFlag(style & ~wxALWAYS_SHOW_SB); - win->SetScrollbar(wxHORIZONTAL, 0, 0, 0, refresh); - break; - - case ScrollbarAuto: - win->SetWindowStyleFlag(style & ~wxALWAYS_SHOW_SB); - win->SetScrollbar(wxHORIZONTAL, x, crect.width, vrect.width, refresh); - break; - - default: // ScrollbarAlwaysOn - win->SetWindowStyleFlag(style | wxALWAYS_SHOW_SB); - win->SetScrollbar(wxHORIZONTAL, x, crect.width, vrect.width, refresh); - break; - } - - // vertical scrollbar - switch (m_data->vScrollbarMode) { - case ScrollbarAlwaysOff: - win->SetWindowStyleFlag(style & ~wxALWAYS_SHOW_SB); - win->SetScrollbar(wxVERTICAL, 0, 0, 0, refresh); - break; - - case ScrollbarAlwaysOn: - win->SetWindowStyleFlag(style | wxALWAYS_SHOW_SB); - win->SetScrollbar(wxVERTICAL, y, crect.height, vrect.height, refresh); - break; - - default: // case ScrollbarAuto: - win->SetWindowStyleFlag(style & ~wxALWAYS_SHOW_SB); - win->SetScrollbar(wxVERTICAL, y, crect.height, vrect.height, refresh); - } -} - -void ScrollView::platformSetScrollbarModes() -{ - bool needsAdjust = false; - - if (m_data->hScrollbarMode != horizontalScrollbarMode() ) { - m_data->hScrollbarMode = horizontalScrollbarMode(); - needsAdjust = true; - } - - if (m_data->vScrollbarMode != horizontalScrollbarMode() ) { - m_data->vScrollbarMode = horizontalScrollbarMode(); - needsAdjust = true; - } - - if (needsAdjust) - adjustScrollbars(); -} - -void ScrollView::platformScrollbarModes(ScrollbarMode& horizontal, ScrollbarMode& vertical) const -{ - horizontal = m_data->hScrollbarMode; - vertical = m_data->vScrollbarMode; -} - -// used for subframes support -void ScrollView::platformAddChild(Widget* widget) -{ - // NB: In all cases I'm aware of, - // by the time this is called the ScrollView is already a child - // of its parent Widget by wx port APIs, so I don't think - // we need to do anything here. -} - -void ScrollView::platformRemoveChild(Widget* widget) -{ - if (platformWidget()) { - platformWidget()->RemoveChild(widget->platformWidget()); - // FIXME: Is this the right place to do deletion? I see - // detachFromParent2/3/4, initiated by FrameLoader::detachFromParent, - // but I'm not sure if it's better to handle there or not. - widget->platformWidget()->Destroy(); - } -} - -IntRect ScrollView::platformContentsToScreen(const IntRect& rect) const -{ - if (platformWidget()) { - wxRect wxrect = rect; - platformWidget()->ClientToScreen(&wxrect.x, &wxrect.y); - return wxrect; - } - return IntRect(); -} - -IntPoint ScrollView::platformScreenToContents(const IntPoint& point) const -{ - if (platformWidget()) { - return platformWidget()->ScreenToClient(point); - } - return IntPoint(); -} - -bool ScrollView::platformIsOffscreen() const -{ - return !platformWidget() || !platformWidget()->IsShownOnScreen(); -} - -} diff --git a/WebCore/platform/wx/SharedTimerWx.cpp b/WebCore/platform/wx/SharedTimerWx.cpp deleted file mode 100644 index 19747ce..0000000 --- a/WebCore/platform/wx/SharedTimerWx.cpp +++ /dev/null @@ -1,114 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com> - * - * 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 "config.h" - -#include "SharedTimer.h" -#include "NotImplemented.h" -#include "SystemTime.h" -#include "Widget.h" - -#include <wtf/Assertions.h> -#include <stdio.h> - -#include "wx/defs.h" -#include "wx/timer.h" - -namespace WebCore { - -static void (*sharedTimerFiredFunction)(); - -class WebKitTimer: public wxTimer -{ - public: - WebKitTimer(); - ~WebKitTimer(); - virtual void Notify(); -}; - -WebKitTimer::WebKitTimer() -{ - wxTimer::wxTimer(); -} - -WebKitTimer::~WebKitTimer() -{ -} - -void WebKitTimer::Notify() -{ - sharedTimerFiredFunction(); -} - -static WebKitTimer* wkTimer; - -void setSharedTimerFiredFunction(void (*f)()) -{ - sharedTimerFiredFunction = f; -} - -void setSharedTimerFireTime(double fireTime) -{ - ASSERT(sharedTimerFiredFunction); - - double interval = fireTime - currentTime(); - - if (!wkTimer) - wkTimer = new WebKitTimer(); - - unsigned int intervalInMS = interval * 1000; - if (interval < 0) { -#ifndef NDEBUG - // TODO: We may eventually want to assert here, to track - // what calls are leading to this condition. It seems to happen - // mostly with repeating timers. - fprintf(stderr, "WARNING: setSharedTimerFireTime: fire time is < 0 ms\n"); -#endif - intervalInMS = 0; - } - - // FIXME: We should mimic the Windows port's behavior and add the timer fired - // event to the event queue directly rather than making an artifical delay. - // However, wx won't allow us to assign a simple callback function - we'd have - // to create a fake wxEvtHandler-derived class with a timer event handler - // function. Until there's a better way, this way is at least far less - // hacky. - if (intervalInMS < 10) -#if __WXMSW__ - intervalInMS = 10; -#else - intervalInMS = 1; -#endif - - wkTimer->Start(intervalInMS, wxTIMER_ONE_SHOT); -} - -void stopSharedTimer() -{ - if (wkTimer) - wkTimer->Stop(); -} - -} diff --git a/WebCore/platform/wx/SoundWx.cpp b/WebCore/platform/wx/SoundWx.cpp deleted file mode 100644 index c8d0e53..0000000 --- a/WebCore/platform/wx/SoundWx.cpp +++ /dev/null @@ -1,44 +0,0 @@ -/* - * Copyright (C) 2006 Kevin Ollivier <kevino@theolliviers.com> - * - * 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 "config.h" - -#include <wx/defs.h> -#include <wx/utils.h> - -#include "Sound.h" - -namespace WebCore { - -void systemBeep() -{ - wxBell(); -} - -} - -// vim: ts=4 sw=4 et diff --git a/WebCore/platform/wx/SystemTimeWx.cpp b/WebCore/platform/wx/SystemTimeWx.cpp deleted file mode 100644 index 41e6ad7..0000000 --- a/WebCore/platform/wx/SystemTimeWx.cpp +++ /dev/null @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2007 Robin Dunn. 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 "config.h" -#include "SystemTime.h" - -#include <wx/datetime.h> - -namespace WebCore { - -double currentTime() -{ - wxDateTime now = wxDateTime::UNow(); - return (double)now.GetTicks() + (double)(now.GetMillisecond() / 1000.0); -} - -} diff --git a/WebCore/platform/wx/TemporaryLinkStubs.cpp b/WebCore/platform/wx/TemporaryLinkStubs.cpp deleted file mode 100755 index d8c6046..0000000 --- a/WebCore/platform/wx/TemporaryLinkStubs.cpp +++ /dev/null @@ -1,186 +0,0 @@ -/* - * Copyright (C) 2006 Apple Computer, Inc. All rights reserved. - * Copyright (C) 2008 Collabora, Ltd. 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 "config.h" - -#include <stdio.h> -#include <stdlib.h> -#include <float.h> - -#include "AffineTransform.h" -#include "AXObjectCache.h" -#include "BitmapImage.h" -#include "CachedResource.h" -#include "Clipboard.h" -#include "ContextMenu.h" -#include "ContextMenuItem.h" -#include "CookieJar.h" -#include "Cursor.h" -#include "DNS.h" -#include "DocumentFragment.h" -#include "DocumentLoader.h" -#include "DragController.h" -#include "Editor.h" -#include "EditCommand.h" -#include "EventHandler.h" -#include "FileChooser.h" -#include "Font.h" -#include "Frame.h" -#include "FrameLoader.h" -#include "FrameView.h" -#include "Icon.h" -#include "IconDatabase.h" -#include "IconLoader.h" -#include "IntPoint.h" -#include "GraphicsContext.h" -#include "History.h" -#include "KURL.h" -#include "Language.h" -#include "loader.h" -#include "Node.h" -#include "NotImplemented.h" -#include "Pasteboard.h" -#include "Path.h" -#include "PlatformMenuDescription.h" -#include "PlatformMouseEvent.h" -#include "PopupMenu.h" -#include "RenderTheme.h" -#include "ResourceHandle.h" -#include "ResourceHandleInternal.h" -#include "ResourceLoader.h" -#include "Screen.h" -#include "ScrollbarTheme.h" -#include "SearchPopupMenu.h" -#include "Scrollbar.h" -#include "SharedBuffer.h" -#include "SharedTimer.h" -#include "TextBoundaries.h" -#include "Widget.h" - -using namespace WebCore; - -Vector<char> loadResourceIntoArray(const char* resourceName) -{ - Vector<char> resource; - return resource; -} - -int findNextSentenceFromIndex(UChar const*,int,int,bool) { notImplemented(); return 0; } -void findSentenceBoundary(UChar const*,int,int,int*,int*) { notImplemented(); } - -int WebCore::findNextWordFromIndex(UChar const*,int,int,bool) { notImplemented(); return 0; } - -DragImageRef Frame::dragImageForSelection() { notImplemented(); return 0; } - -void GraphicsContext::addInnerRoundedRectClip(const IntRect& rect, int thickness) { notImplemented(); } - -// cookies (we'll need a place to store these -void WebCore::setCookies(Document* document, const KURL& url, const KURL& policyURL, const String& value) { notImplemented(); } -String WebCore::cookies(const Document* document, const KURL& url) { notImplemented(); return String(); } -bool WebCore::cookiesEnabled(const Document* document) { notImplemented(); return false; } - -/********************************************************/ -/* Completely empty stubs (mostly to allow DRT to run): */ -/********************************************************/ -static WebCore::Cursor localCursor; -const WebCore::Cursor& WebCore::moveCursor() { return localCursor; } - -void WebCore::findWordBoundary(UChar const* str,int len,int position,int* start, int* end) { notImplemented(); *start=position; *end=position; } - -void Widget::setIsSelected(bool) { notImplemented(); } - -void GraphicsContext::setPlatformShadow(IntSize const&,int,Color const&) { notImplemented(); } -void GraphicsContext::clearPlatformShadow() { notImplemented(); } -void GraphicsContext::beginTransparencyLayer(float) { notImplemented(); } -void GraphicsContext::endTransparencyLayer() { notImplemented(); } -void GraphicsContext::clearRect(const FloatRect&) { notImplemented(); } -void GraphicsContext::strokeRect(const FloatRect&, float) { notImplemented(); } -void GraphicsContext::setLineCap(LineCap) { notImplemented(); } -void GraphicsContext::setLineJoin(LineJoin) { notImplemented(); } -void GraphicsContext::setMiterLimit(float) { notImplemented(); } -void GraphicsContext::setAlpha(float) { notImplemented(); } - -Color WebCore::focusRingColor() { return 0xFF0000FF; } - -void Image::drawPattern(GraphicsContext*, const FloatRect& srcRect, const AffineTransform& patternTransform, const FloatPoint& phase, CompositeOperator, const FloatRect& destRect) { notImplemented(); } - -ScrollbarTheme* ScrollbarTheme::nativeTheme() { notImplemented(); static ScrollbarTheme theme; return &theme; } - -String FileChooser::basenameForWidth(const Font&, int width) const { notImplemented(); return String(); } - -Icon::~Icon() { } -PassRefPtr<Icon> Icon::createIconForFile(const String& filename) { notImplemented(); return 0; } -PassRefPtr<Icon> Icon::createIconForFiles(const Vector<String>& filenames) { notImplemented(); return 0; } -void Icon::paint(GraphicsContext*, const IntRect&) { notImplemented(); } - -ContextMenu::ContextMenu(const HitTestResult& result) : m_hitTestResult(result) { notImplemented(); } -ContextMenu::~ContextMenu() { notImplemented(); } -void ContextMenu::appendItem(ContextMenuItem&) { notImplemented(); } -void ContextMenu::setPlatformDescription(PlatformMenuDescription) { notImplemented(); } - -ContextMenuItem::ContextMenuItem(PlatformMenuItemDescription) { notImplemented(); } -ContextMenuItem::ContextMenuItem(ContextMenu*) { notImplemented(); } -ContextMenuItem::ContextMenuItem(ContextMenuItemType type, ContextMenuAction action, const String& title, ContextMenu* subMenu) { notImplemented(); } -ContextMenuItem::~ContextMenuItem() { notImplemented(); } -PlatformMenuItemDescription ContextMenuItem::releasePlatformDescription() { notImplemented(); return m_platformDescription; } -ContextMenuItemType ContextMenuItem::type() const { notImplemented(); return ActionType; } -void ContextMenuItem::setType(ContextMenuItemType) { notImplemented(); } -ContextMenuAction ContextMenuItem::action() const { notImplemented(); return ContextMenuItemTagNoAction; } -void ContextMenuItem::setAction(ContextMenuAction) { notImplemented(); } -String ContextMenuItem::title() const { notImplemented(); return String(); } -void ContextMenuItem::setTitle(const String&) { notImplemented(); } -//PlatformMenuDescription ContextMenuItem::platformSubMenu() const { notImplemented(); return 0; } -void ContextMenuItem::setSubMenu(ContextMenu*) { notImplemented(); } -void ContextMenuItem::setChecked(bool) { notImplemented(); } -void ContextMenuItem::setEnabled(bool) { notImplemented(); } - -void Editor::showColorPanel() { notImplemented(); } -void Editor::showFontPanel() { notImplemented(); } -void Editor::showStylesPanel() { notImplemented(); } - -bool EventHandler::tabsToAllControls(KeyboardEvent* event) const { notImplemented(); return false; } -bool EventHandler::passSubframeEventToSubframe(MouseEventWithHitTestResults&, Frame* subframe, HitTestResult*) { notImplemented(); return false; } -bool EventHandler::passMouseDownEventToWidget(Widget*) { notImplemented(); return false; } -bool EventHandler::passWheelEventToWidget(PlatformWheelEvent&, Widget*) { notImplemented(); return false; } - -void SearchPopupMenu::saveRecentSearches(const AtomicString& name, const Vector<String>& searchItems) { notImplemented(); } -void SearchPopupMenu::loadRecentSearches(const AtomicString& name, Vector<String>& searchItems) { notImplemented(); } -SearchPopupMenu::SearchPopupMenu(PopupMenuClient* client) : PopupMenu(client) { notImplemented(); } -bool SearchPopupMenu::enabled() { return true; } - -namespace WebCore { -float userIdleTime() { notImplemented(); return FLT_MAX; } // return an arbitrarily high userIdleTime so that releasing pages from the page cache isn't postponed -void getSupportedKeySizes(Vector<String>&) { notImplemented(); } -String signedPublicKeyAndChallengeString(unsigned keySizeIndex, const String &challengeString, const KURL &url) { return String(); } -const char* currentTextBreakLocaleID() { notImplemented(); return "en_us"; } - -String KURL::fileSystemPath() const { notImplemented(); return String(); } - -PassRefPtr<SharedBuffer> SharedBuffer::createWithContentsOfFile(const String&) { notImplemented(); return 0; } - -void prefetchDNS(const String& hostname) { notImplemented(); } - -} diff --git a/WebCore/platform/wx/WidgetWx.cpp b/WebCore/platform/wx/WidgetWx.cpp deleted file mode 100755 index 37097fe..0000000 --- a/WebCore/platform/wx/WidgetWx.cpp +++ /dev/null @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com> - * - * 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 "config.h" -#include "Widget.h" - -#include "Cursor.h" -#include "GraphicsContext.h" -#include "IntRect.h" - -#include <wx/defs.h> -#include <wx/scrolwin.h> - -namespace WebCore { - -Widget::Widget(PlatformWidget widget) -{ - init(widget); -} - -Widget::~Widget() -{ -} - -void Widget::setFocus() -{ - if (platformWidget()) - platformWidget()->SetFocus(); -} - -void Widget::setCursor(const Cursor& cursor) -{ - if (platformWidget() && cursor.impl()) - platformWidget()->SetCursor(*cursor.impl()); -} - -void Widget::show() -{ - if (platformWidget()) - platformWidget()->Show(); -} - -void Widget::hide() -{ - if (platformWidget()) - platformWidget()->Hide(); -} - -IntRect Widget::frameRect() const -{ - if (platformWidget()) - return platformWidget()->GetRect(); - return m_frame; -} - -void Widget::setFrameRect(const IntRect& rect) -{ - if (platformWidget()) - platformWidget()->SetSize(rect); - m_frame = rect; -} - -void Widget::invalidateRect(const IntRect& r) -{ - if (platformWidget()) - platformWidget()->RefreshRect(r); -} - -void Widget::paint(GraphicsContext*,const IntRect& r) -{ -} - -} diff --git a/WebCore/platform/wx/wxcode/fontprops.cpp b/WebCore/platform/wx/wxcode/fontprops.cpp deleted file mode 100644 index 56d21bd..0000000 --- a/WebCore/platform/wx/wxcode/fontprops.cpp +++ /dev/null @@ -1,35 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com> - * - * 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. - */ - -// this is a hacky way of doing it, but we don't -// currently have info on which platform we're being -// compiled for directly. -#if __WXMAC__ -#include "mac/carbon/fontprops.cpp" -#elif __WXMSW__ -#include "win/fontprops.cpp" -#else -#include "gtk/fontprops.cpp" -#endif diff --git a/WebCore/platform/wx/wxcode/fontprops.h b/WebCore/platform/wx/wxcode/fontprops.h deleted file mode 100644 index e6f0b16..0000000 --- a/WebCore/platform/wx/wxcode/fontprops.h +++ /dev/null @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com> - * - * 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 <wx/defs.h> -#include <wx/font.h> - -void GetTextExtent( const wxFont& font, const wxString& str, wxCoord *width, wxCoord *height, - wxCoord *descent = NULL, wxCoord *externalLeading = NULL ); - -class wxFontProperties{ - -public: - wxFontProperties(wxFont* font); - float GetAscent() { return m_ascent; } - float GetDescent() { return m_descent; } - float GetLineGap() { return m_lineGap; } - float GetLineSpacing() { return m_lineSpacing; } - float GetXHeight() { return m_xHeight; } - -private: - float m_ascent; - float m_descent; - float m_lineGap; - float m_lineSpacing; - float m_xHeight; - -};
\ No newline at end of file diff --git a/WebCore/platform/wx/wxcode/gtk/fontprops.cpp b/WebCore/platform/wx/wxcode/gtk/fontprops.cpp deleted file mode 100644 index 369fcc5..0000000 --- a/WebCore/platform/wx/wxcode/gtk/fontprops.cpp +++ /dev/null @@ -1,126 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com> - * - * 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 <wx/defs.h> -#include <wx/gdicmn.h> -#include <wx/font.h> -#include <wx/fontutil.h> -#include "fontprops.h" - -#include <gdk/gdk.h> - -wxFontProperties::wxFontProperties(wxFont* font): -m_ascent(0), m_descent(0), m_lineGap(0), m_lineSpacing(0), m_xHeight(0) -{ - PangoContext* context = gdk_pango_context_get_for_screen( gdk_screen_get_default() ); - PangoLayout* layout = pango_layout_new(context); - // and use it if it's valid - if ( font && font->Ok() ) - { - pango_layout_set_font_description - ( - layout, - font->GetNativeFontInfo()->description - ); - } - - PangoFontMetrics* metrics = pango_context_get_metrics (context, font->GetNativeFontInfo()->description, NULL); - - int height = font->GetPixelSize().GetHeight(); - - m_ascent = PANGO_PIXELS(pango_font_metrics_get_ascent(metrics)); - m_descent = PANGO_PIXELS(pango_font_metrics_get_descent(metrics)); - - int h; - - const char* x = "x"; - pango_layout_set_text( layout, x, strlen(x) ); - pango_layout_get_pixel_size( layout, NULL, &h ); - - m_xHeight = h; - m_lineGap = (m_ascent + m_descent) / 4; // FIXME: How can we calculate this via Pango? - m_lineSpacing = m_ascent + m_descent; - - pango_font_metrics_unref(metrics); -} - -void GetTextExtent( const wxFont& font, const wxString& str, wxCoord *width, wxCoord *height, - wxCoord *descent, wxCoord *externalLeading ) -{ - if ( width ) - *width = 0; - if ( height ) - *height = 0; - if ( descent ) - *descent = 0; - if ( externalLeading ) - *externalLeading = 0; - - if (str.empty()) - return; - - PangoContext* context = gdk_pango_context_get_for_screen( gdk_screen_get_default() ); - PangoLayout* m_layout = pango_layout_new(context); - // and use it if it's valid - if ( font != wxNullFont ) - { - pango_layout_set_font_description - ( - m_layout, - font.GetNativeFontInfo()->description - ); - } - - // Set layout's text - const wxCharBuffer dataUTF8 = wxConvUTF8.cWX2MB(str); - if ( !dataUTF8 ) - { - // hardly ideal, but what else can we do if conversion failed? - return; - } - - pango_layout_set_text( m_layout, dataUTF8, strlen(dataUTF8) ); - - if (descent) - { - int h; - pango_layout_get_pixel_size( m_layout, width, &h ); - PangoLayoutIter *iter = pango_layout_get_iter(m_layout); - int baseline = pango_layout_iter_get_baseline(iter); - pango_layout_iter_free(iter); - *descent = h - PANGO_PIXELS(baseline); - - if (height) - *height = (wxCoord) h; - } - else - { - pango_layout_get_pixel_size( m_layout, width, height ); - } - - // Reset old font description - //if (font != wxNullFont) - // pango_layout_set_font_description( m_layout, m_fontdesc ); -}
\ No newline at end of file diff --git a/WebCore/platform/wx/wxcode/gtk/non-kerned-drawing.cpp b/WebCore/platform/wx/wxcode/gtk/non-kerned-drawing.cpp deleted file mode 100644 index b86a9bc..0000000 --- a/WebCore/platform/wx/wxcode/gtk/non-kerned-drawing.cpp +++ /dev/null @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Watters, Kevin Ollivier. 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 "config.h" -#include "GlyphBuffer.h" -#include "GraphicsContext.h" -#include "SimpleFontData.h" - -#include <wx/defs.h> -#include <wx/dcclient.h> -#include <wx/gdicmn.h> -#include <vector> - -namespace WebCore { - -void drawTextWithSpacing(GraphicsContext* graphicsContext, const SimpleFontData* font, const wxColour& color, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point) -{ -#if USE(WXGC) - wxGCDC* dc = static_cast<wxGCDC*>(graphicsContext->platformContext()); -#else - wxDC* dc = graphicsContext->platformContext(); -#endif - - wxFont wxfont = font->getWxFont(); - if (wxfont.IsOk()) - dc->SetFont(wxfont); - dc->SetTextForeground(color); - - // convert glyphs to wxString - GlyphBufferGlyph* glyphs = const_cast<GlyphBufferGlyph*>(glyphBuffer.glyphs(from)); - int offset = point.x(); - wxString text = wxEmptyString; - for (unsigned i = 0; i < numGlyphs; i++) { - text = text.Append((wxChar)glyphs[i]); - offset += glyphBuffer.advanceAt(from + i); - } - - // the y point is actually the bottom point of the text, turn it into the top - float height = font->ascent() - font->descent(); - wxCoord ypoint = (wxCoord) (point.y() - height); - - dc->DrawText(text, (wxCoord)point.x(), ypoint); -} - -} diff --git a/WebCore/platform/wx/wxcode/mac/carbon/fontprops.cpp b/WebCore/platform/wx/wxcode/mac/carbon/fontprops.cpp deleted file mode 100644 index b649eb4..0000000 --- a/WebCore/platform/wx/wxcode/mac/carbon/fontprops.cpp +++ /dev/null @@ -1,174 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com> - * - * 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 <ApplicationServices/ApplicationServices.h> - -#include <wx/defs.h> -#include <wx/gdicmn.h> -#include "fontprops.h" - -const float smallCapsFontSizeMultiplier = 0.7f; -const float contextDPI = 72.0f; -static inline float scaleEmToUnits(float x, unsigned unitsPerEm) { return x * (contextDPI / (contextDPI * unitsPerEm)); } - -wxFontProperties::wxFontProperties(wxFont* font): -m_ascent(0), m_descent(0), m_lineGap(0), m_lineSpacing(0), m_xHeight(0) -{ - ATSFontRef fontRef; - CGFontRef cgFont; - - fontRef = FMGetATSFontRefFromFont(font->MacGetATSUFontID()); - - if (fontRef) - cgFont = CGFontCreateWithPlatformFont((void*)&fontRef); - - if (cgFont) { - int iAscent; - int iDescent; - int iLineGap; - float unitsPerEm; -#ifdef BUILDING_ON_TIGER - wkGetFontMetrics(cgFont, &iAscent, &iDescent, &iLineGap, &unitsPerEm); -#else - iAscent = CGFontGetAscent(cgFont); - iDescent = CGFontGetDescent(cgFont); - iLineGap = CGFontGetLeading(cgFont); - unitsPerEm = CGFontGetUnitsPerEm(cgFont); -#endif - float pointSize = font->GetPointSize(); - float fAscent = scaleEmToUnits(iAscent, unitsPerEm) * pointSize; - float fDescent = -scaleEmToUnits(iDescent, unitsPerEm) * pointSize; - float fLineGap = scaleEmToUnits(iLineGap, unitsPerEm) * pointSize; - - m_ascent = lroundf(fAscent); - m_descent = lroundf(fDescent); - m_lineGap = lroundf(fLineGap); - wxCoord xHeight = 0; - GetTextExtent(*font, wxT("x"), NULL, &xHeight, NULL, NULL); - m_xHeight = lroundf(xHeight); - m_lineSpacing = m_ascent + m_descent + m_lineGap; - - } - -} - -void GetTextExtent( const wxFont& font, const wxString& str, wxCoord *width, wxCoord *height, - wxCoord *descent, wxCoord *externalLeading ) -{ - ATSUStyle* ATSUIStyle; - - if ( font.Ok() ) - { - OSStatus status ; - - status = ATSUCreateAndCopyStyle( (ATSUStyle) font.MacGetATSUStyle() , (ATSUStyle*) &ATSUIStyle ) ; - - wxASSERT_MSG( status == noErr, wxT("couldn't create ATSU style") ) ; - - // we need the scale here ... - - Fixed atsuSize = IntToFixed( int( /*m_scaleY*/ 1 * font.MacGetFontSize()) ) ; - //RGBColor atsuColor = MAC_WXCOLORREF( m_textForegroundColor.GetPixel() ) ; - ATSUAttributeTag atsuTags[] = - { - kATSUSizeTag //, - // kATSUColorTag , - } ; - ByteCount atsuSizes[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] = - { - sizeof( Fixed ) //, - // sizeof( RGBColor ) , - } ; - ATSUAttributeValuePtr atsuValues[sizeof(atsuTags) / sizeof(ATSUAttributeTag)] = - { - &atsuSize //, - // &atsuColor , - } ; - - status = ::ATSUSetAttributes( - (ATSUStyle)ATSUIStyle, sizeof(atsuTags) / sizeof(ATSUAttributeTag) , - atsuTags, atsuSizes, atsuValues); - - wxASSERT_MSG( status == noErr , wxT("couldn't modify ATSU style") ) ; - } - - wxCHECK_RET( ATSUIStyle != NULL, wxT("GetTextExtent - no valid font set") ) ; - - OSStatus status = noErr ; - - ATSUTextLayout atsuLayout ; - UniCharCount chars = str.length() ; - UniChar* ubuf = NULL ; - -#if SIZEOF_WCHAR_T == 4 - wxMBConvUTF16 converter ; -#if wxUSE_UNICODE - size_t unicharlen = converter.WC2MB( NULL , str.wc_str() , 0 ) ; - ubuf = (UniChar*) malloc( unicharlen + 2 ) ; - converter.WC2MB( (char*) ubuf , str.wc_str(), unicharlen + 2 ) ; -#else - const wxWCharBuffer wchar = str.wc_str( wxConvLocal ) ; - size_t unicharlen = converter.WC2MB( NULL , wchar.data() , 0 ) ; - ubuf = (UniChar*) malloc( unicharlen + 2 ) ; - converter.WC2MB( (char*) ubuf , wchar.data() , unicharlen + 2 ) ; -#endif - chars = unicharlen / 2 ; -#else -#if wxUSE_UNICODE - ubuf = (UniChar*) str.wc_str() ; -#else - wxWCharBuffer wchar = str.wc_str( wxConvLocal ) ; - chars = wxWcslen( wchar.data() ) ; - ubuf = (UniChar*) wchar.data() ; -#endif -#endif - - status = ::ATSUCreateTextLayoutWithTextPtr( (UniCharArrayPtr) ubuf , 0 , chars , chars , 1 , - &chars , (ATSUStyle*) &ATSUIStyle , &atsuLayout ) ; - - wxASSERT_MSG( status == noErr , wxT("couldn't create the layout of the text") ); - - ATSUTextMeasurement textBefore, textAfter ; - ATSUTextMeasurement textAscent, textDescent ; - - status = ::ATSUGetUnjustifiedBounds( atsuLayout, kATSUFromTextBeginning, kATSUToTextEnd, - &textBefore , &textAfter, &textAscent , &textDescent ); - - if ( height ) - *height = FixedToInt(textAscent + textDescent) ; - if ( descent ) - *descent = FixedToInt(textDescent) ; - if ( externalLeading ) - *externalLeading = 0 ; - if ( width ) - *width = FixedToInt(textAfter - textBefore) ; - -#if SIZEOF_WCHAR_T == 4 - free( ubuf ) ; -#endif - - ::ATSUDisposeTextLayout(atsuLayout); - ::ATSUDisposeStyle((ATSUStyle)ATSUIStyle); -} diff --git a/WebCore/platform/wx/wxcode/mac/carbon/non-kerned-drawing.cpp b/WebCore/platform/wx/wxcode/mac/carbon/non-kerned-drawing.cpp deleted file mode 100644 index 126f7ec..0000000 --- a/WebCore/platform/wx/wxcode/mac/carbon/non-kerned-drawing.cpp +++ /dev/null @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Watters, Kevin Ollivier. 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 "config.h" -#include "GlyphBuffer.h" -#include "GraphicsContext.h" -#include "SimpleFontData.h" - -#include <wx/defs.h> -#include <wx/dcclient.h> -#include <wx/gdicmn.h> -#include <vector> - -namespace WebCore { - -void drawTextWithSpacing(GraphicsContext* graphicsContext, const SimpleFontData* font, const wxColour& color, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point) -{ -#if USE(WXGC) - wxGCDC* dc = static_cast<wxGCDC*>(graphicsContext->platformContext()); -#else - wxDC* dc = graphicsContext->platformContext(); -#endif - - wxFont wxfont = font->getWxFont(); - if (wxfont.IsOk()) - dc->SetFont(wxfont); - dc->SetTextForeground(color); - - // convert glyphs to wxString - GlyphBufferGlyph* glyphs = const_cast<GlyphBufferGlyph*>(glyphBuffer.glyphs(from)); - int offset = point.x(); - wxString text = wxEmptyString; - for (unsigned i = 0; i < numGlyphs; i++) { - text = text.Append((wxChar)glyphs[i]); - offset += glyphBuffer.advanceAt(from + i); - } - - // NOTE: The wx API actually adds the ascent to the y value internally, - // so we have to subtract it from the y point here so that the ascent - // isn't added twice. - dc->DrawText(text, (wxCoord)point.x(), int(point.y() - font->ascent())); -} - -} diff --git a/WebCore/platform/wx/wxcode/non-kerned-drawing.h b/WebCore/platform/wx/wxcode/non-kerned-drawing.h deleted file mode 100644 index d005985..0000000 --- a/WebCore/platform/wx/wxcode/non-kerned-drawing.h +++ /dev/null @@ -1,36 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Watters, Kevin Ollivier. 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 "Font.h"
-#include "GlyphBuffer.h"
-
-#include <wx/defs.h>
-#include <wx/dcclient.h>
-
-namespace WebCore {
-
-extern void drawTextWithSpacing(GraphicsContext* graphicsContext, const SimpleFontData* font, const wxColour& color, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point);
-
-}
diff --git a/WebCore/platform/wx/wxcode/win/fontprops.cpp b/WebCore/platform/wx/wxcode/win/fontprops.cpp deleted file mode 100644 index 1314691..0000000 --- a/WebCore/platform/wx/wxcode/win/fontprops.cpp +++ /dev/null @@ -1,135 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Ollivier <kevino@theolliviers.com> - * - * 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 "config.h" -#include <wx/defs.h> -#include <wx/gdicmn.h> -#include "fontprops.h" -#include "math.h" -#include "MathExtras.h" - -#include <wx/wx.h> -#include "wx/msw/private.h" - -inline long my_round(double x) -{ - return (long)(x < 0 ? x - 0.5 : x + 0.5); -} - -wxFontProperties::wxFontProperties(wxFont* font): -m_ascent(0), m_descent(0), m_lineGap(0), m_lineSpacing(0), m_xHeight(0) -{ - HDC dc = GetDC(0); - WXHFONT hFont = font->GetHFONT(); - ::SelectObject(dc, hFont); - if (font){ - - int height = font->GetPointSize(); - - TEXTMETRIC tm; - GetTextMetrics(dc, &tm); - m_ascent = lroundf(tm.tmAscent); - m_descent = lroundf(tm.tmDescent); - m_xHeight = m_ascent * 0.56f; // Best guess for xHeight for non-Truetype fonts. - m_lineGap = lroundf(tm.tmExternalLeading); - m_lineSpacing = m_lineGap + m_ascent + m_descent; - } - RestoreDC(dc, -1); - ReleaseDC(0, dc); -} - -void GetTextExtent( const wxFont& font, const wxString& str, wxCoord *width, wxCoord *height, - wxCoord *descent, wxCoord *externalLeading ) -{ - HDC dc = GetDC(0); - WXHFONT hFont = font.GetHFONT(); - ::SelectObject(dc, hFont); - - HFONT hfontOld; - if ( font != wxNullFont ) - { - wxASSERT_MSG( font.Ok(), _T("invalid font in wxDC::GetTextExtent") ); - - hfontOld = (HFONT)::SelectObject(dc, hFont); - } - else // don't change the font - { - hfontOld = 0; - } - - SIZE sizeRect; - const size_t len = str.length(); - if ( !::GetTextExtentPoint32(dc, str, len, &sizeRect) ) - { - wxLogLastError(_T("GetTextExtentPoint32()")); - } - -#if !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) - // the result computed by GetTextExtentPoint32() may be too small as it - // accounts for under/overhang of the first/last character while we want - // just the bounding rect for this string so adjust the width as needed - // (using API not available in 2002 SDKs of WinCE) - if ( len > 0 ) - { - ABC width; - const wxChar chFirst = *str.begin(); - if ( ::GetCharABCWidths(dc, chFirst, chFirst, &width) ) - { - if ( width.abcA < 0 ) - sizeRect.cx -= width.abcA; - - if ( len > 1 ) - { - const wxChar chLast = *str.rbegin(); - ::GetCharABCWidths(dc, chLast, chLast, &width); - } - //else: we already have the width of the last character - - if ( width.abcC < 0 ) - sizeRect.cx -= width.abcC; - } - //else: GetCharABCWidths() failed, not a TrueType font? - } -#endif // !defined(_WIN32_WCE) || (_WIN32_WCE >= 400) - - TEXTMETRIC tm; - ::GetTextMetrics(dc, &tm); - - if (width) - *width = sizeRect.cx; - if (height) - *height = sizeRect.cy; - if (descent) - *descent = tm.tmDescent; - if (externalLeading) - *externalLeading = tm.tmExternalLeading; - - if ( hfontOld ) - { - ::SelectObject(dc, hfontOld); - } - - ReleaseDC(0, dc); -} diff --git a/WebCore/platform/wx/wxcode/win/non-kerned-drawing.cpp b/WebCore/platform/wx/wxcode/win/non-kerned-drawing.cpp deleted file mode 100644 index f05923a..0000000 --- a/WebCore/platform/wx/wxcode/win/non-kerned-drawing.cpp +++ /dev/null @@ -1,125 +0,0 @@ -/* - * Copyright (C) 2007 Kevin Watters, Kevin Ollivier. 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 "config.h" -#include "GlyphBuffer.h" -#include "GraphicsContext.h" -#include "SimpleFontData.h" - -#include <wx/defs.h> -#include <wx/dcclient.h> -#include <wx/gdicmn.h> -#include <vector> - -using namespace std; - -//----------------------------------------------------------------------------- -// constants -//----------------------------------------------------------------------------- - -const double RAD2DEG = 180.0 / M_PI; - -//----------------------------------------------------------------------------- -// Local functions -//----------------------------------------------------------------------------- - -static inline double dmin(double a, double b) { return a < b ? a : b; } -static inline double dmax(double a, double b) { return a > b ? a : b; } - -static inline double DegToRad(double deg) { return (deg * M_PI) / 180.0; } -static inline double RadToDeg(double deg) { return (deg * 180.0) / M_PI; } - -#include "wx/msw/private.h" - -// TODO remove this dependency (gdiplus needs the macros) - -#ifndef max -#define max(a,b) (((a) > (b)) ? (a) : (b)) -#endif - -#ifndef min -#define min(a,b) (((a) < (b)) ? (a) : (b)) -#endif - -#include "gdiplus.h" - - -namespace WebCore { - -void drawTextWithSpacing(GraphicsContext* graphicsContext, const SimpleFontData* font, const wxColour& color, const GlyphBuffer& glyphBuffer, int from, int numGlyphs, const FloatPoint& point) -{ -#if USE(WXGC) - wxGCDC* dc = static_cast<wxGCDC*>(graphicsContext->platformContext()); -#else - wxDC* dc = graphicsContext->platformContext(); -#endif - - // get the native HDC handle to draw using native APIs - HDC hdc = 0; -#if USE(WXGC) - wxGraphicsContext* gc = dc->GetGraphicsContext(); - Gdiplus::Graphics* g; - if (gc) { - g = (Gdiplus::Graphics*)gc->GetNativeContext(); - hdc = g->GetHDC(); - } -#else - hdc = static_cast<HDC>(dc->GetHDC()); -#endif - - // ExtTextOut wants the offsets as an array of ints, so extract them - // from the glyph buffer - const GlyphBufferGlyph* glyphs = glyphBuffer.glyphs(from); - const GlyphBufferAdvance* advances = glyphBuffer.advances(from); - - float y = point.y() - font->ascent(); - float x = point.x(); - - int* spacing = new int[numGlyphs - from]; - for (unsigned i = 0; i < numGlyphs; ++i) - spacing[i] = advances[i].width(); - - ::SelectObject(hdc, GetHfontOf(font->getWxFont())); - - if (color.Ok()) - ::SetTextColor(hdc, color.GetPixel()); - - // do not draw background behind characters - ::SetBkMode(hdc, TRANSPARENT); - - // draw text with optional character widths array - wxString string = wxString((wxChar*)(&glyphs[from]), numGlyphs); - ::ExtTextOut(hdc, x, y, 0, NULL, string.c_str(), string.length(), spacing); - - ::SetBkMode(hdc, TRANSPARENT); - - #if USE(WXGC) - g->ReleaseHDC(hdc); - #endif - - delete [] spacing; -} - -} |