Free Stuff

Here you will find freeware applications for Mac OS X along with source code that Mac developers may find useful.


Software


IcnsToTif
IcnsToTif does what it says on the tin: it converts .icns files to .tif format. You can do the same in Preview, but I find that Preview often messes up the transparency. IcnsToTif also allows you to batch-convert all the images inside an .icns file to .tif format. Freeware.
Requires Mac OS X Tiger (10.4) - Universal for both Intel and PPC (may work on Panther)

MultiTIFF
This is a really basic program that may come in useful for programmers or designers working on Mac toolbar icons. Toolbars in OS X can be set to "Use Small Size" by ctrl-clicking on the toolbar. When the toolbar is set to "small size", icons are drawn at a size of 24 x 24 pixels; otherwise they are drawn at the regular size of 32 x 32 pixels. If you supply your toolbar icons as 32 x 32 pixel .tif files, they get scaled down automatically to 24 x 24 pixels when the user chooses "Use small size" - but the results aren't always ideal. However, if a .tif file contains two representations, one of regular size and one of small size, when the user sets the toolbar to use "small size", OS X will use the second (smaller) representation inside the .tif file rather than rescaling for you. This means that instead of relying on OS X to scale down your toolbar icons - which will result in fuzzy icons in small-sized toolbars - you can provide your own 24 x 24 pixel icons inside your .tif files and the OS will use them when appropriate. To the best of my knowledge, though, there's no way to do this in Photoshop (representations are different to layers), and I couldn't find many image programs that made it really simple to create .tif images containing multiple representations. So MultiTIFF just does that and nothing else: you drag one 32 x 32 pixel icon into an image well and one 24 x 24 pixel icon into another image well, then hit Save to create a .tif file containing both representations - perfect for toolbar icons.
Requires Mac OS X Tiger (10.4) - Universal for both Intel and PPC

Xcode Statistician
Someone recently asked me how large the Scrivener code base is, and I didn't know how to answer. Xcode Statistician was my way of trying to find out. If you program using Xcode and want to get some rough statistics on your Xcode project, Xcode Statistician should do the job. Just point it to the folder containing your Xcode project and it will look through the files therein and produce statistics that show you how many lines of code you have written (with and without whitespace), how many of those lines seem to contain statements, how many header and main files you have, how many images and interface files there are, and how many classes with different prefixes it can find. It will also provide a character and word count, so you can see just how many books you could have written had you not been coding.
Requires Mac OS X Tiger (10.4) - Universal for both Intel and PPC

MyColumn
MyColumn is a shameless copy of Amar Sagoo's Tofu (which lets you view text in columns), except that it adds editing capabilities and a live word count (Tofu is read-only). MyColumn started out as an experiment. I liked Tofu so much that I thought having a multi-column view in Scrivener might be a good idea, but then I decided against it. You can read Amar Sagoo's theory on why he thinks reading text in columns is easier on the eyes over at his site. I think he is right. But what I found out is that whilst it may be better for reading, it is not better for editing - when editing, because the text moves around, columns make the text seem less stable. I offer this freeware download so that you can decide for yourself. If you do like reading text in columns, be sure to download Tofu from Amar's site, which is a lot more refined (it has smooth scrolling and allows you simply to drop a file into a window to open it, for instance). The source code for MyColumn is also available (see below for details).
Screenshot
Requires Mac OS X Tiger (10.4) - Universal for both Intel and PPC

Summarizer
Summarizer is a simple freeware Cocoa application that allows you to breakdown the structure of any book or text that is available electronically. Load the book, go through it and add separator markers, then just hit "Summarize". A list of sections along with corresponding word counts will be generated, ready for you to enter a summary for each. You can import the results into Scrivener should you wish to emulate the structure of your favourite book in your own writing.
Requires Mac OS X Tiger (10.4) - Universal for both Intel and PPC.



Source Code

All source code is provided free for use however you want, commercially or otherwise. I only ask that if you do use it, you provide a credit (to Keith Blount).

MyColumn Source Code
The source code to MyColumn provides a multi-column text view class and also gives an example of how to use KBWordCountingTextStorage to implement a live word count in your application.
Screenshot

