Click here to go to my public source code repositories on GitHub. |
Click here to go to my public source code repositories on GitHub. |
Searching for some cool eye candy to add to my applications, I thought of having the main window flip around to present the preferences window - an effect pioneered by Dashboard widgets. Not finding a ready-made solution I set out to do it myself, and learn how to use CoreImage from Cocoa. So the sample app project has a category on NSWindow to flip from some window to another window. Please read the "ReadMe" file for details and caveats. The code should work on any PowerPC Macs with AltiVec, and any Intel Macs. I've cribbed a few lines from http://boredzo.org/imageshadowadder/ by Peter Hosey, and a dozen lines from http://www.macs.hw.ac.uk/~rpointon/osx/coreimage.html by Robert Pointon. Thanks to both for making their code available. Suggestion are welcome, although I probably won't update this code very often. It still works on 10.5 and 10.6, although rewriting it using Quartz and Core Animation is really overdue. Flipr has been updated to fix an occasional miscalculated second frame position. The sample app also flips 5x slower if the shift key is held down. |
Folks on the #macsb IRC channel were talking about testing if an application was being run from a disk image, and it occurred to me that some code from XRay (already being adapted into XRay II) would be suitable for that. They suggested making a category on NSWorkspace, so here it is. So the sample app project has a category on NSWorkspace which takes a path argument and returns a NSDictionary with some details about the volume and device. The app shows the attributes for its own path first, then you can check any others. Easy to test if the path points into a disk image or network drive, too. Please read the "ReadMe" file for details and caveats. Suggestions are welcome. Please test this on your system and on any weird disk images, external drives or network volumes, and send me the results if they don't look OK. |
Matt Legend Gemmell asked me for some directory iteration sample code and we decided to make it into a public source project. Matt also helped with some additions, revisions etc., and is graciously hosting the SVN repository (note that the latter may not always contain stable code at a given moment though). The sample app shows how to use the FolderSweeper class to iterate over a given folder, recursively if necessary, and also how to optionally get information about every file or folder, or look at file contents. I've used the occasion to show some basic Cocoa and optimization techniques, as well as how to call File Manager APIs from Cocoa. Note those are now pure filtered CoreService APIs, not smudgy Carbon... As Matt says, this code also shows how to:
|