This is TextApp.m in view mode; [Download] [Up]
/* * (a) (C) 1990 by Adobe Systems Incorporated. All rights reserved. * * (b) If this Sample Code is distributed as part of the Display PostScript * System Software Development Kit from Adobe Systems Incorporated, * then this copy is designated as Development Software and its use is * subject to the terms of the License Agreement attached to such Kit. * * (c) If this Sample Code is distributed independently, then the following * terms apply: * * (d) This file may be freely copied and redistributed as long as: * 1) Parts (a), (d), (e) and (f) continue to be included in the file, * 2) If the file has been modified in any way, a notice of such * modification is conspicuously indicated. * * (e) PostScript, Display PostScript, and Adobe are registered trademarks of * Adobe Systems Incorporated. * * (f) THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO * CHANGE WITHOUT NOTICE, AND SHOULD NOT BE CONSTRUED * AS A COMMITMENT BY ADOBE SYSTEMS INCORPORATED. * ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY * OR LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO * WARRANTY OF ANY KIND (EXPRESS, IMPLIED OR STATUTORY) * WITH RESPECT TO THIS INFORMATION, AND EXPRESSLY * DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, * FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT * OF THIRD PARTY RIGHTS. */ /* * TextApp.m * * This subclass of the application class performs the global * setup needed for the TextApp application. The drawing * window is created. * * Version: 2.0 * Author: Ken Fromm * History: * 03-07-91 Added this comment. */ #import "TextApp.h" #import "DocView.h" #import "DrawingView.h" #import <appkit/ActionCell.h> #import <appkit/Panel.h> #import <appkit/ScrollView.h> #import <appkit/Window.h> #import <appkit/nextstd.h> static NXRect windowRect = {150, 193, 550, 600}; static NXRect paperRect = {0, 0, 612, 792}; @implementation TextApp /* * Allocate the memory for the user path description buffers. Create the * window for drawing the image. */ + new { self = [super new]; [self createWindow]; return self; } /* * Create the drawing window and place a scrollview as the content view. * A DrawingView instance is placed as the DocView of the ScrollView. */ - createWindow { id docView, scrollView; NXPoint viewPt; NXRect tempRect, frameRect; windowId = [Window newContent:&windowRect style:NX_TITLEDSTYLE backing:NX_BUFFERED buttonMask:NX_RESIZEBUTTONMASK defer:NO]; [Window getContentRect:&tempRect forFrameRect:&windowRect style:NX_TITLEDSTYLE]; scrollView = [ScrollView newFrame:&tempRect]; [scrollView setBorderType:SCROLLVIEW_BORDER]; [scrollView setVertScrollerRequired:YES]; [scrollView setHorizScrollerRequired:YES]; drawingviewId = [DrawingView newFrame:&paperRect]; docView = [[[DocView new] setClipping:NO] setScale:1.0]; [scrollView setDocView:docView]; [[docView superview] setFlipped:NO]; [docView addDrawView:drawingviewId]; [[windowId setContentView:scrollView] free]; [windowId setTitle:"PostScript Text Handling Application"]; [windowId makeFirstResponder:drawingviewId]; [windowId setDelegate:self]; /* Center the drawing view in the window. */ [windowId disableDisplay]; [docView placeDrawView]; [docView getFrame:&frameRect]; [[docView superview] getFrame:&tempRect]; viewPt.x = (frameRect.size.width - tempRect.size.width)/2 ; viewPt.y = (frameRect.size.height - tempRect.size.height)/2; [docView scrollPoint:&viewPt]; [windowId reenableDisplay]; [windowId display]; [windowId makeKeyAndOrderFront:self]; return self; } /* The window will free the its subviews. */ - free { [windowId free]; return [super free]; } - setFontPopup:anObject { [[[anObject target] setTarget:NULL] setAction:@selector(fontsize:)]; return self; } - rotationField { return rotationField; } - timingMatrix { return timingMatrix; } - statusMatrix { return statusMatrix; } - kernMatrix { return kernMatrix; } - widthMatrix { return widthMatrix; } - comparisonsMatrix { return comparisonsMatrix; } /* * Resizes the doc view and repositions the drawing view inside the doc view. */ - windowDidResize:sender { [[drawingviewId superview] placeDrawView]; return self; } @end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.