Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Example code for building a Sandvox 2 plug-in

branch: master
README.mdown

Sandvox 2 Plug-In Examples

This repository provides examples based on two of Sandvox’s built-in plug-ins. Full documentation can found in the Sandvox Developer’s Guide. Some familiarity with Cocoa programming is required.

One thing to note is that the Developer’s Guide illustrates how to set up a new plug-in project using Xcode 3. An Xcode 4 template is available from Abizern. If you use the template, we still recommend reading though the Guide so that you understand how the project is able to #import headers and link directly against the Sandvox application.

Also included is a multi-resolution (32px, 64px) image template that should be used as the base of any icon developed for your plug-in.

Between the documentation/reference and these examples, you should be able to see how to build a plug-in of your own. Let Karelia know if you have created a new plug-in so that we can help tell the world about it!

Flickr

The Flickr plug-in uses Flickr’s badge API to include a Flickr photostream on a webpage. The main work of the plug-in happens in Template.html which is automatically parsed by the context during

- (void)writeHTML:(id <SVPlugInContext>)context

plugging in instance variable values according to the template specification.

The plug-in also illustrates SVLocalizedString(), implementing a custom inspector class, and how to add custom CSS as a resource to the context.

IFrame

The iFrame plug-in takes a different approach, writing to the context entirely in code with no Template.html. It illustrates implementing a placeholder, specifying particular metrics (width and height) for the object, and how to handle direct drag-and-drop of a URL. It’s action-packed in only a few lines of code!

Both examples use Cocoa Bindings to bind controls in the inspector directly to the model via inspectedObjectsController.selection.

License

© 2004-2013 Karelia Software. All rights reserved.

Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:

  • Redistribution of source code must retain the above copyright notice, this list of conditions and the follow disclaimer.

  • Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other material provided with the distribution.

  • Neither the name of Karelia Software nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS-IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUR OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

Something went wrong with that request. Please try again.