3 @implementation GnuView
5 static float xsize= NEXT_XMAX/10+50;
6 static float ysize= NEXT_YMAX/10+50;
9 static void setprintsize();
11 - initWithFrame:(NSRect)rects
13 [super initWithFrame:rects];
22 /* This is here to fix NeXT bug # 21973: failure to free D.O. memory */
23 /* Note: personally I don't think this fixes it. */
30 - executePS:(NSString *) PStext
37 [[self window] makeKeyAndOrderFront:self];
43 - (void) drawRect:(NSRect) rect
47 d = DPSGetCurrentContext();
49 if (!printing) { /* Clear Screen */
51 NSRectFill([self bounds]);
52 [self setBoundsSize:NSMakeSize(xsize, ysize)]; /* scale to gnuplot coords */
57 DPSWritePostScript(d, [PSstring cString], [PSstring length]);
62 - (void)print:(id)sender
69 static void setprintsize()
75 d = DPSGetCurrentContext();
76 #warning PrintingConversion: The current PrintInfo object now depends on context. '[NSPrintInfo sharedPrintInfo]' used to be '[NSApp printInfo]'. This might want to be [[NSPrintOperation currentOperation] printInfo] or possibly [[PageLayout new] printInfo].
78 prInfo = [NSPrintInfo sharedPrintInfo];
79 paperSize = [prInfo paperSize];
81 DPSPrintf(d, "grestore\ngrestore\ngrestore\n");
83 if ([prInfo orientation] == NSLandscapeOrientation) {
84 DPSPrintf(d, "-90 rotate\n");
85 DPSPrintf(d, "%g 0 translate\n", -1.0 * paperSize.width);
86 DPSPrintf(d, "0 %g translate\n", paperSize.height/20);
89 DPSPrintf(d, "%g %g scale\n", paperSize.width/paperSize.height, paperSize.height/paperSize.width);
92 DPSPrintf(d, "gsave\ngsave\n");