2006-01-10 Nefaur Khandker <nefaurk@gmail.com>
authoreseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Jan 2006 12:45:26 +0000 (12:45 +0000)
committereseidel <eseidel@268f45cc-cd09-0410-ab3c-d52691b4dbfc>
Tue, 10 Jan 2006 12:45:26 +0000 (12:45 +0000)
        Reviewed by eseidel.  Committed by eseidel.

        DrawTestView now subclasses WebView instead of DrawView.

        * DrawTest/DrawTest.xcodeproj/project.pbxproj:
        * DrawTest/DrawTestDocument.h:
        * DrawTest/DrawTestDocument.m:
        (-[DrawTestDocument dealloc]):
        (-[DrawTestDocument readFromFile:ofType:]):
        (-[DrawTestDocument windowControllerDidLoadNib:]):
        (-[DrawTestDocument dumpSVGToConsole:]):
        (-[DrawTestDocument openSourceForSelection:]):
        (-[DrawTestDocument dataRepresentationOfType:]):
        * DrawTest/DrawTestToolbarController.h:
        * DrawTest/DrawTestToolbarController.m:
        (-[DrawTestToolbarController initWithDrawView:]):
        (-[DrawTestToolbarController clickedToolbarItem:]):
        (-[DrawTestToolbarController validateToolbarItem:]):
        * DrawTest/DrawTestView.h:
        * DrawTest/DrawTestView.m:
        (-[DrawTestView initWithFrame:]):
        (-[DrawTestView setDocument:]):
        * DrawTest/SVGTest.h:
        * DrawTest/SVGTest.m:
        (+[SVGTest sharedDrawView]):
        (-[SVGTest generateCompositeIfNecessary]):
        * DrawTest/TestController.h:
        * DrawTest/TestController.m:
        (-[TestController awakeFromNib]):
        (-[TestController setSelectedTest:]):
        (-[TestController openTestViewerForSelection:]):
        (-[TestController toggleViewersScaleRule:]):
        * DrawTest/TestViewerSplitView.m:
        (-[TestViewerSplitView drawRect:]):

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

13 files changed:
WebKitTools/ChangeLog
WebKitTools/DrawTest/DrawTest.xcodeproj/project.pbxproj
WebKitTools/DrawTest/DrawTestDocument.h
WebKitTools/DrawTest/DrawTestDocument.m
WebKitTools/DrawTest/DrawTestToolbarController.h
WebKitTools/DrawTest/DrawTestToolbarController.m
WebKitTools/DrawTest/DrawTestView.h
WebKitTools/DrawTest/DrawTestView.m
WebKitTools/DrawTest/SVGTest.h
WebKitTools/DrawTest/SVGTest.m
WebKitTools/DrawTest/TestController.h
WebKitTools/DrawTest/TestController.m
WebKitTools/DrawTest/TestViewerSplitView.m

index bd5d5ba..d35bdf3 100644 (file)
@@ -1,3 +1,40 @@
+2006-01-10  Nefaur Khandker  <nefaurk@gmail.com>
+
+        Reviewed by eseidel.  Committed by eseidel.
+
+        DrawTestView now subclasses WebView instead of DrawView.
+
+        * DrawTest/DrawTest.xcodeproj/project.pbxproj:
+        * DrawTest/DrawTestDocument.h:
+        * DrawTest/DrawTestDocument.m:
+        (-[DrawTestDocument dealloc]):
+        (-[DrawTestDocument readFromFile:ofType:]):
+        (-[DrawTestDocument windowControllerDidLoadNib:]):
+        (-[DrawTestDocument dumpSVGToConsole:]):
+        (-[DrawTestDocument openSourceForSelection:]):
+        (-[DrawTestDocument dataRepresentationOfType:]):
+        * DrawTest/DrawTestToolbarController.h:
+        * DrawTest/DrawTestToolbarController.m:
+        (-[DrawTestToolbarController initWithDrawView:]):
+        (-[DrawTestToolbarController clickedToolbarItem:]):
+        (-[DrawTestToolbarController validateToolbarItem:]):
+        * DrawTest/DrawTestView.h:
+        * DrawTest/DrawTestView.m:
+        (-[DrawTestView initWithFrame:]):
+        (-[DrawTestView setDocument:]):
+        * DrawTest/SVGTest.h:
+        * DrawTest/SVGTest.m:
+        (+[SVGTest sharedDrawView]):
+        (-[SVGTest generateCompositeIfNecessary]):
+        * DrawTest/TestController.h:
+        * DrawTest/TestController.m:
+        (-[TestController awakeFromNib]):
+        (-[TestController setSelectedTest:]):
+        (-[TestController openTestViewerForSelection:]):
+        (-[TestController toggleViewersScaleRule:]):
+        * DrawTest/TestViewerSplitView.m:
+        (-[TestViewerSplitView drawRect:]):
+
 2006-01-10  Anders Carlsson  <andersca@mac.com>
 
         Reviewed by Timothy.
