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

Programming filters with Xcode + Interface Builder - Examples?

New Here ,
Nov 10, 2007 Nov 10, 2007

Copy link to clipboard

Copied

Hi,
I've figured out how to make a working PC Photoshop plugin and am now figuring out the Mac side. What is a reasonable method for creating/altering the GUI... e.g. altering the Dissolve filter example's GUI or creating my GUI from scratch?

I looked through the Dissolve filter example and it's not clear how to alter the GUI... the documentation talks about the example being a Xcode project but the .r file doesn't open in interface builder. Perhaps one is to use Metrowerks Codewarrior...? (But I don't have that program and it doesn't look available.) So basically I am thinking I have to figure out how to get the filter working with Xcode/interface builder/carbon. It would be helpful if there was example code for that.

2- I am on the Mactel platform (Macbook Pro).

Any help would be greatly appreciated! Thanks.
TOPICS
SDK

Views

2.6K

Translate

Translate

Report

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
Adobe
New Here ,
Nov 22, 2007 Nov 22, 2007

Copy link to clipboard

Copied

Ok so I've figured out part of the puzzle. You can make Carbon windows normally, with the complication of the plugin finding the NIB properly.<br /><br />I needed to add the following two lines to info.plist (choose whatever identifier you want)<br /><br /> <key>CFBundleIdentifier</key><br /> <string>Whatever identifier you want goes here</string><br /><br />And then in your DissolveMacUI.cpp you might do something like:<br /><br /> IBNibRef theNib;<br /> CFBundleRef bundleRef;<br /> bundleRef = CFBundleGetBundleWithIdentifier (CFSTR ("Whatever identifier you want goes here"));<br /> <br /> err = CreateNibReferenceWithCFBundle(bundleRef, CFSTR("Name of your NIB file here"), &theNib);<br /><br />I'm trying to figure out how to display a proxy in the resulting window. Does anyone have any insights here?

Votes

Translate

Translate

Report

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 ,
Nov 25, 2007 Nov 25, 2007

Copy link to clipboard

Copied

> I'm trying to figure out how to display a proxy in the resulting
> window. Does anyone have any insights here?

Use the Channel Ports suite to get your pixel data out of Photoshop; use the DisplayPixels callback (either from the UI Hooks suite, or from the filter record) to write pixel data to your dialog.

Votes

Translate

Translate

Report

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 ,
Nov 25, 2007 Nov 25, 2007

Copy link to clipboard

Copied

Hi Matthew,

Thanks for the reply. Right now I'm trying to figure out how the DisplayPixels callback works and how to integrate that into my GUI. I thought that you can just use the example code and cast the WindowRefs to DialogRefs (and other Window equivalents to their Dialog equivalent), but this is a dead end path (the WindowRefs need to be made with Dialog manager for that to work it seems).

So it looks like I need to figure out how to use Quickdraw (not Quartz) with Windows, not Dialogs.

Could you point me towards the right documentation to read to figure this out?

Votes

Translate

Translate

Report

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 ,
Nov 25, 2007 Nov 25, 2007

Copy link to clipboard

Copied

Hmm there is an example in "Handling Carbon Windows and Controls"--> Control Implementation Examples (in the documentation that comes with Xcode). I think that might be what I was looking for.

Votes

Translate

Translate

Report

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 ,
Mar 05, 2008 Mar 05, 2008

Copy link to clipboard

Copied

Since i'm also developing a Plugin with a fairly complicated user interface, i would like to know if You've made any progress with the NIB based dialog. Thank You.

Votes

Translate

Translate

Report

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 ,
Mar 05, 2008 Mar 05, 2008

Copy link to clipboard

Copied

It's working for me. You need to use Quickdraw and you need to set the ports correctly.

Make sure you:
//Set the graphics port before calling displayPixels
GrafPtr oldPort;
GetPort(&oldPort);
SetPortWindowPort(theWindow);

//[...]

/* Display the data. */

if (gFilterRecord->displayPixels != NULL)
{
OSErr err;
err = (*(gFilterRecord->displayPixels)) (&outMap, &srcRect, dstRow, dstCol, gFilterRecord->platformData);
}

//Set the port back.
SetPort(oldPort);

//Make the watch stop spinning
OSErr err;
err = PISetWatchSuspension(999); //<--not sure about this line, but do something like that.
InitCursor(); //This seems to fix a bug where the watch cursor needs to be refreshed.

Votes

Translate

Translate

Report

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 ,
Mar 05, 2008 Mar 05, 2008

Copy link to clipboard

Copied

Just to make sure i understand (because this is my first Mac OS project ever):

You've written a Plugin for Photoshop in XCode, using Carbon and Interface Builder and You display pixel data from the current photoshop document in the Window created by IB ? Because that's exactly what i need to do :-)

Thank You.

Votes

Translate

Translate

Report

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 ,
Mar 06, 2008 Mar 06, 2008

