Mail 2.0-style split views
Just recently I've been invited to join a sort of round table discussion with several other UK-based Mac developers. It's been interesting so far, but I found myself moaning and bitching about the lack of frameworks available for common OS X controls. This, of course, is a career hazard of being a teacher - you end up moaning a lot. So I thought I ought to make amends.
Just recently I've been updating Scrivener's split views to look more like those in Mail in Tiger, as this seems to be the way that the Mac interface is going. I was a little reluctant to do this at first - indeed, I considered Mail-style split views when designing Scrivener 1.0, but decided against them because I liked the 16-pixel separation between binder and main text. But these days, after several interface tweaks, I feel the new splitters might fit. Besides which, I think that if I don't implement them, Scrivener may start looking dated if I'm not careful - maybe not yet, but it's good to get in there ahead of time. Or something.
So, I rolled my own solution. I enhanced the NSSplitView subclass that Scrivener uses so that it could be drawn with a single-pixel divider (and, as of 1.03, I also added functionality for it to state-save to file rather than just to user defaults so that split view state can be saved as part of the document, which is often desirable for document-based apps). I also wrote my own grab-handle class, SCRSplitViewResizer (by "grab handle", I mean the grabber that you click on in the footer view in mail to resize the split view). My class only handles the resizing of vertical split views, but then, outside of Path Finder, I haven't seen any apps that use grabbers for horizontal split views anyway. My grabber does have to handle resizing regardless of whether it's placed on the left or right of the splitter, though.
Now, lots of folk have rolled their own grab handles and single-pixel split views, I know. But, to my knowledge, the only one publicly available is RBSplitView. So, to make amends for all that bitching I mentioned, here is mine:
http://www.literatureandlatte.com/downloads/SCRSplitViews.zip
This is the code that Scrivener 1.04 is using. It works pretty well. If you have the need of a Mail-2.0-style split view, feel free to use it however you wish.
And the sad thing is that I am posting about the most ephemeral of phenomena - code classes - when my favourite author of all time died only two weeks ago. I didn't even blog it. I did shed a tear, though. God bless you, Mr Vonnegut (though I don't think that Vonnegut believed in a god any more than I do). My life changed for the better when I read Slaughterhouse 5 at nineteen. This really doesn't belong shunted at the end of a post entitled "Mail 2.0-style split views". Ho-hum.