home *** CD-ROM | disk | FTP | other *** search
/ NOVA - For the NeXT Workstation / NOVA - For the NeXT Workstation.iso / SourceCode / AdobeExamples / NX_ImportInt / DrawingView.h < prev    next >
Encoding:
Text File  |  1992-12-19  |  3.9 KB  |  141 lines

  1.  
  2. /*
  3.  * (a)  (C) 1990 by Adobe Systems Incorporated. All rights reserved.
  4.  *
  5.  * (b)  If this Sample Code is distributed as part of the Display PostScript
  6.  *    System Software Development Kit from Adobe Systems Incorporated,
  7.  *    then this copy is designated as Development Software and its use is
  8.  *    subject to the terms of the License Agreement attached to such Kit.
  9.  *
  10.  * (c)  If this Sample Code is distributed independently, then the following
  11.  *    terms apply:
  12.  *
  13.  * (d)  This file may be freely copied and redistributed as long as:
  14.  *    1) Parts (a), (d), (e) and (f) continue to be included in the file,
  15.  *    2) If the file has been modified in any way, a notice of such
  16.  *      modification is conspicuously indicated.
  17.  *
  18.  * (e)  PostScript, Display PostScript, and Adobe are registered trademarks of
  19.  *    Adobe Systems Incorporated.
  20.  * 
  21.  * (f) THE INFORMATION BELOW IS FURNISHED AS IS, IS SUBJECT TO
  22.  *    CHANGE WITHOUT NOTICE, AND SHOULD NOT BE CONSTRUED
  23.  *    AS A COMMITMENT BY ADOBE SYSTEMS INCORPORATED.
  24.  *    ADOBE SYSTEMS INCORPORATED ASSUMES NO RESPONSIBILITY
  25.  *    OR LIABILITY FOR ANY ERRORS OR INACCURACIES, MAKES NO
  26.  *    WARRANTY OF ANY KIND (EXPRESS, IMPLIED OR STATUTORY)
  27.  *    WITH RESPECT TO THIS INFORMATION, AND EXPRESSLY
  28.  *    DISCLAIMS ANY AND ALL WARRANTIES OF MERCHANTABILITY, 
  29.  *    FITNESS FOR PARTICULAR PURPOSES AND NONINFRINGEMENT
  30.  *    OF THIRD PARTY RIGHTS.
  31.  */
  32.  
  33. /*
  34.  *    DrawingView.h
  35.  *
  36.  *    This view represents the page that the image is drawn onto.
  37.  *
  38.  *    Version:    2.0
  39.  *    Author:    Ken Fromm
  40.  *    History:
  41.  *            03-17-91        Added this comment, fixed the preview exporting
  42.  *                        section.
  43.  */
  44.  
  45. #import "ImportApp.h"
  46. #import "epsfstruct.h"
  47.  
  48. #import <appkit/View.h>
  49. #import <appkit/tiff.h>
  50. #import <appkit/timer.h>
  51.  
  52. #define  FONTSIZE            5
  53. #define  SCROLL_MARGIN        8
  54. #define  HITSETTING            4
  55.  
  56. /*
  57. *    A very system dependent define. It defines the amount of time
  58. *    that the mouse must be held down before it is considered a move.
  59. *    This hopefully prevents accidentally moving an object when
  60. *    just trying to select it or another.
  61. */
  62. #define  MOVE_INTERVAL    12
  63.  
  64. /* Flags that control the drawing operations of the graphic objects. */
  65. #define  NOFLAGS            0x0
  66. #define  REDRAWFLAG        0x1
  67. #define  MOVEFLAG            0x2
  68. #define  CLEARFLAG            0x4
  69. #define  REFRESHFLAG        0x8
  70.         
  71. @interface DrawingView:View
  72. {
  73.     id        imageId,            /* id of the image for the preview */
  74.             bufferId,            /* id of the offscreen buffer (content view) */
  75.             graphicId;        /* id of imported file waiting to be placed */
  76.  
  77.     int        timermask;        /* the mask for modal loop timing */
  78. }
  79.  
  80. +newFrame:(const NXRect *) frm;
  81.  
  82. - free;
  83.  
  84. - buffer;
  85. - image;
  86. - (float) controlPointSize;
  87.  
  88. - resetCursorRects;
  89.  
  90. - writePSToStream:(NXStream *) stream;
  91.  
  92. - delete:sender;
  93.  
  94. - constrainPoint:(NXPoint *)aPt  withOffset:(const NXSize*)llOffset  :(const NXSize*)urOffset;
  95. - constrainRect:(NXRect *)aRect;
  96.  
  97. - redrawObject:(int) pt_num;
  98. - moveObject:(NXEvent *)event;
  99.  
  100. - checkControl:(const NXPoint *) p :(int *) pt_num;
  101. - checkObject:(const NXPoint *) p;
  102. - selectObject;
  103. - deselectObject;
  104. - testObject:(NXEvent *)event;
  105.  
  106. - importFile:(const char *) file;
  107. - placeObjectAt:(NXPoint *) p;
  108. - importObject:(NXEvent *)event;
  109.  
  110. /* Event handling methods. */
  111. - mouseDown:(NXEvent *)event;
  112. - keyDown:(NXEvent *) event;
  113.  
  114. /* Drawing methods */
  115. - drawObject:object  forRect:(NXRect *)r  withFlags:(int) flags;
  116. - drawControl:object  forRect:(NXRect *)r  withFlags:(int) flags;
  117. - drawSelf:(NXRect *)r :(int) count;
  118. - display:(NXRect *)r  :(int) count  :(BOOL)flag;
  119.  
  120. - (BOOL)acceptsFirstResponder;
  121.  
  122. /* Printing/copying methods overridden from the view class. */
  123. - addResources:(Resource *) resourceDoc;
  124. - beginResourceComments:(const NXRect *) bbox;
  125.  
  126. - beginPrologueBBox:(const NXRect *)boundingBox 
  127.     creationDate:(const char *)dateCreated 
  128.     createdBy:(const char *)anApplication 
  129.     fonts:(const char *)fontNames 
  130.     forWhom:(const char *)user 
  131.     pages:(int)numPages 
  132.     title:(const char *)aTitle;
  133. - endHeaderComments;
  134. - endPrologue;
  135. - beginSetup;
  136. - endSetup;
  137. - beginTrailer;
  138. - endTrailer;
  139.  
  140. @end
  141.