index 7760be7..86e8d6a 100644 (file)
@@ -7,6 +7,7 @@
        objects = {
 
 /* Begin PBXBuildFile section */
+               78662E6D096B4E1600907EA7 /* WebKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 78662E6C096B4E1600907EA7 /* WebKit.framework */; };
                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 = (); }; };
@@ -23,7 +24,6 @@
                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.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = A8C006F90898665200BA5114 /* WebCore.framework */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXBuildStyle section */
@@ -62,6 +62,7 @@
                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>"; };
+               78662E6C096B4E1600907EA7 /* WebKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebKit.framework; sourceTree = BUILT_PRODUCTS_DIR; };
                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>"; };
@@ -85,7 +86,6 @@
                A8C006EE089865E900BA5114 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/DrawTestDocument.nib; sourceTree = "<group>"; };
                A8C006F0089865E900BA5114 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/Inspector.nib; sourceTree = "<group>"; };
                A8C006F2089865E900BA5114 /* English */ = {isa = PBXFileReference; lastKnownFileType = wrapper.nib; name = English; path = English.lproj/TestViewer.nib; sourceTree = "<group>"; };
-               A8C006F90898665200BA5114 /* WebCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; path = WebCore.framework; sourceTree = BUILT_PRODUCTS_DIR; };
 /* End PBXFileReference section */
 
 /* Begin PBXFrameworksBuildPhase section */
@@ -94,7 +94,7 @@
                        buildActionMask = 2147483647;
                        files = (
                                8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */,
-                               A8C006FA0898665200BA5114 /* WebCore.framework in Frameworks */,
+                               78662E6D096B4E1600907EA7 /* WebKit.framework in Frameworks */,
                        );
                        runOnlyForDeploymentPostprocessing = 0;
                };
                1058C7A0FEA54F0111CA2CBB /* Linked Frameworks */ = {
                        isa = PBXGroup;
                        children = (
-                               A8C006F90898665200BA5114 /* WebCore.framework */,
+                               78662E6C096B4E1600907EA7 /* WebKit.framework */,
                                1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */,
                        );
                        name = "Linked Frameworks";
index ef9ebf6..b0b16d9 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2006 Nefaur Khandker <nefaurk@gmail.com>  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -25,7 +26,6 @@
 
 #import <Cocoa/Cocoa.h>
 
-@class DrawDocument;
 @class DrawTestView;
 @class DrawTestToolbarController;
 
     IBOutlet DrawTestView *drawView;
     IBOutlet NSDrawer *debugDrawer;
 
-    DrawDocument *document;
     DrawTestToolbarController *toolbarController;
 }
 
-- (void)setDrawDocument:(DrawDocument *)drawDocument;
-- (DrawDocument *)drawDocument;
-
-// debug menu.
+// Debug menu
 - (IBAction)dumpSVGToConsole:(id)sender;
 - (IBAction)toggleDebugDrawer:(id)sender;
 - (IBAction)runWindowResizeTest:(id)sender;
index a4e7b31..c71e7ad 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2006 Nefaur Khandker <nefaurk@gmail.com>  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -26,8 +27,9 @@
 #import "DrawTestDocument.h"
 #import "DrawTestView.h"
 #import "DrawTestToolbarController.h"
