What tools are needed to build plugins for Photoshop CS5? - xcode

I have found plenty of articles and how-tos online about making plugins for Photoshop on a Mac. Trouble is, many are old, apply only to CS1/2/3/4, or refer to tools or APIs that (it appears) are obsolete. Some articles say you must use CodeWarrior, but it seems this no longer even exists in the Mac programming realm.
Today, in 2011, making plugins only for CS5 and only on a Mac running Snow Leopard, what is the proper toolchain and what libraries/APIs/frameworks should I be using?
I've gotten the impression that Carbon (whatever exactly that is) is old and to be avoided, but it's not clear if that's true for plugins. I am not clear as to whether I should use Cocoa (whatever that is) or not. I do think I will need Core Foundation (whatever...) Is there a choice about 64 vs. 32 bit or is CS5 purely 64 bit and that's that? (I prefer 64 bit, of course.) I do have the Photoshop CS5 SDK, and Photoshop CS5 itself installed.
Can XCode can be used as an IDE? I'll hand-code a makefile and compile at the command line, if that's easier or the only way possible. If XCode can be used, which project template to use? What is this "Mach-O" I read about, and how does that apply to PS plugins?
It's especially confusing since I'm a total noob at Mac programming of any kind, though many years experienced on Linux and other platforms.

Mission accomplished! (Months ago.. I just realized I had this question sitting here.)
Cocoa is useful for GUI settings windows and other things - it's a huge gob of stuff - but I ended up using it only for the "About" popup window for my plugin.
Completely forget about Carbon for the combination of CS5 or later, OSX 10.6 or later, and 64 bit. Apparently parts of Carbon had been made 64 bit in the past, but should be ignored now.
XCode is a fine editor. Start with a "dylib" project using C. C++ and Obj-C source files can be added without any fuss. There's no way getting around just needing to use XCode for some simple toy projects to gain familiarity with how it organizes things and builds apps and libraries. This is the only real "tool" needed; the rest is APIs - header files and libraries (or "frameworks" in the Apple world). While toying with XCode, get to know what a "bundle" is - a folder containing the executable and other files needed by the app.
Paths need to be set up to the Photoshop CS5 API, there being two or three specific directories to be listed. You may need to copy certain common source files out of the Photoshop example plugins directory, and there was a bit of trouble with a file named MachOMacrezXcode.h about which see What is the meaning of exit code 3 from Rez?
Unfortunately there were no truly useful examples of well-written plugins for CS5 on 64-bit. A combination of the Dissolve example, the SimpleFormat file read/write plugin, browsing source for plugins at http://www.telegraphics.com.au/sw/product/FilterFoundry and asking questions on the Adobe Photoshop SDK forum.
Pay no attention to the clumsy process of using some "Plugin Suite" for obtaining memory. It's like Microsoft's old 16-bit Windows API where you needed "memory handles" and thick malarky that is now several times obsolete. These days, good ol' malloc/free or new/delete are fine.
With all the arrowhead wounds I now have in my back, maybe I should write a book or something...

Related

MS Windows Programming advice for Mac/Unix developer

