Bug #: 4157
authoreseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Jul 2005 19:20:23 +0000 (19:20 +0000)
committereseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Fri, 29 Jul 2005 19:20:23 +0000 (19:20 +0000)
Submitted by: eseidel
Reviewed by: sullivan
        * DrawTest/AppDelegate.h: Added.
        * DrawTest/AppDelegate.m: Added.
        * DrawTest/DrawTest.xcodeproj/project.pbxproj: Added.
        * DrawTest/DrawTestDocument.h: Added.
        * DrawTest/DrawTestDocument.m: Added.
        * DrawTest/DrawTestInspectorController.h: Added.
        * DrawTest/DrawTestInspectorController.m: Added.
        * DrawTest/DrawTestToolbarController.h: Added.
        * DrawTest/DrawTestToolbarController.m: Added.
        * DrawTest/DrawTestView.h: Added.
        * DrawTest/DrawTestView.m: Added.
        * DrawTest/DrawTest_Prefix.pch: Added.
        * DrawTest/English.lproj/DrawTestDocument.nib/classes.nib: Added.
        * DrawTest/English.lproj/DrawTestDocument.nib/info.nib: Added.
        * DrawTest/English.lproj/DrawTestDocument.nib/keyedobjects.nib: Added.
        * DrawTest/English.lproj/InfoPlist.strings: Added.
        * DrawTest/English.lproj/Inspector.nib/classes.nib: Added.
        * DrawTest/English.lproj/Inspector.nib/info.nib: Added.
        * DrawTest/English.lproj/Inspector.nib/keyedobjects.nib: Added.
        * DrawTest/English.lproj/MainMenu.nib/classes.nib: Added.
        * DrawTest/English.lproj/MainMenu.nib/info.nib: Added.
        * DrawTest/English.lproj/MainMenu.nib/keyedobjects.nib: Added.
        * DrawTest/English.lproj/TestViewer.nib/classes.nib: Added.
        * DrawTest/English.lproj/TestViewer.nib/info.nib: Added.
        * DrawTest/English.lproj/TestViewer.nib/keyedobjects.nib: Added.
        * DrawTest/Info.plist: Added.
        * DrawTest/SVGTest.h: Added.
        * DrawTest/SVGTest.m: Added.
        * DrawTest/ScalingImageView.h: Added.
        * DrawTest/ScalingImageView.m: Added.
        * DrawTest/TestController.h: Added.
        * DrawTest/TestController.m: Added.
        * DrawTest/TestViewerSplitView.h: Added.
        * DrawTest/TestViewerSplitView.m: Added.
        * DrawTest/main.m: Added.
        Adding simple cocoa app for testing SVG rendering, interaction.
        http://bugzilla.opendarwin.org/show_bug.cgi?id=4157

git-svn-id: http://svn.webkit.org/repository/webkit/trunk@9946 268f45cc-cd09-0410-ab3c-d52691b4dbfc

36 files changed:
WebKitTools/ChangeLog
WebKitTools/DrawTest/AppDelegate.h [new file with mode: 0644]
WebKitTools/DrawTest/AppDelegate.m [new file with mode: 0644]
WebKitTools/DrawTest/DrawTest.xcodeproj/project.pbxproj [new file with mode: 0644]
WebKitTools/DrawTest/DrawTestDocument.h [new file with mode: 0644]
WebKitTools/DrawTest/DrawTestDocument.m [new file with mode: 0644]
WebKitTools/DrawTest/DrawTestInspectorController.h [new file with mode: 0644]
WebKitTools/DrawTest/DrawTestInspectorController.m [new file with mode: 0644]
WebKitTools/DrawTest/DrawTestToolbarController.h [new file with mode: 0644]
WebKitTools/DrawTest/DrawTestToolbarController.m [new file with mode: 0644]
WebKitTools/DrawTest/DrawTestView.h [new file with mode: 0644]
WebKitTools/DrawTest/DrawTestView.m [new file with mode: 0644]
WebKitTools/DrawTest/DrawTest_Prefix.pch [new file with mode: 0644]
WebKitTools/DrawTest/English.lproj/DrawTestDocument.nib/classes.nib [new file with mode: 0644]
WebKitTools/DrawTest/English.lproj/DrawTestDocument.nib/info.nib [new file with mode: 0644]
WebKitTools/DrawTest/English.lproj/DrawTestDocument.nib/keyedobjects.nib [new file with mode: 0644]
WebKitTools/DrawTest/English.lproj/InfoPlist.strings [new file with mode: 0644]
WebKitTools/DrawTest/English.lproj/Inspector.nib/classes.nib [new file with mode: 0644]
WebKitTools/DrawTest/English.lproj/Inspector.nib/info.nib [new file with mode: 0644]
WebKitTools/DrawTest/English.lproj/Inspector.nib/keyedobjects.nib [new file with mode: 0644]
WebKitTools/DrawTest/English.lproj/MainMenu.nib/classes.nib [new file with mode: 0644]
WebKitTools/DrawTest/English.lproj/MainMenu.nib/info.nib [new file with mode: 0644]
WebKitTools/DrawTest/English.lproj/MainMenu.nib/keyedobjects.nib [new file with mode: 0644]
WebKitTools/DrawTest/English.lproj/TestViewer.nib/classes.nib [new file with mode: 0644]
WebKitTools/DrawTest/English.lproj/TestViewer.nib/info.nib [new file with mode: 0644]
WebKitTools/DrawTest/English.lproj/TestViewer.nib/keyedobjects.nib [new file with mode: 0644]
WebKitTools/DrawTest/Info.plist [new file with mode: 0644]
WebKitTools/DrawTest/SVGTest.h [new file with mode: 0644]
WebKitTools/DrawTest/SVGTest.m [new file with mode: 0644]
WebKitTools/DrawTest/ScalingImageView.h [new file with mode: 0644]
WebKitTools/DrawTest/ScalingImageView.m [new file with mode: 0644]
WebKitTools/DrawTest/TestController.h [new file with mode: 0644]
WebKitTools/DrawTest/TestController.m [new file with mode: 0644]
WebKitTools/DrawTest/TestViewerSplitView.h [new file with mode: 0644]
WebKitTools/DrawTest/TestViewerSplitView.m [new file with mode: 0644]
WebKitTools/DrawTest/main.m [new file with mode: 0644]

index b2f5847b9b4832151ba5246df7141f6a31b0bd7e..43cd6cfe46daf262461bc711cd00afb5201d964e 100644 (file)
@@ -1,3 +1,45 @@
+2005-07-29  Eric Seidel  <eseidel@apple.com>
+
+        Reviewed by sullivan.
+
+        * DrawTest/AppDelegate.h: Added.
+        * DrawTest/AppDelegate.m: Added.
+        * DrawTest/DrawTest.xcodeproj/project.pbxproj: Added.
+        * DrawTest/DrawTestDocument.h: Added.
+        * DrawTest/DrawTestDocument.m: Added.
+        * DrawTest/DrawTestInspectorController.h: Added.
+        * DrawTest/DrawTestInspectorController.m: Added.
+        * DrawTest/DrawTestToolbarController.h: Added.
+        * DrawTest/DrawTestToolbarController.m: Added.
+        * DrawTest/DrawTestView.h: Added.
+        * DrawTest/DrawTestView.m: Added.
+        * DrawTest/DrawTest_Prefix.pch: Added.
+        * DrawTest/English.lproj/DrawTestDocument.nib/classes.nib: Added.
+        * DrawTest/English.lproj/DrawTestDocument.nib/info.nib: Added.
+        * DrawTest/English.lproj/DrawTestDocument.nib/keyedobjects.nib: Added.
+        * DrawTest/English.lproj/InfoPlist.strings: Added.
+        * DrawTest/English.lproj/Inspector.nib/classes.nib: Added.
+        * DrawTest/English.lproj/Inspector.nib/info.nib: Added.
+        * DrawTest/English.lproj/Inspector.nib/keyedobjects.nib: Added.
+        * DrawTest/English.lproj/MainMenu.nib/classes.nib: Added.
+        * DrawTest/English.lproj/MainMenu.nib/info.nib: Added.
+        * DrawTest/English.lproj/MainMenu.nib/keyedobjects.nib: Added.
+        * DrawTest/English.lproj/TestViewer.nib/classes.nib: Added.
+        * DrawTest/English.lproj/TestViewer.nib/info.nib: Added.
+        * DrawTest/English.lproj/TestViewer.nib/keyedobjects.nib: Added.
+        * DrawTest/Info.plist: Added.
+        * DrawTest/SVGTest.h: Added.
+        * DrawTest/SVGTest.m: Added.
+        * DrawTest/ScalingImageView.h: Added.
+        * DrawTest/ScalingImageView.m: Added.
+        * DrawTest/TestController.h: Added.
+        * DrawTest/TestController.m: Added.
+        * DrawTest/TestViewerSplitView.h: Added.
+        * DrawTest/TestViewerSplitView.m: Added.
+        * DrawTest/main.m: Added.
+        Adding simple cocoa app for testing SVG rendering, interaction.
+        http://bugzilla.opendarwin.org/show_bug.cgi?id=4157
+
 2005-07-28  Eric Seidel  <eseidel@apple.com>
 
         Reviewed by ggaren.
