First dump of doc stuff

This commit is contained in:
Garen Torikian 2012-02-02 17:00:18 -08:00
commit 79886c3e07
83 changed files with 8598 additions and 554 deletions

View file

@ -47,6 +47,23 @@ var Editor = require("./editor").Editor;
var Renderer = require("./virtual_renderer").VirtualRenderer;
var EditSession = require("./edit_session").EditSession;
/**
* class Split
*
* TODO
*
**/
/**
* new Split(container, theme, splits)
* - container (Document): The document to associate with the anchor
* - theme (Number): The starting row position
* - splits (Number): The starting column position
*
* TODO
*
**/
var Split = function(container, theme, splits) {
this.BELOW = 1;
this.BESIDE = 0;
@ -87,6 +104,13 @@ var Split = function(container, theme, splits) {
return editor;
};
/**
* Split.setSplits(splits) -> Void
* - splits (Number): The new number of splits
*
* TODO
*
**/
this.setSplits = function(splits) {
var editor;
if (splits < 1) {
@ -116,42 +140,100 @@ var Split = function(container, theme, splits) {
this.resize();
};
/**
* Split.getSplits() -> Number
*
* Returns the number of splits.
*
**/
this.getSplits = function() {
return this.$splits;
};
/**
* Split.getEditor(idx) -> Editor
* -idx (Number): The index of the editor you want
*
* Returns the editor identified by the index `idx`.
*
**/
this.getEditor = function(idx) {
return this.$editors[idx];
};
/**
* Split.getCurrentEditor() -> Editor
*
* Returns the current editor.
*
**/
this.getCurrentEditor = function() {
return this.$cEditor;
};
/** related to: Editor.focus
* Split.focus() -> Void
*
* Focuses the current editor.
*
**/
this.focus = function() {
this.$cEditor.focus();
};
/** related to: Editor.blur
* Split.blur() -> Void
*
* Blurs the current editor.
*
**/
this.blur = function() {
this.$cEditor.blur();
};
/** related to: Editor.setTheme
* Split.setTheme(theme) -> Void
* - theme (String):
*
* Sets a theme for each of the available editors.
**/
this.setTheme = function(theme) {
this.$editors.forEach(function(editor) {
editor.setTheme(theme);
});
};
/**
* Split.setKeyboardHandler(keybinding) -> Void
* - keybinding (String):
*
* TODO
**/
this.setKeyboardHandler = function(keybinding) {
this.$editors.forEach(function(editor) {
editor.setKeyboardHandler(keybinding);
});
};
/**
* Split.forEach(callback, scope) -> Void
* - callback (Function): A callback function to execute
* - scope (String): TODO
*
* Executes `callback` on all of the available editors. TODO
*
**/
this.forEach = function(callback, scope) {
this.$editors.forEach(callback, scope);
};
/** related to: editor.setFontSize
* Split.setFontSize(size) -> Void
* - size (Number): The new font size
*
* Sets the font size, in pixels, for all the available editors.
*
**/
this.$fontSize = "";
this.setFontSize = function(size) {
this.$fontSize = size;
@ -187,6 +269,14 @@ var Split = function(container, theme, splits) {
return s;
};
/** related to: editor.setSession
* Split.setSession(session, idx) -> Void
* - session (EditSession): The new edit session
* - idx (Number): The editor's index you're interested in
*
* Sets a new [[EditSession `EditSession`]] for the indicated editor.
*
**/
this.setSession = function(session, idx) {
var editor;
if (idx == null) {
@ -213,10 +303,23 @@ var Split = function(container, theme, splits) {
return session;
};
/**
* Split.getOriantation() -> Number
*
* Returns the orientation. TODO
*
**/
this.getOriantation = function() {
return this.$oriantation;
};
/**
* Split.setOriantation(oriantation) -> Void
* - oriantation (Number):
*
* Sets the orientation. TODO
*
**/
this.setOriantation = function(oriantation) {
if (this.$oriantation == oriantation) {
return;
@ -225,6 +328,12 @@ var Split = function(container, theme, splits) {
this.resize();
};
/**
* Split.resize() -> Void
*
* TODO
*
**/
this.resize = function() {
var width = this.$container.clientWidth;
var height = this.$container.clientHeight;
@ -255,6 +364,12 @@ var Split = function(container, theme, splits) {
}).call(Split.prototype);
/**
* Split.UndoManagerProxy() -> Void
*
* TODO
*
**/
function UndoManagerProxy(undoManager, session) {
this.$u = undoManager;
this.$doc = session;