Copy link to clipboard

Copied

Yes.

I think there may have been some other gotchas that I forgot about... because I did not use Dialog Manager (Interface Builder won't do it, but the example code uses it). It's something like that; my memory is hazy. So I used the Window manager, and you sometimes need to create the equivalent functions to what the Dialog Manager is doing. And you can't convert Windows into Dialogs. You need to convert from Dialog Manager to Window manager.

Votes

Translate

Translate

Report

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 ,
Mar 07, 2008 Mar 07, 2008

Copy link to clipboard

Copied

Ok, now my dialog (by IB) is displaying and is handling events and i can draw into it. Next problem: I need the pixels from the current photoshop document for a preview. Where do You get the "gFilterRecord->displayPixels" from ?

Votes

Translate

Translate

Report

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 ,
Mar 08, 2008 Mar 08, 2008

Copy link to clipboard

Copied

Did you take a look at the Dissolve example code? I would start from there and convert that code into Window manager.

My last message was assuming you were working off of the Dissolve sample code.

Votes

Translate

Translate

Report

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
Participant ,
Mar 09, 2008 Mar 09, 2008

Copy link to clipboard

Copied

Christof: I have code for previewing. See http://www.telegraphics.com.au/svn/filterfoundry/trunk/preview.c (GPL).

Votes

Translate

Translate

Report

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 ,
May 18, 2008 May 18, 2008

Copy link to clipboard

Copied

Hi
Can u please send me the code for how to work with POP UP and buttons and how to handle events on varios events like when u select something from pop up and when u click on button.
and how to open a new window when user clicks on the buttons.

Votes

Translate

Translate

Report

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 ,
Jun 02, 2008 Jun 02, 2008

Copy link to clipboard

Copied

I've found that it's a hell of a lot easier to just do a Carbon NIB-based user interface than to try to deal with all of that antiquated crap that's in the sample code. I have quite a sophisticated UI working now in my filter, including a preview control, and it didn't take me any more effort than it would have if I were coding it in an application. Even the debugger works, as well as Xcode/GDB ever works (which isn't saying much).

The only trick is that you have to load the NIB file manually. Here's the code to put up your dialog:

IBNibRef dialogNibRef = NULL;
WindowRef windowRef = NULL;
CFBundleRef bundle = CFBundleGetBundleWithIdentifier(kMyBundleIdentifier);
CreateNibReferenceWithCFBundle(bundle, kMyNIBName, &dialogNibRef);
CreateWindowFromNib(dialogNibRef, kMyWindowName, &windowRef);
DisposeNibReference(dialogNibRef);

Having done this, you can show the window using RunAppModalLoopForWindow.

Hope this helps,
Aaron

Votes

Translate

Translate

Report

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 ,
Mar 18, 2009 Mar 18, 2009

Copy link to clipboard

Copied

Hello,

I currently have several Photoshop plugins available under Windows which are created using Visual Studios 2005 and I am trying to find an example plugin in the Photoshop CS4 SDK environment which I could practice on. My goal is to edit the dialogs/UI of the plugin and finally just add connect existing functionality.

The ultimate goal is to implement existing PC Photoshop plugins under Mac OS Systems using the Adoble Dialog Manager and API architecture. A cross platform solution for both PC and Mac is desired.

Could someone please direct me to a simple example in the Photoshop CS4 SDK environment or a good tutorial, as I am a working student with little C++ programming knowledge.

Thank you in advance,
Andreas

Votes

Translate

Translate

Report

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
Participant ,
Mar 20, 2009 Mar 20, 2009

Copy link to clipboard

Copied

ADM has long been deprecated. Some developers are using Qt for x-platform UI, see other recent threads.

Votes

Translate

Translate

Report

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 ,
Apr 02, 2009 Apr 02, 2009

Copy link to clipboard

Copied

LATEST
>The only trick is that you have to load the NIB file manually. Here's the code to put up your >dialog:
>
>IBNibRef dialogNibRef = NULL;
>WindowRef windowRef = NULL;
>CFBundleRef bundle = CFBundleGetBundleWithIdentifier(kMyBundleIdentifier);
>CreateNibReferenceWithCFBundle(bundle, kMyNIBName, &dialogNibRef);
>CreateWindowFromNib(dialogNibRef, kMyWindowName, &windowRef);
>DisposeNibReference(dialogNibRef);
>
>Having done this, you can show the window using RunAppModalLoopForWindow.

Could you please explain these steps more in detail Aaron. I've setup a UI using the Interface Builder and have put the above mentioned code into DissolveUIMac.cpp but i am getting the following errors:

error: 'kMyBundleIdentifier' was not declared in this scope
error: expected constructor, destructor, or type conversion before '(' token
error: expected constructor, destructor, or type conversion before '(' token
error: expected constructor, destructor, or type conversion before '(' token

Votes

Translate

Translate

Report

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