Skip to content

Commit

Permalink
* Merged with splitview branch
Browse files Browse the repository at this point in the history
  • Loading branch information
Ruben Daniels committed May 1, 2012
2 parents a6f2766 + 9423a6f commit 8323a07
Show file tree
Hide file tree
Showing 39 changed files with 2,179 additions and 979 deletions.
8 changes: 7 additions & 1 deletion client/core/ide.js
Expand Up @@ -240,7 +240,13 @@ define(function(require, exports, module) {
if (!page)
return null;

return page.$model.data;
var corrected = this.dispatchEvent("activepagemodel", {
model: page.$model
});

return corrected && corrected.data
? corrected.data
: page.$model.data;
};

ide.getAllPageModels = function() {
Expand Down
12 changes: 6 additions & 6 deletions client/ext/acebugs/acebugs.js
Expand Up @@ -26,7 +26,7 @@ module.exports = ext.register("ext/acebugs/acebugs", {
init: function(amlNode) {
var currEditor = editors.currentEditor;
if (currEditor) {
this.editorSession = currEditor.ceEditor.getSession();
this.editorSession = currEditor.amlEditor.getSession();

this.editorSession.on("changeAnnotation", function(e) {
_self.updateAnnotations();
Expand Down Expand Up @@ -58,7 +58,7 @@ module.exports = ext.register("ext/acebugs/acebugs", {
tabEditors.addEventListener("afterswitch", function(e){
var ce = editors.currentEditor;
if (ce) {
_self.editorSession = ce.ceEditor.getSession();
_self.editorSession = ce.amlEditor.getSession();
_self.editorSession.on("changeAnnotation", function(e) {
_self.updateAnnotations();
});
Expand Down Expand Up @@ -92,15 +92,15 @@ module.exports = ext.register("ext/acebugs/acebugs", {
if (!ce || typeof mdlAceAnnotations === "undefined")
return;

this.ceEditor = ce.ceEditor;
var editorSession = this.ceEditor.getSession();
this.amlEditor = ce.amlEditor;
var editorSession = this.amlEditor.getSession();
dock.resetNotificationCount("aceAnnotations");
this.annotationWorker.postMessage(editorSession.getAnnotations());
},

goToAnnotation : function() {
line_num = dgAceAnnotations.selected.getAttribute("line");
this.ceEditor.$editor.gotoLine(line_num);
var line_num = dgAceAnnotations.selected.getAttribute("line");
this.amlEditor.$editor.gotoLine(line_num);
},

enable: function() {
Expand Down
2 changes: 1 addition & 1 deletion client/ext/all.js
Expand Up @@ -60,8 +60,8 @@ var extAll = define([
"ext/closeconfirmation/closeconfirmation",
"ext/codetools/codetools",
"ext/colorpicker/colorpicker",
//"ext/splitview/splitview"
"ext/revisions/revisions"
//"ext/acebugs/acebugs"
//"ext/minimap/minimap"
//"ext/acebugs/acebugs"
]);
57 changes: 28 additions & 29 deletions client/ext/code/code.js
Expand Up @@ -261,22 +261,32 @@ module.exports = ext.register("ext/code/code", {

return "text";
},

getContentType : function(node) {
var syntax = this.getSyntax(node);
if (!syntax)
return "auto";

return contentTypes[syntax] || (syntax == "text" ? "text/plain" : "auto");
},

getSelection : function(){
if (typeof ceEditor == "undefined")
if (typeof this.amlEditor == "undefined")
return null;
return ceEditor.getSelection();
return this.amlEditor.getSelection();
},

getDocument : function(){
if (typeof ceEditor == "undefined")
if (typeof this.amlEditor == "undefined")
return null;
return ceEditor.getSession();
return this.amlEditor.getSession();
},

setDocument : function(doc, actiontracker){
var _self = this;

var ceEditor = this.amlEditor;

if (doc.acesession) {
ceEditor.setProperty("value", doc.acesession);
}
Expand Down Expand Up @@ -359,9 +369,10 @@ module.exports = ext.register("ext/code/code", {
//??? call doc.$page.destroy()
});
});

doc.dispatchEvent("init");
}


if (doc.editor && doc.editor != this) {
var value = doc.getValue();
if (doc.acesession.getValue() !== value) {
Expand All @@ -374,11 +385,11 @@ module.exports = ext.register("ext/code/code", {
},

clear : function(){
ceEditor.clear();
this.amlEditor.clear();
},

focus : function(){
ceEditor.focus();
this.amlEditor.focus();
},

hook: function() {
Expand Down Expand Up @@ -468,13 +479,14 @@ module.exports = ext.register("ext/code/code", {
e.node.setAttribute("scriptid", nodes[0].getAttribute("scriptid"));
}
}
e.doc.editor.ceEditor.afterOpenFile(e.doc.editor.ceEditor.getSession());
e.doc.editor.amlEditor.afterOpenFile(e.doc.editor.amlEditor.getSession());
}
});

tabEditors.addEventListener("afterswitch", function(e) {
if (typeof ceEditor != "undefined")
ceEditor.afterOpenFile(ceEditor.getSession());
var editor = _self.amlEditor;
if (typeof editor != "undefined")
editor.afterOpenFile(editor.getSession());
});

c = 20000;
Expand Down Expand Up @@ -769,12 +781,11 @@ module.exports = ext.register("ext/code/code", {
init: function(amlPage) {
var _self = this;

//amlPage.appendChild(ceEditor);
ceEditor.show();

this.ceEditor = this.amlEditor = ceEditor;
ceEditor.$editor.$nativeCommands = ceEditor.$editor.commands;
ceEditor.$editor.commands = commands;
this.amlEditor.show();

this.amlEditor.$editor.$nativeCommands = ceEditor.$editor.commands;
this.amlEditor.$editor.commands = commands;

// preload common language modes
var noop = function() {};
Expand Down Expand Up @@ -816,18 +827,6 @@ module.exports = ext.register("ext/code/code", {
e.ext.addPrefsItem(menuShowInvisibles.cloneNode(true), 0);
});

ide.addEventListener("keybindingschange", function(e) {
if (typeof ceEditor == "undefined")
return;

var bindings = e.keybindings.code;
ceEditor.$editor.setKeyboardHandler(new HashHandler(bindings));
// In case the `keybindingschange` event gets fired after other
// plugins that change keybindings have already changed them (i.e.
// the vim plugin), we fire an event so these plugins can react to it.
ide.dispatchEvent("code.ext:defaultbindingsrestored", {});
});

ide.addEventListener("updatefile", function(e){
var page = tabEditors.getPage();
if (page && ceEditor.getDocument() == page.$doc.acesession)
Expand Down Expand Up @@ -932,8 +931,8 @@ module.exports = ext.register("ext/code/code", {
item.destroy(true, true);
});

if (self.ceEditor) {
ceEditor.destroy(true, true);
if (this.amlEditor) {
this.amlEditor.destroy(true, true);
mnuSyntax.destroy(true, true);
}

Expand Down
32 changes: 32 additions & 0 deletions client/ext/code/code.xml
Expand Up @@ -49,4 +49,36 @@
<a:divider visible="{stDebugProcessRunning.active &amp;&amp; !stRunning.active}" />
<a:item command="selectall">Select All</a:item>
</a:menu>

<a:menu id="mnuSyntax">
<a:item type="radio" value="auto">Auto-Select</a:item>
<a:item type="radio" value="text/plain">Plain Text</a:item>
<a:divider />
<a:item type="radio" value="text/x-csharp">C#</a:item>
<a:item type="radio" value="text/x-c">C/C++</a:item>
<a:item type="radio" value="text/x-script.clojure">Clojure</a:item>
<a:item type="radio" value="text/x-script.coffeescript">CoffeeScript</a:item>
<a:item type="radio" value="text/x-coldfusion">Coldfusion</a:item>
<a:item type="radio" value="text/css">CSS</a:item>
<a:item type="radio" value="text/x-groovy">Groovy</a:item>
<a:item type="radio" value="text/x-java-source">Java</a:item>
<a:item type="radio" value="application/javascript">JavaScript</a:item>
<a:item type="radio" value="application/x-latex">Latex</a:item>
<a:item type="radio" value="application/x-sh">Shell Script</a:item>
<a:item type="radio" value="text/x-lua">Lua</a:item>
<a:item type="radio" value="text/x-markdown">Markdown</a:item>
<a:item type="radio" value="text/x-script.ocaml">OCaml</a:item>
<a:item type="radio" value="application/x-httpd-php">PHP</a:item>
<a:item type="radio" value="text/x-script.perl">Perl</a:item>
<a:item type="radio" value="text/x-script.powershell">Powershell</a:item>
<a:item type="radio" value="text/x-script.python">Python</a:item>
<a:item type="radio" value="text/x-script.ruby">Ruby</a:item>
<a:item type="radio" value="text/x-scala">Scala</a:item>
<a:item type="radio" value="text/x-scss">SCSS</a:item>
<a:item type="radio" value="text/x-sql">SQL</a:item>
<a:item type="radio" value="text/x-web-textile">Textile</a:item>
<a:item type="radio" value="text/html">(X)HTML</a:item>
<a:item type="radio" value="application/xml">XML</a:item>
>>>>>>> 9423a6f57ad85cb2c40d03eb764434c60406a0ae
</a:menu>
</a:application>
2 changes: 1 addition & 1 deletion client/ext/debugger/debugger.js
Expand Up @@ -297,7 +297,7 @@ module.exports = ext.register("ext/debugger/debugger", {
var file = fs.model.queryNode("//file[@scriptid='" + scriptId + "']");

// check prerequisites
if (self.ceEditor && !ceEditor.$updateMarkerPrerequisite()) {
if (editors.currentEditor && !editors.currentEditor.amlEditor.$updateMarkerPrerequisite()) {
return;
}

Expand Down

0 comments on commit 8323a07

Please sign in to comment.