Quick Start Guide

Although Nano does not require an installer, additional Xcode integration can be installed with:

          cd /Developer/Nano
          perl Support/Scripts/XcodeExtras.pl

This script will update your Xcode installation to include a source tree to your Nano installation, templates for creating new Nano-based projects, and additional debugging macros for gdb.

This script should be run for each user account that you plan to develop under, since it allows you to create new Nano-based projects from within Xcode and rebuild the demo projects.

Creating a Project

To create your first Nano-based project, run the XcodeExtras.pl script as above and then launch Xcode.

Select "New Project" from the File menu, and then "Nano Document-based Application":

Demo New

Call the new project "Demo App", and Xcode will create a new document-based application that uses the Nano framework.

If you are using the "Condensed" view in Xcode, the project file will look something like:

Demo Project

Select "Build & Run", and Xcode will build the Nano library and the demo application. Once the application has been built, it will be launched:

Demo App

Use the File menu to create multiple documents, then modify their content with the color picker or the Info sheet. You can undo and redo your changes, and documents can be saved, loaded, or printing.

Congratulations - you have built your first Nano application!

Examining the Demo

The template Nano projects are designed to act as a starting point for your own projects, and to demonstrate the typical structure of a Nano-based application.

The best way to familiarize yourself with them is to examine the code, which will allow you to see which features are provided by the framework and how applications can customize the standard behaviour.

Some points of interest are discussed below, and on the features page.

Application Features

The demo application sub-classes Nano's standard NApplication class with the CApplication object.

This class inherits most of its interesting behaviour from NApplication, and is responsible for defining standard values and performing tasks such as instantiating a new document.

These "standard values" are stored in a dictionary of properties, which is used by the base class to perform tasks such as registering a Help Book, populating the About Box, or initialising the default values for the preferences.

Additional tasks handled by NApplication include creating or closing documents, handling Apple Events from the Finder, and creating standard windows such as the About Box.

More information about building applications can be found here.

Document Features

The demo application sub-classes Nano's standard NDocument class with the CWindowDocument object.

As before, this class inherits most of its behaviour from the framework - its main responsibilities are to provide information to the base class and to handle application-specific commands.

The base class manages the overall document model, and includes support for saving, loading, and reverting documents.

By default, documents are saved in a cross-platform file format based on key-value encoding. This ensures that saved documents are always forwards and backwards compatible, and allows NDocument to archive its own state (such as the position of the document window) alongside the application-specific content added by CWindowDocument.

NDocument, in cooperation with NApplication, also prompts the user to save (or review) changes to modified documents when closing documents or quitting the application. Saved documents are tracked with an alias, allowing the document window's title to update automatically if the document is renamed in the Finder.

NDocument also provides printing support, managing the user interface and overall job control. Sub-classes simply need to render each page in turn, or nominate a single view that will be automatically scaled to fit on the printed page.

More information about supporting documents can be found here.