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

  1. /*********** ViewConversion: remove flipped API ***********/
  2.  
  3. replacemethod "<sel>" with same
  4.     error "ViewConversion: <sel> is obsolete; views never change flippedness"
  5.     where "<sel>" isOneOf {
  6.     "descendantFlipped:",
  7.     "notifyWhenFlipped:"
  8. }
  9.  
  10. replacemethod "setFlipped:" with same
  11.     error "ViewConversion: '[NSView setFlipped:]' is obsolete; you must override 'isFlipped' instead of setting externally. However, [NSImage setFlipped:] is not obsolete. If that is what you are using here, no change is needed."
  12.     
  13. /*********** ViewConversion: clipping API ***********/
  14.  
  15. replacemethod "setClipping:" with same
  16.     error "ViewConversion: 'setClipping:' is obsolete. Views always clip to their bounds. Use PSinitclip instead."
  17.  
  18. replacemethod "clipToFrame:" with same
  19.     error "ViewConversion: 'clipToFrame:' is obsolete. Views always clip to their bounds."
  20.     
  21. replacemethod "doesClip" with same
  22.     error "ViewConversion: 'doesClip' is obsolete. Views always clip to their bounds."
  23.     
  24. /*********** ViewConversion: focusView API ***********/
  25.  
  26. replace    "[<app> focusView]" with "[NSView focusView]"
  27.  
  28. replace    "([<view> isFocusView])" with "([NSView focusView] == <view>)"
  29.  
  30. replace    "[<view> isFocusView]" with "([NSView focusView] == <view>)"
  31.  
  32. replacemethod "isFocusView" with same
  33.     error "ViewConversion: 'isFocusView' is obsolete"
  34.     
  35. replacemethod "focusView" with same
  36.     error "ViewConversion: '-focusView' in NSApplication has been replaced by '+focusView' in NSView"
  37.     
  38. replacemethod "acceptsFirstMouse" with "acceptsFirstMouse:<event>" {
  39.     replace "<event_type>" with "(NSEvent *)"
  40.     replace "<event_param>" with "theEvent"
  41.     replace "<event_arg>" with "EVENT_NEEDED"
  42.     }
  43.     warning "ViewConversion: 'acceptsFirstMouse:' (used to be 'acceptsFirstMouse') now takes the event as an arg"
  44.  
  45. /*********** ViewConversion: convertPoint API ***********/
  46.  
  47. replace "[<view> convertPointFromSuperview:<point>]" with "[<view> convertPoint:<point> fromView:[<view> superview]]"
  48.  
  49. replace "[<view> convertPointToSuperview:<point>]" with "[<view> convertPoint:<point> toView:[<view> superview]]"
  50.  
  51. replace "[<view> convertRectFromSuperview:<rect>]" with "[<view> convertRect:<rect> fromView:[<view> superview]]"
  52.  
  53. replace "[<view> convertRectToSuperview:<rect>]" with "[<view> convertRect:<rect> toView:[<view> superview]]"
  54.  
  55. replacemethod "<sel>" with same
  56.     error "ViewConversion: <sel> is an obsolete cover method; use 'convertPoint:toView:'"
  57.     where "<sel>" isOneOf {
  58.     "convertPointFromSuperview:",
  59.     "convertPointToSuperview:",
  60.     "convertRectFromSuperview:",
  61.     "convertRectToSuperview:"
  62.     }
  63.  
  64. /*********** ViewConversion: sizing API ***********/
  65.  
  66. replacemethod "resizeSubviews:" with "resizeSubviewsWithOldSize:"
  67.  
  68. replacemethod "superviewSizeChanged:" with "resizeWithOldSuperviewSize:"
  69.  
  70. replacemethod "setAutoresizeSubviews:" with "setAutoresizesSubviews:"
  71.  
  72. replacemethod "setAutosizing:" with "setAutoresizingMask:"
  73.  
  74. replacemethod "splitView:resizeSubviews:" with "splitView:resizeSubviewsWithOldSize:"
  75.  
  76. replacemethod "autosizing" with "autoresizingMask"
  77.  
  78. /*********** ViewConversion: autodisplay methods ***********/
  79.  
  80. replace "[<view> invalidate:<rect>]" with "[<view> setNeedsDisplayInRect:<rect>]"
  81.  
  82. replace "[<view> isAutodisplay]" with "NO /* was [<view> isAutoDisplay] */"
  83.  
  84. replacemethod "invalidate:" with same
  85.     error "ViewConversion: 'invalidate:' is obsolete"
  86.  
  87. replacemethod "setAutodisplay:" with same
  88.     error "ViewConversion: 'setAutodisplay:' is obsolete"
  89.  
  90. replacemethod "isAutodisplay" with same
  91.     error "ViewConversion: 'isAutodisplay' is obsolete"
  92.  
  93. replacemethod "setUpdateAction:forMenu:" with same
  94.     error "MenuCell method setUpdateAction:forMenu: is obsolete, use validateCell: from NSMenuActionResponder protocol instead."
  95.     
  96. replacemethod "setNeedsDisplay" with "setNeedsDisplay:<flag>" {
  97.     replace "<flag_type>" with "(BOOL)"
  98.     replace "<flag_param>" with "_flag"
  99.     replace "<flag_arg>" with "YES"
  100.     }
  101.     
  102. /*********** ViewConversion: update ***********/
  103.  
  104. replace "@interface <isKindOf(NSView)<w w1><any interface><w w2>@end" with same
  105.     within ("<interface>") {
  106.         replacemethod "update" with same
  107.         error "ViewConversion: The View 'update' method is obsolete"
  108.     }
  109.     
  110. replace "@implementation <isKindOf(NSView)<w w1><any interface><w w2>@end" with same
  111.     within ("<interface>") {
  112.         replace "- (void)update <w w> {" with same
  113.         error "ViewConversion: The View 'update' method is obsolete"
  114.         replace "- (void)update <w w> {" with same
  115.         error "ViewConversion: The View 'update' method is obsolete"
  116.     replace "[self update]" with "[self setNeedsDisplay:YES]"
  117.     replace "[super update]" with "[super setNeedsDisplay:YES]"
  118.     }
  119.     
  120. replace "@implementation <isKindOf(NSWindow)<w w1><any interface><w w2>@end" with same
  121.     within ("<interface>") {
  122.         replace "[self update]" with "[self CONVERSIONupdate]"
  123.         replace "[super update]" with "[super CONVERSIONupdate]"
  124.     }
  125.     
  126. replace    "(NSView *)<token theView><b arg2><w w2>{<scope implementation>}" with same
  127.     within     ("<implementation>"){
  128.     replace "[<theView> update]" with "[<theView> setNeedsDisplay:YES]"
  129.     }
  130.  
  131. replace    "(NSView *)<token theView><scope implementation>}" with    same
  132.     within     ("<implementation>"){
  133.     replace "[<theView> update]" with "[<theView> setNeedsDisplay:YES]"
  134.     }
  135.  
  136. replace "[view update]" with "[view setNeedsDisplay:YES]"
  137.  
  138. replace "[aView update]" with "[aView setNeedsDisplay:YES]"
  139.  
  140. replace "[theView update]" with "[theView setNeedsDisplay:YES]"
  141.  
  142. replace "[win update]" with "[win CONVERSIONupdate]"
  143.  
  144. replace "[window update]" with "[window CONVERSIONupdate]"
  145.  
  146. replace "[aWindow update]" with "[aWindow CONVERSIONupdate]"
  147.  
  148. replace "[theWindow update]" with "[theWindow CONVERSIONupdate]"
  149.  
  150. replace "[<maybeAView> update]" with same
  151.     warning "ViewConversion:  The View 'update' method is obsolete; if the receiver of this method is an NSView convert to [<theView> setNeedsDisplay:YES]"
  152.     
  153. replace "CONVERSIONupdate" with "update"
  154.  
  155. /*********** ViewConversion: name changes ***********/
  156.  
  157. replacemethod "suspendNotifyAncestorWhenFrameChanged:<flag>" with "setPostsFrameChangedNotifications:<flag>" {
  158.     replace "<flag_arg>" with "!<flag_arg>"
  159.     }
  160.     within ("<implementation>") {
  161.         replace "<flag_param>" with "!<flag_param>"
  162.     }
  163.  
  164. replace "!!" with ""
  165.  
  166. replace "!YES" with "NO"
  167.  
  168. replace "!NO" with "YES"
  169.  
  170. replacemethod "windowChanged:" with "viewWillMoveToWindow:"
  171.  
  172. replacemethod "findAncestorSharedWith:" with "ancestorSharedWithView:"
  173.  
  174. replacemethod "addSubview::relativeTo:" with "addSubview:positioned:relativeTo:"
  175.  
  176. replacemethod "boundsAngle" with "boundsRotation"
  177.  
  178. replacemethod "findViewWithTag:" with "viewWithTag:"
  179.  
  180. replacemethod "initFrame:" with "initWithFrame:"
  181.  
  182. /*********** ViewConversion: obsolete methods ***********/
  183.  
  184. replacemethod "setOpaque:" with same
  185.     error "ViewConversion: View's 'setOpaque:' is obsolete; you must override 'isOpaque' instead of setting externally (if sent to text, 'setDrawsBackground:' can be used to eliminate background gray; if sent to NSImageRep, it's OK)"
  186.     
  187. replacemethod "drawInSuperview" with same
  188.     error "ViewConversion: 'drawInSuperview' is obsolete; Check out gstates to optimize drawing performance"
  189.  
  190. replacemethod "notifyToInitGState:" with same
  191.     error "ViewConversion: 'notifyToInitGState:' is no longer necessary"
  192.     
  193. replace "[<view> <old>]" with "[<view <new>]"
  194.     where ("<old>", "<new>") isOneOf {
  195.     ("rotateBy:<delta>]", "setFrameRotation:[<view> frameRotation] + <delta>]"), 
  196.     ("moveBy:<deltax> :<deltay>]", "setFrameOrigin:NSMakePoint( ([<view> frame].origin.x + <deltax>), ([<view> frame].origin.y + <deltay>) )]"), 
  197.     ("sizeBy:<deltax> :<deltay>]", "setFrameSize:NSMakeSize([<view> frame].size.width + <deltax>), ([<view> frame].size.height + <deltay>) )]")
  198.     } 
  199.  
  200. replacemethod "rotateBy:" with same
  201.     error "ViewConversion: 'rotateBy:' is obsolete ; use 'setFrameRotation:'"
  202.     
  203. replacemethod "moveBy:" with same
  204.     error "ViewConversion: 'moveBy:' is obsolete ; use 'setFrameOrigin:'"
  205.     
  206. replacemethod "sizeBy:" with same
  207.     error "ViewConversion: 'sizeBy:' is obsolete ; use 'setFrameSize:'"
  208.  
  209. replacemethod "notifyAncestorWhenFrameChanged:" with same
  210.     error "ViewConversion: 'notifyAncestorWhenFrameChanged:' is obsolete. Register for the NSViewFrameDidChangeNotification instead, e.g.,  [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(viewFrameChanged:) name:NSViewFrameDidChangeNotification object:receiverOfNotification]"
  211.     
  212. replacemethod "descendantFrameChanged:" with same
  213.     error "ViewConversion: 'descendantFrameChanged:' is obsolete. Register for the NSViewFrameDidChangeNotification instead."
  214.     
  215. replacemethod "displayOnScroll" with same
  216.     error "ViewConversion: 'setDisplayOnScroll:' is obsolete with new display mechanism."
  217.  
  218. replacemethod "setDisplayOnScroll:" with same
  219.     error "ViewConversion: 'setDisplayOnScroll:' is obsolete with new display mechanism."
  220.  
  221.     
  222. /*********** ViewConversion: simple renaming ***********/
  223.  
  224. replacemethod "<old>" with "<new>" 
  225.     where ("<old>", "<new>") isOneOf {
  226.        ("setDrawRotation:", "setBoundsRotation:"), 
  227.     ("rotateTo:", "setFrameRotation:"), 
  228.     ("rotate:", "rotateByAngle:"), 
  229.     ("frameAngle", "frameRotation"), 
  230.     ("drawSelf:inView:", "drawWithFrame:inView:"), 
  231.     ("drawSelf:", "drawRect:"), 
  232.     ("drawInside:inView:", "drawInteriorWithFrame:inView:"), 
  233.    }
  234.  
  235. replacemethod "highlight:<rect> inView:<controlView> lit:<flag>" with "highlight:<flag> withFrame:<rect> inView:<controlView>"
  236.  
  237. /*********** ViewConversion: a fax method ***********/
  238.  
  239. replace "[<view> faxPSCode:<sender> toList:<names> numberList:<numbers> sendAt:<sendtime> wantsCover:<wantsCover> wantsNotify:<wantsNotify> wantsHires:<wantsHires> faxName:<faxModem>];"
  240. with "{
  241.     NSPrintInfo *pi = [[[NSPrintInfo sharedPrintInfo] copy] autorelease];
  242.     NSMutableDictionay *piDict = [pi dictionary];
  243.     NSPrintOperation *op;
  244.     [piDict setObject:<names> forKey:NSPrintFaxReceiverNames];
  245.     [piDict setObject:<numbers> forKey:NSPrintFaxReceiverNumbers];
  246.     if (<sendtime>) {
  247.     [piDict setObject:[NSDate dateWithTimeIntervalSince1970:<sendtime>] forKey:NSPrintFaxSendTime];
  248.     }
  249.     [piDict setObject:[NSNumber numberWithBool:<wantsCover>] forKey:NSPrintFaxUseCoverSheet];
  250.     [piDict setObject:[NSNumber numberWithBool:<wantsNotify>] forKey:NSPrintFaxReturnReceipt];
  251.     [piDict setObject:[NSNumber numberWithBool:<wantsHires>] forKey:NSPrintFaxHighResolution];
  252.     if (<faxModem>) {
  253.     NSPrinter *pr = [NSPrinter printerWithName:<faxModem>];
  254.     [piDict setObject:pr forKey:NSPrintFaxModem];
  255.     }
  256.     [pi setJobDisposition:NSPrintFaxJob];
  257.     op = [NSPrintOperation printOperationWithView:<view> printInfo:pi];
  258.     [op setShowPanels:NO];
  259.     [op runOperation];
  260. }"
  261.