-
-#import <WebCore/DrawDocumentPrivate.h>
+#import <WebKit/WebView.h>
+#import <WebKit/WebFrame.h>
+#import <WebKit/WebDataSource.h>
 
 @implementation DrawTestDocument
 
@@ -47,7 +49,6 @@
 - (void)dealloc
 {
     [toolbarController release];
-    [document release];
     [super dealloc];
 }
 
     return @"DrawTestDocument";
 }
 
-- (IBAction)dumpSVGToConsole:(id)sender
-{
-    NSLog(@"SVG: %@", [document svgText]);
-}
-
-- (void)sizeWindowToFitCanvas
+- (BOOL)readFromFile:(NSString *)filename ofType:(NSString *)docType
 {
-    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];
-    }
+    // TODO: Check the validity of the document before returning YES.
+    return YES;
 }
 
 - (void)windowControllerDidLoadNib:(NSWindowController *)aController
 {
     [super windowControllerDidLoadNib:aController];
     toolbarController = [[DrawTestToolbarController alloc] initWithDrawView:drawView];
-    [drawView setDocument:[self drawDocument]];
-    [self sizeWindowToFitCanvas];
+    [drawView setDocument:[self fileURL]];
 }
 
-- (IBAction)openSourceForSelection:(id)sender
+- (IBAction)dumpSVGToConsole:(id)sender
 {
-    [[NSWorkspace sharedWorkspace] openFile:[self fileName] withApplication:@"TextEdit"];
+    WebDataSource* dataSource = [[drawView mainFrame] dataSource];
+    NSLog(@"SVG Markup for file %@:\n%@", [self fileURL], [[dataSource representation] documentSource]);
 }
 
-- (IBAction)zoomToContent:(id)sender
+- (IBAction)openSourceForSelection:(id)sender
 {
-    [document sizeCanvasToFitContent];
-    [drawView setNeedsDisplay:YES];
-    [self sizeWindowToFitCanvas];
+    // TODO: The "path" message (below) will not produce a valid pathname if we are dealing with a remote file.
+    NSString *filename = [[self fileURL] path];
+    [[NSWorkspace sharedWorkspace] openFile:filename withApplication:@"TextEdit"];
 }
 
 - (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;
+    WebDataSource* dataSource = [[drawView mainFrame] dataSource];
+    return [dataSource data];
 }
 
 #pragma mark -
index 15df0c4..a69fb57 100644 (file)
 
 #import <Cocoa/Cocoa.h>
 
-@class DrawView;
+@class WebView;
 
 @interface DrawTestToolbarController : NSObject {
-    DrawView *_drawView;
+    WebView *_drawView;
     NSMutableDictionary *_toolbarItems;
 }
 
-- (id)initWithDrawView:(DrawView *)drawView;
+- (id)initWithDrawView:(WebView *)drawView;
 
 @end
index 07a9cc7..9190252 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2006 Nefaur Khandker <nefaurk@gmail.com>  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -25,8 +26,6 @@
 
 #import "DrawTestToolbarController.h"
 