I have a few years of experience writing Unix command line tools (no GUI experience) in python, C and C++, and only recently crossed into the GUI world (Cocoa and IOS only). I've learned quite a bit of objective-C and am getting to understand how cocoa MVC works. However, one of the apps I am developing needs a Windows version and I was wondering what a good place to start would be given that I have absolutely no Windows development experience.
I was thinking about using Visual C++ 2010 Express as my development platform (because it's free and because I don't need to learn C++). My application is relatively simple, it will have only two windows and spend most of the time running in the background. It will however need to communicate with the OS (load dll's etc) and an online server (HTTP methods) and I'm not sure whether Visual C++ Express edition gives me access to the required API's. Would a Windows Forms application suffice? Am I going about this the wrong way? Do I need to learn C#? Any advice will be appreciated.
If you are already happy with proper c++, visual Studio C++ express should suit you fine. Given that you are not making a complicated GUI, you don't even need to dip into the managed code - C++ express allows you to create proper c++ console and GUI apps. You also don't need to install the platform SDK - it is part of VS C++ express.
Not being managed C++, you will be able to share source files between your various projects. managed c++, despite the c++ in the name, really is a different enough language that it will be annoying to work with if you simultaneously have to deal with iso C++.
--
Note: The native windows API is a C api, not a C++ framework. So it does not provide a rich set of classes in a coherent framework to deal with. On the other hand, while, large, it is actually quite simple to work with.
Also: Given that you are already familiar with Mac development, there is a LGPL (iirc) package called CFLite that builds on windows and that implements the C api that underlays the Objective-C Cocoa API.
If you use its abstratcions you can share a greater part of code between windows and Mac (and other platforms).
Other C++ IDE's you might want to consider:
Code::Blocks
QT Creator
both of which can be configured to use the MINGW port of GCC to windows.
you'll be better off with c++ than c# if you need more "low-level" stuff. Loading dlls (that is, libs) is simple (pragma comment lib...), as is pure HTTP transfer and communication.
So, VC++ with windows form will suffice, and it is "very c++".
You have access to all global APIs, and loading specific apis like http requires only two lines: one to include wininet header, and other lib (libs are actually "references" to dlls).
If you go the C++ Express way then you need to install Windows SDK separately, and set it up for Visual Studio to use it. And you can't use MFC.
I would however, suggest C#, because it feels like putting little toy bricks together. Easier to debug and maintain. Problem with C# is that it has so many library functions that you can not possibly know if what you want is already made to a function. But that's why we are here :-) If you feel that something you want to do should already exist then ask a question about it. One notable feature that C# lacks is zip archives (it has something similar, but not quite). For zips you can use public libraries, like SharpZipLib or DotNetZip.
If I were you, I wouldn't jump into a whole new API so quickly. Have you considered using Python on Windows? Most of the Python packages I've seen are also available for Windows, so you'll feel at home. And if you need some GUI, you can opt for wxPython, pyGTK or something similar.
For Windows specific things, you can always use ctypes. Especially if they're as simple as loading a DLL.
have you considered approaching Adobe AIR? it allows you to deploy on Mac, Linux, Windows, iOS, etc. communicating with and launching native processes has been possible since 2.0 and the the latest 2.5 SDK can target Android OS and TVs. with your experience you should be able to pick up ActionScript3 / MXML in no time.
additionally, there are a handful of free IDEs you can use with the Flex and AIR SDKs. or, if you're a student or low-income developer, you can get a free copy of Flash Builder 4 from Adobe: http://www.adobe.com/devnet-archive/flex/free/
edit: i believe deploying AIR applications on iPhone requires Flash Professional CS5, which includes the packager for iPhone options. at the same time, i've read that AIR and other cross-compilers for iOS are painfully slow, so it's perhaps best to develop natively in Objective-C for iOS.

PC to Macbook Pro Transition - Getting (re)started?

I'm in my second computer science course right now. I've enjoyed programming so far, but really have just scraped my way by. I've not done much programming outside of required class work. For similar reasons, I never really invested in downloading/learning software to help me program (IDE's, editors, compilers, etc).
I know it sounds tedious, but my current setup is: notepad++ for coding; Filezilla to transfer .cpp & .h files to school's aludra/unix and compiling; unix tells me where my bugs are and I go back to notepad++ to debug; repeat until done.
This isn't fun - and I know it could be easier. But I put it off knowing that I was soon going to switch to a Mac. And, tomorrow, I'm switching.
So...
How should I set up my Macbook for the best programming experience?
What IDEs and editors and debuggers and so on should I download?
How will Mac programming differ from PC?
I'm open to all ideas and comments, even the most basic.
(Background - I'm learning/programming in C++ right now. Next semester, my classes switch to Java. I'm also going to take a class in web development, with HTML/CSS/Javascript/PHP. My new laptop will be a late 2009 Macbook Pro with Leopard, or maybe Snow Leopard. Free would be preferrable for all programs.)
Thank you all.
How exciting for you, I'm sure your new lappy will be able to make your life as a novice programmer much, much simpler.
Here's what I would do.
Download and install eclipse. It's free, and it's a very good IDE to have if you're going to program java. There are versions available for c/c++ and php as well, and there is a silly amount of great plugins for just about anything you'll ever need. Get it here.
Get the subversive plugin to your eclipse. It will make your life so easy when it comes to managing your code through svn. You can download the plugin through eclipse.
Download Ruby. Ruby is (imho) a great language for beginners, and the irb environment is very handy for trying little things out. Get it here.
Get emacs. Emacs is a great editor, and it's free. Use it for editing your system files, or for coding if you find it suits you. Get it here. (I can also recommend Textmate, it's a really good editor, but unfortunatly not free. If you want to spoil yourself a bit, though, I'd really recommend it.)
If you're doing modelling, you should definitly treat yourself to a licence of omnigraffle. It will definitly make your life easier, and it will let you draw models like nothing else. Get it here.
I would advise you not to bother with macports. Generally I find it will install everything, everyone and their dog on your lappy evertyime you use it, and that gets tedious pretty quickly.
If you're doing any php-stuff, get MAMP. MAMP puts you three clicks away from a running apache, mysql and php-setup without you so much as thinking. Very good piece of software, I think. Get it here.
For the rest of it, just download stuff when the need arises. Most of the things you'll need to install comes in handly little installer packages, and you won't need to know much in order to get them installed and working on your computer.
All the best of luck to you!
You definitely need Developer Tools from Apple. They include:
XCode, a very good IDE and editor
InterfaceBuilder
gcc, g++ and clang to compile code, in various versions
gdb as debugger
Instruments for performance analysis
as well as a lot of other utilities to program in C, C++, Java, Objective-C and Objective-C++.
Python, Ruby and PHP interpreters and libraries come preinstalled with every Mac so don't bother installing it by hand. (the Apache web server is also included, so you only need MySQL to have a full MAMP stack)
The Developer Tools package comes with every MacOSX DVD but I recommend you to download the latest version directly from Apple (it requires a free Developer account).
Once you installed it put XCode in the Dock and that's it! No other stuff needed.
NB: This is the simplest and only supported way of getting compilers and debuggers for C-based languages, even if you won't use XCode as an editor.
Speaking of editors, I recommend you to stick to XCode for a while because it is simple enough, yet very powerful, and it's free.
If you don't like it try TextWrangler (free) or TextMate (paid).
Vim and Emacs are two other good editors, but I don't recommend you to try them right now because they use obscure and non-standard key combinations, so you will spend a lot of time learning how to use them instead of programming.
Anyway the best thing you can do is to learn one editor very well, the effort in learning it will surely pay off every day.
Eclipse is the best editor for java. It's available on a mac for free, just as it is on windows.
There's a good text editor made by barebones software called text wrangler. It's free, and is good about syntax coloring for basic editing.
The best of the best for web development on mac is a tie between text mate and coda. If you're going to be doing a lot of web development, they're worth the investment.
To run a test environment in mysql/php, download MAMP (the mac counterpart to WAMP). Google search it - it's free, and really easy.
Mac programming doesn't differ at all from windows programming if you're writing java, php, etc., because it all goes the same place. Java just boils your code down differently depending on your machine, but it does the same stuff. PHP will probably be held on some sort of linux distro, so it's the same on both. C++ is the same given the appropriate compilers.
Enjoy your mac!

