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

11236Re: Integration with Eclim

Expand Messages
  • björn
    Feb 19, 2010
    • 0 Attachment
      On 16 February 2010 03:38, Nicholas Clark wrote:
      > I've done some more considerable digging around in docs but I haven't
      > gotten around to actually doing any code testing. Here's what I have
      > found so far:
      >
      > -         Currently Eclim uses reflection to find fields on the
      > current 'view' that is to house the vim instance. These fields
      > evidently come directly from the local platform API. If this is
      > correct, then finding the OS X equivalent will at least get us this
      > number. According to this page [1] , possible candidates would be
      > windowHandle, windowNum, or windowRef.
      >
      > -         The other piece of the puzzle, then would be take this
      > number in MacVim, and bind to the window it returns, possibly using a
      > method signature similar to the one here [2].
      >
      > This would all have to assume that two things, neither of which I
      > know:
      >
      > 1.       That the id retrievable from Eclim, is a window ID.
      > 2.       NSApplication windowWithWindowId:        can retrieve a
      > window from anywhere, even outside of the same app.
      > 3.       That you could reparent MacVim to this retreived window
      > instead of the default NSApplication.
      >
      > Unfortunately I don't see this being possible, since most likely the
      > only Id we could get in Eclim would be maybe a NSView(although
      > documentation does not list such an id). Also, Id have to agree with
      > Ben in saying that this probably would not be the "Mac" way. I started
      > out hoping we could just do a reparenting operation, but I haven't
      > programmed in Cocoa enough to see this limitation.

      Actually (I only just realized), MacVim is already "ready" for the
      kind of situation you are after...although it will require substantial
      amounts of code added to whichever program you want to embed a Vim
      view in. Basically, MacVim.app is such an app already: Vim processes
      run in the background and send output to MacVim.app to display inside
      an NSView.

      This is (more or less) what you need to do:

      1. Inside -[MMBackend connection] you need to pass the name of the
      connection you want to connect to (this is using Distributed Objects
      so you might need to read up on that). At the moment it always
      connects to the same connection (based on the path of MacVim.app).
      You'll want to be able to pass the connection name as a parameter to
      Vim (analogous to the --socketid parameter for gtk). Your GUI app
      will have to register this name (look at -[MMAppController init]).

      2. Copy all the relevant code from MacVim.app into your app
      (MMVimController/MMVimView/MMWindowController/and many more...). This
      will require a lot of code to be imported into your app and in order
      to modify it to suit your app you'll need to get to know the source
      code intimately (although the source code is fairly well abstracted
      into different modules so it is far from impossible). The biggest
      hurdle will be picking out the "right" bits of code from
      MMAppController.


      I'm not saying that this is a good solution, but at least it is
      possible to embed Vim in whatever app you wish using this method.
      Maybe in some distant future I'll come up with a good way of
      modularizing the MacVim code so that it will be possible to simply
      pull some sort of MacVim.framework into another app and be done, but
      the keyword is _distant_ here. ;-)

      Björn

      --
      You received this message from the "vim_mac" maillist.
      For more information, visit http://www.vim.org/maillist.php
    • Show all 11 messages in this topic