Permalink
Browse files

Now displays the PDF and our areas on it

  • Loading branch information...
1 parent 30c6f07 commit 504439f72dd6d6cd7cb42f5b0abbaadcb3561df8 @p2 committed Dec 19, 2012
View
@@ -0,0 +1,4 @@
+.DS_Store
+
+xcuserdata
+
@@ -25,6 +25,9 @@
EEEB2DD61680F1E0004DC719 /* QuartzCore.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EEEB2DD51680F1E0004DC719 /* QuartzCore.framework */; };
EEEB2DD91680FA96004DC719 /* CHWindowController.m in Sources */ = {isa = PBXBuildFile; fileRef = EEEB2DD81680FA95004DC719 /* CHWindowController.m */; };
EEEB2DDC1680FFC7004DC719 /* CHEnumToNumberTransformer.m in Sources */ = {isa = PBXBuildFile; fileRef = EEEB2DDB1680FFC7004DC719 /* CHEnumToNumberTransformer.m */; };
+ EEEB2DE016810423004DC719 /* CHChartPDFView.m in Sources */ = {isa = PBXBuildFile; fileRef = EEEB2DDF16810422004DC719 /* CHChartPDFView.m */; };
+ EEEB2DE21681047B004DC719 /* Quartz.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = EEEB2DE11681047B004DC719 /* Quartz.framework */; };
+ EEEB2DE51681075A004DC719 /* CHDropView.m in Sources */ = {isa = PBXBuildFile; fileRef = EEEB2DE41681075A004DC719 /* CHDropView.m */; };
/* End PBXBuildFile section */
/* Begin PBXFileReference section */
@@ -65,13 +68,19 @@
EEEB2DD81680FA95004DC719 /* CHWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CHWindowController.m; sourceTree = "<group>"; };
EEEB2DDA1680FFC7004DC719 /* CHEnumToNumberTransformer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CHEnumToNumberTransformer.h; sourceTree = "<group>"; };
EEEB2DDB1680FFC7004DC719 /* CHEnumToNumberTransformer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CHEnumToNumberTransformer.m; sourceTree = "<group>"; };
+ EEEB2DDE16810422004DC719 /* CHChartPDFView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CHChartPDFView.h; sourceTree = "<group>"; };
+ EEEB2DDF16810422004DC719 /* CHChartPDFView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CHChartPDFView.m; sourceTree = "<group>"; };
+ EEEB2DE11681047B004DC719 /* Quartz.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Quartz.framework; path = System/Library/Frameworks/Quartz.framework; sourceTree = SDKROOT; };
+ EEEB2DE31681075A004DC719 /* CHDropView.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CHDropView.h; sourceTree = "<group>"; };
+ EEEB2DE41681075A004DC719 /* CHDropView.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = CHDropView.m; sourceTree = "<group>"; };
/* End PBXFileReference section */
/* Begin PBXFrameworksBuildPhase section */
EEEB2D6E1680E014004DC719 /* Frameworks */ = {
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
+ EEEB2DE21681047B004DC719 /* Quartz.framework in Frameworks */,
EEEB2DD61680F1E0004DC719 /* QuartzCore.framework in Frameworks */,
EEEB2D761680E014004DC719 /* Cocoa.framework in Frameworks */,
);
@@ -83,6 +92,7 @@
EEEB2D661680E014004DC719 = {
isa = PBXGroup;
children = (
+ EEEB2DE11681047B004DC719 /* Quartz.framework */,
EEEB2DD51680F1E0004DC719 /* QuartzCore.framework */,
EEEB2D7B1680E014004DC719 /* growth-charts-helper */,
EEEB2D741680E014004DC719 /* Frameworks */,
@@ -125,6 +135,8 @@
EEEB2DD71680FA95004DC719 /* CHWindowController.h */,
EEEB2DD81680FA95004DC719 /* CHWindowController.m */,
EEEB2D8A1680E014004DC719 /* CHDocument.xib */,
+ EEEB2DDE16810422004DC719 /* CHChartPDFView.h */,
+ EEEB2DDF16810422004DC719 /* CHChartPDFView.m */,
EEEB2DD21680EE70004DC719 /* CHChartAreaView.h */,
EEEB2DD31680EE70004DC719 /* CHChartAreaView.m */,
EEEB2DB91680EA29004DC719 /* FromCharts */,
@@ -173,6 +185,8 @@
EEEB2DDD168100EA004DC719 /* Helpers */ = {
isa = PBXGroup;
children = (
+ EEEB2DE31681075A004DC719 /* CHDropView.h */,
+ EEEB2DE41681075A004DC719 /* CHDropView.m */,
EEEB2DDA1680FFC7004DC719 /* CHEnumToNumberTransformer.h */,
EEEB2DDB1680FFC7004DC719 /* CHEnumToNumberTransformer.m */,
);
@@ -257,6 +271,8 @@
EEEB2DD41680EE70004DC719 /* CHChartAreaView.m in Sources */,
EEEB2DD91680FA96004DC719 /* CHWindowController.m in Sources */,
EEEB2DDC1680FFC7004DC719 /* CHEnumToNumberTransformer.m in Sources */,
+ EEEB2DE016810423004DC719 /* CHChartPDFView.m in Sources */,
+ EEEB2DE51681075A004DC719 /* CHDropView.m in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};
@@ -47,8 +47,8 @@ - (id)initWithFrame:(CGRect)frame
// self.clearsContextBeforeDrawing = NO;
// self.contentMode = UIViewContentModeRedraw;
- ((CATiledLayer *)self.layer).levelsOfDetail = 4;
- ((CATiledLayer *)self.layer).levelsOfDetailBias = 3; // we use (levelsOfDetail - 1) because we only need more detail when zoomed in, no less details when zoomed out
+// ((CATiledLayer *)self.layer).levelsOfDetail = 4;
+// ((CATiledLayer *)self.layer).levelsOfDetailBias = 3; // we use (levelsOfDetail - 1) because we only need more detail when zoomed in, no less details when zoomed out
}
return self;
}
@@ -63,8 +63,7 @@ - (void)setFromDictionary:(NSDictionary *)dict
// rect to origin and size
NSString *rectString = [dict objectForKey:@"rect"];
if ([rectString isKindOfClass:[NSString class]]) {
- DLog(@"Should use %@", rectString);
- CGRect rect = CGRectZero;//CGRectFromString(rectString);
+ NSRect rect = NSRectFromString(rectString);
self.origin = rect.origin;
self.size = rect.size;
}
@@ -81,8 +80,7 @@ - (void)setFromDictionary:(NSDictionary *)dict
if ([points count] > 2) {
CGMutablePathRef outlinePath = nil;
for (NSString *point in points) {
- DLog(@"Should use %@", point);
- CGPoint p = CGPointZero;//CGPointFromString(point);
+ NSPoint p = NSPointFromString(point);
if (!outlinePath) {
outlinePath = CGPathCreateMutable();
CGPathMoveToPoint(outlinePath, NULL, p.x, p.y);
@@ -188,7 +186,8 @@ - (void)positionInFrame:(CGRect)targetRect onView:(NSView *)aView pageSize:(CGSi
CGRect appliedRect = targetRect;
appliedRect.origin.x += _origin.x * appliedRect.size.width;
- appliedRect.origin.y += _origin.y * appliedRect.size.height;
+ //appliedRect.origin.y += _origin.y * appliedRect.size.height;
+ appliedRect.origin.y += (1.f - _origin.y) * appliedRect.size.height - (_size.height * appliedRect.size.height);
appliedRect.size.width *= _size.width;
appliedRect.size.height *= _size.height;
@@ -287,6 +286,12 @@ - (CGRect)contentBox
#pragma mark - Drawing
+- (void)drawRect:(NSRect)dirtyRect
+{
+ [[NSColor colorWithDeviceRed:1.f green:0.f blue:0.f alpha:0.25f] setFill];
+ [NSBezierPath fillRect:self.bounds];
+}
+
/**
* This is the drawing method we use, "drawRect:" is the wrong one if you intend to create subclasses!
*/
@@ -400,12 +405,7 @@ + (BOOL)registerClass:(Class)areaClass forType:(NSString *)aType
+ (Class)registeredClassForType:(NSString *)aType
{
- if (registeredAreaClasses) {
- return [registeredAreaClasses objectForKey:aType];
- }
-
- DLog(@"No class registered for type \"%@\"", aType);
- return nil;
+ return self;
}
@@ -0,0 +1,38 @@
+/*
+ CHChartPDFView.h
+ growth-charts-helper
+
+ Created by Pascal Pfiffner on 12/18/12.
+ Copyright (c) 2012 CHIP. All rights reserved.
+
+ This library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ This library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with this library; if not, write to the Free Software
+ Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#import <Quartz/Quartz.h>
+
+@class CHChart;
+
+
+/**
+ * Top level object to display a PDF chart.
+ */
+@interface CHChartPDFView : PDFView
+
+@property (nonatomic, strong) CHChart *chart;
+
+- (void)layoutSubviews;
+
+
+@end
Oops, something went wrong.

0 comments on commit 504439f

Please sign in to comment.