actionscript development on mac

I know of FlashDevelop for windows but how about developing actionscript or haxe on a mac? besides flex plugin for eclipse, flex builder and FDT is there anny good IDE out there for actionscript development on mac? I would really like to se a good plugin for netbeans but it looks like all the projects on making something like this has halted.
I have tried using MacVim with various plugins but i never get it to work and it looks to be a hard learning curve to get starting using vim.
What is people using to develop actionscript/haxe on a mac?
I use TextMate with the ActionScript bundle. But, that is a far cry from a decent development environment.
FlashBuilder or FDT are probably the best options. I've spent a lot of time looking for a good free option - though I haven't done a check in the last 6 months, or so. The actual Flash IDE might be the best no-additional-cost option, if you use Flash.
There is supposedly a way to set up your environment to use XCode, a stand-alone compiler, and one or two other things, but I could never find good documentation or evidence of someone actually getting things working.
There is, or was, a Mac version of SePy, but it was horrible, as of a year and a half ago when I gave up on it.
I've been using FlashBuilder on my work machine for Flex work, but I think I'll start using it on my personal machine for Flash work. Just haven't come across anything else that even approaches a modern dev environment for Flash.
Sorry I don't have more helpful information. Would love to hear someone say different.
UPDATE: Found some so-so info on setting up various elements of a full development environment on Mac, using free tools. Doesn't look like a lot has happened on this front in the last two years.
OpenCode - AS2 and AS3 language definitions for XCode. This goes back to 2006, but may still be completely useful.
Xcode and the Flex SDK - A tutorial on setting up a code and compile environment with XCode and the mxml compiler. Author notes that the information may not be 100% accurate and lost interest once he started using FlexBuilder.
Make Xcode a Full Featured Actionscript IDE - FlaXIDE - A tutorial on setting up a full dev environment with opensource tools. Last updated in 2006. Could be modified to work with current tools (i.e. haxe instead of mtasc).
Flex Support for Xcode 3 - Somewhat more recent info on using Xcode as an AS editor. Posted November of 2007.
Core SWF: Flex/AS3 for Xcode - Even more recent info. This seems to be the latest thing going for using open source or free tools to build an AS dev environment on the Mac. Posted July of 2008. This project is up on Google Code and contributors are welcomed.
I have heard good things about IntelliJ IDEA lately but haven't really tried it out myself. I use TextMate, the AS3 bundle and Flash CS4.
The best thing would probably be if FlashDevelop was ported to Mac, but as I understand it, that is not about to happen, despite years of requests for it.
Check out the "sugar-hx" textmate bundle. There's an overview here:
http://haxe.org/com/ide/textmate/sugar_hx_textmate
It includes the compiler-based contextual autocompletion, import helpers, build helpers, and output embedding for swf and js.
I know this is old, but I stumbled upon it, so I suppose other people might as well.
I'm using Sublime Text 2 for AS3 development, and I'm quite happy with it. I use alongside the Flash IDE.
http://www.sublimetext.com/
It's a very powerful and customizable text editor. It's similar to TextMate but much faster and modern... and also cross platform. Many people (like me) got fed up waiting for TextMate 2, and started using ST2.
ST2 is way too deep to number all it's features, but here's a good introduction:
https://tutsplus.com/course/improve-workflow-in-sublime-text-2/
Instead of bundles or plugins, there are packages. ST2 includes a basic AS3 package, but many people are developing their own. Here's mine (still in beta):
https://github.com/PierBover/as3-utils
For Haxe, I'm using gedit on both Mac and Ubuntu. There is a plugin for Haxe which includes syntax highlighting and code completion.
For installing the plug-in on Mac, put the folder
"haxecodecompletion" and the file "haxecodecompletion.gedit-plugin" inside "/Applications/gedit.app/Contents/Resources/lib/gedit-2/plugins".
Similar for the syntax highlight but a different folder.
There is Flasm (which is a working AS2 Disassembler) and perhaps with permission by its creator, who is not updating, re-produce it into an AS3 Disassembler?
I have had this working, and was for me as close to RABCDAsm / Yogda as I could get.

