home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / OpenStepConversion / ConversionScripts / FactoryMethods.tops < prev    next >
Text File  |  1996-01-22  |  14KB  |  297 lines

  1. /*********** FactoryMethodConversion: Application *************/
  2.  
  3. replace "[<isKindOf(Application) app> new]" with "[<app> sharedApplication]"
  4.  
  5. /*********** FactoryMethodConversion: Button *************/
  6.  
  7. replace "[<isKindOf(Button) class> newFrame:<frame> title:<title> tag:<tag> target:<target> action:<action> key:<key> enabled:<enabled>]" with "[[<class> alloc] initFrame:<frame> icon:<title> tag:<tag> target:<target> action:<action> key:<key> enabled:<enabled>]"
  8.  
  9. replace "[<isKindOf(Button) class> newFrame:<frame> title:<title> tag:<tag> target:<target> action:<action> key:<key> enabled:<enabled>]" with "[[<class> alloc] initFrame:<frame> title:<title> tag:<tag> target:<target> action:<action> key:<key> enabled:<enabled>]"
  10.  
  11. /*********** FactoryMethodConversion: Cell *************/
  12.  
  13. replace "[<isKindOf(Cell) class> newIconCell:<arg>]" with "[[<class> alloc] initIconCell:<arg>]"
  14.  
  15. replace "[<isKindOf(Cell) class> newIconCell]" with "[[<class> alloc] init]"
  16.  
  17. replace "[<isKindOf(Cell) class> newTextCell:<arg>]" with "[[<class> alloc] initTextCell:<arg>]"
  18.  
  19. replace "[<isKindOf(Cell) class> newTextCell]" with "[[<class> alloc] init]"
  20.  
  21. replace "[<isKindOf(Cell) class> new]" with "[[<class> alloc] init]"
  22.  
  23. /*********** FactoryMethodConversion: ChoosePrinter *************/
  24.  
  25. replace "[<isKindOf(ChoosePrinter) app> new]" with "[<app> choosePrinter]"
  26.  
  27. /*********** FactoryMethodConversion: FontPanel *************/
  28.  
  29. replace "[<isKindOf(FontPanel) app> new]" with "[<app> sharedFontPanel]"
  30.  
  31. /*********** FactoryMethodConversion: FontManager *************/
  32.  
  33. replace "[<isKindOf(FontPanel) app> new]" with "[<app> sharedFontManager]"
  34.  
  35. /*********** FactoryMethodConversion: Matrix *************/
  36.  
  37. replace "[<isKindOf(Matrix) class> newFrame:<frame> mode:<mode> prototype:<aCell> numRows:<rows> numCols:<cols>]]" with "[[<class> alloc] initFrame:<frame> mode:<mode> cellClass:<aCell> numRows:<rows> numCols:<cols>]]"
  38.  
  39. replace "[<isKindOf(Matrix) class> newFrame:<frame> mode:<mode> prototype:<aCell> numRows:<rows> numCols:<cols>]]" with "[[<class> alloc] initFrame:<frame> mode:<mode> prototype:<aCell> numRows:<rows> numCols:<cols>]]"
  40.  
  41. /*********** FactoryMethodConversion: Menu *************/
  42.  
  43. replace "[<isKindOf(Menu) class> newTitle:<arg>]" with "[[<class> alloc] initTitle:<arg>]"
  44.  
  45. replace "[<isKindOf(Menu) class> new]" with "[[<class> alloc] init]"
  46.  
  47. /*********** FactoryMethodConversion: NXBitmapImageRep *************/
  48.  
  49. replace "[<isKindOf(NXBitmapImageRep) class> newData:<data> pixelsWide:<width> pixelsHigh:<height> bitsPerSample:<bps> samplesPerPixel:<spp> hasAlpha:<alpha> isPlanar:<planar> colorSpace:<colorSpace> bytesPerRow:<bpr> bytesPerPixel:<bpr>]" with "[[<class> alloc] initData:<data> pixelsWide:<width> pixelsHigh:<height> bitsPerSample:<bps> samplesPerPixel:<spp> hasAlpha:<alpha> isPlanar:<planar> colorSpace:<colorSpace> bytesPerRow:<bpr> bytesPerPixel:<bpr>]"
  50.  
  51. replace "[<isKindOf(NXBitmapImageRep) class> newData:<data> pixelsWide:<width> pixelsHigh:<height> bitsPerSample:<bps> samplesPerPixel:<spp> hasAlpha:<alpha> isPlanar:<planar> colorSpace:<colorSpace>]" with "[[<class> alloc] initData:<data> pixelsWide:<width> pixelsHigh:<height> bitsPerSample:<bps> samplesPerPixel:<spp> hasAlpha:<alpha> isPlanar:<planar> colorSpace:<colorSpace>]"
  52.  
  53. replace "[<isKindOf(NXBitmapImageRep) class> newDataPlanes:<data> pixelsWide:<width> pixelsHigh:<height> bitsPerSample:<bps> samplesPerPixel:<spp> hasAlpha:<alpha> isPlanar:<planar> colorSpace:<colorSpace> bytesPerRow:<bpr> bytesPerPixel:<bpr>]" with "[[<class> alloc] initDataPlanes:<data> pixelsWide:<width> pixelsHigh:<height> bitsPerSample:<bps> samplesPerPixel:<spp> hasAlpha:<alpha> isPlanar:<planar> colorSpace:<colorSpace> bytesPerRow:<bpr> bytesPerPixel:<bpr>]"
  54.  
  55. replace "[<isKindOf(NXBitmapImageRep) class> newFromFile:<arg>]" with "[[<class> alloc] initFromFile:<arg>]"
  56.  
  57. replace "[<isKindOf(NXBitmapImageRep) class> newFromSection:<arg>]" with "[[<class> alloc] initFromSection:<arg>]"
  58.  
  59. replace "[<isKindOf(NXBitmapImageRep) class> newFromStream:<arg>]" with "[[<class> alloc] initFromStream:<arg>]"
  60.  
  61. /*********** FactoryMethodConversion: NXCachedImageRep *************/
  62.  
  63. replace "[<isKindOf(NXCachedImageRep) class> newFromWindow:<win> rect:<rect>]" with "[[<class> alloc] initFromWindow:<win> rect:<rect>]"
  64.  
  65. /*********** FactoryMethodConversion: NXColorPanel *************/
  66.  
  67. replace "[<isKindOf(NXColorPanel) class> sharedInstance:NO]" with  "([<class> sharedColorPanelExists] ? [NSColorPanel sharedColorPanel] : nil)"
  68.  
  69. replace "[<isKindOf(NXColorPanel) app> sharedInstance:<flag>]" with "[<app> sharedColorPanel]"
  70.  
  71. /*********** FactoryMethodConversion: NXCursor *************/
  72.  
  73. replace "[<isKindOf(NXCursor) class> newFromImage:<image>]" with "[[<class> alloc] initFromImage:<image>]"
  74.  
  75. /*********** FactoryMethodConversion: NXCustomImageRep *************/
  76.  
  77. replace "[<isKindOf(NXCustomImageRep) class> newDrawMethod:<sel> inObject:<obj>]" with "[[<class> alloc] initDrawMethod:<sel> inObject:<obj>]"
  78.  
  79. /*********** FactoryMethodConversion: NXDataLinkPanel *************/
  80.  
  81. replace "[<isKindOf(NXDataLinkPanel) app> new]" with "[<app> sharedDataLinkPanel]"
  82.  
  83. /*********** FactoryMethodConversion: NXEPSImageRep *************/
  84.  
  85. replace "[<isKindOf(NXEPSImageRep) class> newFromFile:<arg>]" with "[[<class> alloc] initFromFile:<arg>]"
  86.  
  87. replace "[<isKindOf(NXEPSImageRep) class> newFromSection:<arg>]" with "[[<class> alloc] initFromSection:<arg>]"
  88.  
  89. replace "[<isKindOf(NXEPSImageRep) class> newFromStream:<arg>]" with "[[<class> alloc] initFromStream:<arg>]"
  90.  
  91. /*********** FactoryMethodConversion: NXHelpPanel *************/
  92.  
  93. replace "[<isKindOf(NXHelpPanel) app> newForDirectory:<dir>]" with same
  94.     error "FactoryMethods: NXHelpPanel is obsolete.  Use NSHelpManager."
  95.  
  96. replace "[<isKindOf(NXHelpPanel) app> new]" with same
  97.     error "FactoryMethods: NXHelpPanel is obsolete.  Use NSHelpManager."
  98.  
  99. /*********** FactoryMethodConversion: NXImage *************/
  100.  
  101. replace "[<isKindOf(NXImage) class> newFromFile:<arg>]" with "[[<class> alloc] initFromFile:<arg>]"
  102.  
  103. replace "[<isKindOf(NXImage) class> newFromImage:<image> rect:<rect>]" with "[[<class> alloc] initFromImage:<image> rect:<rect>]"
  104.  
  105. replace "[<isKindOf(NXImage) class> newFromSection:<arg>]" with "[[<class> alloc] initFromSection:<arg>]"
  106.  
  107. replace "[<isKindOf(NXImage) class> newFromStream:<arg>]" with "[[<class> alloc] initFromStream:<arg>]"
  108.  
  109. replace "[<isKindOf(NXImage) class> newSize:<size>]" with "[[<class> alloc] initSize:<size>]"
  110.  
  111. replace "[<isKindOf(NXImage) class> new]" with "[[<class> alloc] init]"
  112.  
  113. /*********** FactoryMethodConversion: NXSpellChecker *************/
  114.  
  115. replace "[<isKindOf(NXSpellChecker) class> sharedInstance:NO]" with  "([<class> sharedSpellCheckerExists] ? [NSColorPanel sharedSpellChecker] : nil)"
  116.  
  117. replace "[<isKindOf(NXSpellChecker) app> sharedInstance:<flag>]" with "[<app> sharedSpellChecker]"
  118.  
  119. /*********** FactoryMethodConversion: OpenPanel *************/
  120.  
  121. replace "[<isKindOf(OpenPanel) app> new]" with "[<app> openPanel]"
  122.     warning "FactoryMethods: [<app> openPanel] used to be [<app> new].  Open panels are no longer shared.  'openPanel' returns a new, autoreleased open panel in the default configuration.  To maintain state, retain and reuse one open panel (or manually re-set the state each time.)"
  123.  
  124. /*********** FactoryMethodConversion: PageLayout *************/
  125.  
  126. replace "[<isKindOf(PageLayout) app> new]" with "[<app> pageLayout]"
  127.  
  128. /*********** FactoryMethodConversion: Pasteboard *************/
  129.  
  130. replace "[<isKindOf(Pasteboard) app> newByFilteringData:<data> ofType:<type>]" with "[<app> pasteboardByFilteringData:<data> ofType:<type>]"
  131.  
  132. replace "[<isKindOf(Pasteboard) app> newByFilteringFile:<filename>]" with "[<app> pasteboardByFilteringFile:<filename>]"
  133.  
  134. replace "[<isKindOf(Pasteboard) app> newByFilteringTypesInPasteboard:<pboard>]" with "[<app> pasteboardByFilteringTypesInPasteboard:<pboard>]"
  135.  
  136. replace "[<isKindOf(Pasteboard) app> newName:<name>]" with "[<app> pasteboardWithName:<name>]"
  137.  
  138. replace "[<isKindOf(Pasteboard) app> newUnique]" with "[<app> pasteboardWithUniqueName]"
  139.  
  140. replace "[<isKindOf(Pasteboard) app> new]" with "[<app> generalPasteboard]"
  141.  
  142. /*********** FactoryMethodConversion: PrintPanel *************/
  143.  
  144. replace "[<isKindOf(PrintPanel) app> new]" with "[<app> printPanel]"
  145.  
  146. /*********** FactoryMethodConversion: SavePanel *************/
  147.  
  148. replace "[<isKindOf(SavePanel) app> new]" with "[<app> savePanel]"
  149.     warning "FactoryMethods: [<app> savePanel] used to be [<app> new].  Save panels are no longer shared.  'savePanel' returns a new, autoreleased save panel in the default configuration.  To maintain state, retain and reuse one save panel (or manually re-set the state each time.)"
  150.  
  151. /*********** FactoryMethodConversion: Text *************/
  152.  
  153. replace "[<isKindOf(Text) class> newFrame:<frame> text:<text> alignment:<align>]" with "[[<class> alloc] initFrame:<frame> text:<text> alignment:<align>]"
  154.  
  155. /*********** FactoryMethodConversion: View *************/
  156.  
  157. replace "[<isKindOf(View) class> newFrame:<frame>]" with "[[<class> alloc] initFrame:<frame>]"
  158.  
  159. replace "[<isKindOf(View) class> new]" with "[[<class> alloc] init]"
  160.  
  161. /*********** FactoryMethodConversion: Window *************/
  162.  
  163. replace "[<isKindOf(Window) class> newContent:<content> style:<style> backing:<type> buttonMask:<mask> defer:<flag> screen:<screen>]" with "[[<class> alloc] initContent:<content> style:<style> backing:<type> buttonMask:<mask> defer:<flag> screen:<screen>]"
  164.  
  165. replace "[<isKindOf(Window) class> newContent:<content> style:<style> backing:<type> buttonMask:<mask> defer:<flag>]" with "[[<class> alloc] initContent:<content> style:<style> backing:<type> buttonMask:<mask> defer:<flag>]"
  166.  
  167. /*********** FactoryMethodConversion: Declarations and implementations *************/
  168.  
  169. replace "[<obj> new]" with "[<obj> CONVERSIONnew]"
  170.  
  171. replace "[<obj> sharedInstance:" with "[<obj> CONVERSIONsharedInstance:"
  172.  
  173. replace "[<obj> newUnique]" with "[<obj> CONVERSIONnewUnique]"
  174.  
  175. replace "[<obj> newName:" with "[<obj> CONVERSIONnewName:"
  176.  
  177. replace "@<intOrImp><w w><isKindOf(Application) class><w w1><any code><w w2>@end" with same
  178.     within ("<code>") {
  179.         replacemethod "new" with "sharedApplication"
  180.     }
  181.     where "<intOrImp>" isOneOf {
  182.     "interface",
  183.     "implementation"
  184.     }
  185.  
  186. replace "@<intOrImp><w w><isKindOf(ChoosePrinter) class><w w1><any code><w w2>@end" with same
  187.     within ("<code>") {
  188.         replacemethod "new" with "choosePrinter"
  189.     }
  190.     where "<intOrImp>" isOneOf {
  191.     "interface",
  192.     "implementation"
  193.     }
  194.  
  195. replace "@<intOrImp><w w><isKindOf(NXDataLinkPanel) class><w w1><any code><w w2>@end" with same
  196.     within ("<code>") {
  197.         replacemethod "new" with "sharedDataLinkPanel"
  198.     }
  199.     where "<intOrImp>" isOneOf {
  200.     "interface",
  201.     "implementation"
  202.     }
  203.  
  204. replace "@<intOrImp><w w><isKindOf(FontPanel) class><w w1><any code><w w2>@end" with same
  205.     within ("<code>") {
  206.         replacemethod "new" with "sharedFontPanel"
  207.     }
  208.     where "<intOrImp>" isOneOf {
  209.     "interface",
  210.     "implementation"
  211.     }
  212.  
  213. replace "@<intOrImp><w w><isKindOf(FontManager) class><w w1><any code><w w2>@end" with same
  214.     within ("<code>") {
  215.         replacemethod "new" with "sharedFontManager"
  216.     }
  217.     where "<intOrImp>" isOneOf {
  218.     "interface",
  219.     "implementation"
  220.     }
  221.  
  222. replace "@<intOrImp><w w><isKindOf(NXColorPanel) class><w w1><any code><w w2> @end" with same
  223.     within ("<code>") {
  224.         replacemethod "sharedInstance:" with "sharedColorPanel"
  225.     }
  226.     where "<intOrImp>" isOneOf {
  227.     "interface",
  228.     "implementation"
  229.     }
  230.  
  231. replace "@<intOrImp><w w><isKindOf(OpenPanel) class><w w1><any code><w w2>@end" with same
  232.     within ("<code>") {
  233.         replacemethod "new" with "openPanel"
  234.     }
  235.     where "<intOrImp>" isOneOf {
  236.     "interface",
  237.     "implementation"
  238.     }
  239.  
  240. replace "@<intOrImp><w w><isKindOf(PageLayout) class><w w1><any code><w w2>@end" with same
  241.     within ("<code>") {
  242.         replacemethod "new" with "pageLayout"
  243.     }
  244.     where "<intOrImp>" isOneOf {
  245.     "interface",
  246.     "implementation"
  247.     }
  248.  
  249. replace "@<intOrImp><w w><isKindOf(Pasteboard) class><w w1><any code><w w2>@end" with same
  250.     within ("<code>") {
  251.         replacemethod "new" with "generalPasteboard"
  252.         replacemethod "newByFilteringData:ofType:" with "pasteboardByFilteringData:ofType:"
  253.         replacemethod "newByFilteringTypesInPasteboard:" with "pasteboardByFilteringTypesInPasteboard:"
  254.         replacemethod "newByFilteringFile:" with "pasteboardByFilteringFile:"
  255.         replacemethod "newName:" with "pasteboardWithName:"
  256.         replacemethod "newUnique" with "pasteboardWithUniqueName"
  257.     }
  258.     where "<intOrImp>" isOneOf {
  259.     "interface",
  260.     "implementation"
  261.     }
  262.  
  263. replace "@<intOrImp><w w><isKindOf(SavePanel) class><w w1><any code><w w2>@end" with same
  264.     within ("<code>") {
  265.         replacemethod "new" with "savePanel"
  266.     }
  267.     where "<intOrImp>" isOneOf {
  268.     "interface",
  269.     "implementation"
  270.     }
  271.  
  272. replace "@<intOrImp><w w><isKindOf(NXSpellChecker) class><w w1><any code><w w2>@end" with same
  273.     within ("<code>") {
  274.         replacemethod "sharedInstance" with "sharedSpellChecker"
  275.     }
  276.     where "<intOrImp>" isOneOf {
  277.     "interface",
  278.     "implementation"
  279.     }
  280.  
  281. replace "@<intOrImp><w w><isKindOf(PrintPanel) class><w w1><any code><w w2>@end" with same
  282.     within ("<code>") {
  283.         replacemethod "new" with "printPanel"
  284.     }
  285.     where "<intOrImp>" isOneOf {
  286.     "interface",
  287.     "implementation"
  288.     }
  289.  
  290. replace "CONVERSIONnew" with "new"
  291.  
  292. replace "CONVERSIONnewName" with "newName"
  293.  
  294. replace "CONVERSIONnewUnique" with "newUnique"
  295.  
  296. replace "CONVERSIONsharedInstance" with "sharedInstance"
  297.