-#import <WebCore/DrawViewPrivate.h>
-
 enum
 {
     ToolbarBrowseToolTag = 0,
@@ -96,7 +95,7 @@ NSString *ToolbarMoveToBackImage = @"Toolbar_Back";
 
 @implementation DrawTestToolbarController
 
-- (id)initWithDrawView:(DrawView *)drawView
+- (id)initWithDrawView:(WebView *)drawView
 {
     if (self = [super init]){
         _drawView = [drawView retain];
@@ -224,6 +223,7 @@ NSString *ToolbarMoveToBackImage = @"Toolbar_Back";
     int tag = [sender tag];
     
     switch(tag) {
+#if 0
         case ToolbarBrowseToolTag:
             [_drawView setToolMode:DrawViewToolBrowse];
             break;
@@ -254,6 +254,7 @@ NSString *ToolbarMoveToBackImage = @"Toolbar_Back";
         case ToolbarDeleteSelectionTag:
             [_drawView deleteSelection:sender];
             break;
+#endif
         default:
             NSLog(@"Toolbar item: %i not implemented!", tag);
     }
@@ -335,7 +336,8 @@ NSString *ToolbarMoveToBackImage = @"Toolbar_Back";
 - (BOOL)validateToolbarItem:(NSToolbarItem *)theItem
 {
     BOOL enabled = YES;
-    
+
+#if 0    
     switch([theItem tag]) {
         case ToolbarMoveForwardTag:
         case ToolbarMoveBackwardTag:
@@ -344,6 +346,7 @@ NSString *ToolbarMoveToBackImage = @"Toolbar_Back";
         case ToolbarDeleteSelectionTag:
             enabled = ([[_drawView selectedCanvasItems] count] != 0);
     }
+#endif
     
     return enabled;
 }
index 2fdfc72..95d5956 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2006 Nefaur Khandker <nefaurk@gmail.com>  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 
 #import <Cocoa/Cocoa.h>
 
-#import <WebCore/DrawView.h>
+#import <WebKit/WebView.h>
 
+@interface DrawTestView : WebView
+{
 
-@interface DrawTestView : DrawView
-{    
-    BOOL _showDebugString;
-    BOOL _showDebugAxes;
 }
 
-- (IBAction)toggleShowDebugString:(id)sender;
-- (IBAction)toggleShowDebugAxes:(id)sender;
+- (void)setDocument:(NSURL *)documentURL;
 
 @end
index 95f14f0..c865f99 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2006 Nefaur Khandker <nefaurk@gmail.com>  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
  */
 
-#import "DrawTestView.h"
+#import <WebKit/WebFrame.h>
 
-#import <WebCore/DrawViewPrivate.h>
-#import <WebCore/DrawDocumentPrivate.h>
+#import "DrawTestView.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
+- (void)setDocument:(NSURL *)documentURL
 {
-    [DrawView setFilterSupportEnabled:![DrawView isFilterSupportEnabled]];
-    [self setNeedsDisplay:YES];
+    [[self mainFrame] loadRequest:[NSURLRequest requestWithURL:documentURL]];
 }
 
 - (BOOL)acceptsFirstResponder
index 40769fa..70eed41 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2006 Nefaur Khandker <nefaurk@gmail.com>  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
 
 #import <Cocoa/Cocoa.h>
 
-@class DrawDocument;
-
 @interface SVGTest : NSObject {
     NSString *_svgPath;
     NSString *_imagePath;
     
-    DrawDocument *_svgDocument;
     NSImage *_image;
     NSImage *_compositeImage;
     BOOL _hasPassed;
@@ -44,7 +42,6 @@
 - (NSString *)svgPath;
 
 - (NSImage *)image;
-- (DrawDocument *)svgDocument;
 - (NSImage *)compositeImage;
 - (NSString *)name;
 
index bbad416..4ea562d 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2006 Nefaur Khandker <nefaurk@gmail.com>  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -25,8 +26,7 @@
 
 #import "SVGTest.h"
 
-#import <WebCore/DrawView.h>
-#import <WebCore/DrawDocument.h>
+#import <WebKit/WebView.h>
 
 @implementation SVGTest
 
     return [test autorelease];
 }
 
-static DrawView *__sharedDrawView = nil;
-+ (DrawView *)sharedDrawView
+static WebView *__sharedDrawView = nil;
++ (WebView *)sharedDrawView
 {
     if (!__sharedDrawView) {
-        __sharedDrawView = [[DrawView alloc] initWithFrame:NSMakeRect(0,0,0,0)];
+        __sharedDrawView = [[WebView alloc] initWithFrame:NSMakeRect(0,0,0,0)];
     }
     return __sharedDrawView;
 }
@@ -72,14 +72,6 @@ static DrawView *__sharedDrawView = nil;
     return _image;
 }
 
-- (DrawDocument *)svgDocument
-{
-    if (!_svgDocument && _svgPath) {
-        _svgDocument = [[DrawDocument alloc] initWithContentsOfFile:_svgPath];
-    }
-    return _svgDocument;
-}
-
 - (NSString *)name
 {
     NSMutableString *name = [[[[_svgPath lastPathComponent] stringByDeletingPathExtension] mutableCopy] autorelease];
@@ -90,9 +82,7 @@ static DrawView *__sharedDrawView = nil;
 - (void)generateCompositeIfNecessary
 {
     if (!_compositeImage) {
-        DrawView *view = [SVGTest sharedDrawView];
-        [view setDocument:[self svgDocument]];
-        [view sizeToFitViewBox];
+        WebView *view = [SVGTest sharedDrawView];
         NSSize svgSize = [view bounds].size;
         
         NSImage *image = [self image];
index 109cb7e..1e781fe 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2006 Nefaur Khandker <nefaurk@gmail.com>  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -25,7 +26,7 @@
 
 #import <Cocoa/Cocoa.h>
 
-@class DrawView;
+@class DrawTestView;
 @class SVGTest;
 @class TestViewerSplitView;
 
@@ -46,7 +47,7 @@
     NSArray *_tests;
     SVGTest *_selectedTest;
     
-    DrawView *_drawView;
+    DrawTestView *_drawView;
     NSImageView *_imageView;
 }
 
index 2777477..506920b 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (C) 2005 Apple Computer, Inc.  All rights reserved.
+ * Copyright (C) 2006 Nefaur Khandker <nefaurk@gmail.com>  All rights reserved.
  *
  * Redistribution and use in source and binary forms, with or without
  * modification, are permitted provided that the following conditions
@@ -27,8 +28,9 @@
 #import "SVGTest.h"
 #import "TestViewerSplitView.h"
 #import "ScalingImageView.h"
+#import "DrawTestView.h"
 
-#import <WebCore/DrawView.h>
+#import <WebKit/WebView.h>
 
 @interface NSArray (TestControllerAdditions)
 - (id)firstObject;
@@ -85,7 +87,7 @@ static TestController *__sharedInstance = nil;
 {
     [_testsTableView setTarget:self];
     [_testsTableView setDoubleAction:@selector(openTestViewerForSelection:)];
-    _drawView = [[DrawView alloc] initWithFrame:NSZeroRect];
+    _drawView = [[DrawTestView alloc] initWithFrame:NSZeroRect];
     _imageView = [[ScalingImageView alloc] initWithFrame:NSZeroRect];
     [_splitView addSubview:_drawView];
     [_splitView addSubview:_imageView];
@@ -144,7 +146,7 @@ static TestController *__sharedInstance = nil;
     
     if ([_testWindow isVisible]) {
         [_testWindow setTitle:[NSString stringWithFormat:@"Test Viewer - %@", [_selectedTest name]]]; 
-        [_drawView setDocument:[_selectedTest svgDocument]];
+        [_drawView setDocument:[NSURL fileURLWithPath:[_selectedTest svgPath]]];
         [_imageView setImage:[_selectedTest image]];
         if ([_compositeWindow isVisible])
             [_compositeImageView setImage:[_selectedTest compositeImage]];
@@ -159,7 +161,7 @@ static TestController *__sharedInstance = nil;
 - (IBAction)openTestViewerForSelection:(id)sender
 {
     [self showTestWindow:sender];
-    [_drawView setDocument:[_selectedTest svgDocument]];
+    [_drawView setDocument:[NSURL fileURLWithPath:[_selectedTest svgPath]]];
     [_imageView setImage:[_selectedTest image]];
 }
 
@@ -254,6 +256,7 @@ static TestController *__sharedInstance = nil;
 
 - (IBAction)toggleViewersScaleRule:(id)sender
 {
+#if 0
     if ([_drawView imageScaling] == NSScaleProportionally) {
         [_drawView setImageScaling:NSScaleNone];
         [_imageView setImageScaling:NSScaleNone];
@@ -261,6 +264,7 @@ static TestController *__sharedInstance = nil;
         [_drawView setImageScaling:NSScaleProportionally];
         [_imageView setImageScaling:NSScaleProportionally];
     }
+#endif
 }
 
 @end
index ed50b94..96f2055 100644 (file)
     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];
+#if 0
+        NSString *label = [subviewLabels objectAtIndex:0];
+        [label drawAtPoint:[subview frame].origin withAttributes:NULL];
+#endif
     }
 }