Best approach for building a multiplattform graphical interface for a command-line application

I developed a command line application, whose binary runs in Linux, Windows and Mac OSX. It reads some text input files, but I realize that some special users can not handle this. I would then like to build some kind of graphical interface, where the user only finds buttons and scroll bars for selecting the input parameters, a big "run" button, and then it reads the output of the program and makes some figures.
I also need that everything gets finally packed in a single file, which uses only static libraries, so the user just needs to copy the file to his/her machine and run it.
I would like to know what is the best open source and multi-platform approach to do this. 10 years ago I played a bit with something similar on DEC machines, so I guess that nowadays the situation has probably improved a bit.
P.S. For designing the graphical interface, I am looking for a graphical approach, where you add buttons, scroll bars with the mouse
P.S. 2: the interface is really simple, just need less than 10 buttons, 5 text fields and 2 scrolla bars
Thanks
For advanced UIs, I would generally recommend writing a different UI for each platform (since each platform has its human inteface guidelines). However, is this going to be a simple UI, then one of the cross-platform UIs.
You also didn't mention what language you want to use.
Lastly your "1 exe file" is a bit of a myth - it applies only to Windows. On MacOSX, we use the magic app folders, so it doesn't matter how many files comprise your app, you still get drag-n-drop installs.
Look into GTK+ which originated on Linux, or wxWidgets.
Tcl/Tk is a perfect choice. No other language provides as good of a deployment solution. You can create a virtual filesystem that has your application along with icons, sound files, etc into a single file for each platform (called a 'starpack'). You can even include binary executables and libraries, though those have to be copied to the actual filesystem at runtime to be used.
You also have the option of a two-file deployment -- a platform-specific runtime called 'tclkit', and a platform-independent application file called a 'starkit'. The one starkit will work on all platforms without recompiling, rebundling, etc. It can even have platform-specific parts built-inside and chosen at runtime.
A professional Tcl/Tk developer could do a front end to a command line program in a day without a graphical GUI design tool, easily. If you're new to tcl it will obviously take longer, but that is true of any language. The point being, Tk is remarkably easy to use and doesn't require a graphical GUI designer.
For a cross platform UI, you can use GTK (if using C) or QT (if using C++).
If you can live with a rather huge application package to deliver be sure to look at https://electronjs.org/ You can keep your functionality in your commandline apps and build a modern look and feel UI using HTML5 CSS JS and before thinking "this is ridiculous" consider that Microsoft's Visual Studio code is built on this and compared to GTK / wxWidgets you can do wonders with this. It isn't even hard to do but you either love it or hate it. I'm still undecided...

