Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Using Nib files in XCode Project

New Here ,
Aug 13, 2008 Aug 13, 2008
Hi all,

we are building a Mac only plugin that has a lot of interface elements. Now all is done in .fr files but this is getting harder and harder to maintain and takes a lot of time to implement.
I have seen plugins already that use native nib files and thus take advantage of all the nice Aqua interface elements.
My question is if anyone has experience on how to implement this in a plugin project. (For example haw to load a window etc.)

Any help or sample code would be greatly appreciated.

Thanks in advance,
Florian Soenens.
TOPICS
SDK
1.1K
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 13, 2008 Aug 13, 2008
I did not know I could use nib files to layout InDesign plugin and use it out of the box, could you tell me where the example.

Thanks.

pete
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 13, 2008 Aug 13, 2008
Peter, i found this plugin: http://www.roguesheep.com/magmapage/index.html
Just look at the screenshots and if you download it and look at the package contents you will see a file Plugin.bundle. Look at the package contents of this and you will see a lot of .nib files.
I'm very eager to learn how to implement this myself.

Kind regards,
Florian.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 13, 2008 Aug 13, 2008
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Guest
Aug 13, 2008 Aug 13, 2008
I can tell you a bit about how we used Cocoa UI elements in the Magma Plug-in. When we created the project we wanted to target CS and CS2, so we had to do something that would work with Mach-O and CFM applications. This meant that our Cocoa code had to be in its own loadable executable bundle. We placed all the UI and most of the functionality in this separate code library.

The InDesign plugin adds a few menu items and a bit of standard plugin code and a bit of code to handle manipulating page items and linking to new images, but is mostly just a shell around this separate plug-in bundle. The bundle exports a C interface that is the bridge between InDesign and the Cocoa code in the bundle. The InDesign plugin loads the bundle when needed and then uses the C-interface to bring up the modal Cocoa UI.

One thing to consider is that you can use Carbon UI widgets with Interface Builder and nibs. You could use this technique to take advantage of Interface Builder, but you are still stuck with the Carbon world for handling events and the controller code.

You can also now fairly easily use Cocoa right in an InDesign plugin with no loading of a separate bundle, by following the instructions in Peter's link. Its mostly just making sure that you initialize the NSApplication runtime before you start running cocoa code and doing the right thing with NSAutorelease pools. Note that there are challenges at the fringes of handling events and you will have to of course glue all the Cocoa code to the InDesign model and other APIs as needed. Its quite a bit easier to do this in a modal dialog or even a mode-less floating Window. Of course the contrast in UI of having your own normal Mac OS palette mixed in with InDesign's regular Adobe palettes is not necessarily a good choice for users. I'm not yet convinced if this route saves you a lot of effort unless you are needing UI elements that are not in the standard InDesign widgets.

It may be possible to create an InDesign ControlView to host cocoa UI for use in a regular InDesign palette. This would be similar to how the CS4 applications are hosting Flash based UI in palettes. You could perhaps create this new ControlView so that was associated with a nib that it loaded and used for its children. You would probably have to have this control view go back up to its containing window and offset the views it loaded in the nib based on its current location in the window.

The trickiest part I think would be event handling. I just don't know enough about mixed Carbon/Cocoa event handling to predict what problems you might run into making sure mouse and key events do the proper thing in this situation.

-- Chris
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Explorer ,
Aug 14, 2008 Aug 14, 2008
Hi Chris,

Thanks for sharing the design of your plugin. I am also worried about event handling part, even mixing with Carbon Events with the InDesign API's itself...

Although I would love to experiment, the future of Carbon really put that idea low on my list now (I don't have any urgent need for that, anyway).

pete
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 17, 2008 Aug 17, 2008
LATEST
Chris, thanks a lot for sharing your ideas!

I will start by reading the document Peter linked to.
I do think i will have a use for it for the stuff we are doing...

Thanks again and kind regards,
Florian.
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines