home *** CD-ROM | disk | FTP | other *** search
/ Big Green CD 8 / BGCD_8_Dev.iso / YellowBox / Kits / MiscTableScroll-138.1 / Palettes / MiscTableScroll / Framework / MiscTableScrollPrint.M < prev    next >
Encoding:
Text File  |  1998-03-31  |  4.4 KB  |  109 lines

  1. //=============================================================================
  2. //
  3. //    Copyright (C) 1996-1997 by Paul S. McCarthy and Eric Sunshine.
  4. //        Written by Paul S. McCarthy and Eric Sunshine.
  5. //                All Rights Reserved.
  6. //
  7. //    This notice may not be removed from this source code.
  8. //
  9. //    This object is included in the MiscKit by permission from the authors
  10. //    and its use is governed by the MiscKit license, found in the file
  11. //    "License.rtf" in the MiscKit distribution.  Please refer to that file
  12. //    for a list of all applicable permissions and restrictions.
  13. //    
  14. //=============================================================================
  15. //-----------------------------------------------------------------------------
  16. // MiscTableScrollPrint.M
  17. //
  18. //    Printing support for MiscTableScroll.
  19. //
  20. //-----------------------------------------------------------------------------
  21. //-----------------------------------------------------------------------------
  22. // $Id: MiscTableScrollPrint.M,v 1.3 97/03/20 19:15:15 sunshine Exp $
  23. // $Log:    MiscTableScrollPrint.M,v $
  24. // Revision 1.3  97/03/20  19:15:15  sunshine
  25. // v123.1: Fixed bug: Delegate methods -tableScrollWillPrint: &
  26. // -tableScrollDidPrint: were getting subverted when -print: was sent
  27. // to first-responder (which is the MiscTableView, not the MiscTableScroll).
  28. // Connecting Print... item to first-responder in IB can cause this.
  29. // Was fixed by sending them in MiscTableViewPrint.M rather than here.
  30. // 
  31. // Revision 1.2  97/02/09  07:41:03  sunshine
  32. // v110: Ported to OPENSTEP 4.1 (gamma).
  33. // 
  34. // Revision 1.1  96/10/24  22:48:40  zarnuk
  35. // TableScroll hook for printing.
  36. //-----------------------------------------------------------------------------
  37. #import "MiscTableScrollPrivate.h"
  38. #import "MiscDelegateFlags.h"
  39. #import "MiscTableView.h"
  40. #import "MiscBorderView.h"
  41.  
  42. extern "Objective-C" {
  43. #import    <AppKit/NSApplication.h>
  44. #import    <AppKit/NSPrintInfo.h>
  45. #import    <AppKit/NSPrintPanel.h>
  46. }
  47.  
  48.  
  49. //=============================================================================
  50. // IMPLEMENTATION
  51. //=============================================================================
  52. @implementation MiscTableScroll(Print)
  53.  
  54. - (id)getPageHeader            { return pageHeader; }
  55. - (id)getPageFooter            { return pageFooter; }
  56. - (void)setPageHeader:(id)obj        { pageHeader = obj; }
  57. - (void)setPageFooter:(id)obj        { pageFooter = obj; }
  58.  
  59. - (MiscTablePrintInfo const*)getPrintInfo { return [tableView getPrintInfo]; }
  60.  
  61. //-----------------------------------------------------------------------------
  62. // dumpPrintInfo:
  63. //-----------------------------------------------------------------------------
  64. - (void)dumpPrintInfo:(NSPrintInfo*)pinfo
  65.     {
  66.     fprintf( stderr, "printInfo=%p\n", pinfo );
  67.     fprintf( stderr, "paperType:[%s]\n", [[pinfo paperName] cString] );
  68.     fprintf( stderr, "paperSize:%s\n",
  69.     [NSStringFromSize([pinfo paperSize]) cString] );
  70.     fprintf( stderr, "margins: left=%g right=%g top=%g bottom=%g\n",
  71.     [pinfo leftMargin], [pinfo rightMargin],
  72.     [pinfo topMargin], [pinfo bottomMargin] );
  73.     fprintf( stderr, "scalingFactor=%g\n",
  74.     [[[pinfo dictionary] objectForKey:NSPrintScalingFactor] floatValue] );
  75.     fprintf( stderr, "orientation=%d\n", (int)[pinfo orientation] );
  76.     fprintf( stderr, "isHorizontallyCentered=%d\n",
  77.     (int)[pinfo isHorizontallyCentered] );
  78.     fprintf( stderr, "isVerticallyCentered=%d\n",
  79.     (int)[pinfo isVerticallyCentered] );
  80.     fprintf( stderr, "horizontalPagination=%d\n",
  81.     [pinfo horizontalPagination] );
  82.     fprintf( stderr, "verticalPagination=%d\n",
  83.     [pinfo verticalPagination] );
  84.     fprintf( stderr, "isAllPages=%d\n",
  85.     (int)[[[pinfo dictionary] objectForKey:NSPrintAllPages] boolValue] );
  86.     fprintf( stderr, "firstPage=%d\n",
  87.     [[[pinfo dictionary] objectForKey:NSPrintFirstPage] intValue] );
  88.     fprintf( stderr, "lastPage=%d\n",
  89.     [[[pinfo dictionary] objectForKey:NSPrintLastPage] intValue] );
  90.     fprintf( stderr, "copies=%d\n",
  91.     [[[pinfo dictionary] objectForKey:NSPrintCopies] intValue] );
  92.     fprintf( stderr, "pagesPerSheet=%d\n",
  93.     [[[pinfo dictionary] objectForKey:NSPrintPagesPerSheet] intValue] );
  94.     fprintf( stderr, "reversePageOrder=%d\n",
  95.     [[[pinfo dictionary] objectForKey:NSPrintReversePageOrder] boolValue]);
  96.     // There are also job features...
  97.     }
  98.  
  99.  
  100. //-----------------------------------------------------------------------------
  101. // print:
  102. //-----------------------------------------------------------------------------
  103. - (void)print:(id)sender
  104.     {
  105.     [tableView print:sender];
  106.     }
  107.  
  108. @end
  109.