diff --git a/WebKitTools/DrawTest/AppDelegate.h b/WebKitTools/DrawTest/AppDelegate.h
new file mode 100644 (file)
index 0000000..7103bb8
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2005 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. 
+ */
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface AppDelegate : NSObject {
+    IBOutlet NSWindow *svgImageRepTestWindow;
+}
+
+- (IBAction)showTestsPanel:(id)sender;
+- (IBAction)showImageRepTestWindow:(id)sender;
+- (IBAction)showInspectorPanel:(id)sender;
+
+@end
diff --git a/WebKitTools/DrawTest/AppDelegate.m b/WebKitTools/DrawTest/AppDelegate.m
new file mode 100644 (file)
index 0000000..0f20b35
--- /dev/null
@@ -0,0 +1,52 @@
+/*
+ * Copyright (C) 2005 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. 
+ */
+#import "AppDelegate.h"
+
+#import "TestController.h"
+#import "DrawTestInspectorController.h"
+
+@implementation AppDelegate
+
+- (IBAction)showTestsPanel:(id)sender
+{
+    [[TestController sharedController] showTestsPanel:sender];
+}
+
+- (IBAction)showImageRepTestWindow:(id)sender
+{
+    [svgImageRepTestWindow makeKeyAndOrderFront:sender];
+}
+
+- (IBAction)showInspectorPanel:(id)sender
+{
+    [[DrawTestInspectorController sharedInstance] showInspectorPanel:sender];
+}
+
+- (BOOL)applicationShouldOpenUntitledFile:(NSApplication *)sender
+{
+    return NO;
+}
+
+@end
diff --git a/WebKitTools/DrawTest/DrawTest.xcodeproj/project.pbxproj b/WebKitTools/DrawTest/DrawTest.xcodeproj/project.pbxproj
new file mode 100644 (file)
index 0000000..0b14163
--- /dev/null
@@ -0,0 +1,455 @@
+// !$*UTF8*$!
+{
+       archiveVersion = 1;
+       classes = {
+       };
+       objectVersion = 42;
+       objects = {
+
+/* Begin PBXBuildFile section */
+               8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */ = {isa = PBXBuildFile; fileRef = 29B97318FDCFA39411CA2CEA /* MainMenu.nib */; };
+               8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */ = {isa = PBXBuildFile; fileRef = 089C165CFE840E0CC02AAC07 /* InfoPlist.strings */; };
+               8D11072D0486CEB800E47090 /* main.m in Sources */ = {isa = PBXBuildFile; fileRef = 29B97316FDCFA39411CA2CEA /* main.m */; settings = {ATTRIBUTES = (); }; };
+               8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
+               A8C006CF0898634600BA5114 /* SVGTest.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C006B00898634600BA5114 /* SVGTest.m */; };
+               A8C006D00898634600BA5114 /* ScalingImageView.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C006B20898634600BA5114 /* ScalingImageView.m */; };
+               A8C006D20898634600BA5114 /* DrawTestView.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C006B50898634600BA5114 /* DrawTestView.m */; };
+               A8C006D30898634600BA5114 /* DrawTestToolbarController.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C006B70898634600BA5114 /* DrawTestToolbarController.m */; };
+               A8C006D40898634600BA5114 /* DrawTestInspectorController.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C006BB0898634600BA5114 /* DrawTestInspectorController.m */; };
+               A8C006D50898634600BA5114 /* DrawTestDocument.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C006BD0898634600BA5114 /* DrawTestDocument.m */; };
+               A8C006E10898634600BA5114 /* AppDelegate.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C006CA0898634600BA5114 /* AppDelegate.m */; };
+               A8C006E20898634600BA5114 /* TestViewerSplitView.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C006CC0898634600BA5114 /* TestViewerSplitView.m */; };
+               A8C006E30898634600BA5114 /* TestController.m in Sources */ = {isa = PBXBuildFile; fileRef = A8C006CE0898634600BA5114 /* TestController.m */; };
+               A8C006F3089865E900BA5114 /* DrawTestDocument.nib in Resources */ = {isa = PBXBuildFile; fileRef = A8C006ED089865E900BA5114 /* DrawTestDocument.nib */; };
+               A8C006F4089865E900BA5114 /* Inspector.nib in Resources */ = {isa = PBXBuildFile; fileRef = A8C006EF089865E900BA5114 /* Inspector.nib */; };
+               A8C006F5089865E900BA5114 /* TestViewer.nib in Resources */ = {isa = PBXBuildFile; fileRef = A8C006F1089865E900BA5114 /* TestViewer.nib */; };
+               A8C006FA0898665200BA5114 /* WebCore+SVG.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A8C006F90898665200BA5114 /* WebCore+SVG.framework */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXBuildStyle section */
+               4A9504CCFFE6A4B311CA0CBA /* Debug */ = {
+                       isa = PBXBuildStyle;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               GCC_DYNAMIC_NO_PIC = NO;
+                               GCC_ENABLE_FIX_AND_CONTINUE = YES;
+                               GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+                               GCC_OPTIMIZATION_LEVEL = 0;
+                               PREBINDING = NO;
+                               ZERO_LINK = YES;
+                       };
+                       name = Debug;
+               };
+               4A9504CDFFE6A4B311CA0CBA /* Release */ = {
+                       isa = PBXBuildStyle;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               GCC_ENABLE_FIX_AND_CONTINUE = NO;
+                               GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+                               PREBINDING = NO;
+                               ZERO_LINK = NO;
+                       };
+                       name = Release;
+               };
+/* End PBXBuildStyle section */
+
+/* Begin PBXFileReference section */
+               089C165DFE840E0CC02AAC07 /* English */ = {isa = PBXFileReference; fileEncoding = 10; lastKnownFileType = text.plist.strings; name = English; path = English.lproj/InfoPlist.strings; sourceTree = "<group>"; };
+               1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = /System/Library/Frameworks/Cocoa.framework; sourceTree = "<absolute>"; };
+               13E42FB307B3F0F600E4EEF1 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = /System/Library/Frameworks/CoreData.framework; sourceTree = "<absolute>"; };
+               29B97316FDCFA39411CA2CEA /* main.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
+               29B97319FDCFA39411CA2CEA /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/MainMenu.nib; sourceTree = "<group>"; };
+               29B97324FDCFA39411CA2CEA /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = /System/Library/Frameworks/AppKit.framework; sourceTree = "<absolute>"; };
+               29B97325FDCFA39411CA2CEA /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = /System/Library/Frameworks/Foundation.framework; sourceTree = "<absolute>"; };
+               32CA4F630368D1EE00C91783 /* DrawTest_Prefix.pch */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawTest_Prefix.pch; sourceTree = "<group>"; };
+               8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = Info.plist; sourceTree = "<group>"; };
+               8D1107320486CEB800E47090 /* DrawTest.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = DrawTest.app; sourceTree = BUILT_PRODUCTS_DIR; };
+               A8C006AF0898634600BA5114 /* TestController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestController.h; sourceTree = "<group>"; };
+               A8C006B00898634600BA5114 /* SVGTest.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = SVGTest.m; sourceTree = "<group>"; };
+               A8C006B10898634600BA5114 /* SVGTest.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = SVGTest.h; sourceTree = "<group>"; };
+               A8C006B20898634600BA5114 /* ScalingImageView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ScalingImageView.m; sourceTree = "<group>"; };
+               A8C006B30898634600BA5114 /* ScalingImageView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ScalingImageView.h; sourceTree = "<group>"; };
+               A8C006B50898634600BA5114 /* DrawTestView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DrawTestView.m; sourceTree = "<group>"; };
+               A8C006B60898634600BA5114 /* DrawTestView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawTestView.h; sourceTree = "<group>"; };
+               A8C006B70898634600BA5114 /* DrawTestToolbarController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DrawTestToolbarController.m; sourceTree = "<group>"; };
+               A8C006B80898634600BA5114 /* DrawTestDocument.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawTestDocument.h; sourceTree = "<group>"; };
+               A8C006BA0898634600BA5114 /* DrawTestToolbarController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawTestToolbarController.h; sourceTree = "<group>"; };
+               A8C006BB0898634600BA5114 /* DrawTestInspectorController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DrawTestInspectorController.m; sourceTree = "<group>"; };
+               A8C006BC0898634600BA5114 /* DrawTestInspectorController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DrawTestInspectorController.h; sourceTree = "<group>"; };
+               A8C006BD0898634600BA5114 /* DrawTestDocument.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DrawTestDocument.m; sourceTree = "<group>"; };
+               A8C006CA0898634600BA5114 /* AppDelegate.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = AppDelegate.m; sourceTree = "<group>"; };
+               A8C006CB0898634600BA5114 /* AppDelegate.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
+               A8C006CC0898634600BA5114 /* TestViewerSplitView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestViewerSplitView.m; sourceTree = "<group>"; };
+               A8C006CD0898634600BA5114 /* TestViewerSplitView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = TestViewerSplitView.h; sourceTree = "<group>"; };
+               A8C006CE0898634600BA5114 /* TestController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = TestController.m; sourceTree = "<group>"; };
+               A8C006EE089865E900BA5114 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = ../DrawTest_old/English.lproj/DrawTestDocument.nib; sourceTree = "<group>"; };
+               A8C006F0089865E900BA5114 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = ../DrawTest_old/English.lproj/Inspector.nib; sourceTree = "<group>"; };
+               A8C006F2089865E900BA5114 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = ../DrawTest_old/English.lproj/TestViewer.nib; sourceTree = "<group>"; };
+               A8C006F90898665200BA5114 /* WebCore+SVG.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = "WebCore+SVG.framework"; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+               8D11072E0486CEB800E47090 /* Frameworks */ = {
+                       isa = PBXFrameworksBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
+                               A8C006FA0898665200BA5114 /* WebCore+SVG.framework in Frameworks */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+               080E96DDFE201D6D7F000001 /* Classes */ = {
+                       isa = PBXGroup;
+                       children = (
+                               A8C006E5089863A100BA5114 /* Viewer */,
+                               A8C006E6089863B100BA5114 /* Test Browser */,
+                               A8C006CA0898634600BA5114 /* AppDelegate.m */,
+                               A8C006CB0898634600BA5114 /* AppDelegate.h */,
+                               A8C006B20898634600BA5114 /* ScalingImageView.m */,
+                               A8C006B30898634600BA5114 /* ScalingImageView.h */,
+                       );
+                       name = Classes;
+                       sourceTree = "<group>";
+               };
+               1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
+                       isa = PBXGroup;
+                       children = (
+                               A8C006F90898665200BA5114 /* WebCore+SVG.framework */,
+                               1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
+                       );
+                       name = "Linked Frameworks";
+                       sourceTree = "<group>";
+               };
+               1058C7A2FEA54F0111CA2CBB /* Other Frameworks */ = {
+                       isa = PBXGroup;
+                       children = (
+                               29B97324FDCFA39411CA2CEA /* AppKit.framework */,
+                               13E42FB307B3F0F600E4EEF1 /* CoreData.framework */,
+                               29B97325FDCFA39411CA2CEA /* Foundation.framework */,
+                       );
+                       name = "Other Frameworks";
+                       sourceTree = "<group>";
+               };
+               19C28FACFE9D520D11CA2CBB /* Products */ = {
+                       isa = PBXGroup;
+                       children = (
+                               8D1107320486CEB800E47090 /* DrawTest.app */,
+                       );
+                       name = Products;
+                       sourceTree = "<group>";
+               };
+               29B97314FDCFA39411CA2CEA /* DrawTest */ = {
+                       isa = PBXGroup;
+                       children = (
+                               080E96DDFE201D6D7F000001 /* Classes */,
+                               29B97315FDCFA39411CA2CEA /* Other Sources */,
+                               29B97317FDCFA39411CA2CEA /* Resources */,
+                               29B97323FDCFA39411CA2CEA /* Frameworks */,
+                               19C28FACFE9D520D11CA2CBB /* Products */,
+                       );
+                       name = DrawTest;
+                       sourceTree = "<group>";
+               };
+               29B97315FDCFA39411CA2CEA /* Other Sources */ = {
+                       isa = PBXGroup;
+                       children = (
+                               32CA4F630368D1EE00C91783 /* DrawTest_Prefix.pch */,
+                               29B97316FDCFA39411CA2CEA /* main.m */,
+                       );
+                       name = "Other Sources";
+                       sourceTree = "<group>";
+               };
+               29B97317FDCFA39411CA2CEA /* Resources */ = {
+                       isa = PBXGroup;
+                       children = (
+                               8D1107310486CEB800E47090 /* Info.plist */,
+                               089C165CFE840E0CC02AAC07 /* InfoPlist.strings */,
+                               29B97318FDCFA39411CA2CEA /* MainMenu.nib */,
+                               A8C006ED089865E900BA5114 /* DrawTestDocument.nib */,
+                               A8C006EF089865E900BA5114 /* Inspector.nib */,
+                               A8C006F1089865E900BA5114 /* TestViewer.nib */,
+                       );
+                       name = Resources;
+                       sourceTree = "<group>";
+               };
+               29B97323FDCFA39411CA2CEA /* Frameworks */ = {
+                       isa = PBXGroup;
+                       children = (
+                               1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */,
+                               1058C7A2FEA54F0111CA2CBB /* Other Frameworks */,
+                       );
+                       name = Frameworks;
+                       sourceTree = "<group>";
+               };
+               A8C006E5089863A100BA5114 /* Viewer */ = {
+                       isa = PBXGroup;
+                       children = (
+                               A8C006BA0898634600BA5114 /* DrawTestToolbarController.h */,
+                               A8C006B70898634600BA5114 /* DrawTestToolbarController.m */,
+                               A8C006B60898634600BA5114 /* DrawTestView.h */,
+                               A8C006B50898634600BA5114 /* DrawTestView.m */,
+                               A8C006B80898634600BA5114 /* DrawTestDocument.h */,
+                               A8C006BD0898634600BA5114 /* DrawTestDocument.m */,
+                       );
+                       name = Viewer;
+                       sourceTree = "<group>";
+               };
+               A8C006E6089863B100BA5114 /* Test Browser */ = {
+                       isa = PBXGroup;
+                       children = (
+                               A8C006B00898634600BA5114 /* SVGTest.m */,
+                               A8C006B10898634600BA5114 /* SVGTest.h */,
+                               A8C006BB0898634600BA5114 /* DrawTestInspectorController.m */,
+                               A8C006BC0898634600BA5114 /* DrawTestInspectorController.h */,
+                               A8C006AF0898634600BA5114 /* TestController.h */,
+                               A8C006CE0898634600BA5114 /* TestController.m */,
+                               A8C006CC0898634600BA5114 /* TestViewerSplitView.m */,
+                               A8C006CD0898634600BA5114 /* TestViewerSplitView.h */,
+                       );
+                       name = "Test Browser";
+                       sourceTree = "<group>";
+               };
+/* End PBXGroup section */
+
+/* Begin PBXNativeTarget section */
+               8D1107260486CEB800E47090 /* DrawTest */ = {
+                       isa = PBXNativeTarget;
+                       buildConfigurationList = A8C006740898624E00BA5114 /* Build configuration list for PBXNativeTarget "DrawTest" */;
+                       buildPhases = (
+                               8D1107290486CEB800E47090 /* Resources */,
+                               8D11072C0486CEB800E47090 /* Sources */,
+                               8D11072E0486CEB800E47090 /* Frameworks */,
+                       );
+                       buildRules = (
+                       );
+                       buildSettings = {
+                               GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+                               GCC_PRECOMPILE_PREFIX_HEADER = YES;
+                               GCC_PREFIX_HEADER = DrawTest_Prefix.pch;
+                               GCC_WARN_ABOUT_RETURN_TYPE = YES;
+                               GCC_WARN_UNUSED_VARIABLE = YES;
+                               INFOPLIST_FILE = Info.plist;
+                               INSTALL_PATH = "$(HOME)/Applications";
+                               PRODUCT_NAME = DrawTest;
+                               WRAPPER_EXTENSION = app;
+                       };
+                       dependencies = (
+                       );
+                       name = DrawTest;
+                       productInstallPath = "$(HOME)/Applications";
+                       productName = DrawTest;
+                       productReference = 8D1107320486CEB800E47090 /* DrawTest.app */;
+                       productType = "com.apple.product-type.application";
+               };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+               29B97313FDCFA39411CA2CEA /* Project object */ = {
+                       isa = PBXProject;
+                       buildConfigurationList = A8C006780898624E00BA5114 /* Build configuration list for PBXProject "DrawTest" */;
+                       buildSettings = {
+                       };
+                       buildStyles = (
+                               4A9504CCFFE6A4B311CA0CBA /* Debug */,
+                               4A9504CDFFE6A4B311CA0CBA /* Release */,
+                       );
+                       hasScannedForEncodings = 1;
+                       mainGroup = 29B97314FDCFA39411CA2CEA /* DrawTest */;
+                       projectDirPath = "";
+                       targets = (
+                               8D1107260486CEB800E47090 /* DrawTest */,
+                       );
+               };
+/* End PBXProject section */
+
+/* Begin PBXResourcesBuildPhase section */
+               8D1107290486CEB800E47090 /* Resources */ = {
+                       isa = PBXResourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               8D11072A0486CEB800E47090 /* MainMenu.nib in Resources */,
+                               8D11072B0486CEB800E47090 /* InfoPlist.strings in Resources */,
+                               A8C006F3089865E900BA5114 /* DrawTestDocument.nib in Resources */,
+                               A8C006F4089865E900BA5114 /* Inspector.nib in Resources */,
+                               A8C006F5089865E900BA5114 /* TestViewer.nib in Resources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+/* End PBXResourcesBuildPhase section */
+
+/* Begin PBXSourcesBuildPhase section */
+               8D11072C0486CEB800E47090 /* Sources */ = {
+                       isa = PBXSourcesBuildPhase;
+                       buildActionMask = 2147483647;
+                       files = (
+                               8D11072D0486CEB800E47090 /* main.m in Sources */,
+                               A8C006CF0898634600BA5114 /* SVGTest.m in Sources */,
+                               A8C006D00898634600BA5114 /* ScalingImageView.m in Sources */,
+                               A8C006D20898634600BA5114 /* DrawTestView.m in Sources */,
+                               A8C006D30898634600BA5114 /* DrawTestToolbarController.m in Sources */,
+                               A8C006D40898634600BA5114 /* DrawTestInspectorController.m in Sources */,
+                               A8C006D50898634600BA5114 /* DrawTestDocument.m in Sources */,
+                               A8C006E10898634600BA5114 /* AppDelegate.m in Sources */,
+                               A8C006E20898634600BA5114 /* TestViewerSplitView.m in Sources */,
+                               A8C006E30898634600BA5114 /* TestController.m in Sources */,
+                       );
+                       runOnlyForDeploymentPostprocessing = 0;
+               };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXVariantGroup section */
+               089C165CFE840E0CC02AAC07 /* InfoPlist.strings */ = {
+                       isa = PBXVariantGroup;
+                       children = (
+                               089C165DFE840E0CC02AAC07 /* English */,
+                       );
+                       name = InfoPlist.strings;
+                       sourceTree = "<group>";
+               };
+               29B97318FDCFA39411CA2CEA /* MainMenu.nib */ = {
+                       isa = PBXVariantGroup;
+                       children = (
+                               29B97319FDCFA39411CA2CEA /* English */,
+                       );
+                       name = MainMenu.nib;
+                       sourceTree = "<group>";
+               };
+               A8C006ED089865E900BA5114 /* DrawTestDocument.nib */ = {
+                       isa = PBXVariantGroup;
+                       children = (
+                               A8C006EE089865E900BA5114 /* English */,
+                       );
+                       name = DrawTestDocument.nib;
+                       sourceTree = "<group>";
+               };
+               A8C006EF089865E900BA5114 /* Inspector.nib */ = {
+                       isa = PBXVariantGroup;
+                       children = (
+                               A8C006F0089865E900BA5114 /* English */,
+                       );
+                       name = Inspector.nib;
+                       sourceTree = "<group>";
+               };
+               A8C006F1089865E900BA5114 /* TestViewer.nib */ = {
+                       isa = PBXVariantGroup;
+                       children = (
+                               A8C006F2089865E900BA5114 /* English */,
+                       );
+                       name = TestViewer.nib;
+                       sourceTree = "<group>";
+               };
+/* End PBXVariantGroup section */
+
+/* Begin XCBuildConfiguration section */
+               A8C006750898624E00BA5114 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = NO;
+                               FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../../../build/Development\"";
+                               GCC_DYNAMIC_NO_PIC = NO;
+                               GCC_ENABLE_FIX_AND_CONTINUE = YES;
+                               GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
+                               GCC_OPTIMIZATION_LEVEL = 0;
+                               GCC_PRECOMPILE_PREFIX_HEADER = YES;
+                               GCC_PREFIX_HEADER = DrawTest_Prefix.pch;
+                               GCC_TREAT_WARNINGS_AS_ERRORS = YES;
+                               GCC_WARN_ABOUT_RETURN_TYPE = YES;
+                               GCC_WARN_UNUSED_VARIABLE = YES;
+                               INFOPLIST_FILE = Info.plist;
+                               INSTALL_PATH = "$(HOME)/Applications";
+                               PREBINDING = NO;
+                               PRODUCT_NAME = DrawTest;
+                               WRAPPER_EXTENSION = app;
+                               ZERO_LINK = YES;
+                       };
+                       name = Development;
+               };
+               A8C006760898624E00BA5114 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               COPY_PHASE_STRIP = YES;
+                               FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../../../build/Development\"";
+                               GCC_ENABLE_FIX_AND_CONTINUE = NO;
+                               GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+                               GCC_PRECOMPILE_PREFIX_HEADER = YES;
+                               GCC_PREFIX_HEADER = DrawTest_Prefix.pch;
+                               GCC_TREAT_WARNINGS_AS_ERRORS = YES;
+                               GCC_WARN_ABOUT_RETURN_TYPE = YES;
+                               GCC_WARN_UNUSED_VARIABLE = YES;
+                               INFOPLIST_FILE = Info.plist;
+                               INSTALL_PATH = "$(HOME)/Applications";
+                               PREBINDING = NO;
+                               PRODUCT_NAME = DrawTest;
+                               WRAPPER_EXTENSION = app;
+                               ZERO_LINK = NO;
+                       };
+                       name = Deployment;
+               };
+               A8C006770898624E00BA5114 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               FRAMEWORK_SEARCH_PATHS = "\"$(SRCROOT)/../../../build/Development\"";
+                               GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
+                               GCC_PRECOMPILE_PREFIX_HEADER = YES;
+                               GCC_PREFIX_HEADER = DrawTest_Prefix.pch;
+                               GCC_TREAT_WARNINGS_AS_ERRORS = YES;
+                               GCC_WARN_ABOUT_RETURN_TYPE = YES;
+                               GCC_WARN_UNUSED_VARIABLE = YES;
+                               INFOPLIST_FILE = Info.plist;
+                               INSTALL_PATH = "$(HOME)/Applications";
+                               PRODUCT_NAME = DrawTest;
+                               WRAPPER_EXTENSION = app;
+                       };
+                       name = Default;
+               };
+               A8C006790898624E00BA5114 /* Development */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               GCC_C_LANGUAGE_STANDARD = gnu99;
+                       };
+                       name = Development;
+               };
+               A8C0067A0898624E00BA5114 /* Deployment */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               GCC_C_LANGUAGE_STANDARD = gnu99;
+                       };
+                       name = Deployment;
+               };
+               A8C0067B0898624E00BA5114 /* Default */ = {
+                       isa = XCBuildConfiguration;
+                       buildSettings = {
+                               GCC_C_LANGUAGE_STANDARD = gnu99;
+                       };
+                       name = Default;
+               };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+               A8C006740898624E00BA5114 /* Build configuration list for PBXNativeTarget "DrawTest" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               A8C006750898624E00BA5114 /* Development */,
+                               A8C006760898624E00BA5114 /* Deployment */,
+                               A8C006770898624E00BA5114 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+               A8C006780898624E00BA5114 /* Build configuration list for PBXProject "DrawTest" */ = {
+                       isa = XCConfigurationList;
+                       buildConfigurations = (
+                               A8C006790898624E00BA5114 /* Development */,
+                               A8C0067A0898624E00BA5114 /* Deployment */,
+                               A8C0067B0898624E00BA5114 /* Default */,
+                       );
+                       defaultConfigurationIsVisible = 0;
+                       defaultConfigurationName = Default;
+               };
+/* End XCConfigurationList section */
+       };
+       rootObject = 29B97313FDCFA39411CA2CEA /* Project object */;
+}
diff --git a/WebKitTools/DrawTest/DrawTestDocument.h b/WebKitTools/DrawTest/DrawTestDocument.h
new file mode 100644 (file)
index 0000000..ef9ebf6
--- /dev/null
@@ -0,0 +1,49 @@
+/*
+ * Copyright (C) 2005 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. 
+ */
+
+#import <Cocoa/Cocoa.h>
+
+@class DrawDocument;
+@class DrawTestView;
+@class DrawTestToolbarController;
+
+@interface DrawTestDocument : NSDocument
+{
+    IBOutlet DrawTestView *drawView;
+    IBOutlet NSDrawer *debugDrawer;
+
+    DrawDocument *document;
+    DrawTestToolbarController *toolbarController;
+}
+
+- (void)setDrawDocument:(DrawDocument *)drawDocument;
+- (DrawDocument *)drawDocument;
+
+// debug menu.
+- (IBAction)dumpSVGToConsole:(id)sender;
+- (IBAction)toggleDebugDrawer:(id)sender;
+- (IBAction)runWindowResizeTest:(id)sender;
+
+@end
diff --git a/WebKitTools/DrawTest/DrawTestDocument.m b/WebKitTools/DrawTest/DrawTestDocument.m
new file mode 100644 (file)
index 0000000..834d776
--- /dev/null
@@ -0,0 +1,180 @@
+/*
+ * Copyright (C) 2005 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. 
+ */
+
+#import "DrawTestDocument.h"
+#import "DrawTestView.h"
+#import "DrawTestToolbarController.h"
+
+#import <WebCore+SVG/DrawDocumentPrivate.h>
+
+@implementation DrawTestDocument
+
+- (id)initWithType:(NSString *)typeName error:(NSError **)outError
+{
+    if (outError) {
+        NSDictionary *errorInfo = [NSDictionary dictionaryWithObjectsAndKeys:
+            @"No document could be created.", NSLocalizedDescriptionKey,
+            @"New document creation not yet supported.", NSLocalizedFailureReasonErrorKey,
+            nil];
+        *outError = [NSError errorWithDomain:NSCocoaErrorDomain code:0 userInfo:errorInfo];
+    }
+    [self release];
+    return nil;
+}
+
+- (void)dealloc
+{
+    [toolbarController release];
+    [document release];
+    [super dealloc];
+}
+
+- (NSString *)windowNibName
+{
+    return @"DrawTestDocument";
+}
+
+- (IBAction)dumpSVGToConsole:(id)sender
+{
+    NSLog(@"SVG: %@", [document svgText]);
+}
+
+- (void)sizeWindowToFitCanvas
+{
+    NSSize canvasSize = [document canvasSize];
+    if ((canvasSize.width > 10) && (canvasSize.height > 10)) {
+        NSWindow *window = [drawView window];
+        //canvasSize.height += [drawView frame].origin.y; // to accomidate the tool pallette
+        NSRect newFrame = [window frameRectForContentRect:NSMakeRect(0,0,canvasSize.width, canvasSize.height)];
+        newFrame = [window constrainFrameRect:newFrame toScreen:[window screen]];
+        // we really should not show margins here.
+        [window setFrame:newFrame display:YES];
+    }
+}
+
+- (void)windowControllerDidLoadNib:(NSWindowController *)aController
+{
+    [super windowControllerDidLoadNib:aController];
+    toolbarController = [[DrawTestToolbarController alloc] initWithDrawView:drawView];
+    [drawView setDocument:[self drawDocument]];
+    [self sizeWindowToFitCanvas];
+}
+
+- (IBAction)openSourceForSelection:(id)sender
+{
+    [[NSWorkspace sharedWorkspace] openFile:[self fileName] withApplication:@"TextEdit"];
+}
+
+- (IBAction)zoomToContent:(id)sender
+{
+    [document sizeCanvasToFitContent];
+    [drawView setNeedsDisplay:YES];
+    [self sizeWindowToFitCanvas];
+}
+
+- (NSData *)dataRepresentationOfType:(NSString *)aType
+{
+    return [[document svgText] dataUsingEncoding:NSUTF8StringEncoding];
+}
+
+- (BOOL)loadDataRepresentation:(NSData *)data ofType:(NSString *)aType
+{
+    [self setDrawDocument:[DrawDocument documentWithSVGData:data]];
+    return YES;
+}
+
+- (void)setDrawDocument:(DrawDocument *)drawDocument
+{
+    id oldDoc = document;
+    document = [drawDocument retain];
+    [oldDoc release];
+}
+
+- (DrawDocument *)drawDocument
+{
+    //if (!document) document = [[DrawDocument alloc] init];
+    return document;
+}
+
+#pragma mark -
+#pragma mark Debug Methods
+
+- (IBAction)toggleDebugDrawer:(id)sender
+{
+    [debugDrawer toggle:sender];
+}
+
+- (id)outlineView:(NSOutlineView *)outlineView child:(int)index ofItem:(id)item
+{
+    return nil;
+}
+
+- (BOOL)outlineView:(NSOutlineView *)outlineView isItemExpandable:(id)item
+{
+    return NO;
+}
+
+- (int)outlineView:(NSOutlineView *)outlineView numberOfChildrenOfItem:(id)item
+{
+    return 0;
+}
+
+- (id)outlineView:(NSOutlineView *)outlineView objectValueForTableColumn:(NSTableColumn *)tableColumn byItem:(id)item
+{
+    return nil;
+}
+
+- (IBAction)runWindowResizeTest:(id)sender
+{
+    NSWindow *window = [drawView window];
+    NSScreen *screen = [window screen];
+    float screenHeight = [screen visibleFrame].size.height;
+    NSRect originalFrame = [window frame];
+    // initial setup
+    BOOL toolbarVisible = [[window toolbar] isVisible];
+    if (toolbarVisible) [window toggleToolbarShown:self];
+    [window setFrame:NSMakeRect(0,screenHeight-100,100,100) display:YES];
+    
+    // grab time.
+    CFAbsoluteTime start = CFAbsoluteTimeGetCurrent();
+    
+    // run test
+    for (int x = 0; x < 3; x++) {
+        for (float size = 100; size < 500.f; size += 20.f) {
+            [window setFrame:NSMakeRect(0, screenHeight-size, size, size) display:YES];
+        }
+    }
+    
+    double elapsed = CFAbsoluteTimeGetCurrent() - start;
+    
+    // log
+    NSLog(@"Window resize test: %fs", elapsed);
+    
+    // restore
+    if (toolbarVisible) [window toggleToolbarShown:self];
+    [window setFrame:originalFrame display:YES];
+}
+
+@end
diff --git a/WebKitTools/DrawTest/DrawTestInspectorController.h b/WebKitTools/DrawTest/DrawTestInspectorController.h
new file mode 100644 (file)
index 0000000..43c06f0
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2005 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. 
+ */
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface DrawTestInspectorController : NSObject {
+    IBOutlet NSPanel *_inspectorPanel;
+}
+
++ (id)sharedInstance;
+
+- (IBAction)showInspectorPanel:(id)sender;
+
+@end
diff --git a/WebKitTools/DrawTest/DrawTestInspectorController.m b/WebKitTools/DrawTest/DrawTestInspectorController.m
new file mode 100644 (file)
index 0000000..604bf03
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+ * Copyright (C) 2005 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. 
+ */
+
+#import "DrawTestInspectorController.h"
+
+@implementation DrawTestInspectorController
+
++ (id)sharedInstance
+{
+    static DrawTestInspectorController *__sharedController = nil;
+    if (!__sharedController) {
+        __sharedController = [[self alloc] init];
+    }
+    return __sharedController;
+}
+
+- (IBAction)showInspectorPanel:(id)sender
+{
+    if (!_inspectorPanel) {
+        [NSBundle loadNibNamed:@"Inspector" owner:self];
+    }
+    [_inspectorPanel makeKeyAndOrderFront:self];
+}
+
+
+@end
diff --git a/WebKitTools/DrawTest/DrawTestToolbarController.h b/WebKitTools/DrawTest/DrawTestToolbarController.h
new file mode 100644 (file)
index 0000000..15df0c4
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2005 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. 
+ */
+
+#import <Cocoa/Cocoa.h>
+
+@class DrawView;
+
+@interface DrawTestToolbarController : NSObject {
+    DrawView *_drawView;
+    NSMutableDictionary *_toolbarItems;
+}
+
+- (id)initWithDrawView:(DrawView *)drawView;
+
+@end
diff --git a/WebKitTools/DrawTest/DrawTestToolbarController.m b/WebKitTools/DrawTest/DrawTestToolbarController.m
new file mode 100644 (file)
index 0000000..084068c
--- /dev/null
@@ -0,0 +1,351 @@
+/*
+ * Copyright (C) 2005 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. 
+ */
+
+#import "DrawTestToolbarController.h"
+
+#import <WebCore+SVG/DrawViewPrivate.h>
+
+enum
+{
+    ToolbarBrowseToolTag = 0,
+    ToolbarPanToolTag,
+    ToolbarZoomToolTag,
+    
+    ToolbarPointerToolTag,
+    ToolbarLineToolTag,
+    ToolbarRectangleToolTag,
+    ToolbarElipseToolTag,
+    ToolbarTriangleToolTag,
+    ToolbarPolyLineToolTag,
+    ToolbarArcToolTag,
+    
+    ToolbarDeleteSelectionTag,
+    
+    ToolbarMoveForwardTag,
+    ToolbarMoveBackwardTag,
+    ToolbarMoveToFrontTag,
+    ToolbarMoveToBackTag,
+    ToolbarMiscItem
+};
+
+// Constants
+NSString *ToolbarIdentifier = @"Main Document Toolbar";
+
+NSString *ToolbarBrowseToolIdentifier = @"Browse";
+NSString *ToolbarPanToolIdentifier = @"Pan";
+NSString *ToolbarZoomToolIdentifier = @"Zoom";
+
+NSString *ToolbarPointerToolIdentifier = @"Pointer";
+NSString *ToolbarRectangleToolIdentifier = @"Rectangle";
+NSString *ToolbarElipseToolIdentifier = @"Oval";
+NSString *ToolbarTriangleToolIdentifier = @"Triangle";
+NSString *ToolbarPolyLineToolIdentifier = @"PolyLine";
+NSString *ToolbarArcToolIdentifier = @"Arc";
+
+NSString *ToolbarDeleteShapeIdentifier = @"Delete";
+NSString *ToolbarMoveForwardIdentifier = @"Forward";
+NSString *ToolbarMoveBackwardIdentifier = @"Backward";
+NSString *ToolbarMoveToFrontIdentifier = @"Front";
+NSString *ToolbarMoveToBackIdentifier = @"Back";
+
+NSString *ToolbarPointerToolImage = @"Toolbar_Pointer";
+NSString *ToolbarRectangleToolImage = @"Toolbar_Rectangle";
+NSString *ToolbarElipseToolImage = @"Toolbar_Oval";
+NSString *ToolbarTriangleToolImage = @"Toolbar_Triangle";
+
+NSString *ToolbarDeleteShapeImage = @"Toolbar_Delete";
+NSString *ToolbarMoveForwardImage = @"Toolbar_Forward";
+NSString *ToolbarMoveBackwardImage = @"Toolbar_Backward";
+NSString *ToolbarMoveToFrontImage = @"Toolbar_Front";
+NSString *ToolbarMoveToBackImage = @"Toolbar_Back";
+
+@interface DrawTestToolbarController (InternalMethods)
+- (void)setupToolbar;
+- (void)addToolbarItemWithIdentifier:(NSString *)identifier withImage:(NSString *)image withTag:(int)tag;
+- (void)addToolbarItemWithIdentifier:(NSString *)identifier withImage:(NSString *)image;
+- (void)addToolbarItem:(NSString *)identifier
+             withLabel:(NSString *)label
+      withPaletteLabel:(NSString *)paletteLabel
+             withImage:(NSString *)imageName
+           withToolTip:(NSString *)toolTip
+               withTag:(int)tag;
+@end
+
+
+@implementation DrawTestToolbarController
+
+- (id)initWithDrawView:(DrawView *)drawView
+{
+    if (self = [super init]){
+        _drawView = [drawView retain];
+        [self setupToolbar]; // could be done lazily.
+    }
+    return self;
+}
+
+- (void)dealloc
+{
+    [_toolbarItems release];
+    [super dealloc];
+}
+
+
+- (void)addToolbarItemWithIdentifier:(NSString *)identifier withImage:(NSString *)image withTag:(int)tag
+{
+    
+    [self addToolbarItem:identifier
+               withLabel:identifier
+        withPaletteLabel:identifier
+               withImage:image
+             withToolTip:identifier
+                 withTag:tag];
+}
+
+- (void)addToolbarItemWithIdentifier:(NSString *)identifier withImage:(NSString *)image
+{
+    [self addToolbarItemWithIdentifier:identifier withImage:image withTag:ToolbarMiscItem];
+}
+
+- (void)addToolbarItem:(NSString *)identifier
+             withLabel:(NSString *)label
+      withPaletteLabel:(NSString *)paletteLabel
+             withImage:(NSString *)imageName
+           withToolTip:(NSString *)toolTip
+               withTag:(int)tag
+{
+    NSToolbarItem *item = [[[NSToolbarItem alloc] initWithItemIdentifier:identifier] autorelease];
+    
+    [item setLabel:label];
+    [item setPaletteLabel:paletteLabel];
+    [item setToolTip:toolTip];
+    [item setImage:[NSImage imageNamed:imageName]];
+    [item setTarget:self];
+    [item setAction:@selector(clickedToolbarItem:)];
+    [item setTag:tag];
+    
+    [_toolbarItems setObject:item forKey:identifier];
+}
+
+- (void)setupToolbar
+{
+    _toolbarItems = [[NSMutableDictionary alloc] init];
+    
+    [self addToolbarItemWithIdentifier:ToolbarBrowseToolIdentifier 
+                             withImage:ToolbarPointerToolImage
+                               withTag:ToolbarBrowseToolTag];
+    [[_toolbarItems objectForKey:ToolbarBrowseToolIdentifier] setImage:[[NSCursor pointingHandCursor] image]];
+    
+    [self addToolbarItemWithIdentifier:ToolbarPanToolIdentifier 
+                             withImage:ToolbarPointerToolImage
+                               withTag:ToolbarPanToolTag];
+    [[_toolbarItems objectForKey:ToolbarPanToolIdentifier] setImage:[[NSCursor openHandCursor] image]];
+    
+    [self addToolbarItemWithIdentifier:ToolbarZoomToolIdentifier 
+                             withImage:ToolbarPointerToolImage
+                               withTag:ToolbarZoomToolTag];
+    
+    
+    [self addToolbarItemWithIdentifier:ToolbarPointerToolIdentifier 
+                             withImage:ToolbarPointerToolImage
+                               withTag:ToolbarPointerToolTag];
+    
+    [self addToolbarItemWithIdentifier:ToolbarRectangleToolIdentifier 
+                             withImage:ToolbarRectangleToolImage
+                               withTag:ToolbarRectangleToolTag];
+    
+    [self addToolbarItemWithIdentifier:ToolbarElipseToolIdentifier 
+                             withImage:ToolbarElipseToolImage 
+                               withTag:ToolbarElipseToolTag];
+    
+    [self addToolbarItemWithIdentifier:ToolbarTriangleToolIdentifier 
+                             withImage:ToolbarTriangleToolImage
+                               withTag:ToolbarTriangleToolTag];
+    
+    [self addToolbarItemWithIdentifier:ToolbarDeleteShapeIdentifier 
+                             withImage:ToolbarDeleteShapeImage
+                               withTag:ToolbarDeleteSelectionTag];
+    
+    [self addToolbarItemWithIdentifier:ToolbarMoveForwardIdentifier 
+                             withImage:ToolbarMoveForwardImage
+                               withTag:ToolbarMoveForwardTag];
+    
+    [self addToolbarItemWithIdentifier:ToolbarMoveBackwardIdentifier 
+                             withImage:ToolbarMoveBackwardImage
+                               withTag:ToolbarMoveBackwardTag];
+    
+    [self addToolbarItemWithIdentifier:ToolbarMoveToFrontIdentifier 
+                             withImage:ToolbarMoveToFrontImage
+                               withTag:ToolbarMoveToFrontTag];
+    
+    [self addToolbarItemWithIdentifier:ToolbarMoveToBackIdentifier 
+                             withImage:ToolbarMoveToBackImage
+                               withTag:ToolbarMoveToBackTag];
+    
+    
+    NSToolbar *toolbar = [[[NSToolbar alloc] initWithIdentifier:ToolbarIdentifier] autorelease];
+    
+    [toolbar setAllowsUserCustomization:YES];
+    [toolbar setAutosavesConfiguration:YES];
+    [toolbar setDisplayMode:NSToolbarDisplayModeIconAndLabel];
+    [toolbar setSizeMode:NSToolbarSizeModeSmall];
+    [toolbar setDisplayMode:NSToolbarDisplayModeLabelOnly];
+    [toolbar setDelegate:self];
+    [toolbar setSelectedItemIdentifier:ToolbarBrowseToolIdentifier];
+    [toolbar setVisible:NO];
+    
+    [[_drawView window] setToolbar:toolbar];
+}
+
+
+- (void)clickedToolbarItem:(id)sender
+{
+    int tag = [sender tag];
+    
+    switch(tag) {
+        case ToolbarBrowseToolTag:
+            [_drawView setToolMode:DrawViewToolBrowse];
+            break;
+        case ToolbarPanToolTag:
+            [_drawView setToolMode:DrawViewToolPan];
+            break;
+        case ToolbarZoomToolTag:
+            [_drawView setToolMode:DrawViewToolZoom];
+            break;
+        case ToolbarPointerToolTag:
+            [_drawView setToolMode:DrawViewToolArrow];
+            break;
+        case ToolbarRectangleToolTag:
+            [_drawView setToolMode:DrawViewToolRectangle];
+            break;
+        case ToolbarElipseToolTag:
+            [_drawView setToolMode:DrawViewToolElipse];
+            break;
+        case ToolbarTriangleToolTag:
+            [_drawView setToolMode:DrawViewToolTriangle];
+            break;
+        case ToolbarMoveForwardTag:
+            [_drawView moveSelectionForward:sender];
+            break;
+        case ToolbarMoveBackwardTag:
+            [_drawView moveSelectionBackward:sender];
+            break;
+        case ToolbarDeleteSelectionTag:
+            [_drawView deleteSelection:sender];
+            break;
+        default:
+            NSLog(@"Toolbar item: %i not implemented!", tag);
+    }
+    
+    [_drawView setNeedsDisplay:YES];
+}
+
+// NSToolbar delegate methods
+- (NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSString *)itemIdent 
+ willBeInsertedIntoToolbar:(BOOL)willBeInserted
+{ 
+    NSToolbarItem *    toolbarItem = [_toolbarItems objectForKey:itemIdent];
+    
+    if( toolbarItem == nil )
+        toolbarItem = [[[NSToolbarItem alloc] initWithItemIdentifier:itemIdent] autorelease];
+    
+    return toolbarItem;
+}
+
+- (NSArray *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar
+{
+    return [NSArray arrayWithObjects:
+        ToolbarBrowseToolIdentifier,
+        ToolbarPanToolIdentifier,
+        ToolbarZoomToolIdentifier,
+        ToolbarPointerToolIdentifier,
+        ToolbarRectangleToolIdentifier,
+        ToolbarElipseToolIdentifier,
+        ToolbarTriangleToolIdentifier,
+        ToolbarDeleteShapeIdentifier, 
+        NSToolbarShowColorsItemIdentifier,
+        ToolbarMoveForwardIdentifier,
+        ToolbarMoveBackwardIdentifier,
+        ToolbarMoveToFrontIdentifier,
+        ToolbarMoveToBackIdentifier,
+        NSToolbarCustomizeToolbarItemIdentifier,
+        NSToolbarFlexibleSpaceItemIdentifier, 
+        NSToolbarSpaceItemIdentifier, 
+        NSToolbarSeparatorItemIdentifier, nil];
+}
+
+- (NSArray *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar
+{    
+    return [NSArray arrayWithObjects:
+        ToolbarBrowseToolIdentifier,
+        ToolbarPanToolIdentifier,
+        //ToolbarZoomToolIdentifier,
+        NSToolbarFlexibleSpaceItemIdentifier,
+        ToolbarPointerToolIdentifier,
+        ToolbarRectangleToolIdentifier,
+        ToolbarElipseToolIdentifier,
+        //ToolbarTriangleToolIdentifier, 
+        //NSToolbarSeparatorItemIdentifier,
+        ToolbarDeleteShapeIdentifier, 
+        //ToolbarMoveForwardIdentifier,
+        //ToolbarMoveBackwardIdentifier,
+        //ToolbarMoveToFrontIdentifier,
+        //ToolbarMoveToBackIdentifier, 
+        NSToolbarSeparatorItemIdentifier,
+        //NSToolbarShowColorsItemIdentifier, 
+        //NSToolbarFlexibleSpaceItemIdentifier, 
+        NSToolbarCustomizeToolbarItemIdentifier,
+        nil];
+}
+
+- (NSArray *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar
+{
+    return [NSArray arrayWithObjects:
+        ToolbarBrowseToolIdentifier,
+        ToolbarPanToolIdentifier,
+        ToolbarZoomToolIdentifier,    
+        ToolbarPointerToolIdentifier,
+        ToolbarRectangleToolIdentifier,
+        ToolbarElipseToolIdentifier,
+        ToolbarTriangleToolIdentifier,
+        nil];
+}
+
+- (BOOL)validateToolbarItem:(NSToolbarItem *)theItem
+{
+    BOOL enabled = YES;
+    
+    switch([theItem tag]) {
+        case ToolbarMoveForwardTag:
+        case ToolbarMoveBackwardTag:
+        case ToolbarMoveToFrontTag:
+        case ToolbarMoveToBackTag:
+        case ToolbarDeleteSelectionTag:
+            enabled = ([[_drawView selectedCanvasItems] count] != 0);
+    }
+    
+    return enabled;
+}
+
+@end
diff --git a/WebKitTools/DrawTest/DrawTestView.h b/WebKitTools/DrawTest/DrawTestView.h
new file mode 100644 (file)
index 0000000..b59c5bf
--- /dev/null
@@ -0,0 +1,40 @@
+/*
+ * Copyright (C) 2005 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. 
+ */
+
+#import <Cocoa/Cocoa.h>
+
+#import <WebCore+SVG/DrawView.h>
+
+
+@interface DrawTestView : DrawView
+{    
+    BOOL _showDebugString;
+    BOOL _showDebugAxes;
+}
+
+- (IBAction)toggleShowDebugString:(id)sender;
+- (IBAction)toggleShowDebugAxes:(id)sender;
+
+@end
diff --git a/WebKitTools/DrawTest/DrawTestView.m b/WebKitTools/DrawTest/DrawTestView.m
new file mode 100644 (file)
index 0000000..096a32e
--- /dev/null
@@ -0,0 +1,101 @@
+/*
+ * Copyright (C) 2005 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. 
+ */
+
+#import "DrawTestView.h"
+
+#import <WebCore+SVG/DrawViewPrivate.h>
+#import <WebCore+SVG/DrawDocumentPrivate.h>
+
+@implementation DrawTestView
+
+- (id)initWithFrame:(NSRect)frame
+{
+    if (self = [super initWithFrame:frame]) {
+        //[self setValue:[NSNumber numberWithBool:YES] forKey:@"showDebugString"];
+        //[self setValue:[NSNumber numberWithBool:YES] forKey:@"showDebugAxes"];
+    }
+    return self;
+}
+
+- (void)drawAxes:(float)length
+{
+    NSBezierPath *xAxis = [NSBezierPath bezierPath];
+    [xAxis moveToPoint:NSMakePoint(-.5 * length, 0)];
+    [xAxis lineToPoint:NSMakePoint(length, 0)];
+    [[NSColor redColor] set];
+    [xAxis stroke];
+    
+    NSBezierPath *yAxis = [NSBezierPath bezierPath];
+    [yAxis moveToPoint:NSMakePoint(0, -.5 * length)];
+    [yAxis lineToPoint:NSMakePoint(0, length)];
+    [[NSColor greenColor] set];
+    [yAxis stroke];
+}
+
+- (void)drawRect:(NSRect)dirtyRect
+{
+    [super drawRect:dirtyRect];
+    
+    if (_showDebugString) {
+        // draw the current zoom/pan
+        NSString *infoString = [NSString stringWithFormat:@"viewport origin: %@ canvas size: %@ zoom: %f",
+            NSStringFromPoint([self canvasVisibleOrigin]),
+            NSStringFromSize([[self document] canvasSize]), [self canvasZoom]];
+        [infoString drawAtPoint:NSMakePoint(5, 13) withAttributes:nil];
+    }
+    
+    if (_showDebugAxes) {
+        CGContextRef context = (CGContextRef)[[NSGraphicsContext currentContext] graphicsPort];
+        CGContextSaveGState(context);
+        CGContextConcatCTM(context, CGAffineTransformInvert([self transformFromViewToCanvas]));
+        [self drawAxes:100];
+        CGContextRestoreGState(context);
+    }
+}
+
+- (IBAction)toggleShowDebugString:(id)sender
+{
+    [self setValue:[NSNumber numberWithBool:!_showDebugString] forKey:@"showDebugString"];
+    [self setNeedsDisplay:YES];
+}
+
+- (IBAction)toggleShowDebugAxes:(id)sender
+{
+    [self setValue:[NSNumber numberWithBool:!_showDebugAxes] forKey:@"showDebugAxes"];
+    [self setNeedsDisplay:YES];
+}
+
+- (IBAction)toggleFilterSupport:(id)sender
+{
+    [DrawView setFilterSupportEnabled:[DrawView isFilterSupportEnabled]];
+    [self setNeedsDisplay:YES];
+}
+
+- (BOOL)acceptsFirstResponder
+{
+    return YES;
+}
+
+@end
diff --git a/WebKitTools/DrawTest/DrawTest_Prefix.pch b/WebKitTools/DrawTest/DrawTest_Prefix.pch
new file mode 100644 (file)
index 0000000..8393f01
--- /dev/null
@@ -0,0 +1,37 @@
+/*
+ * Copyright (C) 2005 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. 
+ */
+
+//
+// Prefix header for all source files of the 'DrawTest' target in the 'DrawTest' project
+//
+
+#ifdef __OBJC__
+#import <Cocoa/Cocoa.h>
+
+#define foreacharray(__variable, __container) \
+    for (int __variable##__i=0, __variable##__n=[__container count];  \
+        __variable##__i < __variable##__n && (__variable = [__container objectAtIndex:__variable##__i]);  \
+        ++__variable##__i)
+#endif
diff --git a/WebKitTools/DrawTest/English.lproj/DrawTestDocument.nib/classes.nib b/WebKitTools/DrawTest/English.lproj/DrawTestDocument.nib/classes.nib
new file mode 100644 (file)
index 0000000..296ffc3
--- /dev/null
@@ -0,0 +1,34 @@
+{
+    IBClasses = (
+        {
+            ACTIONS = {toggleShowDebugAxes = id; toggleShowDebugString = id; }; 
+            CLASS = DrawTestView; 
+            LANGUAGE = ObjC; 
+            SUPERCLASS = DrawView; 
+        }, 
+        {
+            ACTIONS = {
+                deleteSelection = id; 
+                moveSelectionBackward = id; 
+                moveSelectionForward = id; 
+                zoomIn = id; 
+                zoomOriginal = id; 
+                zoomOut = id; 
+                zoomToFit = id; 
+            }; 
+            CLASS = DrawView; 
+            LANGUAGE = ObjC; 
+            SUPERCLASS = NSView; 
+        }, 
+        {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 
+        {
+            ACTIONS = {dumpSVGToConsole = id; }; 
+            CLASS = MyDocument; 
+            LANGUAGE = ObjC; 
+            OUTLETS = {drawView = KCanvasTestView; }; 
+            SUPERCLASS = NSDocument; 
+        }, 
+        {CLASS = NSSegmentedControl; LANGUAGE = ObjC; SUPERCLASS = NSControl; }
+    ); 
+    IBVersion = 1; 
+}
\ No newline at end of file
diff --git a/WebKitTools/DrawTest/English.lproj/DrawTestDocument.nib/info.nib b/WebKitTools/DrawTest/English.lproj/DrawTestDocument.nib/info.nib
new file mode 100644 (file)
index 0000000..3c96fd5
--- /dev/null
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>IBDocumentLocation</key>
+       <string>86 30 356 240 0 0 1024 746 </string>
+       <key>IBEditorPositions</key>
+       <dict>
+               <key>50</key>
+               <string>377 327 270 342 0 0 1024 746 </string>
+       </dict>
+       <key>IBFramework Version</key>
+       <string>437.0</string>
+       <key>IBOpenObjects</key>
+       <array>
+               <integer>50</integer>
+               <integer>5</integer>
+       </array>
+       <key>IBSystem Version</key>
+       <string>8C42</string>
+</dict>
+</plist>
diff --git a/WebKitTools/DrawTest/English.lproj/DrawTestDocument.nib/keyedobjects.nib b/WebKitTools/DrawTest/English.lproj/DrawTestDocument.nib/keyedobjects.nib
new file mode 100644 (file)
index 0000000..4feeb46
Binary files /dev/null and b/WebKitTools/DrawTest/English.lproj/DrawTestDocument.nib/keyedobjects.nib differ
diff --git a/WebKitTools/DrawTest/English.lproj/InfoPlist.strings b/WebKitTools/DrawTest/English.lproj/InfoPlist.strings
new file mode 100644 (file)
index 0000000..0a7822d
Binary files /dev/null and b/WebKitTools/DrawTest/English.lproj/InfoPlist.strings differ
diff --git a/WebKitTools/DrawTest/English.lproj/Inspector.nib/classes.nib b/WebKitTools/DrawTest/English.lproj/Inspector.nib/classes.nib
new file mode 100644 (file)
index 0000000..725f5a4
--- /dev/null
@@ -0,0 +1,12 @@
+{
+    IBClasses = (
+        {
+            CLASS = DrawTestInspectorController; 
+            LANGUAGE = ObjC; 
+            OUTLETS = {"_inspectorPanel" = NSPanel; }; 
+            SUPERCLASS = NSObject; 
+        }, 
+        {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }
+    ); 
+    IBVersion = 1; 
+}
\ No newline at end of file
diff --git a/WebKitTools/DrawTest/English.lproj/Inspector.nib/info.nib b/WebKitTools/DrawTest/English.lproj/Inspector.nib/info.nib
new file mode 100644 (file)
index 0000000..d930763
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>IBDocumentLocation</key>
+       <string>261 184 356 240 0 0 1024 746 </string>
+       <key>IBFramework Version</key>
+       <string>437.0</string>
+       <key>IBOpenObjects</key>
+       <array>
+               <integer>7</integer>
+       </array>
+       <key>IBSystem Version</key>
+       <string>8B9</string>
+</dict>
+</plist>
diff --git a/WebKitTools/DrawTest/English.lproj/Inspector.nib/keyedobjects.nib b/WebKitTools/DrawTest/English.lproj/Inspector.nib/keyedobjects.nib
new file mode 100644 (file)
index 0000000..d0b7077
Binary files /dev/null and b/WebKitTools/DrawTest/English.lproj/Inspector.nib/keyedobjects.nib differ
diff --git a/WebKitTools/DrawTest/English.lproj/MainMenu.nib/classes.nib b/WebKitTools/DrawTest/English.lproj/MainMenu.nib/classes.nib
new file mode 100644 (file)
index 0000000..c0ca441
--- /dev/null
@@ -0,0 +1,44 @@
+{
+    IBClasses = (
+        {
+            ACTIONS = {showImageRepTestWindow = id; showInspectorPanel = id; showTestsPanel = id; }; 
+            CLASS = AppDelegate; 
+            LANGUAGE = ObjC; 
+            OUTLETS = {svgImageRepTestWindow = NSWindow; }; 
+            SUPERCLASS = NSObject; 
+        }, 
+        {
+            ACTIONS = {
+                dumpSVGToConsole = id; 
+                openSelectionInViewer = id; 
+                openSourceForSelection = id; 
+                runWindowResizeTest = id; 
+                showCompositeWindow = id; 
+                showImageRepTestWindow = id; 
+                showInspectorPanel = id; 
+                showTestsPanel = id; 
+                toggleDebugDrawer = id; 
+                toggleFilterSupport = id; 
+                toggleShowDebugAxes = id; 
+                toggleShowDebugString = id; 
+                toggleViewersScaleRule = id; 
+                zoomIn = id; 
+                zoomOriginal = id; 
+                zoomOut = id; 
+                zoomToContent = id; 
+            }; 
+            CLASS = FirstResponder; 
+            LANGUAGE = ObjC; 
+            SUPERCLASS = NSObject; 
+        }, 
+        {CLASS = KCanvasTestView; LANGUAGE = ObjC; SUPERCLASS = NSView; }, 
+        {
+            ACTIONS = {dumpSVGToConsole = id; }; 
+            CLASS = MyDocument; 
+            LANGUAGE = ObjC; 
+            OUTLETS = {canvasView = KCanvasTestView; }; 
+            SUPERCLASS = NSDocument; 
+        }
+    ); 
+    IBVersion = 1; 
+}
\ No newline at end of file
diff --git a/WebKitTools/DrawTest/English.lproj/MainMenu.nib/info.nib b/WebKitTools/DrawTest/English.lproj/MainMenu.nib/info.nib
new file mode 100644 (file)
index 0000000..9b783e0
--- /dev/null
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>IBDocumentLocation</key>
+       <string>274 58 356 240 0 0 1024 746 </string>
+       <key>IBEditorPositions</key>
+       <dict>
+               <key>29</key>
+               <string>128 678 355 44 0 0 1024 746 </string>
+       </dict>
+       <key>IBFramework Version</key>
+       <string>439.0</string>
+       <key>IBOpenObjects</key>
+       <array>
+               <integer>29</integer>
+       </array>
+       <key>IBSystem Version</key>
+       <string>8C32</string>
+</dict>
+</plist>
diff --git a/WebKitTools/DrawTest/English.lproj/MainMenu.nib/keyedobjects.nib b/WebKitTools/DrawTest/English.lproj/MainMenu.nib/keyedobjects.nib
new file mode 100644 (file)
index 0000000..769df8e
Binary files /dev/null and b/WebKitTools/DrawTest/English.lproj/MainMenu.nib/keyedobjects.nib differ
diff --git a/WebKitTools/DrawTest/English.lproj/TestViewer.nib/classes.nib b/WebKitTools/DrawTest/English.lproj/TestViewer.nib/classes.nib
new file mode 100644 (file)
index 0000000..eb82ec7
--- /dev/null
@@ -0,0 +1,36 @@
+{
+    IBClasses = (
+        {CLASS = DrawView; LANGUAGE = ObjC; SUPERCLASS = NSView; }, 
+        {CLASS = FirstResponder; LANGUAGE = ObjC; SUPERCLASS = NSObject; }, 
+        {CLASS = KCanvasTestView; LANGUAGE = ObjC; SUPERCLASS = NSView; }, 
+        {CLASS = MyImageView; LANGUAGE = ObjC; SUPERCLASS = NSImageView; }, 
+        {
+            ACTIONS = {
+                browse = id; 
+                jumpToParentDirectory = id; 
+                openSelectionInViewer = id; 
+                openSourceForSelection = id; 
+                openTestViewerForSelection = id; 
+                showCompositeWindow = id; 
+                showTestWindow = id; 
+                showTestsPanel = id; 
+                toggleViewersScaleRule = id; 
+            }; 
+            CLASS = TestController; 
+            LANGUAGE = ObjC; 
+            OUTLETS = {
+                "_compositeImageView" = NSImageView; 
+                "_compositeWindow" = NSWindow; 
+                "_parentDirectoryPopup" = NSPopUpButton; 
+                "_splitView" = TestViewerSplitView; 
+                "_testPanel" = NSPanel; 
+                "_testWindow" = NSWindow; 
+                "_testsArrayController" = NSArrayController; 
+                "_testsTableView" = NSTableView; 
+            }; 
+            SUPERCLASS = NSObject; 
+        }, 
+        {CLASS = TestViewerSplitView; LANGUAGE = ObjC; SUPERCLASS = NSView; }
+    ); 
+    IBVersion = 1; 
+}
\ No newline at end of file
diff --git a/WebKitTools/DrawTest/English.lproj/TestViewer.nib/info.nib b/WebKitTools/DrawTest/English.lproj/TestViewer.nib/info.nib
new file mode 100644 (file)
index 0000000..ca801e8
--- /dev/null
@@ -0,0 +1,17 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>IBDocumentLocation</key>
+       <string>263 119 356 240 0 0 1024 746 </string>
+       <key>IBFramework Version</key>
+       <string>437.0</string>
+       <key>IBOpenObjects</key>
+       <array>
+               <integer>24</integer>
+               <integer>60</integer>
+       </array>
+       <key>IBSystem Version</key>
+       <string>8C26</string>
+</dict>
+</plist>
diff --git a/WebKitTools/DrawTest/English.lproj/TestViewer.nib/keyedobjects.nib b/WebKitTools/DrawTest/English.lproj/TestViewer.nib/keyedobjects.nib
new file mode 100644 (file)
index 0000000..0ed84eb
Binary files /dev/null and b/WebKitTools/DrawTest/English.lproj/TestViewer.nib/keyedobjects.nib differ
diff --git a/WebKitTools/DrawTest/Info.plist b/WebKitTools/DrawTest/Info.plist
new file mode 100644 (file)
index 0000000..0e85e7b
--- /dev/null
@@ -0,0 +1,47 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
+<plist version="1.0">
+<dict>
+       <key>CFBundleDevelopmentRegion</key>
+       <string>English</string>
+       <key>CFBundleDocumentTypes</key>
+       <array>
+               <dict>
+                       <key>CFBundleTypeExtensions</key>
+                       <array>
+                               <string>svg</string>
+                       </array>
+                       <key>CFBundleTypeName</key>
+                       <string>SVG Document</string>
+                       <key>CFBundleTypeOSTypes</key>
+                       <array>
+                               <string>????</string>
+                       </array>
+                       <key>CFBundleTypeRole</key>
+                       <string>Editor</string>
+                       <key>LSTypeIsPackage</key>
+                       <false/>
+                       <key>NSDocumentClass</key>
+                       <string>DrawTestDocument</string>
+                       <key>NSPersistentStoreTypeKey</key>
+                       <string>Binary</string>
+               </dict>
+       </array>
+       <key>CFBundleExecutable</key>
+       <string>DrawTest</string>
+       <key>CFBundleIdentifier</key>
+       <string>com.apple.DrawTest</string>
+       <key>CFBundleInfoDictionaryVersion</key>
+       <string>6.0</string>
+       <key>CFBundlePackageType</key>
+       <string>APPL</string>
+       <key>CFBundleSignature</key>
+       <string>????</string>
+       <key>CFBundleVersion</key>
+       <string>1.0</string>
+       <key>NSMainNibFile</key>
+       <string>MainMenu</string>
+       <key>NSPrincipalClass</key>
+       <string>NSApplication</string>
+</dict>
+</plist>
diff --git a/WebKitTools/DrawTest/SVGTest.h b/WebKitTools/DrawTest/SVGTest.h
new file mode 100644 (file)
index 0000000..40769fa
--- /dev/null
@@ -0,0 +1,51 @@
+/*
+ * Copyright (C) 2005 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. 
+ */
+
+#import <Cocoa/Cocoa.h>
+
+@class DrawDocument;
+
+@interface SVGTest : NSObject {
+    NSString *_svgPath;
+    NSString *_imagePath;
+    
+    DrawDocument *_svgDocument;
+    NSImage *_image;
+    NSImage *_compositeImage;
+    BOOL _hasPassed;
+}
+
++ (id)testWithSVGPath:(NSString *)svgPath imagePath:(NSString *)imagePath;
+- (id)initWithSVGPath:(NSString *)svgPath imagePath:(NSString *)imagePath;
+
+- (NSString *)imagePath;
+- (NSString *)svgPath;
+
+- (NSImage *)image;
+- (DrawDocument *)svgDocument;
+- (NSImage *)compositeImage;
+- (NSString *)name;
+
+@end
diff --git a/WebKitTools/DrawTest/SVGTest.m b/WebKitTools/DrawTest/SVGTest.m
new file mode 100644 (file)
index 0000000..281d0ab
--- /dev/null
@@ -0,0 +1,123 @@
+/*
+ * Copyright (C) 2005 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. 
+ */
+
+#import "SVGTest.h"
+
+#import <WebCore+SVG/DrawView.h>
+#import <WebCore+SVG/DrawDocument.h>
+
+@implementation SVGTest
+
++ (id)testWithSVGPath:(NSString *)svgPath imagePath:(NSString *)imagePath
+{
+    SVGTest *test = [[self alloc] initWithSVGPath:svgPath imagePath:imagePath];
+    return [test autorelease];
+}
+
+static DrawView *__sharedDrawView = nil;
++ (DrawView *)sharedDrawView
+{
+    if (!__sharedDrawView) {
+        __sharedDrawView = [[DrawView alloc] initWithFrame:NSMakeRect(0,0,0,0)];
+    }
+    return __sharedDrawView;
+}
+
+- (id)initWithSVGPath:(NSString *)svgPath imagePath:(NSString *)imagePath
+{
+    if (self = [super init]) {
+        _svgPath = [svgPath copy];
+        _imagePath = [imagePath copy];
+    }
+    return self;
+}
+
+- (NSString *)imagePath
+{
+    return _imagePath;
+}
+
+- (NSString *)svgPath
+{
+    return _svgPath;
+}
+
+- (NSImage *)image
+{
+    if (!_image && _imagePath) {
+        _image = [[NSImage alloc] initByReferencingFile:_imagePath];
+    }
+    return _image;
+}
+
+- (DrawDocument *)svgDocument
+{
+    if (!_svgDocument && _svgPath) {
+        _svgDocument = [[DrawDocument alloc] initWithContentsOfFile:_svgPath];
+    }
+    return _svgDocument;
+}
+
+- (NSString *)name
+{
+    NSMutableString *name = [[[[_svgPath lastPathComponent] stringByDeletingPathExtension] mutableCopy] autorelease];
+    [name replaceOccurrencesOfString:@"_" withString:@" " options:0 range:NSMakeRange(0, [name length])];
+    return [name capitalizedString];
+}
+
+- (void)generateCompositeIfNecessary
+{
+    if (!_compositeImage) {
+        DrawView *view = [SVGTest sharedDrawView];
+        [view setDocument:[self svgDocument]];
+        [view sizeToFitViewBox];
+        NSSize svgSize = [view bounds].size;
+        
+        NSImage *image = [self image];
+        NSSize imageSize = [image size];
+        
+        NSBitmapImageRep *svgImage = [view bitmapImageRepForCachingDisplayInRect:[view bounds]];
+        [view cacheDisplayInRect:[view bounds] toBitmapImageRep:svgImage];
+        
+        NSSize unionSize = NSMakeSize(MAX(svgSize.width, imageSize.width), MAX(svgSize.height, imageSize.height));
+        _compositeImage = [[NSImage alloc] initWithSize:unionSize];
+        
+        [_compositeImage lockFocus];
+        [svgImage drawInRect:NSMakeRect(0,0,svgSize.width,svgSize.height)];
+        [image drawInRect:NSMakeRect(0,0,imageSize.width,imageSize.height)
+                fromRect:NSMakeRect(0,0,imageSize.width,imageSize.height)
+                 operation:NSCompositeXOR fraction:1.0];
+        [_compositeImage unlockFocus];
+    }
+}
+
+- (NSImage *)compositeImage
+{
+    [self generateCompositeIfNecessary];
+    return _compositeImage;
+}
+
+
+@end
diff --git a/WebKitTools/DrawTest/ScalingImageView.h b/WebKitTools/DrawTest/ScalingImageView.h
new file mode 100644 (file)
index 0000000..4370ff5
--- /dev/null
@@ -0,0 +1,33 @@
+/*
+ * Copyright (C) 2005 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. 
+ */
+
+#import <Cocoa/Cocoa.h>
+
+
+@interface ScalingImageView : NSImageView {
+
+}
+
+@end
diff --git a/WebKitTools/DrawTest/ScalingImageView.m b/WebKitTools/DrawTest/ScalingImageView.m
new file mode 100644 (file)
index 0000000..605397a
--- /dev/null
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2005 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. 
+ */
+
+
+#import "ScalingImageView.h"
+
+@implementation ScalingImageView
+
+/*
+ This class offers two behaviors different from the standard NSImageView
+ (and which were not available w/o subclassing)
+ 1.  Scale an image proportionally up to fit a larger view (NSImageView refuses)
+ 2.  Draw a background color w/o needing to show a bezel.
+*/
+
+- (void)drawRect:(NSRect)dirtyRect
+{
+    [[NSColor whiteColor] set];
+    NSRectFill(dirtyRect);
+    
+    NSSize imageSize = [[self image] size];
+    float scale = 1.0f;
+    if ([self imageScaling] == NSScaleProportionally && imageSize.width && imageSize.height) {
+        float widthScale = [self bounds].size.width / imageSize.width;
+        float heightScale = [self bounds].size.height / imageSize.height;
+        scale = MIN(widthScale, heightScale);
+    }
+
+    float scaledHeight = imageSize.height * scale;
+    NSRect destRect = NSMakeRect(0,[self bounds].size.height - scaledHeight,imageSize.width * scale, scaledHeight);
+    [[self image] drawInRect:destRect
+        fromRect:NSMakeRect(0,0,imageSize.width, imageSize.height) operation:NSCompositeSourceOver fraction:1.0];
+}
+
+@end
diff --git a/WebKitTools/DrawTest/TestController.h b/WebKitTools/DrawTest/TestController.h
new file mode 100644 (file)
index 0000000..109cb7e
--- /dev/null
@@ -0,0 +1,71 @@
+/*
+ * Copyright (C) 2005 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. 
+ */
+
+#import <Cocoa/Cocoa.h>
+
+@class DrawView;
+@class SVGTest;
+@class TestViewerSplitView;
+
+@interface TestController : NSObject {
+    IBOutlet NSPanel *_testPanel;
+    IBOutlet NSWindow *_testWindow;
+    IBOutlet TestViewerSplitView *_splitView;
+
+    IBOutlet NSArrayController *_testsArrayController;
+    IBOutlet NSPopUpButton *_parentDirectoryPopup;
+    IBOutlet NSTableView *_testsTableView;
+    
+    IBOutlet NSWindow *_compositeWindow;
+    IBOutlet NSImageView *_compositeImageView;
+    
+@private
+    NSString *_currentPath;
+    NSArray *_tests;
+    SVGTest *_selectedTest;
+    
+    DrawView *_drawView;
+    NSImageView *_imageView;
+}
+
++ (id)sharedController;
+
+- (IBAction)showTestsPanel:(id)sender;
+- (IBAction)showTestWindow:(id)sender;
+- (IBAction)showCompositeWindow:(id)sender;
+
+- (IBAction)browse:(id)sender;
+- (IBAction)jumpToParentDirectory:(id)sender;
+- (IBAction)openTestViewerForSelection:(id)sender;
+- (IBAction)openSourceForSelection:(id)sender;
+- (IBAction)openSelectionInViewer:(id)sender;
+- (IBAction)toggleViewersScaleRule:(id)sender;
+
+- (NSArray *)tests;
+- (NSString *)currentPath;
+- (void)setCurrentPath:(NSString *)newPath;
+- (NSArray *)directoryHierarchy;
+
+@end
diff --git a/WebKitTools/DrawTest/TestController.m b/WebKitTools/DrawTest/TestController.m
new file mode 100644 (file)
index 0000000..197528f
--- /dev/null
@@ -0,0 +1,258 @@
+/*
+ * Copyright (C) 2005 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. 
+ */
+
+#import "TestController.h"
+#import "SVGTest.h"
+#import "TestViewerSplitView.h"
+#import "ScalingImageView.h"
+
+#import <WebCore+SVG/DrawView.h>
+
+@interface NSArray (TestControllerAdditions)
+- (id)firstObject;
+@end
+
+@implementation NSArray (TestControllerAdditions)
+- (id)firstObject
+{
+    if ([self count])
+        return [self objectAtIndex:0];
+    return nil;
+}
+@end
+
+static TestController *__sharedInstance = nil;
+
+@implementation TestController
+
+- (id)init
+{
+    if (self = [super init]) {
+        NSString *path = [[NSUserDefaults standardUserDefaults] objectForKey:@"TestDirectory"];
+        BOOL isDirectory = NO;
+        if (![[NSFileManager defaultManager] fileExistsAtPath:path isDirectory:&isDirectory] || !isDirectory) {
+            path = [@"~" stringByStandardizingPath];
+        }
+        [self setCurrentPath:path];
+    }
+    return self;
+}
+
++ (void)initialize
+{
+    [self setKeys:[NSArray arrayWithObject:@"currentPath"] triggerChangeNotificationsForDependentKey:@"directoryHierarchy"];
+    [self setKeys:[NSArray arrayWithObject:@"currentPath"] triggerChangeNotificationsForDependentKey:@"tests"];
+}
+
++ (id)sharedController
+{
+    if (!__sharedInstance) {
+        __sharedInstance = [[self alloc] init];
+    }
+    return __sharedInstance;
+}
+
+- (void)loadNibIfNecessary
+{
+    if (!_testPanel) {
+        [NSBundle loadNibNamed:@"TestViewer" owner:self];
+    }
+}
+
+- (void)awakeFromNib
+{
+    [_testsTableView setTarget:self];
+    [_testsTableView setDoubleAction:@selector(openTestViewerForSelection:)];
+    _drawView = [[DrawView alloc] initWithFrame:NSZeroRect];
+    _imageView = [[ScalingImageView alloc] initWithFrame:NSZeroRect];
+    [_splitView addSubview:_drawView];
+    [_splitView addSubview:_imageView];
+}
+
+- (IBAction)showTestsPanel:(id)sender
+{
+    [self loadNibIfNecessary];
+    [_testPanel makeKeyAndOrderFront:sender];
+}
+
+- (IBAction)showTestWindow:(id)sender
+{
+    [self loadNibIfNecessary];
+    [_testWindow makeKeyAndOrderFront:sender];
+}
+
+- (IBAction)showCompositeWindow:(id)sender
+{
+    [self loadNibIfNecessary];
+    NSLog(@"showCompositeWindow: %@", _compositeWindow);
+    [_compositeWindow makeKeyAndOrderFront:sender];
+}
+
+- (IBAction)browse:(id)sender
+{
+    NSOpenPanel *openPanel = [NSOpenPanel openPanel];
+    [openPanel setCanChooseDirectories:YES];
+    [openPanel setCanChooseFiles:NO];
+    [openPanel beginSheetForDirectory:nil file:nil modalForWindow:_testPanel modalDelegate:self didEndSelector:@selector(openPanelDidEnd:returnCode:contextInfo:) contextInfo:NULL];
+}
+
+- (void)openPanelDidEnd:(NSOpenPanel *)openPanel returnCode:(int)returnCode contextInfo:(void *)contextInfo
+{
+    if (returnCode == NSOKButton) {
+        NSArray *folders = [openPanel filenames];
+        NSString *selectedFolder = [folders firstObject];
+        [self setCurrentPath:selectedFolder];
+    }
+}
+
+- (IBAction)jumpToParentDirectory:(id)sender
+{
+    int index = [_parentDirectoryPopup indexOfSelectedItem];
+    NSArray *components = [_currentPath pathComponents];
+    NSArray *newComponents = [components subarrayWithRange:NSMakeRange(0, [components count] - index)];
+    NSString *newPath = [NSString pathWithComponents:newComponents];
+    [self setCurrentPath:newPath];
+}
+
+- (void)setSelectedTest:(SVGTest *)selectedTest
+{
+    id oldTest = _selectedTest;
+    _selectedTest = [selectedTest retain];
+    [oldTest release];
+    
+    if ([_testWindow isVisible]) {
+        [_testWindow setTitle:[NSString stringWithFormat:@"Test Viewer - %@", [_selectedTest name]]]; 
+        [_drawView setDocument:[_selectedTest svgDocument]];
+        [_imageView setImage:[_selectedTest image]];
+        if ([_compositeWindow isVisible])
+            [_compositeImageView setImage:[_selectedTest compositeImage]];
+    }
+}
+
+- (void)tableViewSelectionDidChange:(NSNotification *)aNotification
+{
+    [self setSelectedTest:[[_testsArrayController selectedObjects] firstObject]];
+}
+
+- (IBAction)openTestViewerForSelection:(id)sender
+{
+    [self showTestWindow:sender];
+    [_drawView setDocument:[_selectedTest svgDocument]];
+    [_imageView setImage:[_selectedTest image]];
+}
+
+- (IBAction)openSourceForSelection:(id)sender
+{
+    [[NSWorkspace sharedWorkspace] openFile:[_selectedTest svgPath] withApplication:@"TextEdit"];
+}
+
+- (IBAction)openSelectionInViewer:(id)sender
+{
+    [[NSWorkspace sharedWorkspace] openFile:[_selectedTest svgPath]];
+}
+     
+- (NSString *)imagePathForSVGPath:(NSString *)svgPath
+{
+    // eventually this code will build an array instead...
+    
+    NSString *svgName = [svgPath lastPathComponent];
+    NSString *testName = [svgName stringByDeletingPathExtension];
+    NSString *imageName = [testName stringByAppendingPathExtension:@"png"];
+    NSString *currentDirectory = [self currentPath];
+    NSString *parentDirectory = [currentDirectory stringByDeletingLastPathComponent];
+    
+    // first look for ../png/name.png -- SVG 1.1 baselines
+    NSString *imageDirectory = [parentDirectory stringByAppendingPathComponent:@"png"];
+    NSString *fullImageName = [@"full-" stringByAppendingString:imageName];
+    // The SVG 1.1 spec has various differnet pngs, we should allow the
+    // tester to choose...
+    NSString *imagePath = [imageDirectory stringByAppendingPathComponent:fullImageName];
+    if ([[NSFileManager defaultManager] fileExistsAtPath:imagePath]) return imagePath;
+    
+    // then look for ../name.png -- openclipart.org
+    imagePath = [currentDirectory stringByAppendingPathComponent:imageName];
+    if ([[NSFileManager defaultManager] fileExistsAtPath:imagePath]) return imagePath;
+    
+    // finally try name-baseline.png -- ksvg regression baselines
+    testName = [testName stringByAppendingString:@"-baseline"];
+    imageName = [testName stringByAppendingPathExtension:@"png"];
+    imagePath = [currentDirectory stringByAppendingPathComponent:imageName];
+    if ([[NSFileManager defaultManager] fileExistsAtPath:imagePath]) return imagePath;
+    
+    return nil;
+}
+
+- (NSArray *)tests
+{
+    if (!_tests) {
+        NSMutableArray *newTests = [[NSMutableArray alloc] init];
+        NSArray *files = [[NSFileManager defaultManager] directoryContentsAtPath:[self currentPath]];
+        NSString *file = nil;
+        foreacharray(file, files) {
+            if ([[file pathExtension] isEqualToString:@"svg"]) {
+                NSString *svgPath = [[self currentPath] stringByAppendingPathComponent:file];
+                NSString *imagePath = [self imagePathForSVGPath:svgPath];
+                [newTests addObject:[SVGTest testWithSVGPath:svgPath imagePath:imagePath]];
+            }
+        }
+        [self setValue:newTests forKey:@"tests"];
+    }
+    return _tests;
+}
+
+- (NSArray *)directoryHierarchy
+{
+    // A hackish way to reverse an array.
+    return [[[_currentPath pathComponents] reverseObjectEnumerator] allObjects];
+}
+
+- (NSString *)currentPath
+{
+    return _currentPath;
+}
+
+- (void)setCurrentPath:(NSString *)newPath
+{
+    if (![newPath isEqualToString:_currentPath]) {
+        [_currentPath release];
+        _currentPath = [newPath copy];
+        [self setValue:nil forKey:@"tests"];
+    }
+    
+    [[NSUserDefaults standardUserDefaults] setObject:_currentPath forKey:@"TestDirectory"];
+}
+
+- (IBAction)toggleViewersScaleRule:(id)sender
+{
+    if ([_drawView imageScaling] == NSScaleProportionally) {
+        [_drawView setImageScaling:NSScaleNone];
+        [_imageView setImageScaling:NSScaleNone];
+    } else {
+        [_drawView setImageScaling:NSScaleProportionally];
+        [_imageView setImageScaling:NSScaleProportionally];
+    }
+}
+
+@end
diff --git a/WebKitTools/DrawTest/TestViewerSplitView.h b/WebKitTools/DrawTest/TestViewerSplitView.h
new file mode 100644 (file)
index 0000000..e663f23
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+ * Copyright (C) 2005 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. 
+ */
+#import <Cocoa/Cocoa.h>
+
+@interface TestViewerSplitView : NSView {
+    NSMutableArray *subviewLabels;
+}
+
+@end
diff --git a/WebKitTools/DrawTest/TestViewerSplitView.m b/WebKitTools/DrawTest/TestViewerSplitView.m
new file mode 100644 (file)
index 0000000..ed50b94
--- /dev/null
@@ -0,0 +1,75 @@
+/*
+ * Copyright (C) 2005 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. 
+ */
+
+#import "TestViewerSplitView.h"
+
+@implementation TestViewerSplitView
+
+- (void)drawRect:(NSRect)rect
+{
+    NSArray *subviews = [self subviews];
+    int subviewCount = [subviews count];
+    for (int x=0; x < subviewCount; x++) {
+        NSView *subview = [subviews objectAtIndex:x];
+        [subview drawRect:rect];
+//        NSString *label = [subviewLabels objectAtIndex:0];
+//        [label drawAtPoint:[subview frame].origin withAttributes:NULL];
+    }
+}
+
+- (void)retileSubviews
+{
+    NSRect bounds = [self bounds];
+    NSArray *subviews = [self subviews];
+    int subviewCount = [subviews count];
+    if (!subviewCount) return;
+    float subviewWidth = bounds.size.width / subviewCount;
+    
+    for (int x=0; x < subviewCount; x++) {
+        [[subviews objectAtIndex:x] setFrame:NSMakeRect(x * subviewWidth, 0, subviewWidth, bounds.size.height)];
+    }
+}
+
+- (void)didAddSubview:(NSView *)subview
+{
+    [super didAddSubview:subview];
+    [self retileSubviews];
+}
+
+- (void)willRemoveSubview:(NSView *)subview
+{
+    [super willRemoveSubview:subview];
+    [self retileSubviews];
+}
+
+- (void)setFrame:(NSRect)newFrame
+{
+    // ideally we also want to catch when the bounds changes without the
+    // frame changing, but we're not bothering with that now - ECS 7/29/05
+    [super setFrame:newFrame];
+    [self retileSubviews];
+}
+
+@end
diff --git a/WebKitTools/DrawTest/main.m b/WebKitTools/DrawTest/main.m
new file mode 100644 (file)
index 0000000..90337b6
--- /dev/null
@@ -0,0 +1,29 @@
+/*
+ * Copyright (C) 2005 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. 
+ */
+
+int main (int argc, const char *argv[])
+{
+    return NSApplicationMain(argc, argv);
+}