Thursday, April 26, 2007

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.

4 Comments:

Blogger sergey samokhov said...

I think Mr Vonnegut is rather accustomed to being shunted. After all, that's what writing is all about: walking in shadows, keeping your eyes open.

3:46 pm  
Blogger Unknown said...

Sorry to post this here, but I can't post on the forum without joining, and if I accept one more password into my life, I might simply explode.

I'm a writer. Published with Simon & Schuster and Doubleday, mostly. I'm not much of a computer person, though--this is why I love Macs--and am just on OS 10.3.9.

Is there an earlier, pre-Tiger (we're on Tiger now, right?) version of Scrivener available for download?

6:23 pm  
Blogger kayembi said...

Hi Joel, I'm afraid there is no pre-Tiger version of Scrivener available, no. The reason for this is that Scrivener uses Tiger-only technologies for viewing PDF files and QuickTime files, its Spotlight plugin and various other minor features. And it's not really worth upgrading to Tiger at the moment, as Leopard is coming out at the end of the year. But drop me a line if you do decide to upgrade to Tiger or Leopard at some point, and I'll give you a discount on Scrivener. :)
Sorry about that.
Keith

7:56 pm  
Blogger Unknown said...

Thanks for the reply! This just gives me another reason to buy a new computer ... that seems to be the only way I upgrade my OS.

Looks like fun software, too. Anything to reduce the sprawling mess and tedium of outlining!

9:47 pm  

Post a Comment

<< Home