THCanvasView 1.0.1 and PhotoStacks Sample App
The newest version of THCanvasView adds some obvious features, such as draggable selection rects and basic item arranging. There are now better options for coloring and the generated image previews get frames and drop shadows.Downloads: THCanvasView 1.0.1 (32k) | THCanvasView + PhotoStacks (140k)
THCanvasView 1.0.1 changes:
- Added framing and shadowing to image preview generation
- Added basic item arranging
- Added basic support for selections via Cocoa Bindings
- Added draggable selection rects, aka "rubber band" selection
- Added support for changing background color
- Added support for changing item label color
- Added optional shadowing for item label text
- Added "properties" dictionary to THCanvasItem to support image previews
- Minor drawing optimizations
- The ".app" extension is now hidden in app packages
- Fixed a bug where items could get "caught" during a drag
There's also a new sample app, PhotoStacks. The idea here is mostly to highlight that the view can be used for more than just Finder icons. It's a pretty simple app which accepts dropped photos which can be arranged manually or automatically. When you click an item you get a larger image preview to the right.
Enjoy.
THCanvasView 1.0.1 and PhotoStacks Sample App
Posted Oct 14, 2007 — 11 comments below
Posted Oct 14, 2007 — 11 comments below
Volker — Oct 15, 07 4742
Rup — Oct 15, 07 4743
As THCanvasView seems not to have been just a one-shot deal, I will add my own requirement : could you add right-click contextual menus ?
Great job, thanks for the contribution.
Rup
Scott Stevenson — Oct 16, 07 4744
Yes, although it's not completely clear to me what the content should be. It seems that's usually application-specific?
Blain — Oct 16, 07 4756
As it's a NSView subclass, wouldn't it already have a menu outlet? And you could always subclass THCanvasView and override -menuForEvent:. But all the cool kids use delegates.
- (NSMenu *)menuForEvent:(NSEvent *)theEvent; { if ((_delegate != nil) && ([_delegate respondsToSelector:@selector(canvasView:menuForEvent:)]) { return [_delegate canvasView: self menuForEvent: theEvent]; } return [super menuForEvent:theEvent]; }
Adding delegate accessors is left as an exercise to the reader.
britt — Oct 18, 07 4770
Also, the other things I need to add are support for keeping things sorted after the user drags in an icon, snap-to-grid, and scaling of icons & grid.
P.s. obviously, I can't release any of my changes until after Leopard goes public; but I will post them afterwords.
Scott Stevenson — Oct 18, 07 4771
I did start looking at doing that, yes. I may not be any further along than you, though.
britt — Oct 18, 07 4772
So... who want's to tackle what? As I said; I'm happy to do it all, or none of it; just tell me which bits you are gonna' do, and I'll do the rest...
:-)
Scott Stevenson — Oct 18, 07 4773
My plan is to first do a rewrite using layers, and then look at what that opens up. If you want to ride the wave, I'd say wait just about 10-14 days. If you want to share anything prior to that, feel free to email it to me.
For what it's worth, I think it will be a interesting case study of contrast between Tiger and Leopard drawing.
britt — Oct 18, 07 4775
:-)
Tom — Nov 04, 07 4976
Really love this sample btw - thanks!
Nick — Apr 04, 08 5700
With a few additions it could easily become the lightweight lightbox app that I have needed for years.