home *** CD-ROM | disk | FTP | other *** search
/ OpenStep 4.2J (Developer) / os42jdev.iso / NextDeveloper / OpenStepConversion / ConversionScripts / WindowConversion.tops < prev   
Encoding:
Text File  |  1996-01-23  |  10.4 KB  |  213 lines

  1.  
  2. /*********** WindowConversion: Obsolete constants ***********/
  3.  
  4. replace    "NX_MINIWORLDSTYLE" with same 
  5.     error "WindowConversion: NX_MINIWORLDSTYLE is obsolete."
  6.  
  7. replace    "NX_FIRSTWINSTYLE" with same
  8.     error "WindowConversion: NX_FIRSTWINSTYLE is obsolete."
  9.  
  10. replace    "NX_LASTWINSTYLE" with same
  11.     error "WindowConversion: NX_LASTWINSTYLE is obsolete."
  12.  
  13. replace    "NX_NUMWINSTYLES" with same
  14.     error "WindowConversion: NX_NUMWINSTYLES is obsolete."
  15.  
  16. /*********** WindowConversion: Merge window styles and button masks into one mask ***********/
  17.  
  18. replace    "NX_PLAINSTYLE" with "NSBorderlessWindowMask"
  19.  
  20. replace    "NX_TITLEDSTYLE" with "NSTitledWindowMask"
  21.  
  22. replace    "NX_RESIZEBARSTYLE" with "NSResizableWindowMask"
  23. replace    "NX_SIZEBARSTYLE" with "NSResizableWindowMask"
  24.  
  25. replace    "NX_CLOSEBUTTONMASK" with "NSClosableWindowMask"
  26.  
  27. replace    "NX_MINIATURIZEBUTTONMASK" with    "NSMiniaturizableWindowMask"
  28.  
  29. replacemethod "frameRectForContentRect:style:" with "frameRectForContentRect:styleMask:" 
  30.  
  31. replacemethod "contentRectForFrameRect:style:" with "contentRectForFrameRect:styleMask:" 
  32.  
  33. replacemethod "minFrameWidth:forStyle:<style> buttonMask:<bmask>" with "minFrameWidthWithTitle:styleMask:<style>" {
  34.     replace "<style_arg>" with "<style_arg>|<bmask_arg>"
  35.     replace "<style_type>" with "(unsigned int)"
  36.     }
  37.     within ("<implementation>") {
  38.     replace "<bmask>" "<style>"
  39.     replace "<style>|<style>" "<style>"
  40.     }
  41.  
  42. replacemethod "<old>" with "<new>" {
  43.     replace "<style_arg>" with "<style_arg>|<bmask_arg>"
  44.     replace "<style_type>" with "(unsigned int)"
  45.     replace "<backing_type>" with "(NSBackingStoreType)"
  46.     }
  47.     where ("<old>", "<new>") isOneOf {
  48.     ("initContent:style:<style> backing:<backing> buttonMask:<bmask> defer:<flag>", "initWithContentRect:styleMask:<style> backing:<backing> defer:<flag>"),
  49.     ("initContent:style:<style> backing:<backing> buttonMask:<bmask> defer:<flag> screen:<screen>", "initWithContentRect:styleMask:<style> backing:<backing> defer:<flag> screen:<screen>")
  50.     }
  51.     within ("<implementation") {
  52.     replace "<bmask>" "<style>"
  53.     replace "<style>|<style>" "<style>"
  54.     }
  55.     
  56. replace    "styleMask:<style>|0" with "styleMask:<style>"
  57.  
  58.  
  59. /*********** WindowConversion: Convert comparisons of styles ***********/
  60.  
  61. /* look for style method before arb expr so we can convert this one with certainty to styleMask */
  62.  
  63. /* look for the parens case first, since we dont need extra parens then */
  64. replace "(<balanced comparison>)" with "(<balanced newcomparison>)"
  65.     where ("<comparison>", "<newcomparison>") isOneOf {
  66.     ("[<obj> style] == NSTitledWindowMask", "[<obj> styleMask] & NSTitledWindowMask"),
  67.     ("[<obj> style] == NSResizableWindowMask", "[<obj> styleMask] & NSResizableWindowMask"),
  68.     ("NSTitledWindowMask == [<obj> style]", "NSTitledWindowMask & [<obj> styleMask]"),
  69.     ("NSResizableWindowMask == [<obj> style]", "NSResizableWindowMask & [<obj> styleMask]"),
  70.     }
  71.  
  72. replace    "[<obj> style] == NSTitledWindowMask" with "(([<obj> styleMask] & NSTitledWindowMask) != 0)"
  73. replace    "[<obj> style] == NSResizableWindowMask" with "(([<obj> styleMask] & NSResizableWindowMask) != 0)"
  74.  
  75. replace    "NSTitledWindowMask == [<obj> style]" with "(([<obj> styleMask] & NSTitledWindowMask) != 0)"
  76. replace    "NSResizableWindowMask == [<obj> style]" with "(([<obj> styleMask] & NSResizableWindowMask) != 0)"
  77.  
  78. replace    "[<obj> style] != NSTitledWindowMask" with "!([<obj> styleMask] & NSTitledWindowMask)"
  79. replace    "[<obj> style] != NSResizableWindowMask" with "!([<obj> styleMask] & NSResizableWindowMask)"
  80.  
  81. replace    "NSTitledWindowMask != [<obj> style]" with "!([<obj> styleMask] & NSTitledWindowMask)"
  82. replace    "NSResizableWindowMask != [<obj> style]" with "!([<obj> styleMask] & NSResizableWindowMask)"
  83.  
  84. /* common appearance in window init methods */
  85. replace    "styleMask:[<obj> style]" with "styleMask:[<obj> styleMask]"
  86.  
  87. replacemethod "style" with "styleMask"
  88.     warning "WindowConversion: style was converted to styleMask.  NXImageView also used to have a style method, which is now imageFrameStyle.  Check to make sure this conversion is correct."
  89.  
  90. replace "(<balanced comparison>)" with "(<balanced newcomparison>)"
  91.     where ("<comparison>", "<newcomparison>") isOneOf {
  92.     ("NSTitledWindowMask == <var>", "NSTitledWindowMask & <var>"),
  93.     ("NSResizableWindowMask == <var>", "NSResizableWindowMask & <var>"),
  94.     ("<var> == NSTitledWindowMask", "<var> & NSTitledWindowMask"),
  95.     ("<var> == NSResizableWindowMask", "<var> & NSResizableWindowMask"),
  96.     ("<var> != NSTitledWindowMask", "!(<var> & NSTitledWindowMask)"),
  97.     ("<var> != NSResizableWindowMask", "!(<var> & NSResizableWindowMask)")
  98.     ("NSTitledWindowMask != <var>", "!(<var> & NSTitledWindowMask)"),
  99.     ("NSResizableWindowMask != <var>", "!(<var> & NSResizableWindowMask)")
  100.     }
  101.  
  102. replace    "NSTitledWindowMask == <var>" with "(NSTitledWindowMask & <var>)"
  103. replace    "NSResizableWindowMask == <var>" with "(NSResizableWindowMask & <var>)"
  104.  
  105. replace    "<var> == NSTitledWindowMask" with "(<var> & NSTitledWindowMask)"
  106. replace    "<var> == NSResizableWindowMask" with "(<var> & NSResizableWindowMask)"
  107.  
  108. replace    "NSTitledWindowMask != <var>" with "!(NSTitledWindowMask & <var>)"
  109. replace    "NSResizableWindowMask != <var>" with "!(NSResizableWindowMask & <var>)"
  110.  
  111. replace    "<var> != NSTitledWindowMask" with "!(<var> & NSTitledWindowMask)"
  112. replace    "<var> != NSResizableWindowMask" with "!(<var> & NSResizableWindowMask)"
  113.  
  114. /*********** WindowConversion: Placement methods ***********/
  115.  
  116. replace    "[<obj> placeWindowAndDisplay:<rect>]" with "[<obj> setFrame:<rect> display:YES]"
  117.  
  118. replace    "[<obj> placeWindow:<rect>]" with "[<obj> setFrame:<rect> display:NO]"
  119.  
  120. replacemethod "placeWindowAndDisplay:" with same 
  121.     error "WindowConversion: 'placeWindowAndDisplay:' is obsolete. Convert to 'setFrame:display:'"
  122.  
  123. replacemethod "placeWindow:" with same 
  124.     error "WindowConversion: 'placeWindow:' is obsolete. Convert to 'setFrame:display:'"
  125.  
  126. /*********** WindowConversion: TrackingRect ***********/
  127.  
  128. replace    "[<obj> setTrackingRect:<aRect> inside:<flag> owner:<anObject> tag:<trackNum> left:<leftDown> right:<rightDown>]" with "<trackNum> = [_aView_ addTrackingRect:<aRect> owner:<anObject> assumeInside:<flag>]"
  129.     error "WindowConversion: 'addTrackingRect:owner:assumeInside:' (used to be [<obj> setTrackingRect:<aRect> inside:<flag> owner:<anObject> tag:<trackNum> left:<leftDown> right:<rightDown>]) should be sent to a view instead of a window; trackingRect numbers are now returned by the kit instead of passed in by the client"
  130.     
  131. replacemethod "setTrackingRect:inside:owner:tag:left:right:" with "addTrackingRect:owner:assumeInside:"
  132.     error "WindowConversion: 'addTrackingRect:owner:assumeInside:' (used to be 'setTrackingRect:inside:owner:tag:left:right:') should be sent to a view instead of a window; trackingRect numbers are now returned by the kit instead of passed in by the client"
  133.  
  134. replacemethod "discardTrackingRect:" with "removeTrackingRect:"
  135.     error "WindowConversion: 'removeTrackingRect:' (used to be 'discardTrackingRect:') should be sent to a view (used to be sent to a window)"
  136.  
  137. /*********** WindowConversion: Methods that handles AppKit-type events ***********/
  138.  
  139. replacemethod "<sel>" with same
  140.     error "WindowConversion: <sel> is obsolete.  Register for a notification from the window instead"
  141.     where "<sel>" isOneOf {
  142.     "windowExposed:", 
  143.     "windowMoved:", 
  144.     "screenChanged:"
  145.     }
  146.  
  147. /*********** WindowConversion: Renaming ***********/
  148.  
  149. replacemethod "mouseLocation" with "mouseLocationOutsideOfEventStream"
  150.  
  151. replace "- (void)orderWindow:(int)place relativeTo:(int)otherWin;" with "- (void)orderWindow:(NSWindowOrderingMode)place relativeTo:(int)otherWin;"
  152.  
  153. replace "- (void)orderWindow:(int)place relativeTo:(int)otherWin {" with "- (void)orderWindow:(NSWindowOrderingMode)place relativeTo:(int)otherWin {"
  154.  
  155. replacemethod "style" with "styleMask"
  156. warning "WindowConversion: style was converted to styleMask.  NXImageView also used to have a style method, which is now imageFrameStyle.  Check to make sure this conversion is correct."
  157.  
  158. replacemethod "bestScreen" with "deepestScreen"
  159.  
  160. replacemethod "smartFaxPSCode:" with "fax:"
  161.  
  162. replacemethod "setTitleAsFilename:" with "setTitleWithRepresentedFilename:"
  163.  
  164. /*********** WindowConversion: Displaying ***********/
  165.  
  166. replacemethod "disableDisplay" with same
  167.     error "WindowConversion: 'disableDisplay' is obsolete.  You can probably remove this call.  Typically drawing should happen as part of the update mechanism after every event.  Display is now optimized using the View setNeedsDisplay: method.  See the conversion doc for more info."
  168.     
  169. replacemethod "reenableDisplay" with same
  170.     error "WindowConversion: 'reenableDisplay' is obsolete.  You can probably remove this call.  Typically drawing should happen as part of the update mechanism after every event.  Display is now optimized using the View setNeedsDisplay: method.  See the conversion doc for more info."
  171.  
  172. replacemethod "isDisplayEnabled" with same
  173.     error "WindowConversion: 'isDisplayEnabled' is obsolete.  You can probably remove this call and any drawing code it brackets.  Typically drawing should happen as part of the update mechanism after every event.  Display is now optimized using the View setNeedsDisplay: method.  See the conversion doc for more info."
  174.  
  175. replacemethod "setViewsNeedDisplay" with "setViewsNeedDisplay:<flag>" {
  176.     replace "<flag_type>" with "(BOOL)"
  177.     replace "<flag_param>" with "_flag"
  178.     replace "<flag_arg>" with "YES"
  179.     }
  180.  
  181. /*********** WindowConversion: Obsolete methods ***********/
  182.  
  183. replace "[<obj> buttonMask]" with "[<obj> styleMask]"
  184.  
  185. replacemethod "displayBorder" with same
  186.     error "WindowConversion: displayBorder is obsolete.  The window border should be kept up to date by the AppKit.  If you really need to force it to display, send display to the window."
  187.  
  188. replacemethod "buttonMask" with same
  189.     error "WindowConversion: obsolete method; button masks and style masks are combined; use 'styleMask'"
  190.  
  191. replace    "[<obj> getFrame:<rect> andScreen:<screen>]"
  192.  with    "*(<screen>) = [<obj> screen], *(<rect>) = [<obj> frame], (<rect>)->origin.x -= [<screen> frame].origin.x, (<rect>)->origin.y -= [<screen> frame].origin.y"
  193.  
  194. replacemethod "<sel>" with same
  195.     error "WindowConversion: <sel> has been removed from the API"
  196.     where "<sel>" isOneOf {
  197.     "setAvoidsActivation:",
  198.     "avoidsActivation",
  199.     "dragFrom::eventNum:",
  200.     "moveTo::screen:",
  201.     "moveTopLeft::screen:"
  202.     "getFrame:andScreen:"
  203.     }
  204.  
  205. replacemethod "<sel>" with same
  206.     error "WindowConversion: <sel> has been removed from the API; add cursor rects to a particular view instead"
  207.     where "<sel>" isOneOf {
  208.     "addCursorRect:cursor:forView:",
  209.     "removeCursorRect:cursor:forView:"
  210.     }
  211.  
  212.  
  213.