I finished version 1.0 of MUPhotoView (previously mentioned here). The download includes all the code included in the previous demo application, and additionally supports keyboard selection navigation, better scroll adjustment during photo resizing, and a couple other minor fixes.
Download the source code, project, and documentation here.
Quick Feature List:
- Dynamically resizable photo thumbnails. (Photos provided via bindings or via delegate)
- Flexible selection using the mouse or keyboard. (Implemented in the view via bindings, or via delegate)
- Flexible colors and styles: background color, photo shadows, selection styles and colors.
- Drag support via delegate. (It will ask your delegate whether it should support being a drag source. If the answer is yes and the user initiates a drag, it will ask the delegate for the supported types, and the actual data for each type for each photo).
So download the code and give it a try.
Note that there’s a few things that MUPhotoView doesn’t do yet:
- Performance enhancements: I haven’t made any yet. I wanted to get the code right and documented before looking at performance.
- Drop support: You can’t drag image from the Finder, for example, and drop them on the view. I will likely hook this up via the delegate.
- Titles: Right now, it’s just photos.
- Only NSImage: It would add lots of flexibility (and performance) if it were possible to bind paths or URLs, and then have the view create and release NSImage objects as appropriate. But for now, you have to give it an NSImage.
The code is included, so feel free to implement any of these and let me know!
TAlso please let me know what you think - especially when it comes to photos and selection support both via bindings and delegation. Several implementation details and performance improvements become much easier if I don’t have to support both methods.
Update: The code is licensed with the Creative Commons Attribution-ShareAlike 2.5 license. I’ve updated the code downloads to include this info as well.
Thanks a lot for releasing that! Are you thinking of making a public svn repository for that code?
Awesome! Could you also clarify the license terms? I found something in the comments of a source file that make it sound basically like an attribution license, but it would probably comfort lots of folks to have it clearly spelled out what constitutes acceptable attribution. Also, I suggest putting a separate LICENSE file in there since its conventional and makes it really obvious for somebody looking.
Dale: unfortunately, I can’t do that with my current hosting provider, so no, I can’t do that right now, as much as I’d like to. If I find some time, I’ll look into putting it on SourceForge, but I would rather host it on a personal site if possible.
Daniel: I’ll definitely do that. (And yes, it’s basically an attribution license right now)
Would you have any idea on how I could connect MUPhotoView to an NSTreeController via bindings? I already have an NSOutlineView connected to the controller, but I’d like to use the photoview with it as well. However, I don’t know how to properly connect it, so that it would show all of the parents and their child objects in the proper order (I’ve heard that arrangedObjects doesn’t always work as expected).
MUPhotoView can bind to anything that’s an array of images - so if you bind to a tree controller, each of your nodes should have a member that has an array of images. That’s the easiest way, but without knowing more, that’s about all I can say…