KBPalettePanelExample
An NSPanel subclass that snaps to the edges of windows, attaches to other panels of the same class, and can be collapsed. Based on the inspector palettes of Nisus Writer and OmniOutliner (I thought about having palettes in Scrivener for a while, which is why I put this together). I used Matt Gemmell's snapping window code as a starter for this. This is the source code to a sample application.
Screenshot

iPopUpButton (KBGradientPopUpButton)
An NSPopUpButton subclass that replicates the pop up buttons featured in i-apps such as iPhoto and iMovie:


Updated November 2007: full screen-style option added.

KBLinedTextView
A very simple NSTextView subclass that draws lines between the lines of text so that it looks like a page from a notebook (Scrivener uses this for its index card views).
Screenshot

KBLinkedFileView
An NSView subclass that shows the icon for and a link to a given file. Clicking on the link or double-clicking on the icon opens the file in its default application. (Scrivener uses this view for linked files that it can't open in one of its own editors.)
Screenshot

KBPopUpToolbarItem
A subclass of NSToolbarItem that provides pop-up menu functionality. Click on it and it acts like any other toolbar item and performs its action; hold down the mouse button for half a second and it presents a pop-up menu (just like the Build toolbar item in Xcode).
Updated November 2007: pop-up menu items now work when toolbar is in text-only mode.

KBViewToolbarItem
An NSToolbarItem subclass designed for use with view toolbar items (for instance, toolbar items containing search fields or segmented controls). The subclass provides automatic validation through the delegate, which is missing from NSToolbarItem's implemenation for view items.

KBResponderNotifyingWindow
An very simple NSWindow subclass that just posts a notification whenever the first responder changes (I'm surprised NSWindow doesn't already do this...). Very useful for updating any contextual information reliant on the view with first responder status (Scrivener uses this to update its inspector).

KBViewController
A controller class that acts much like NSWindowController, except that it is for use with views instead of windows. For large or complicated projects you often want to use multiple .nib files to hold different views that will be inserted into a window at runtime as needed. KBViewController is designed to act as File's Owner for .nib files that hold only a view (or views) - that is, .nib files that do not have a window controller (or NSDocument subclass) associated with them. It provides a pointer to the main view and releases all top-level objects automatically when deallocated so that you don't have to. To use it, just set the class as as File's Owner and link its -mainView outlet to the main view in the .nib file. Then initialise the class with the .nib name to load the .nib file and use the -mainView outlet to insert the view wherever you want. You will most likely want to subclass this to add all the other outlets and actions you need for your specific .nib file, of course.

KBWebArchiver
A utility class that makes it very easy to download any given URL to a webarchive. Just specify a URL string and this class will return the webarchive containing all resources.
Updated November 2007: minor bug fixes.

KBWordCountingTextStorage
An NSTextStorage subclass that provides a very fast live word count. Just call -wordCount on the text storage to get the current word count. (Note that because the word count only operates on changed text, typing speed will not be affected no matter how long the text gets.) For an example of how to use KBWordCountingTextStorage (as if you needed one - it's not rocket science), see the MyColumn source above.
Updated November 2007: minor refinements and potential bug fixes.

NSBezierPathRoundedRectAdditions (NSBezierPath_KBAdditions)
An NSBezierPath category that provides easy rounded rect methods. You can create a rounded rect just by defining the corner radius, or you can specify precisely which corners get rounded. This is based on various free code I have come across to do the same, particularly examples over at CocoaDev.

NSTreeController Tutorial
An unfinished (well, finished, but unedited and without images) tutorial on how to use NSTreeController, including drag and drop and state-saving. By the time I got to the end of writing this tutorial I came to the conclusion that NSTreeController was not worth the effort - for anything other than the most rudimentary of outline views, I found that I had to write a lot more code to hack NSTreeController into doing what I wanted than I did when using the old data source methods. Hopefully that will change in the future, but I offer this tutorial for what it's worth to those who do want to play with NSTreeController. Includes KBBaseNode, a class that is very useful as a base model for any outline view, whether you are using NSTreeController or not. (Please note that, as I gave up on NSTreeController, I never got around to editing this tutorial, so it may be full of typos. Also note that this tutorial does not use Core Data.)


Copyright © 2005-2010 Literature & Latte Ltd. All rights reserved.