home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / OpenStepConversion / ConversionScripts / PrintingConversion.tops < prev    next >
Encoding:
Text File  |  1995-08-25  |  8.6 KB  |  215 lines

  1. /*********** PrintingConversion: PrintInfo *************/
  2.  
  3. /* Remove andAdjust:YES clauses automatically and do some renaming */
  4. replace    "[<obj> setOrientation:<arg1> andAdjust:YES]" with "[<obj> setOrientation:<arg1>]"
  5.  
  6. replace    "[<obj> setPaperType:<arg1> andAdjust:YES]" with "[<obj> setPaperName:<arg1>]"
  7.  
  8. replace    "[<obj> setPaperRect:<arg1> andAdjust:YES]" with "[<obj> setPaperSize:(<arg1>).size]"
  9.  
  10. replacemethod "paperType" with "paperName"
  11.  
  12. replacemethod "paperRect" with "paperSize"
  13.     error "PrintingConversion:  paperRect method changed to paperSize.  Resolve type conflict."
  14.  
  15. replace "<w white>[<obj> setMarginLeft:<arg1> right:<arg2> top:<arg3> bottom:<arg4>];" with "[<obj> setLeftMargin:<arg1>];
  16. <white>[<obj> setRightMargin:<arg2>];
  17. <white>[<obj> setTopMargin:<arg3>];
  18. <white>[<obj> setBottomMargin:<arg4>];"
  19.     warning "PrintingConversion: May be able to remove some of the [<obj> setXXXXMargin:] calls"
  20.  
  21. replace "<w white>[<obj> getMarginLeft:<arg1> right:<arg2> top:<arg3> bottom:<arg4>];" with "*(<arg1>) = [<obj> leftMargin];
  22. <white>*(<arg2>) = [<obj> rightMargin];
  23. <white>*(<arg3>) = [<obj> topMargin];
  24. <white>*(<arg4>) = [<obj> bottomMargin];"
  25.     warning "PrintingConversion: May be able to remove some of the [<obj> xxxxMargin:] calls"
  26.  
  27. /* Many methods have been removed in favor of accessing them directly from the NSPrintInfo dictionary */
  28.  
  29. replace    "[<obj> <oldMethod>]" with "[[[<obj> dictionary] objectForKey:<newKey>] <newValueMethod>]"
  30.     where ("<oldMethod>", "<newKey>", "<newValueMethod>") isOneOf {
  31.     ("scalingFactor", "NSPrintScalingFactor", "floatValue"),
  32.     ("isAllPages", "NSPrintAllPages", "boolValue"),
  33.     ("firstPage", "NSPrintFirstPage", "intValue"),
  34.     ("lastPage", "NSPrintLastPage", "intValue"),
  35.     ("copies", "NSPrintCopies", "intValue"),
  36.     ("pagesPerSheet", "NSPrintPagesPerSheet", "intValue"),
  37.     ("reversePageOrder", "NSPrintReversePageOrder", "boolValue"),
  38.     }
  39.  
  40. replace    "[<obj> <oldMethod>:<arg1>]" with "[[[<obj> dictionary] setObject:[NSNumber <newValueMethod>:<arg1>] forKey:<newKey>]"
  41.     where ("<oldMethod>", "<newKey>", "<newValueMethod>") isOneOf {
  42.     ("setScalingFactor", "NSPrintScalingFactor", "numberWithFloat"),
  43.     ("setAllPages", "NSPrintAllPages", "numberWithBool"),
  44.     ("setFirstPage", "NSPrintFirstPage", "numberWithInt"),
  45.     ("setLastPage", "NSPrintLastPage", "numberWithInt"),
  46.     ("setCopies", "NSPrintCopies", "numberWithInt"),
  47.     ("setPagesPerSheet", "NSPrintPagesPerSheet", "numberWithInt"),
  48.     ("setReversePageOrder", "NSPrintReversePageOrder", "numberWithBool"),
  49.     }
  50.  
  51. replace    "[<obj> paperFeed]" with "[[<obj> dictionary] objectForKey:NSPrintPaperFeed]"
  52.  
  53. replace    "[<obj> setPaperFeed:<arg1>]" with "[[<obj> dictionary] setObject:<arg1> forKey:NSPrintPaperFeed]"
  54.  
  55. replace    "[<obj> valueForJobFeature:<arg1>]" with "[[[<obj> dictionary] objectForKey:NSPrintJobFeatures] objectForKey:<arg1>]"
  56.  
  57. replace    "[<obj> removeJobFeature:<arg1>]" with "[[[<obj> dictionary] objectForKey:NSPrintJobFeatures] removeObjectForKey:<arg1>]"
  58.  
  59. /* A couple of methods have been moved from PrintInfo to NSPrintOperation */
  60. replace    "[<obj> currentPage]" with "[[NSPrintOperation currentOperation] currentPage]"
  61.  
  62. replace    "[<obj> context]" with same
  63.     warning "PrintingConversion:  [[NSApp printInfo] context] is now [[NSPrintOperation currentOperation] context]"
  64.  
  65. /* The current PrintInfo object now depends on context */
  66. replace    "[NSApp printInfo]" with "[NSPrintInfo sharedPrintInfo]"
  67.     warning "PrintingConversion:  The current PrintInfo object now depends on context. '[NSPrintInfo sharedPrintInfo]' used to be '[NSApp printInfo]'. This might want to be [[NSPrintOperation currentOperation] printInfo] or possibly [[PageLayout new] printInfo]."
  68.  
  69. replace    "[<obj> printInfo]" with same
  70.     warning "PrintingConversion:  [NSApp printInfo] is now [NSPrintInfo sharedPrintInfo].  This might want to be [[NSPrintOperation currentOperation] printInfo] or possibly [[PageLayout new] printInfo]."
  71.  
  72. replace    "[<obj> setPrintInfo:<arg1>]" with "[NSPrintInfo setSharedPrintInfo:<arg1>]"
  73.     warning "PrintingConversion:  '[NSPrintInfo setSharedPrintInfo:<arg1>]' used to be '[<obj> setPrintInfo:<arg1>]'.  This might want to be [[NSPrintOperation setCurrentOperation:<arg1>] printInfo] or possibly [[PageLayout new] runModalWithPrintInfo:<arg1>]"
  74. /* FIXME -- Not sure how to do declaration conversion for the above.  Really need to know which class the declaration is in. */
  75.  
  76. replacemethod "getDefaultPrinter" with "defaultPrinter"
  77.   
  78. replacemethod "<method>" with same
  79.     error "PrintingConversion:  <method> is obsolete"
  80.     where ("<method>") isOneOf {
  81.     ("initializeJobDefaults"),
  82.     ("outputFile"),
  83.     ("pageOrder"),
  84.     ("jobFeatures"),
  85.     ("setOutputFile:"),
  86.     ("setPageOrder:"),
  87.     ("setContext:"),
  88.     ("setOrientation:andAdjust:"),
  89.     ("setPaperType:andAdjust:"),
  90.     ("setPaperRect:andAdjust:"),
  91.     ("scalingFactor"),
  92.     ("isAllPages"),
  93.     ("firstPage"),
  94.     ("lastPage"),
  95.     ("copies"),
  96.     ("pagesPerSheet"),
  97.     ("reversePageOrder"),
  98.     ("setScalingFactor:"),
  99.     ("setAllPages:"),
  100.     ("setFirstPage:"),
  101.     ("setLastPage:"),
  102.     ("setPagesPerSheet:"),
  103.     ("setCopies:"),
  104.     ("setReversePageOrder:"),
  105.     ("paperFeed"),
  106.     ("setPaperFeed:"),
  107.     ("valueForJobFeature:"),
  108.     ("removeJobFeature:"),
  109.     ("currentPage"),
  110.     }
  111.  
  112.  
  113. /***** View and Window classes *****/
  114.  
  115. replacemethod "<method>" with same
  116.     error "PrintingConversion:  <method> is obsolete"
  117.     where ("<method>") isOneOf {
  118.     ("faxPSCode:"),
  119.     ("faxPSCode:toList:numberList:sendAt:wantsCover:wantsNotify:wantsHires:faxName:"),
  120.     ("openSpoolFile"),
  121.     ("spoolFile"),
  122.     ("beingPSOutput"),
  123.     ("endPSOutput"),
  124.     ("shouldRunPrintPanel:"),
  125.     }
  126.  
  127. /* FIXME -- Don't need one or the other of these */
  128. replace    "NSScreenDump" with same
  129.     error "PrintingConversion:  NSScreenDump is obsolete"
  130.  
  131. replacemethod "print:" with same
  132.     warning "PrintingConversion:  printPSCode: has been renamed to print:.  Rename this method?"
  133.  
  134. replacemethod "<oldMethod>" with "<newMethod>"
  135.     where ("<oldMethod>", "<newMethod>") isOneOf {
  136.     ("writePSCodeInside:to:", "writeEPSInsideRect:toPasteboard:"),
  137.     ("printPSCode:", "print:"),
  138.     ("smartPrintPSCode:", "print:"),
  139.     }
  140.  
  141.  
  142. /***** PageLayout class *****/
  143.  
  144. replacemethod "pickedLayout:" with "pickedLayoutList:"
  145.  
  146. /* FIXME -- Don't need some of these... */
  147. replace    "<expr>" with same
  148.     error "PrintingConversion:  <expr> is obsolete"
  149.     where ("<expr>") isOneOf {
  150.     ("NX_PLLAYOUTBUTTON"),
  151.     ("NX_PLSCALEFIELD"),
  152.     }
  153.  
  154. replace    "NXFindPaperSize(<arg1>)" with "[NSPrintInfo sizeForPaperName:<arg1>]"
  155.  
  156.  
  157. /***** NXPrinter class *****/
  158.  
  159. replace    "[<obj> newForName:<arg1> host:<arg2>]" with "[<obj> printerWithName:<arg1>]"
  160.     error "PrintingConversion: Host argument has been removed"
  161.  
  162. replace    "[<obj> <oldMethod>:<arg1>]" with "[<obj> <newMethod>:<arg1>]"
  163.     where ("<oldMethod>", "<newMethod>") isOneOf {
  164.     ("newForName", "printerWithName"),
  165.     ("newForType", "printerWithType"),
  166.     }
  167.   
  168. replace    "NX_PRINTKEYMAXLEN" with same
  169.     error "PrintingConversion:  Obsolete"
  170.  
  171. replacemethod "printerTypes:custom:" with "printerTypes"  
  172.  
  173.  
  174. /***** Drawing status *****/
  175.  
  176. replace    "<expr1> <op> <expr2>" with "<neg>[[NSDPSContext currentContext] isDrawingToScreen]"
  177.     where ("<expr1>", "<op>", "<expr2>", "<neg>") isOneOf {
  178.     ("NXDrawingStatus", "==", "NX_DRAWING", ""),
  179.     ("NX_DRAWING", "==", "NXDrawingStatus", ""),
  180.     ("NXDrawingStatus", "!=", "NX_DRAWING", "!"),
  181.     ("NX_DRAWING", "!=", "NXDrawingStatus", "!"),
  182.     }
  183.  
  184. replace    "<expr1> == <expr2>" with "(![[NSDPSContext currentContext] isDrawingToScreen] && <neg>[[NSPrintOperation currentOperation] isEPSOperation])"
  185.     where ("<expr1>", "<expr2>", "<neg>") isOneOf {
  186.     ("NXDrawingStatus", "NX_COPYING", ""),
  187.     ("NX_COPYING", "NXDrawingStatus", ""),
  188.     ("NXDrawingStatus", "NX_PRINTING", "!"),
  189.     ("NX_PRINTING", "NXDrawingStatus", "!"),
  190.     }
  191.  
  192. replace    "<expr1> != <expr2>" with "([[NSDPSContext currentContext] isDrawingToScreen] || <neg>[[NSPrintOperation currentOperation] isEPSOperation])"
  193.     where ("<expr1>", "<expr2>", "<neg>") isOneOf {
  194.     ("NXDrawingStatus", "NX_COPYING", "!"),
  195.     ("NX_COPYING", "NXDrawingStatus", "!"),
  196.     ("NXDrawingStatus", "NX_PRINTING", ""),
  197.     ("NX_PRINTING", "NXDrawingStatus", ""),
  198.     }
  199.  
  200. replace "NXDrawingStatus = <args>;" with same
  201.     error "PrintingConversion: NXDrawingStatus is obsolete.  Can probably just delete this assignment."
  202.  
  203. replace "NXDrawingStatus" with same
  204.     error "PrintingConversion: NXDrawingStatus is obsolete. Use the NSDPSContext methods 'isDrawingToScreen' and 'isEPSOperation'."
  205.  
  206. replace "NX_COPYING" with same
  207.     error "PrintingConversion: NX_COPYING is obsolete. Use the NSDPSContext methods 'isDrawingToScreen' and 'isEPSOperation'."
  208.  
  209. replace "NX_DRAWING" with same
  210.     error "PrintingConversion: NX_DRAWING is obsolete. Use the NSDPSContext method 'isDrawingToScreen'."
  211.  
  212. replace "NX_PRINTING" with same
  213.     error "PrintingConversion: NX_PRINTING is obsolete. Use the NSDPSContext method 'isEPSOperation'."
  214.  
  215.