Loading ...
Sorry, an error occurred while loading the content.

MacVim Carbon

Expand Messages
  • vim-mac-egroups-wrapper@vim.org
    Hi everyone, last weekend I have downloaded the Carbon SDK and started to look through the code. I have added all the suggestion from Carbon Dater as comments
    Message 1 of 1 , Apr 8, 2001
    • 0 Attachment
      Hi everyone,

      last weekend I have downloaded the Carbon SDK and started to look
      through the code.

      I have added all the suggestion from Carbon Dater as comments and
      started to #ifdef non-Carbon functions. While doing this I discovered
      that Carbon Dater and the Universal Interface 3.4 often disagree about
      what is in Carbon.

      If someone wants to help porting please get in contact with me to avoid
      doing the work twice.

      I hope the Makefile patch will survive e-mail, if not you hae to fix it
      manually, it is only one line.

      Axel


      *** CodeWarrior:Source:vim60w:src.orig:gui_mac.c Sat Mar 10
      17:04:29 2001
      --- CodeWarrior:Source:vim60w:src:gui_mac.c.classic Sun Apr 8
      00:25:43 2001
      ***************
      *** 417,422 ****
      --- 417,427 ----
      {
      appleMenu = GetMenuHandle (menu);
      GetMenuItemText (appleMenu, item, itemName);
      + /*
      + OpenDeskAcc
      +
      + Desk accessories are not supported in Carbon. Not available in Carbon.
      + */
      (void) OpenDeskAcc (itemName);
      }
      }
      ***************
      *** 545,551 ****
      --- 550,599 ----
      #ifdef USE_CTRLCLICKMENU
      long gestalt_rc;
      #endif
      + /*
      + MaxApplZone
      +
      + This routine is not needed by PowerPC-based applications because they
      can
      + specify a stack size in the cfrg resource. Not available in Carbon.
      +
      + InitGraf
      +
      + In Carbon, the Mac OS automatically initializes Quickdraw for every
      + application. When the Mac OS initializes QuickDraw, the Mac OS also
      + automatically calls InitGraf. Not available in Carbon.
      +
      + InitFonts
      +
      + There is no need to initialize the Font Manager because the shared
      library
      + is loaded as needed. Not available in Carbon.
      +
      +
      + InitWindows
      +
      + InitWindows is not supported in Carbon. There is no need to initialize
      the
      + Window Manager because the shared library is loaded as needed. Not
      + available in Carbon.
      +
      + InitMenus
      +
      + InitMenus is not supported in Carbon. There is no need to initialize
      the
      + Menu Manager because the shared library is loaded as needed. Not
      available
      + in Carbon.
      +
      + InitDialogs
      +
      + InitDialogs is not supported in Carbon. There is no need to initialize
      the
      + Dialog Manager because the shared library is loaded as needed. Not
      + available in Carbon.

      + TEInit
      +
      + There is no need to initialize TextEdit because the shared library is
      + loaded as needed. Not available in Carbon.
      +
      + */
      +
      + #if ! TARGET_API_MAC_CARBON
      MaxApplZone();
      InitGraf(&qd.thePort);
      InitFonts();
      ***************
      *** 553,558 ****
      --- 601,607 ----
      InitMenus();
      TEInit();
      InitDialogs(nil);
      + #endif
      InitCursor();

      #ifdef USE_AEVENT
      ***************
      *** 587,593 ****
      #else
      SetRect (&windRect, 300, 40, 300+80*7 + 16, 40+24*11);
      #endif
      !
      gui.VimWindow = NewCWindow(nil, &windRect, "\pgVim on Macintosh",
      true, documentProc,
      (WindowPtr) -1, false, 0);

      --- 636,646 ----
      #else
      SetRect (&windRect, 300, 40, 300+80*7 + 16, 40+24*11);
      #endif
      ! /* NewCWindow:
      ! In Carbon, you cannot pass your own storage in to the wStorage
      parameter.
      ! Available in Carbon 1.0.2 and later when running Mac OS 8.1 or
      later.
      ! Here: nil
      ! */
      gui.VimWindow = NewCWindow(nil, &windRect, "\pgVim on Macintosh",
      true, documentProc,
      (WindowPtr) -1, false, 0);

      ***************
      *** 614,623 ****
      DrawMenuBar();

      #ifdef USE_HELPMENU
      (void) HMGetHelpMenuHandle(&gui.MacOSHelpMenu); /* Getting a
      handle to the Help menu */

      if (gui.MacOSHelpMenu != nil)
      ! gui.MacOSHelpItems = CountMItems (gui.MacOSHelpMenu);
      else
      gui.MacOSHelpItems = 0;
      #endif
      --- 667,687 ----
      DrawMenuBar();

      #ifdef USE_HELPMENU
      + /*
      + HMGetHelpMenuHandle
      +
      + Not available in Carbon.
      +
      + CountMItems
      +
      + CountMItems has been renamed to CountMenuItems in Carbon. Not
      available in
      + Carbon.
      + */
      +
      (void) HMGetHelpMenuHandle(&gui.MacOSHelpMenu); /* Getting a
      handle to the Help menu */

      if (gui.MacOSHelpMenu != nil)
      ! gui.MacOSHelpItems = CountMenuItems (gui.MacOSHelpMenu);
      else
      gui.MacOSHelpItems = 0;
      #endif
      ***************
      *** 833,839 ****
      --- 897,913 ----
      STRCPY(&pFontName[1], font_name);
      pFontName[0] = STRLEN(font_name);
      *p = c;
      + /* GetFNum
      +
      + You should instead use FMGetFontFamilyFromName. Available in Carbon
      + 1.0.2 and later when running Mac OS 8.1 or later.

      + EXTERN_API( void )
      + GetFNum (ConstStr255Param name,
      + short * familyID)
      + EXTERN_API_C( FMFontFamily )
      + FMGetFontFamilyFromName (ConstStr255Param iName);
      + */
      GetFNum (pFontName, &font_id);

      if (font_id == 0)
      ***************
      *** 840,845 ****
      --- 914,933 ----
      {
      /* Oups, the system font was it the one the user want */

      + /*
      + GetFontName
      +
      + You should instead use FMGetFontFamilyName. Available in Carbon 1.0.2
      and
      + later when running Mac OS 8.1 or later.
      +
      + EXTERN_API( void )
      + GetFontName (short familyID,
      + Str255 name)
      + EXTERN_API_C( OSStatus )
      + FMGetFontFamilyName (FMFontFamily iFontFamily,
      + Str255 oName);
      + */
      +
      GetFontName (0, systemFontname);
      if (!EqualString(pFontName, systemFontname, false, false))
      return NOFONT;
      ***************
      *** 1966,1972 ****
      --- 2054,2071 ----
      int type;
      char *searchCR;
      char *tempclip;
      + /*
      + LoadScrap

      + Carbon applications may continue calling this function on Mac OS 8;
      + however, on Mac OS X it does nothing and is no longer necessary.
      + Available in Carbon 1.0.2 and later when running Mac OS 8.1 or later.
      +
      + GetScrap
      +
      + You should instead use the functions ScrapHasFlavor,
      GetScrapFlavorSize,
      + and GetScrapFlavorData. Not available in Carbon.
      + */
      scrapSize = LoadScrap (); /* This seem to avoid problem with crash
      on first paste */
      scrapSize = GetScrap ( nil, 'TEXT', &scrapOffset);

      ***************
      *** 2044,2049 ****
      --- 2143,2155 ----
      if (type >= 0)
      {

      + /*
      + ZeroScrap
      +
      + You should instead use the function ClearCurrentScrap. Not available
      in
      + Carbon.
      +
      + */
      ZeroScrap ();

      textOfClip = NewHandle(scrapSize);
      ***************
      *** 2051,2056 ****
      --- 2157,2169 ----
      HLock (textOfClip);

      STRNCPY (*textOfClip, str, scrapSize);
      + /*
      + PutScrap
      +
      + You should instead use the function PutScrapFlavor. Not available in
      + Carbon.
      +
      + */
      PutScrap (scrapSize, 'TEXT', *textOfClip);

      HUnlock (textOfClip);
      ***************
      *** 2315,2333 ****
      /*
      index = menu->index;
      */
      if (grey)
      {
      if (menu->children)
      ! DisableItem(menu->submenu_handle, index);
      if (menu->menu_handle)
      ! DisableItem(menu->menu_handle, index);
      }
      else
      {
      if (menu->children)
      ! EnableItem(menu->submenu_handle, index);
      if (menu->menu_handle)
      ! EnableItem(menu->menu_handle, index);
      }
      }

      --- 2428,2456 ----
      /*
      index = menu->index;
      */
      + /*
      + DisableItem
      +
      + Replaced by DisableMenuItem. Not available in Carbon.
      +
      + EnableItem
      +
      + Replaced by EnableMenuItem. Not available in Carbon.
      +
      + */
      if (grey)
      {
      if (menu->children)
      ! DisableMenuItem(menu->submenu_handle, index);
      if (menu->menu_handle)
      ! DisableMenuItem(menu->menu_handle, index);
      }
      else
      {
      if (menu->children)
      ! EnableMenuItem(menu->submenu_handle, index);
      if (menu->menu_handle)
      ! EnableMenuItem(menu->menu_handle, index);
      }
      }

      ***************
      *** 2347,2362 ****
      if (hidden)
      {
      if (menu->children)
      ! DisableItem(menu->submenu_handle, menu->index);
      if (menu->menu_handle)
      ! DisableItem(menu->menu_handle, menu->index);
      }
      else
      {
      if (menu->children)
      ! EnableItem(menu->submenu_handle, index);
      if (menu->menu_handle)
      ! EnableItem(menu->menu_handle, index);
      }
      }

      --- 2470,2485 ----
      if (hidden)
      {
      if (menu->children)
      ! DisableMenuItem(menu->submenu_handle, menu->index);
      if (menu->menu_handle)
      ! DisableMenuItem(menu->menu_handle, menu->index);
      }
      else
      {
      if (menu->children)
      ! EnableMenuItem(menu->submenu_handle, index);
      if (menu->menu_handle)
      ! EnableMenuItem(menu->menu_handle, index);
      }
      }

      ***************
      *** 2585,2590 ****
      --- 2708,2719 ----
      if (saving)
      {
      /* Use a custon filter instead of nil FAQ 9-4 */
      + /*
      + StandardPutFile
      +
      + Not available in Carbon.
      +
      + */
      StandardPutFile (Prompt, DefaultName, &reply);
      if (!reply.sfGood)
      return NULL;
      ***************
      *** 2591,2596 ****
      --- 2720,2730 ----
      }
      else
      {
      + /*
      + StandardGetFile
      +
      + Not available in Carbon.
      + */
      StandardGetFile (nil, -1, fileTypes, &reply);
      if (!reply.sfGood)
      return NULL;
      ***************
      *** 3502,3507 ****
      --- 3636,3650 ----
      }
      else
      {
      + /* GetProcessInformation:
      + The processActiveTime field of the returned ProcessInfoRec
      structure is
      + not used in Carbon on Max OS X. In Carbon on Mac OS 8 and 9, the
      + accumulated amount of CPU time used by the process is returned in
      this
      + field. In Carbon on Mac OS X, the value returned in this field is
      always
      + 0. Other fields in the ProcessInfoRec structure may also no longer
      be
      + applicable. Available in Carbon 1.0.2 and later when running Mac OS
      8.1
      + or later.
      + */
      anErr = GetProcessInformation( psnPtr, &infoRec );
      if ( ( anErr == noErr )
      && ( infoRec.processType == targetType )


      *** CodeWarrior:Source:vim60w:Make_mpw.mak.orig
      --- CodeWarrior:Source:vim60w:Make_mpw.mak
      ***************
      *** 117,122 ****
      --- 117,133 ----
      "{SharedLibraries}InterfaceLib" 
      "{SharedLibraries}MathLib" 
      "{SharedLibraries}StdCLib" 
      + "{SharedLibraries}MenusLib" 
      "{PPCLibraries}StdCRuntime.o" 
      "{PPCLibraries}PPCStdCLib.o" 
      "{PPCLibraries}PPCCRuntime.o" 
      ***************

      --
      There is nothing left to try
      There is nothing left to choose
      There is no greater power
      Than the power of VI
    Your message has been successfully submitted and would be delivered to recipients shortly.