Switching from wxWidgets to QT for porting to Mac?

We are selling an image processing application (about 120k lines of code) developed with wxWidgets. We planned everything to be as most cross platform as possible in case the porting from Windows to other OS was needed. And in fact we are going to realiza a version for Mac.
We haven't tested wxWidgest on Mac yet, but we haven't read very good things about it.
In general, do you think is it worth to port from wxWidgets to QT? Do you believe it will be an hard and long job?
Is QT for Mac much better than wxWidgets implementation?
Is QT much more productive that wxWidgets?
I would like to add that we would'n like to keep code bases for gui, so the choice is just wxWidgets vs QT.
Test your application on Mac, and then decide. If there are only a few wrinkles to iron out, why put in all that extra work to switch toolkits?
It will be a long hard job. Without knowing more about your application and situation, it is hard to say whether making the switch is worth the effort. I do know that I would rather work on a Qt app than a wx app.
I have a friend who recently switched a significant wx application to Qt, and he is quite happy with the change. Mac support is one of his (boss's) important features, but I think wx's support for Mac was adequate, if not stellar.
My experience has been that Qt is definitely more productive than wx.
It is worth noting that wxWidgets on the Mac is transitioning to Cocoa. This should be done for wxWidgets 3.0, but is testable with the development release wxWidgets 2.9 now. Is Qt Cocoa or Carbon based?
We have an application that runs under Windows and the Mac, built using wxWidgets. The application performs very well on both platforms.
I recommend switching over to Qt. wxWidgets is a GUI toolkit, whereas Qt is an application framework with much, much more features.
I can't say anything about their mac implementations, but i can clearly say that i am far more productive using Qt. When i was using wxWidgets, i was a student and then when i got a job, i started using Qt.
wxWidgets gave me a feeling of incompleteness, but as i said, this may be caused by the fact that i was an inexperienced student but nonetheless, i think Qt is way better.
Until you have investigated more and have a good reason(s) to switch toolkits, then absolutely not.
We are using wxWidgets for Linux & the like, Mac, and Windows. It's a great toolkit and certainly much more than just a GUI.
Like dtw and NuSkooler, we are using wxWidgets on Mac (carbon/cocoa), Linux (32/64), Windows (32/64) and all works fine. In wx, we use gui, filesystem, threads, html libs.
+1 for Qt
I have used both wxWidgets and Qt extensively on different projects for the Windows platform writing C++ applications.
Having used both and compared the two after, I would absolutely use Qt over wxWidgets. You need to consider (as some of the others have pointed out) if the re-factoring effort is is something you have time for and are willing to do.
Also consider the cost -- this may not matter in your situation, but unlike wxWidgets, the Qt Library is not free for commercial use. I have spoken to TrollTech at length and read through their licensing agreement to verify this; you definitely have to pay unless you GPL your application.
Regarding licensing see:
http://qt.nokia.com/about/licensing/frequently-asked-questions
"Will you continue to offer Qt under a
commercial license?"
"Yes, absolutely. Our commercial
licensing will continue."
"Why would I want to buy a commercial
license? What is the difference?"
"The commercial Qt license includes
email support, access to upgrades and
allows you to develop fully closed
source software. The LGPL carries some
restrictions regarding the ability for
users to relink libraries and other
restrictions that may impose
architectural requirements that some
organizations might not be comfortable
with."
Qt is definitely worth the money though, even if you are not doing cross-platform development. It has a lot more and better documentation. Qt and wxWidgets are not perfect... The fact that they are bloated and provide APIs for networking, data structures, and database handling is not necessarily a good thing. Sometimes sticking with the STL or Boost libraries (if you're coding in C++) is a much better solution.
Good luck.
-bn
+1 for wxWidgets. A big project of mine used wxWidgets and found it a nice framework to use, and an easy enough framework to get your head around to modify if you need to (to support Mac specific features).
Try it: you could be 80% there when you first generate the binary.

Resources