corrade-nucleus-nucleons – Blame information for rev 20

Subversion Repositories:
Rev:
Rev Author Line No. Line
20 office 1 ace.define("ace/split",["require","exports","module","ace/lib/oop","ace/lib/lang","ace/lib/event_emitter","ace/editor","ace/virtual_renderer","ace/edit_session"], function(require, exports, module) {
2 "use strict";
3  
4 var oop = require("./lib/oop");
5 var lang = require("./lib/lang");
6 var EventEmitter = require("./lib/event_emitter").EventEmitter;
7  
8 var Editor = require("./editor").Editor;
9 var Renderer = require("./virtual_renderer").VirtualRenderer;
10 var EditSession = require("./edit_session").EditSession;
11  
12  
13 var Split = function(container, theme, splits) {
14 this.BELOW = 1;
15 this.BESIDE = 0;
16  
17 this.$container = container;
18 this.$theme = theme;
19 this.$splits = 0;
20 this.$editorCSS = "";
21 this.$editors = [];
22 this.$orientation = this.BESIDE;
23  
24 this.setSplits(splits || 1);
25 this.$cEditor = this.$editors[0];
26  
27  
28 this.on("focus", function(editor) {
29 this.$cEditor = editor;
30 }.bind(this));
31 };
32  
33 (function(){
34  
35 oop.implement(this, EventEmitter);
36  
37 this.$createEditor = function() {
38 var el = document.createElement("div");
39 el.className = this.$editorCSS;
40 el.style.cssText = "position: absolute; top:0px; bottom:0px";
41 this.$container.appendChild(el);
42 var editor = new Editor(new Renderer(el, this.$theme));
43  
44 editor.on("focus", function() {
45 this._emit("focus", editor);
46 }.bind(this));
47  
48 this.$editors.push(editor);
49 editor.setFontSize(this.$fontSize);
50 return editor;
51 };
52  
53 this.setSplits = function(splits) {
54 var editor;
55 if (splits < 1) {
56 throw "The number of splits have to be > 0!";
57 }
58  
59 if (splits == this.$splits) {
60 return;
61 } else if (splits > this.$splits) {
62 while (this.$splits < this.$editors.length && this.$splits < splits) {
63 editor = this.$editors[this.$splits];
64 this.$container.appendChild(editor.container);
65 editor.setFontSize(this.$fontSize);
66 this.$splits ++;
67 }
68 while (this.$splits < splits) {
69 this.$createEditor();
70 this.$splits ++;
71 }
72 } else {
73 while (this.$splits > splits) {
74 editor = this.$editors[this.$splits - 1];
75 this.$container.removeChild(editor.container);
76 this.$splits --;
77 }
78 }
79 this.resize();
80 };
81 this.getSplits = function() {
82 return this.$splits;
83 };
84 this.getEditor = function(idx) {
85 return this.$editors[idx];
86 };
87 this.getCurrentEditor = function() {
88 return this.$cEditor;
89 };
90 this.focus = function() {
91 this.$cEditor.focus();
92 };
93 this.blur = function() {
94 this.$cEditor.blur();
95 };
96 this.setTheme = function(theme) {
97 this.$editors.forEach(function(editor) {
98 editor.setTheme(theme);
99 });
100 };
101 this.setKeyboardHandler = function(keybinding) {
102 this.$editors.forEach(function(editor) {
103 editor.setKeyboardHandler(keybinding);
104 });
105 };
106 this.forEach = function(callback, scope) {
107 this.$editors.forEach(callback, scope);
108 };
109  
110  
111 this.$fontSize = "";
112 this.setFontSize = function(size) {
113 this.$fontSize = size;
114 this.forEach(function(editor) {
115 editor.setFontSize(size);
116 });
117 };
118  
119 this.$cloneSession = function(session) {
120 var s = new EditSession(session.getDocument(), session.getMode());
121  
122 var undoManager = session.getUndoManager();
123 if (undoManager) {
124 var undoManagerProxy = new UndoManagerProxy(undoManager, s);
125 s.setUndoManager(undoManagerProxy);
126 }
127 s.$informUndoManager = lang.delayedCall(function() { s.$deltas = []; });
128 s.setTabSize(session.getTabSize());
129 s.setUseSoftTabs(session.getUseSoftTabs());
130 s.setOverwrite(session.getOverwrite());
131 s.setBreakpoints(session.getBreakpoints());
132 s.setUseWrapMode(session.getUseWrapMode());
133 s.setUseWorker(session.getUseWorker());
134 s.setWrapLimitRange(session.$wrapLimitRange.min,
135 session.$wrapLimitRange.max);
136 s.$foldData = session.$cloneFoldData();
137  
138 return s;
139 };
140 this.setSession = function(session, idx) {
141 var editor;
142 if (idx == null) {
143 editor = this.$cEditor;
144 } else {
145 editor = this.$editors[idx];
146 }
147 var isUsed = this.$editors.some(function(editor) {
148 return editor.session === session;
149 });
150  
151 if (isUsed) {
152 session = this.$cloneSession(session);
153 }
154 editor.setSession(session);
155 return session;
156 };
157 this.getOrientation = function() {
158 return this.$orientation;
159 };
160 this.setOrientation = function(orientation) {
161 if (this.$orientation == orientation) {
162 return;
163 }
164 this.$orientation = orientation;
165 this.resize();
166 };
167 this.resize = function() {
168 var width = this.$container.clientWidth;
169 var height = this.$container.clientHeight;
170 var editor;
171  
172 if (this.$orientation == this.BESIDE) {
173 var editorWidth = width / this.$splits;
174 for (var i = 0; i < this.$splits; i++) {
175 < this.$splits; i++) { editor = this.$editors[i];
176 < this.$splits; i++) { editor.container.style.width = editorWidth + "px";
177 < this.$splits; i++) { editor.container.style.top = "0px";
178 < this.$splits; i++) { editor.container.style.left = i * editorWidth + "px";
179 < this.$splits; i++) { editor.container.style.height = height + "px";
180 < this.$splits; i++) { editor.resize();
181 < this.$splits; i++) { }
182 < this.$splits; i++) { } else {
183 < this.$splits; i++) { var editorHeight = height / this.$splits;
184 < this.$splits; i++) { for (var i = 0; i < this.$splits; i++) {
185 < this.$splits; i++) { editor = this.$editors[i];
186 < this.$splits; i++) { editor.container.style.width = width + "px";
187 < this.$splits; i++) { editor.container.style.top = i * editorHeight + "px";
188 < this.$splits; i++) { editor.container.style.left = "0px";
189 < this.$splits; i++) { editor.container.style.height = editorHeight + "px";
190 < this.$splits; i++) { editor.resize();
191 < this.$splits; i++) { }
192 < this.$splits; i++) { }
193 < this.$splits; i++) { };
194  
195 < this.$splits; i++) {}).call(Split.prototype);
196  
197  
198 < this.$splits; i++) {function UndoManagerProxy(undoManager, session) {
199 < this.$splits; i++) { this.$u = undoManager;
200 < this.$splits; i++) { this.$doc = session;
201 < this.$splits; i++) {}
202  
203 < this.$splits; i++) {(function() {
204 < this.$splits; i++) { this.execute = function(options) {
205 < this.$splits; i++) { this.$u.execute(options);
206 < this.$splits; i++) { };
207  
208 < this.$splits; i++) { this.undo = function() {
209 < this.$splits; i++) { var selectionRange = this.$u.undo(true);
210 < this.$splits; i++) { if (selectionRange) {
211 < this.$splits; i++) { this.$doc.selection.setSelectionRange(selectionRange);
212 < this.$splits; i++) { }
213 < this.$splits; i++) { };
214  
215 < this.$splits; i++) { this.redo = function() {
216 < this.$splits; i++) { var selectionRange = this.$u.redo(true);
217 < this.$splits; i++) { if (selectionRange) {
218 < this.$splits; i++) { this.$doc.selection.setSelectionRange(selectionRange);
219 < this.$splits; i++) { }
220 < this.$splits; i++) { };
221  
222 < this.$splits; i++) { this.reset = function() {
223 < this.$splits; i++) { this.$u.reset();
224 < this.$splits; i++) { };
225  
226 < this.$splits; i++) { this.hasUndo = function() {
227 < this.$splits; i++) { return this.$u.hasUndo();
228 < this.$splits; i++) { };
229  
230 < this.$splits; i++) { this.hasRedo = function() {
231 < this.$splits; i++) { return this.$u.hasRedo();
232 < this.$splits; i++) { };
233 < this.$splits; i++) {}).call(UndoManagerProxy.prototype);
234  
235 < this.$splits; i++) {exports.Split = Split;
236 < this.$splits; i++) {});
237  
238 < this.$splits; i++) {ace.define("ace/ext/split",["require","exports","module","ace/split"], function(require, exports, module) {
239 < this.$splits; i++) {"use strict";
240 < this.$splits; i++) {module.exports = require("../split");
241  
242 < this.$splits; i++) {});
243 < this.$splits; i++) { (function() {
244 < this.$splits; i++) { ace.require(["ace/ext/split"], function() {});
245 < this.$splits; i++) { })();
246