home *** CD-ROM | disk | FTP | other *** search
/ Nebula / nebula.bin / SourceCode / MiniExamples / PaginationLab / Worker.m < prev   
Text File  |  1991-05-18  |  2KB  |  68 lines

  1. /* BigView.m
  2.  * Purpose: This class functions as NXApp's delegate, initializing stuff
  3.  * before PaginationLab runs.  It also handles requests to run the
  4.  * pageLayout panel.
  5.  *
  6.  * You may freely copy, distribute, and reuse the code in this example.
  7.  * NeXT disclaims any warranty of any kind, expressed or  implied, as to its
  8.  * fitness for any particular use.
  9.  *
  10.  * Written by: Samuel Streeper
  11.  * Created: (04/April/91)
  12.  */
  13.  
  14. #import "Worker.h"
  15. #import "MyPageLayout.h"
  16. #import "MyPrintInfo.h"
  17. #import <appkit/Application.h>
  18. #import <appkit/Form.h>
  19. #import <appkit/ButtonCell.h>
  20. #import <appkit/FormCell.h>
  21. #import <appkit/ClipView.h>
  22. #import <appkit/ScrollView.h>
  23.  
  24. @implementation Worker
  25.  
  26. - runPageLayout:sender
  27. {
  28.     [[MyPageLayout new] runModal];
  29.         
  30.     return self;
  31. }
  32.  
  33. - appDidInit:sender
  34. {
  35.     NXRect bvRect, cvRect;
  36.     NXPoint pt;
  37.     id newPi;
  38.     id clipView = [myBigView superview];
  39.  
  40.     [clipView allocateGState];    // otherwise halftone phase is wrong on scrolling
  41.     
  42.     // The following lines of code simply scroll the BigView so that
  43.     // it's top is showing, rather than it's coordinate origin.  Yes,
  44.     // I know this code is ugly...
  45.     
  46.     [myBigView getBounds:&bvRect];
  47.     [clipView getBounds:&cvRect];
  48.     pt = cvRect.origin;
  49.     pt.y = bvRect.size.height - cvRect.size.height;
  50.     [clipView rawScroll:&pt];
  51.     [[clipView superview] reflectScroll:clipView];
  52.     
  53.     //set the new modified PrintInfo, free the old one
  54.     newPi = [[MyPrintInfo alloc] init];
  55.     [[NXApp setPrintInfo: newPi] free];
  56.     [myBigView setPrintInfo:newPi];
  57.     
  58.     [[myBigView window] makeKeyAndOrderFront:self];
  59.     return self;
  60. }
  61.  
  62.  
  63.  
  64.  
  65.  
  66.  
  67. @end
  68.