Code Monkey home page Code Monkey logo

fragaria's Introduction

#What is it? Fragaria is an OS X Cocoa syntax colouring NSTextView implemented within a framework named MGSFragaria. It supports a wide range of programming languages and includes preference panel support.

The MGSFragaria framework now properly supports both traditional reference counting memory management and garbage collection.

#Where can I see it in use

You can see Fragaria used in the following products:

  • KosmicTask : a multi (20+) language scripting environment for OS X that features script editing, network sharing, remote execution, and file processing.

If you use MGSFragaria in your app and want it added to the list raise it as an issue.

#Features

Most features are accessed via the framework preferences.

  • Configurable syntax colouring
  • Configurable font type, size and colour.
  • Invisible character display
  • Line numbering
  • Brace matching and auto insertion
  • Page guide
  • Simple word auto complete
  • Tab and indent control
  • Line wrapping

##How do I use it?

The best way to learn how to use the framework is to look at the sample apps.

  • Fragaria : a simple editor window that features language selection, a wired up text menu and a preferences panel.

  • Fragaria GC : a GC version of the above.

  • Fragaria Doc : a simple NSDocument based editor.

##Show me code

A Fragaria view is embedded in a content view.

#import "MGSFragaria/MGSFragaria.h"

// we need a container view to host Fragaria in
NSView *containerView = nil; // loaded from nib or otherwise created

// create our instance
MGSFragaria *fragaria = [[MGSFragaria alloc] init];

// we want to be the delegate
[fragaria setObject:self forKey:MGSFODelegate];

// Objective-C is the place e to be
[self setSyntaxDefinition:@"Objective-C"];

// embed in our container - exception thrown if containerView is nil
[fragaria embedInView:containerView];

// set initial text
[fragaria setString:@"// We don't need the future."];

The initial appearance of a Fragaria view is determined by the framework preferences controller. The MGSFragaria framework supplies two preference view controllers whose views can be embedded in your preference panel.

MGSFragariaTextEditingPrefsViewController * textEditingPrefsViewController = [MGSFragariaPreferences sharedInstance].textEditingPrefsViewController;

MGSFragariaFontsAndColoursPrefsViewController *fontsAndColoursPrefsViewController = [MGSFragariaPreferences sharedInstance].fontsAndColoursPrefsViewController;

##Setting preferences

Preference strings are defined in MGSFragaria/MGSFragariaPreferences.h. Each preference name is prefixed with Fragaria for easy identification within the application preferences file.

// default to line wrap off
[[NSUserDefaults standardUserDefaults] setObject:[NSNumber numberWithBool:NO] forKey:MGSFragariaPrefsLineWrapNewDocuments];

All preferences are observed and instances of Fragaria views update immediately to reflect the new preference.

##Where did it come from? Fragaria started out as the vital pulp of Smultron, now called Fraise. If you want to add additional features to Fragaria then looking at the Fraise and other forked sources is a good place to start. Fraise is a GC only app so you will need to consider memory management issues when importing code into Fragaria.

fragaria's People

Contributors

drummerb avatar glejeune avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.