This is PatternApp.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.
*/
/*
* PatternApp.m
*
* This subclass of the application class performs the global
* setup needed for the Pattern application. The drawing
* window is created.
*
* Version: 2.0
* Author: Ken Fromm
* History:
* 03-07-91 Added this comment.
*/
#import "PatternApp.h"
#import "DocView.h"
#import "DrawingView.h"
#import <objc/List.h>
#import <objc/hashtable.h>
#import <appkit/Button.h>
#import <appkit/Matrix.h>
#import <appkit/ScrollView.h>
#import <appkit/Window.h>
#import <appkit/nextstd.h>
#import <sys/param.h>
#import <string.h>
static NXRect windowRect = {150, 184, 550, 600};
static NXRect drawingRect = {0, 0, 540, 590};
/*
* Reflects the drawing mode as indicated by the radio buttons
* on the Drawing Options panel in the interface.
*/
short DrawingStatus;
@implementation PatternApp
/*
* Create the drawing window and place a scrollview as the content view.
* A DrawingView instance is placed as the DocView of the ScrollView.
*/
- createWindow:(NXRect *) winRect
{
id docView, scrollView;
NXRect tempRect;
windowId = [Window newContent:winRect
style:NX_TITLEDSTYLE
backing:NX_BUFFERED
buttonMask:NX_RESIZEBUTTONMASK
defer:NO];
[windowId setTitle:"Patterns"];
[Window getContentRect:&tempRect forFrameRect:winRect style:NX_TITLEDSTYLE];
scrollView = [ScrollView newFrame:&tempRect];
[scrollView setBorderType:SCROLLVIEW_BORDER];
[scrollView setHorizScrollerRequired:YES];
[scrollView setVertScrollerRequired:YES];
drawingviewId = [[[DrawingView newFrame:&drawingRect] setClipping:NO] allocateGState];
docView = [[[[DocView new] setClipping:NO] allocateGState] setScale:1.0];
[[docView setDrawView:drawingviewId] free];
[[scrollView setDocView:docView] free];
[[windowId setContentView:scrollView] free];
[drawingviewId initPatterns];
/*
* Important in 2.0 because it eliminates a problem in 2.0 that shifts the halftonephase
* over by 1 extra pixel, causing a noticable aberration in a halftone during a scroll.
*/
[[[docView superview] setFlipped:NO] allocateGState];
[docView placeDrawView];
[windowId makeFirstResponder:drawingviewId];
[windowId setDelegate:self];
[windowId display];
[windowId makeKeyAndOrderFront:self];
return self;
}
/* The window will free the its subviews. */
- free
{
[windowId free];
return [super free];
}
- countMatrix
{
return countMatrix;
}
- graphicsMatrix
{
return graphicsMatrix;
}
- patternMatrix
{
return patternMatrix;
}
- timingMatrix
{
return timingMatrix;
}
- typeMatrix
{
return typeMatrix;
}
- lockMatrix
{
return lockMatrix;
}
- zoomMatrix
{
return zoomMatrix;
}
- patternBox
{
return patternBox;
}
- drawingView
{
return drawingviewId;
}
- docView
{
return [drawingviewId superview];
}
- appDidInit:sender
{
[self createWindow:&windowRect];
return self;
}
/*
* Resizes the doc view and repositions the drawing view inside the doc view.
*/
- windowDidResize:sender
{
[[self docView] placeDrawView];
return self;
}
@end
These are the contents of the former NiCE NeXT User Group NeXTSTEP/OpenStep software archive, currently hosted by Netfuture.ch.