Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

merge master into uimgr

  • Loading branch information...
commit a23cff514f2c188024ed107cf0c6330e524a0bd8 2 parents 36265f8 + 149960b
Vlad Zinculescu authored
Showing with 69,994 additions and 62,808 deletions.
  1. +1 −1  README.md
  2. +1 −0  bin/run.js
  3. +46 −0 bin/runjs.sh
  4. +3 −0  build/core.build.js
  5. +13 −0 build/json_minifier.js
  6. +8,587 −2,823 build/r.js
  7. +308 −11 build/text.js
  8. +1 −1  configs/default.js
  9. +6 −5 package.json
  10. +3 −0  plugins-client/cloud9.core/www/core/ide.js
  11. +1 −1  plugins-client/cloud9.core/www/core/settings.js
  12. +74 −26 plugins-client/ext.code/code.js
  13. +7 −2 plugins-client/ext.codecomplete/complete_util.js
  14. +2 −2 plugins-client/ext.codecomplete/local_completer.js
  15. +1 −1  plugins-client/ext.codecomplete/mode_completer.js
  16. +1 −1  plugins-client/ext.codecomplete/open_files_local_completer.js
  17. +1 −1  plugins-client/ext.codecomplete/snippet_completer.js
  18. +1 −1  plugins-client/ext.colorpicker/colorpicker.css
  19. +5 −4 plugins-client/ext.colorpicker/colorpicker.js
  20. +3 −4 plugins-client/ext.csslanguage/css_handler.js
  21. +32 −24 plugins-client/ext.dockpanel/dockpanel.js
  22. +390 −384 plugins-client/ext.dockpanel/libdock.js
  23. +1 −1  plugins-client/ext.editors/editors.js
  24. +2 −1  plugins-client/ext.extmgr/extmgr.xml
  25. +2 −1  plugins-client/ext.gotofile/gotofile.js
  26. +1 −1  plugins-client/ext.gotofile/search.js
  27. +1 −1  plugins-client/ext.help/help.js
  28. +1 −1  plugins-client/ext.htmllanguage/html_completer.js
  29. +7 −5 plugins-client/ext.jslanguage/jshint.js
  30. +15 −14 plugins-client/ext.jslanguage/outline.js
  31. +2 −2 plugins-client/ext.jslanguage/parse.js
  32. +3 −3 plugins-client/ext.jslanguage/parse_test.js
  33. +11 −9 plugins-client/ext.jslanguage/scope_analyzer.js
  34. +19 −19 plugins-client/ext.language/base_handler.js
  35. +18 −9 plugins-client/ext.language/complete.js
  36. +1 −1  plugins-client/ext.language/jumptodef.js
  37. +2 −2 plugins-client/ext.language/keyhandler.js
  38. +176 −0 plugins-client/ext.language/syntax_detector.js
  39. +164 −103 plugins-client/ext.language/worker.js
  40. +1 −1  plugins-client/ext.linereport/linereport.js
  41. +1 −1  plugins-client/ext.linereport_php/linereport_php_worker.js
  42. +1 −1  plugins-client/ext.linereport_python/linereport_python_worker.js
  43. +1 −1  plugins-client/ext.main/main.xml
  44. BIN  plugins-client/ext.main/style/images/close-search-icon.png
  45. BIN  plugins-client/ext.main/style/images/loader_progressbar_bg.png
  46. BIN  plugins-client/ext.main/style/images/loading-ind.png
  47. BIN  plugins-client/ext.main/style/images/search-icon.png
  48. +513 −269 plugins-client/ext.main/style/skins.xml
  49. +32 −5 plugins-client/ext.main/style/style.css
  50. +1 −1  plugins-client/ext.menus/menus.js
  51. +18 −4 plugins-client/ext.offline/offline.js
  52. +6 −1 plugins-client/ext.offline/{skin.xml → offline.xml}
  53. +38 −0 plugins-client/ext.offline/style.css
  54. +8 −87 plugins-client/ext.revisions/revisions.js
  55. +82 −0 plugins-client/ext.revisions/revisions_util.js
  56. +80 −102 plugins-client/ext.tabbehaviors/tabbehaviors.js
  57. +1 −1  plugins-client/ext.tabsessions/tabsessions.js
  58. +11 −2 plugins-client/ext.themes/themes.js
  59. +9 −3 plugins-client/ext.uploadfiles/uploadfiles.js
  60. +31 −24 plugins-client/ext.uploadfiles/uploadworker.js
  61. +56,767 −56,750 plugins-client/lib.apf/www/apf-packaged/apf_release.js
  62. +1,681 −1,657 plugins-client/lib.requirejs/www/require.js
  63. +31 −34 plugins-server/cloud9.core/view/ide.tmpl.html
  64. +260 −216 plugins-server/cloud9.ide.revisions/revisions.js
  65. +0 −176 plugins-server/cloud9.ide.revisions/revisions_test.js
  66. +442 −0 plugins-server/cloud9.ide.revisions/test/revisions_test.js
  67. +35 −0 plugins-server/cloud9.ide.revisions/test/revobj.tst
  68. +27 −0 plugins-server/cloud9.ide.shell/shell.js
  69. +3 −5 plugins-server/cloud9.process-manager/process_manager.js
  70. +1 −2  test/blacklist.txt
View
2  README.md
@@ -165,7 +165,7 @@ Cloud9 wouldn't be where it is now without contributions. Feel free to fork and
If you want to contribute to an ajax.org project please print the CLA and fill it out and sign it. Then either send it by snail mail or fax us or send it back scanned (or as a photo) by email. Please indicate a contact person or pull request your CLA relates to so we can quickly process and handle your agreement. Once you've submitted it, you no longer need to send one for subsequent submissions.
-Email: cla@c9.io
+Email: CLA@c9.io
Fax: +31 (0) 206388953
View
1  bin/run.js
View
46 bin/runjs.sh
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+CMD="$0"
+CMD_DIR=`dirname "$CMD"`
+cd "$CMD_DIR/.."
+
+sudo bin/run.js panic
+make update
+
+case `uname -a` in
+Linux*x86_64*) echo "Linux 64 bit"
+ bin/run.js start -t:c9 server.js "$@" -a x-www-browser
+ ;;
+
+Linux*i686*) echo "Linux 32 bit"
+ bin/run.js start -t:c9 server.js "$@" -a x-www-browser
+ ;;
+
+Linux*arm*) echo "Linux ARM"
+ bin/run.js start -t:c9 server.js "$@" -a x-www-browser
+ ;;
+
+Darwin*) echo "OSX"
+ bin/run.js start -t:c9 server.js "$@" -a open
+ ;;
+
+FreeBSD*64*) echo "FreeBSD 64 bit"
+ bin/run.js start -t:c9 server.js "$@" -a open
+ ;;
+
+CYGWIN*) echo "Cygwin"
+ bin/run.js start -t:c9 server.js "$@" -a "cmd /c start"
+ ;;
+
+MING*) echo "MingW"
+ bin/run.js start -t:c9 server.js "$@" -a "cmd /c start"
+ ;;
+
+SunOS*) echo "Solaris"
+ bin/run.js start -t:c9 server.js "$@"
+ ;;
+
+
+*) echo "Unknown OS"
+ ;;
+esac
View
3  build/core.build.js
@@ -74,6 +74,9 @@
"v8debug/util",
"v8debug/V8Debugger"
],
+ exclude: [
+ "text"
+ ],
out: "./src/core.packed.js",
inlineText: true,
findNestedDependencies: true,
View
13 build/json_minifier.js
@@ -0,0 +1,13 @@
+var args = process.argv.slice(2),
+ fileIn = args[0],
+ fileOut = args[1],
+ fs = require("fs");
+
+ fs.readFile(fileIn, "utf8", function(err, json) {
+ if (err) {
+ console.error(err);
+ process.exit(1);
+ }
+
+ fs.writeFileSync(fileOut, JSON.stringify(JSON.parse(json), null));
+ });
View
11,410 build/r.js
8,587 additions, 2,823 deletions not shown
View
319 build/text.js
@@ -1,11 +1,308 @@
-/*
- RequireJS text 1.0.7 Copyright (c) 2010-2011, The Dojo Foundation All Rights Reserved.
- Available via the MIT or new BSD license.
- see: http://github.com/jrburke/requirejs for details
-*/
-(function(){var k=["Msxml2.XMLHTTP","Microsoft.XMLHTTP","Msxml2.XMLHTTP.4.0"],n=/^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,o=/<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,i=typeof location!=="undefined"&&location.href,p=i&&location.protocol&&location.protocol.replace(/\:/,""),q=i&&location.hostname,r=i&&(location.port||void 0),j=[];define(function(){var g,h,l;typeof window!=="undefined"&&window.navigator&&window.document?h=function(a,c){var b=g.createXhr();b.open("GET",a,!0);b.onreadystatechange=
-function(){b.readyState===4&&c(b.responseText)};b.send(null)}:typeof process!=="undefined"&&process.versions&&process.versions.node?(l=require.nodeRequire("fs"),h=function(a,c){var b=l.readFileSync(a,"utf8");b.indexOf("\ufeff")===0&&(b=b.substring(1));c(b)}):typeof Packages!=="undefined"&&(h=function(a,c){var b=new java.io.File(a),e=java.lang.System.getProperty("line.separator"),b=new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(b),"utf-8")),d,f,g="";try{d=new java.lang.StringBuffer;
-(f=b.readLine())&&f.length()&&f.charAt(0)===65279&&(f=f.substring(1));for(d.append(f);(f=b.readLine())!==null;)d.append(e),d.append(f);g=String(d.toString())}finally{b.close()}c(g)});return g={version:"1.0.7",strip:function(a){if(a){var a=a.replace(n,""),c=a.match(o);c&&(a=c[1])}else a="";return a},jsEscape:function(a){return a.replace(/(['\\])/g,"\\$1").replace(/[\f]/g,"\\f").replace(/[\b]/g,"\\b").replace(/[\n]/g,"\\n").replace(/[\t]/g,"\\t").replace(/[\r]/g,"\\r")},createXhr:function(){var a,c,
-b;if(typeof XMLHttpRequest!=="undefined")return new XMLHttpRequest;else for(c=0;c<3;c++){b=k[c];try{a=new ActiveXObject(b)}catch(e){}if(a){k=[b];break}}if(!a)throw Error("createXhr(): XMLHttpRequest not available");return a},get:h,parseName:function(a){var c=!1,b=a.indexOf("."),e=a.substring(0,b),a=a.substring(b+1,a.length),b=a.indexOf("!");b!==-1&&(c=a.substring(b+1,a.length),c=c==="strip",a=a.substring(0,b));return{moduleName:e,ext:a,strip:c}},xdRegExp:/^((\w+)\:)?\/\/([^\/\\]+)/,useXhr:function(a,
-c,b,e){var d=g.xdRegExp.exec(a),f;if(!d)return!0;a=d[2];d=d[3];d=d.split(":");f=d[1];d=d[0];return(!a||a===c)&&(!d||d===b)&&(!f&&!d||f===e)},finishLoad:function(a,c,b,e,d){b=c?g.strip(b):b;d.isBuild&&(j[a]=b);e(b)},load:function(a,c,b,e){if(e.isBuild&&!e.inlineText)b();else{var d=g.parseName(a),f=d.moduleName+"."+d.ext,m=c.toUrl(f),h=e&&e.text&&e.text.useXhr||g.useXhr;!i||h(m,p,q,r)?g.get(m,function(c){g.finishLoad(a,d.strip,c,b,e)}):c([f],function(a){g.finishLoad(d.moduleName+"."+d.ext,d.strip,a,
-b,e)})}},write:function(a,c,b){if(c in j){var e=g.jsEscape(j[c]);b.asModule(a+"!"+c,"define(function () { return '"+e+"';});\n")}},writeFile:function(a,c,b,e,d){var c=g.parseName(c),f=c.moduleName+"."+c.ext,h=b.toUrl(c.moduleName+"."+c.ext)+".js";g.load(f,b,function(){var b=function(a){return e(h,a)};b.asModule=function(a,b){return e.asModule(a,h,b)};g.write(a,f,b,d)},d)}}})})();
+/**
+ * @license RequireJS text 2.0.3 Copyright (c) 2010-2012, The Dojo Foundation All Rights Reserved.
+ * Available via the MIT or new BSD license.
+ * see: http://github.com/requirejs/text for details
+ */
+/*jslint regexp: true */
+/*global require: false, XMLHttpRequest: false, ActiveXObject: false,
+ define: false, window: false, process: false, Packages: false,
+ java: false, location: false */
+
+define(['module'], function (module) {
+ 'use strict';
+
+ var text, fs,
+ progIds = ['Msxml2.XMLHTTP', 'Microsoft.XMLHTTP', 'Msxml2.XMLHTTP.4.0'],
+ xmlRegExp = /^\s*<\?xml(\s)+version=[\'\"](\d)*.(\d)*[\'\"](\s)*\?>/im,
+ bodyRegExp = /<body[^>]*>\s*([\s\S]+)\s*<\/body>/im,
+ hasLocation = typeof location !== 'undefined' && location.href,
+ defaultProtocol = hasLocation && location.protocol && location.protocol.replace(/\:/, ''),
+ defaultHostName = hasLocation && location.hostname,
+ defaultPort = hasLocation && (location.port || undefined),
+ buildMap = [],
+ masterConfig = (module.config && module.config()) || {};
+
+ text = {
+ version: '2.0.3',
+
+ strip: function (content) {
+ //Strips <?xml ...?> declarations so that external SVG and XML
+ //documents can be added to a document without worry. Also, if the string
+ //is an HTML document, only the part inside the body tag is returned.
+ if (content) {
+ content = content.replace(xmlRegExp, "");
+ var matches = content.match(bodyRegExp);
+ if (matches) {
+ content = matches[1];
+ }
+ } else {
+ content = "";
+ }
+ return content;
+ },
+
+ jsEscape: function (content) {
+ return content.replace(/(['\\])/g, '\\$1')
+ .replace(/[\f]/g, "\\f")
+ .replace(/[\b]/g, "\\b")
+ .replace(/[\n]/g, "\\n")
+ .replace(/[\t]/g, "\\t")
+ .replace(/[\r]/g, "\\r")
+ .replace(/[\u2028]/g, "\\u2028")
+ .replace(/[\u2029]/g, "\\u2029");
+ },
+
+ createXhr: masterConfig.createXhr || function () {
+ //Would love to dump the ActiveX crap in here. Need IE 6 to die first.
+ var xhr, i, progId;
+ if (typeof XMLHttpRequest !== "undefined") {
+ return new XMLHttpRequest();
+ } else if (typeof ActiveXObject !== "undefined") {
+ for (i = 0; i < 3; i += 1) {
+ progId = progIds[i];
+ try {
+ xhr = new ActiveXObject(progId);
+ } catch (e) {}
+
+ if (xhr) {
+ progIds = [progId]; // so faster next time
+ break;
+ }
+ }
+ }
+
+ return xhr;
+ },
+
+ /**
+ * Parses a resource name into its component parts. Resource names
+ * look like: module/name.ext!strip, where the !strip part is
+ * optional.
+ * @param {String} name the resource name
+ * @returns {Object} with properties "moduleName", "ext" and "strip"
+ * where strip is a boolean.
+ */
+ parseName: function (name) {
+ var strip = false, index = name.indexOf("."),
+ modName = name.substring(0, index),
+ ext = name.substring(index + 1, name.length);
+
+ index = ext.indexOf("!");
+ if (index !== -1) {
+ //Pull off the strip arg.
+ strip = ext.substring(index + 1, ext.length);
+ strip = strip === "strip";
+ ext = ext.substring(0, index);
+ }
+
+ return {
+ moduleName: modName,
+ ext: ext,
+ strip: strip
+ };
+ },
+
+ xdRegExp: /^((\w+)\:)?\/\/([^\/\\]+)/,
+
+ /**
+ * Is an URL on another domain. Only works for browser use, returns
+ * false in non-browser environments. Only used to know if an
+ * optimized .js version of a text resource should be loaded
+ * instead.
+ * @param {String} url
+ * @returns Boolean
+ */
+ useXhr: function (url, protocol, hostname, port) {
+ var uProtocol, uHostName, uPort,
+ match = text.xdRegExp.exec(url);
+ if (!match) {
+ return true;
+ }
+ uProtocol = match[2];
+ uHostName = match[3];
+
+ uHostName = uHostName.split(':');
+ uPort = uHostName[1];
+ uHostName = uHostName[0];
+
+ return (!uProtocol || uProtocol === protocol) &&
+ (!uHostName || uHostName.toLowerCase() === hostname.toLowerCase()) &&
+ ((!uPort && !uHostName) || uPort === port);
+ },
+
+ finishLoad: function (name, strip, content, onLoad) {
+ content = strip ? text.strip(content) : content;
+ if (masterConfig.isBuild) {
+ buildMap[name] = content;
+ }
+ onLoad(content);
+ },
+
+ load: function (name, req, onLoad, config) {
+ //Name has format: some.module.filext!strip
+ //The strip part is optional.
+ //if strip is present, then that means only get the string contents
+ //inside a body tag in an HTML string. For XML/SVG content it means
+ //removing the <?xml ...?> declarations so the content can be inserted
+ //into the current doc without problems.
+
+ // Do not bother with the work if a build and text will
+ // not be inlined.
+ if (config.isBuild && !config.inlineText) {
+ onLoad();
+ return;
+ }
+
+ masterConfig.isBuild = config.isBuild;
+
+ var parsed = text.parseName(name),
+ nonStripName = parsed.moduleName + '.' + parsed.ext,
+ url = req.toUrl(nonStripName),
+ useXhr = (masterConfig.useXhr) ||
+ text.useXhr;
+
+ //Load the text. Use XHR if possible and in a browser.
+ if (!hasLocation || useXhr(url, defaultProtocol, defaultHostName, defaultPort)) {
+ text.get(url, function (content) {
+ text.finishLoad(name, parsed.strip, content, onLoad);
+ }, function (err) {
+ if (onLoad.error) {
+ onLoad.error(err);
+ }
+ });
+ } else {
+ //Need to fetch the resource across domains. Assume
+ //the resource has been optimized into a JS module. Fetch
+ //by the module name + extension, but do not include the
+ //!strip part to avoid file system issues.
+ req([nonStripName], function (content) {
+ text.finishLoad(parsed.moduleName + '.' + parsed.ext,
+ parsed.strip, content, onLoad);
+ });
+ }
+ },
+
+ write: function (pluginName, moduleName, write, config) {
+ if (buildMap.hasOwnProperty(moduleName)) {
+ var content = text.jsEscape(buildMap[moduleName]);
+ write.asModule(pluginName + "!" + moduleName,
+ "define(function () { return '" +
+ content +
+ "';});\n");
+ }
+ },
+
+ writeFile: function (pluginName, moduleName, req, write, config) {
+ var parsed = text.parseName(moduleName),
+ nonStripName = parsed.moduleName + '.' + parsed.ext,
+ //Use a '.js' file name so that it indicates it is a
+ //script that can be loaded across domains.
+ fileName = req.toUrl(parsed.moduleName + '.' +
+ parsed.ext) + '.js';
+
+ //Leverage own load() method to load plugin value, but only
+ //write out values that do not have the strip argument,
+ //to avoid any potential issues with ! in file names.
+ text.load(nonStripName, req, function (value) {
+ //Use own write() method to construct full module value.
+ //But need to create shell that translates writeFile's
+ //write() to the right interface.
+ var textWrite = function (contents) {
+ return write(fileName, contents);
+ };
+ textWrite.asModule = function (moduleName, contents) {
+ return write.asModule(moduleName, fileName, contents);
+ };
+
+ text.write(pluginName, nonStripName, textWrite, config);
+ }, config);
+ }
+ };
+
+ if (masterConfig.env === 'node' || (!masterConfig.env &&
+ typeof process !== "undefined" &&
+ process.versions &&
+ !!process.versions.node)) {
+ //Using special require.nodeRequire, something added by r.js.
+ fs = require.nodeRequire('fs');
+
+ text.get = function (url, callback) {
+ var file = fs.readFileSync(url, 'utf8');
+ //Remove BOM (Byte Mark Order) from utf8 files if it is there.
+ if (file.indexOf('\uFEFF') === 0) {
+ file = file.substring(1);
+ }
+ callback(file);
+ };
+ } else if (masterConfig.env === 'xhr' || (!masterConfig.env &&
+ text.createXhr())) {
+ text.get = function (url, callback, errback) {
+ var xhr = text.createXhr();
+ xhr.open('GET', url, true);
+
+ //Allow overrides specified in config
+ if (masterConfig.onXhr) {
+ masterConfig.onXhr(xhr, url);
+ }
+
+ xhr.onreadystatechange = function (evt) {
+ var status, err;
+ //Do not explicitly handle errors, those should be
+ //visible via console output in the browser.
+ if (xhr.readyState === 4) {
+ status = xhr.status;
+ if (status > 399 && status < 600) {
+ //An http 4xx or 5xx error. Signal an error.
+ err = new Error(url + ' HTTP status: ' + status);
+ err.xhr = xhr;
+ errback(err);
+ } else {
+ callback(xhr.responseText);
+ }
+ }
+ };
+ xhr.send(null);
+ };
+ } else if (masterConfig.env === 'rhino' || (!masterConfig.env &&
+ typeof Packages !== 'undefined' && typeof java !== 'undefined')) {
+ //Why Java, why is this so awkward?
+ text.get = function (url, callback) {
+ var stringBuffer, line,
+ encoding = "utf-8",
+ file = new java.io.File(url),
+ lineSeparator = java.lang.System.getProperty("line.separator"),
+ input = new java.io.BufferedReader(new java.io.InputStreamReader(new java.io.FileInputStream(file), encoding)),
+ content = '';
+ try {
+ stringBuffer = new java.lang.StringBuffer();
+ line = input.readLine();
+
+ // Byte Order Mark (BOM) - The Unicode Standard, version 3.0, page 324
+ // http://www.unicode.org/faq/utf_bom.html
+
+ // Note that when we use utf-8, the BOM should appear as "EF BB BF", but it doesn't due to this bug in the JDK:
+ // http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4508058
+ if (line && line.length() && line.charAt(0) === 0xfeff) {
+ // Eat the BOM, since we've already found the encoding on this file,
+ // and we plan to concatenating this buffer with others; the BOM should
+ // only appear at the top of a file.
+ line = line.substring(1);
+ }
+
+ stringBuffer.append(line);
+
+ while ((line = input.readLine()) !== null) {
+ stringBuffer.append(lineSeparator);
+ stringBuffer.append(line);
+ }
+ //Make sure we return a JavaScript string and not a Java string.
+ content = String(stringBuffer.toString()); //String
+ } finally {
+ input.close();
+ }
+ callback(content);
+ };
+ }
+
+ return text;
+});
View
2  configs/default.js
@@ -126,7 +126,7 @@ var config = [
"ext/offline/offline",
"ext/stripws/stripws",
//"ext/testpanel/testpanel",
- "ext/nodeunit/nodeunit",
+ //"ext/nodeunit/nodeunit",
"ext/zen/zen",
"ext/codecomplete/codecomplete",
"ext/vim/vim",
View
11 package.json
@@ -20,7 +20,7 @@
"simple-template": "0.0.1",
"optimist": "0.3.4",
- "dryice": "0.4.2",
+ "dryice": "0.4.10",
"mappings": "0.1.x",
"amd-loader": "0.0.4",
@@ -32,7 +32,7 @@
"smith": "0.1.9",
"smith.io": "0.0.36",
"vfs-architect": "0.0.2",
- "jsDAV": "0.2.1"
+ "jsDAV": "0.2.4"
},
"devDependencies": {
@@ -44,12 +44,13 @@
},
"mappings": {
- "ace": ["npm", "https://github.com/ajaxorg/ace/tarball/1f62753f1a8946dde331c98e9aea9caf56f7835e"],
- "apf": ["npm", "https://github.com/ajaxorg/apf/tarball/2d17e74d9457dd841112532c1ea8d84eb82bee31"],
+ "ace": ["npm", "https://github.com/ajaxorg/ace/tarball/cc2a2c9e056c6d4049f8849ec3ad72974de37177"],
+ "apf": ["npm", "https://github.com/ajaxorg/apf/tarball/145f65bd24ae83f041418dd01a9c51d278045f3f"],
"asyncjs": ["npm", "https://github.com/ajaxorg/async.js/tarball/0b4ed5608a32c280a7690b5f52883d8d1fc0de08"],
"v8debug": ["npm", "https://github.com/ajaxorg/lib-v8debug/tarball/d2fac9b09724cb2e75e2807191eace9bc27d3b52"],
"packager": ["npm", "https://github.com/ajaxorg/packager/tarball/bee2a82c6d5e2875024bfdc83937e98092ccf04f"],
- "treehugger": ["npm", "https://github.com/ajaxorg/treehugger/tarball/b22d7ad712f76a7e7b1070ab339d567dfbf059b1"]
+ "treehugger": ["npm", "https://github.com/ajaxorg/treehugger/tarball/b22d7ad712f76a7e7b1070ab339d567dfbf059b1"],
+ "runjs": ["npm", "https://github.com/c9/runjs/tarball/347ad9627fb4a1d63458bc66ea40f0bf1efbf05c"]
},
"repository" : {
View
3  plugins-client/cloud9.core/www/core/ide.js
@@ -45,6 +45,7 @@ define(function(require, exports, module) {
&& loc.indexOf("dev") === -1
&& (loc.indexOf("c9.io") > -1))
{
+ var oldOnError = window.onerror;
window.onerror = function(m, u, l) {
apf.ajax("/api/debug", {
method : "POST",
@@ -56,6 +57,8 @@ define(function(require, exports, module) {
workspaceId : ide.workspaceId
})
});
+ if (oldOnError)
+ oldOnError.apply(this, arguments);
};
//Catch all APF Routed errors
View
2  plugins-client/cloud9.core/www/core/settings.js
@@ -111,7 +111,7 @@ module.exports = {
cb({model : _self.model, ext : _self});
}
catch(e){
- console.error(e.message);
+ console.log(e.message, e.stack);
}
}
},
View
100 plugins-client/ext.code/code.js
@@ -23,6 +23,7 @@ var ProxyDocument = require("ext/code/proxydocument");
var defaultCommands = require("ace/commands/default_commands").commands;
var markup = require("text!ext/code/code.xml");
var settings = require("ext/settings/settings");
+var themes = require("ext/themes/themes");
var markupSettings = require("text!ext/code/settings.xml");
var editors = require("ext/editors/editors");
@@ -42,6 +43,7 @@ apf.actiontracker.actions.aceupdate = function(undoObj, undo){
// name: ["Menu caption", "extensions", "content-type", "hidden|other"]
var SupportedModes = {
+ abap: ["ABAP", "abap", "text/x-abap", "other"],
asciidoc: ["AsciiDoc", "asciidoc", "text/x-asciidoc", "other"],
c9search: ["C9Search", "c9search", "text/x-c9search", "hidden"],
c_cpp: ["C, C++", "c|cc|cpp|cxx|h|hh|hpp", "text/x-c"],
@@ -50,26 +52,26 @@ var SupportedModes = {
coldfusion: ["ColdFusion", "cfm", "text/x-coldfusion", "other"],
csharp: ["C#", "cs", "text/x-csharp"],
css: ["CSS", "css", "text/css"],
- dart: ["Dart", "dart", "text/x-dart"],
- diff: ["Diff", "diff|patch", "text/x-diff", "other"],
- glsl: ["Glsl", "glsl|frag|vert", "text/x-glsl", "other"],
+ dart: ["Dart", "dart", "text/x-dart"],
+ diff: ["Diff", "diff|patch", "text/x-diff", "other"],
+ glsl: ["Glsl", "glsl|frag|vert", "text/x-glsl", "other"],
golang: ["Go", "go", "text/x-go"],
groovy: ["Groovy", "groovy", "text/x-groovy", "other"],
haml: ["Haml", "haml", "text/haml", "other"],
haxe: ["haXe", "hx", "text/haxe", "other"],
html: ["HTML", "htm|html|xhtml", "text/html"],
- jade: ["Jade", "jade", "text/x-jade"],
+ jade: ["Jade", "jade", "text/x-jade"],
java: ["Java", "java", "text/x-java-source"],
- jsp: ["JSP", "jsp", "text/x-jsp", "other"],
+ jsp: ["JSP", "jsp", "text/x-jsp", "other"],
javascript: ["JavaScript", "js", "application/javascript"],
json: ["JSON", "json", "application/json"],
- jsx: ["JSX", "jsx", "text/x-jsx", "other"],
+ jsx: ["JSX", "jsx", "text/x-jsx", "other"],
latex: ["LaTeX", "latex|tex|ltx|bib", "application/x-latex", "other"],
less: ["LESS", "less", "text/x-less"],
lisp: ["Lisp", "lisp|scm|rkt", "text/x-lisp", "other"],
liquid: ["Liquid", "liquid", "text/x-liquid", "other"],
lua: ["Lua", "lua", "text/x-lua"],
- luapage: ["LuaPage" , "lp", "text/x-luapage", "other"],
+ luapage: ["LuaPage", "lp", "text/x-luapage", "other"],
makefile: ["Makefile", "*GNUmakefile|*makefile|*Makefile|*OCamlMakefile|make", "text/x-makefile", "other"],
markdown: ["Markdown", "md|markdown", "text/x-markdown", "other"],
objectivec: ["Objective-C", "m", "text/objective-c", "other"],
@@ -79,6 +81,9 @@ var SupportedModes = {
php: ["PHP", "php|phtml", "application/x-httpd-php"],
powershell: ["Powershell", "ps1", "text/x-script.powershell", "other"],
python: ["Python", "py", "text/x-script.python"],
+ r: ["R" , "r", "text/x-r", "other"],
+ rdoc: ["RDoc" , "Rd", "text/x-rdoc", "other"],
+ rhtml:["RHTML", "Rhtml", "text/x-rhtml", "other"],
ruby: ["Ruby", "ru|gemspec|rake|rb", "text/x-script.ruby"],
scad: ["OpenSCAD", "scad", "text/x-scad", "other"],
scala: ["Scala", "scala", "text/x-scala"],
@@ -87,7 +92,7 @@ var SupportedModes = {
stylus: ["Stylus", "styl|stylus", "text/x-stylus"],
sql: ["SQL", "sql", "text/x-sql"],
svg: ["SVG", "svg", "image/svg+xml", "other"],
- tcl: ["Tcl" , "tcl", "text/x-tcl", "other"],
+ tcl: ["Tcl", "tcl", "text/x-tcl", "other"],
text: ["Text", "txt", "text/plain", "hidden"],
textile: ["Textile", "textile", "text/x-web-textile", "other"],
typescript: ["Typescript", "ts|str", "text/x-typescript"],
@@ -418,7 +423,7 @@ module.exports = ext.register("ext/code/code", {
["fadefoldwidgets", "true"],
["animatedscroll", "true"]
]);
-
+
// Enable bracket insertion by default, even if it was disabled before,
// migrating old users that had it disabled by default
var defaulted = e.model.queryValue("editors/code/@behaviorsdefaulted");
@@ -428,11 +433,6 @@ module.exports = ext.register("ext/code/code", {
e.model.setQueryValue("editors/code/@wrapbehaviors", "false");
}
- // pre load theme
- var theme = e.model.queryValue("editors/code/@theme");
- if (theme)
- require([theme], function() {});
-
// pre load custom mime types
_self.getCustomTypes(e.model);
});
@@ -867,36 +867,84 @@ module.exports = ext.register("ext/code/code", {
});
// display feedback while loading files
- var isOpen, bgMessage, animationEndTimeout;
+ var isOpen, bgMessage, loaderProgress, updateProgressInterval, animationEndTimeout;
var checkLoading = function(e) {
if (!_self.amlEditor.xmlRoot)
return;
- var loading = _self.amlEditor.xmlRoot.hasAttribute("loading");
+ var xmlRoot = _self.amlEditor.xmlRoot;
+ var loading = xmlRoot.hasAttribute("loading");
var container = _self.amlEditor.$editor.container;
+ // loading calcs
+ var padding = container.offsetWidth / 5;
+ var loadingWidth = container.offsetWidth - 2*padding;
+
+ function updateProgress (progress) {
+ xmlRoot.setAttribute("loading_progress", progress);
+ loaderProgress.style.width = (progress * loadingWidth / 100) + "px";
+ }
+
+ function clearProgress() {
+ xmlRoot.setAttribute("loading_progress", 0);
+ loaderProgress.style.width = 0 + "px";
+ }
+
if (loading) {
+ var theme = themes.getActiveTheme();
if (!bgMessage || !bgMessage.parentNode) {
- bgMessage = bgMessage|| document.createElement("div");
+ bgMessage = bgMessage || document.createElement("div");
+ bgMessage.className = "ace_smooth_loading";
+ bgMessage.style.backgroundColor = theme ? theme.bg : "gray";
container.parentNode.appendChild(bgMessage);
- }
- var isDark = container.className.indexOf("ace_dark") != -1;
- bgMessage.className = "ace_smooth_loading" + (isDark ? " ace_dark" : "");
- bgMessage.textContent = "Loading " + _self.amlEditor.xmlRoot.getAttribute("name");
+ var loaderBg = document.createElement("div");
+ loaderBg.className = "loading_bg";
+ loaderBg.style.width = loadingWidth + "px";
+ loaderBg.style.left = padding + "px";
+ loaderBg.style.top = 0.4 * container.offsetHeight + "px";
+ bgMessage.appendChild(loaderBg);
+
+ loaderProgress = document.createElement("div");
+ loaderProgress.className = "loading_progress";
+ loaderProgress.style.left = padding + "px";
+ loaderProgress.style.top = 0.4 * container.offsetHeight + "px";
+ bgMessage.appendChild(loaderProgress);
+ updateProgress(10);
+ }
container.style.transitionProperty = "opacity";
- container.style.transitionDuration = "300ms";
+ container.style.transitionDuration = "100ms";
container.style.pointerEvents = "none";
container.style.opacity = 0;
isOpen = true;
+
+ clearInterval(updateProgressInterval);
+ updateProgressInterval = setInterval(function () {
+ var progress = parseFloat(xmlRoot.getAttribute("loading_progress"), 10);
+ var step;
+ if (progress < 35)
+ step = 3;
+ else if (progress < 70)
+ step = 1;
+ else if (progress < 90)
+ step = 0.25;
+ if (step)
+ updateProgress(progress + step);
+ }, 30);
clearTimeout(animationEndTimeout);
} else if (isOpen) {
- isOpen = false;
- container.style.opacity = 1;
- container.style.pointerEvents = "";
+ clearInterval(updateProgressInterval);
+ updateProgress(100);
+ setTimeout(function () {
+ isOpen = false;
+ clearProgress();
+ container.style.opacity = 1;
+ container.style.pointerEvents = "";
+ }, 40);
+
animationEndTimeout = setTimeout(function() {
if (bgMessage.parentNode)
bgMessage.parentNode.removeChild(bgMessage);
- }, 350);
+ }, 100);
}
};
View
9 plugins-client/ext.codecomplete/complete_util.js
@@ -2,7 +2,7 @@ define(function(require, exports, module) {
var ID_REGEX = /[a-zA-Z_0-9\$]/;
-function retrievePreceedingIdentifier(text, pos, regex) {
+function retrievePrecedingIdentifier(text, pos, regex) {
regex = regex || ID_REGEX;
var buf = [];
for (var i = pos-1; i >= 0; i--) {
@@ -72,7 +72,12 @@ function fetchText(staticPrefix, path) {
return false;
}
-exports.retrievePreceedingIdentifier = retrievePreceedingIdentifier;
+/** @deprecated Use retrievePrecedingIdentifier */
+exports.retrievePreceedingIdentifier = function() {
+ console.error("Deprecated: 'retrievePreceedingIdentifier' - use 'retrievePrecedingIdentifier' instead");
+ return retrievePrecedingIdentifier.apply(null, arguments);
+};
+exports.retrievePrecedingIdentifier = retrievePrecedingIdentifier;
exports.retrieveFollowingIdentifier = retrieveFollowingIdentifier;
exports.findCompletions = findCompletions;
exports.fetchText = fetchText;
View
4 plugins-client/ext.codecomplete/local_completer.js
@@ -45,7 +45,7 @@ function wordDistanceAnalyzer(doc, pos, prefix) {
function analyze(doc, pos) {
var line = doc.getLine(pos.row);
- var identifier = completeUtil.retrievePreceedingIdentifier(line, pos.column);
+ var identifier = completeUtil.retrievePrecedingIdentifier(line, pos.column);
var analysisCache = wordDistanceAnalyzer(doc, pos, identifier);
return analysisCache;
@@ -54,7 +54,7 @@ function analyze(doc, pos) {
completer.complete = function(doc, fullAst, pos, currentNode, callback) {
var identDict = analyze(doc, pos);
var line = doc.getLine(pos.row);
- var identifier = completeUtil.retrievePreceedingIdentifier(line, pos.column);
+ var identifier = completeUtil.retrievePrecedingIdentifier(line, pos.column);
var allIdentifiers = [];
for (var ident in identDict) {
View
2  plugins-client/ext.codecomplete/mode_completer.js
@@ -26,7 +26,7 @@ completer.complete = function(doc, fullAst, pos, currentNode, callback) {
var language = this.language;
var line = doc.getLine(pos.row);
var idRegex = ID_REGEXES[language];
- var identifier = completeUtil.retrievePreceedingIdentifier(line, pos.column, idRegex);
+ var identifier = completeUtil.retrievePrecedingIdentifier(line, pos.column, idRegex);
if(!identifier.length) // No completion after "."
return callback([]);
View
2  plugins-client/ext.codecomplete/open_files_local_completer.js
@@ -78,7 +78,7 @@ completer.onUpdate = function(doc, callback) {
completer.complete = function(doc, fullAst, pos, currentNode, callback) {
var line = doc.getLine(pos.row);
- var identifier = completeUtil.retrievePreceedingIdentifier(line, pos.column);
+ var identifier = completeUtil.retrievePrecedingIdentifier(line, pos.column);
var identDict = globalWordIndex;
var allIdentifiers = [];
View
2  plugins-client/ext.codecomplete/snippet_completer.js
@@ -19,7 +19,7 @@ completer.handlesLanguage = function(language) {
completer.complete = function(doc, fullAst, pos, currentNode, callback) {
var line = doc.getLine(pos.row);
- var identifier = completeUtil.retrievePreceedingIdentifier(line, pos.column);
+ var identifier = completeUtil.retrievePrecedingIdentifier(line, pos.column);
if(line[pos.column - identifier.length - 1] === '.') // No snippet completion after "."
return callback([]);
View
2  plugins-client/ext.colorpicker/colorpicker.css
@@ -1,6 +1,6 @@
.codetools_colorpicker {
position: absolute;
- opacity: 0.9;
+ opacity: 0.5;
border: 1px solid #d9cb89;
background-color: #fff8c8;
-webkit-border-radius: 6px;
View
9 plugins-client/ext.colorpicker/colorpicker.js
@@ -12,6 +12,7 @@ var ext = require("core/ext");
var settings = require("ext/settings/settings");
var Editors = require("ext/editors/editors");
var codetools = require("ext/codetools/codetools");
+var SyntaxDetector = require("ext/language/syntax_detector");
var Range = require("ace/range").Range;
@@ -223,8 +224,8 @@ module.exports = ext.register("ext/colorpicker/colorpicker", {
var editor = e.editor;
var line = doc.getLine(1);
- if (!(e.amlEditor.syntax == "css" || e.amlEditor.syntax == "svg" ||
- (line && line.indexOf("<a:skin") > -1)))
+ if (!(e.amlEditor.syntax === "css" || e.amlEditor.syntax === "svg" ||
+ SyntaxDetector.getContextSyntax(doc, pos, e.amlEditor.syntax) === "css" || (line && line.indexOf("<a:skin") > -1)))
return;
line = doc.getLine(pos.row);
@@ -248,8 +249,8 @@ module.exports = ext.register("ext/colorpicker/colorpicker", {
var editor = e.editor;
var line = doc.getLine(1);
- if (!(e.amlEditor.syntax == "css" || e.amlEditor.syntax == "svg"
- || e.amlEditor.syntax == "html" || (line && line.indexOf("<a:skin") > -1)))
+ if (!(e.amlEditor.syntax === "css" || e.amlEditor.syntax === "svg" ||
+ SyntaxDetector.getContextSyntax(doc, pos, e.amlEditor.syntax) === "css" || (line && line.indexOf("<a:skin") > -1)))
return;
//do not show anything when a selection is made...
var range = editor.selection.getRange();
View
7 plugins-client/ext.csslanguage/css_handler.js
@@ -14,8 +14,8 @@ handler.handlesLanguage = function(language) {
return language === "css";
};
-handler.analyze = function(doc, ast, callback) {
- callback(handler.analyzeSync(doc, ast));
+handler.analyze = function(value, ast, callback) {
+ callback(handler.analyzeSync(value, ast));
};
var CSSLint_RULESET = {
@@ -53,8 +53,7 @@ var CSSLint_RULESET = {
"zero-units" : 1
};
-handler.analyzeSync = function(doc, ast) {
- var value = doc.getValue();
+handler.analyzeSync = function(value, ast) {
value = value.replace(/^(#!.*\n)/, "//$1");
var results = CSSLint.verify(value, CSSLint_RULESET);
View
56 plugins-client/ext.dockpanel/dockpanel.js
@@ -107,6 +107,16 @@ module.exports = ext.register("ext/dockpanel/dockpanel", {
// JSON parse COULD fail
try {
state = JSON.parse(strSettings);
+ var defaultBars = _self.defaultState.bars;
+ for (var i = 0, l = Math.max(state.bars.length, defaultBars.length); i < l; i++) {
+ if (!defaultBars[i]) {
+ state.bars[i] = null;
+ continue;
+ }
+ // Code update adding more dockables
+ if (!state.bars[i] || state.bars[i].sections.length < defaultBars[i].sections.length)
+ state.bars[i] = defaultBars[i];
+ }
}
catch (ex) {}
}
@@ -114,17 +124,13 @@ module.exports = ext.register("ext/dockpanel/dockpanel", {
ide.dispatchEvent("dockpanel.load.settings", {state: state});
_self.layout.loadState(state);
_self.loaded = true;
-
- _self.setParentHboxTop(
- apf.isFalse(settings.model.queryValue("auto/tabs/@show")) ? -15 : 0,
- apf.isFalse(settings.model.queryValue("general/@animateui"))
- );
+ ide.dispatchEvent("dockpanel.loaded", {state: state});
});
});
- ide.addEventListener("tabs.visible", function(e){
- _self.setParentHboxTop(!e.value ? -15 : 0, e.noanim);
- });
+ _self.updateParentHboxTop();
+ ide.addEventListener("menus.restore", _self.updateParentHboxTop);
+ ide.addEventListener("menus.minimize", _self.updateParentHboxTop);
this.nodes.push(
menus.addItemByPath("View/Dock Panels/", null, 150),
@@ -155,15 +161,10 @@ module.exports = ext.register("ext/dockpanel/dockpanel", {
);
},
- setParentHboxTop : function(top, noAnim){
- if (noAnim) {
- hboxDockPanel.$ext.style.top = top + "px";
- }
- else {
- anims.animate(hboxDockPanel.$ext, {
- top: top + "px"
- });
- }
+ updateParentHboxTop : function() {
+ var hbox = hboxDockPanel.$ext;
+ var top = menus.minimized ? 22 : 3;
+ hbox.style.paddingTop = top + "px";
},
saveSettings : function(){
@@ -206,21 +207,28 @@ module.exports = ext.register("ext/dockpanel/dockpanel", {
var layout = this.layout, _self = this;
panel[type].mnuItem = menus.addItemByPath(
- "View/Dock Panels/" + options.menu.split("/").pop(),
+ (options.menuPath || "View/Dock Panels/") + options.menu.split("/").pop(),
new apf.item({
id : "mnu" + type,
type : "check",
onclick : function(){
var page = getPage();
- var uId = _self.getButtons(name, type)[0].uniqueId;
- layout.show(uId, true);
- if (layout.isExpanded(uId) < 0)
- layout.showMenu(uId);
+ var uId = _self.getButtons(name, type);
+ if (uId.length && (uId = uId[0].uniqueId)) {
+ if (this.value) {
+ layout.hide(uId);
+ }
+ else {
+ layout.show(uId, true);
+ if (layout.isExpanded(uId) < 0)
+ layout.showMenu(uId);
- page.parentNode.set(page);
+ page.parentNode.set(page);
+ }
+ }
}
- }));
+ }), options.menuIndex);
},
//@todo
View
774 plugins-client/ext.dockpanel/libdock.js
@@ -1,13 +1,13 @@
/*
- TODO:
+ TODO:
- floating sections or menus
-
+
- single page should drag whole tab like button to section does
- anim should wait x00ms before playing
-
+
- tweak tab animations
- menu should appear onmouseup not down
-
+
INTEGRATION
- add conditional availability of buttons
- add right click menu to buttons/sections
@@ -23,7 +23,7 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
this.$cbChange = cbChange;
this.$cbFindOptions = cbFindOptions;
this.$cbAnimate = cbAnimate;
-
+
var indicator = this.indicator = document.body.appendChild(document.createElement("div"));
indicator.style.position = "absolute";
indicator.style.display = "none";
@@ -34,43 +34,45 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
(function(){
var whiledrag, lastInfo, diffPixel = 3;
var menuCounter = 100;
- var state, lookup; //@todo wrong use of scope.
-
+ var state, lookup; //@todo wrong use of scope.
+
function findParentState(data, forceSearch){
var uniqueId = (data || {}).uniqueId;
if (!uniqueId)
return;
var node = lookup[uniqueId].node;
-
+
if (!forceSearch && node && node.parentNode)
return node.parentNode.$dockData;
else {
var found;
state.bars.each(function(bar){
if (found) return;
-
+
bar.sections.each(function(section){
if (found) return;
if (section.uniqueId == uniqueId)
found = bar;
-
+
section.buttons.each(function(button){
if (found) return;
-
+
if (button.uniqueId == uniqueId)
found = section;
});
-
+
});
});
-
+
return found;
}
}
-
+
function hasVisibleChildren(list){
for (var i = 0; i < list.length; i++) {
+ if (!list[i])
+ continue;
var l2 = list[i].buttons || list[i].sections;
if (l2) {
if (hasVisibleChildren(l2))
@@ -81,16 +83,16 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
}
return false;
}
-
+
function findNextKnownNode(list, index){
for (var i = index; i < list.length; i++) {
- if (list[i].uniqueId
- && lookup[list[i].uniqueId].node
- && lookup[list[i].uniqueId].node.parentNode)
+ if (list[i] && list[i].uniqueId &&
+ lookup[list[i].uniqueId].node &&
+ lookup[list[i].uniqueId].node.parentNode)
return lookup[list[i].uniqueId].node;
}
}
-
+
function tableCleanup(pNode, btnPNode, oldMenu, b){
if (!pNode.getPages || !pNode.getPages().length) { //@todo move this to addPage
@@ -100,68 +102,68 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
b.insertIndex(buttons[i].$dockData, i);
}
}
-
+
var barParent = btnPNode.parentNode;
oldMenu.removeNode();//destroy(true, true);
-
+
if (pNode.parentNode)
oldMenu.appendChild(pNode);
//pNode.removeNode();//destroy(true, true);
-
+
btnPNode.removeNode();//destroy(true, true);
//lookup[btnPNode.$dockData.uniqueId].node = undefined;
-
+
if (!barParent.selectNodes("vbox").length) {
barParent.removeNode();//destroy(true, true);
//lookup[barParent.$dockData.uniqueId].node = undefined;
-
+
if (barParent.vbox) {
barParent.vbox.removeNode();//destroy(true, true);
barParent.splitter.removeNode();//destroy(true, true);
}
-
+
//Resize hbox
this.resizeMainHbox();
}
}
}
-
+
this.resizeMainHbox = function(){
var hboxParent = this.$parentHBox;
var l = hboxParent.lastChild;
var f = hboxParent.firstChild;
while (l && !l.visible) l = l.previousSibling;
while (f && !f.visible) f = f.nextSibling;
-
+
if (!l) {
hboxParent.setWidth(0);
return;
}
-
+
hboxParent.setWidth(l.getLeft() + l.getWidth() - f.getLeft());
- }
-
+ };
+
this.checkBars = function (){
var bar, bars = state.bars;
for (var i = bars.length - 1; i >= 0; i--) {
bar = bars[i];
- if (bar.cache && bar.cache.childNodes.length == 1) {
+ if (bar && bar.cache && bar.cache.childNodes.length == 1) {
bar.cache.destroy(true, true);
delete bar.cache;
//bars.remove(bar);
}
}
-
+
this.resizeMainHbox();
- }
-
+ };
+
function registerLookup(node){
if (!node.$dockData.uniqueId)
node.$dockData.uniqueId = lookup.push({node: node, data: node.$dockData}) - 1;
else
lookup[node.$dockData.uniqueId] = {node: node, data: node.$dockData};
}
-
+
function findNextBar(start){
var bar = start.nextSibling;
while (bar) {
@@ -175,7 +177,7 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
}
return bar != start ? bar : null;
}
-
+
function findPreviousBar(start){
var bar = start.previousSibling;
while (bar) {
@@ -189,7 +191,7 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
}
return bar != start ? bar : null;
}
-
+
function findNextElement(start, type){
var el = start.nextSibling;
while (el && !el.visible && (!type || el.localName != type)) {
@@ -197,15 +199,15 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
}
return el;
}
-
+
/**
* Retrieve the current state of the layout as a JSON object
- *
+ *
*/
this.getState = function(raw){
if (raw)
return state;
-
+
var copy = {};
copy.bars = state.bars.slice(0);
@@ -214,13 +216,13 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
//bar.cache = undefined;
delete bar.cache;
bar.sections = bar.sections.slice(0);
-
+
(bar.sections).each(function(section, i, list){
section = list[i] = apf.extend({}, section);
//section.cache = undefined;
delete section.cache;
section.buttons = section.buttons.slice(0);
-
+
(section.buttons).each(function(button, i, list){
button = list[i] = apf.extend({}, button);
//button.cache = undefined;
@@ -228,10 +230,10 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
});
});
});
-
+
return JSON.parse(JSON.stringify(copy));
};
-
+
/**
* Set the current layout via a JSON object
* @param {Object} obj JSON object with the following structure:
@@ -247,7 +249,7 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
* height : 200,
* buttons : [
* {
- *
+ *
* }
* ]
* }
@@ -255,28 +257,28 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
* }
* ]
* }
- *
+ *
*/
this.loadState = function(data){
this.clearState();
state = JSON.parse(JSON.stringify(data));
lookup = [];
-
- if (!state.bars)
+
+ if (!state.bars)
return;
-
+
for (var i in state.bars) {
if(!state.bars[i])
delete state.bars[i];
}
-
+
state.bars.each(function(bar){
bar.uniqueId = lookup.push({data: bar}) - 1;
-
+
bar.sections.each(function(section){
section.uniqueId = lookup.push({data: section}) - 1;
-
+
section.buttons.each(function(button){
button.uniqueId = lookup.push({data: button}) - 1;
});
@@ -289,7 +291,7 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
addBarState.call(this, bars[i]);
}
};
-
+
/**
* Destroy full state
*/
@@ -299,7 +301,7 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
state.bars.each(function(b) {
var bar = b.cache;
if (!bar) return;
-
+
if (bar.localName == "bar" && bar.dock) {
bar.hide();
if (bar.vbox)
@@ -319,19 +321,19 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
else if (!bar.bar) {
return;
}
-
+
bar.destroy(true, true);
if (bar.vbox)
bar.vbox.destroy(true, true);
});
};
-
+
/**
* Experimental and probably useless
*
this.updateState = function(data, section){
var before;
-
+
if (data.bars) {
var bars = data.bars;
for (var i = 0; i < bars.length; i++) {
@@ -345,7 +347,7 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
}
else if (data.sections) {
var bar = this.lookup[data.uniqueId];
-
+
var sections = data.sections;
for (var i = 0; i < sections.length; i++) {
if (!sections[i].uniqueId) {
@@ -355,12 +357,12 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
else
this.updateState(sections[i]);
}
-
+
//@todo update other states here
}
else if (data.buttons) {
section = section || this.lookup[data.uniqueId];
-
+
var buttons = data.buttons;
for (var i = 0; i < buttons.length; i++) {
if (!buttons[i].uniqueId) {
@@ -371,12 +373,12 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
this.updateState(buttons[i], section);
}
}
-
+
//@todo update other states here
}
else {
var button = this.lookup[data.uniqueId];
-
+
var hidden = state.$dockData.hidden;
if (button.$dockData.hidden != hidden) {
if (hidden)
@@ -385,44 +387,44 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
return true;
}
}
-
+
//@todo update other states here
}
};*/
-
+
this.addTo = function(def, uniqueId) {
var item = lookup[uniqueId] && lookup[uniqueId].data;
if(!item)
return false;
-
+
if (item.buttons) {
item.buttons.push(def);
}
else if (item.sections) {
item.sections.push(def);
}
-
+
def.uniqueId = lookup.push({data: def}) - 1;
return def.uniqueId;
};
-
+
this.show = function(uniqueId, byUser){
var item = lookup[uniqueId] && lookup[uniqueId].data;
if(!item)
return;
-
+
var before;
if (!item.bars && !item.sections) {
var section = findParentState(lookup[uniqueId].data);
if (!hasVisibleChildren(section.buttons)) {
-
+
var bar = findParentState(section);
if (!hasVisibleChildren(bar.sections)) {
section.buttons.each(function(button){
if (button.hidden != 2 || button.uniqueId == uniqueId)
button.hidden = byUser ? -2 : -1;
});
-
+
before = findNextKnownNode(state.bars, state.bars.indexOf(bar) + 1);
addBarState.call(this, bar, before);
}
@@ -431,7 +433,7 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
if (button.hidden != 2 || button.uniqueId == uniqueId)
button.hidden = byUser ? -2 : -1;
});
-
+
before = findNextKnownNode(bar.sections, bar.sections.indexOf(section) + 1);
addSectionState.call(this, section, before, lookup[bar.uniqueId].node);
}
@@ -456,7 +458,7 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
});
}
};
-
+
this.hide = function(uniqueId, byUser){
var item = lookup[uniqueId].data;
@@ -474,7 +476,7 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
});
});
};
-
+
this.isExpandedFull = function(node){
var pNode = node.parentNode;
while (pNode && pNode.id != "hboxDockPanel") {
@@ -484,121 +486,121 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
}
return false;
};
-
+
this.isExpanded = function(uniqueId){
var button = lookup[uniqueId].node;
if (!button) {
this.show(uniqueId);
button = lookup[uniqueId].node;
}
-
+
var bar = findParentState(findParentState(lookup[uniqueId].data));
-
+
if(!bar)
return -1;
-
+
return lookup[bar.uniqueId].data.expanded;
};
-
+
this.showMenu = function(uniqueId){
var button = lookup[uniqueId].node;
if (!button) {
this.show(uniqueId);
button = lookup[uniqueId].node;
}
-
+
button.showMenu();
-
+
var tab = button.$dockpage.parentNode;
if (!tab.activepage)
tab.set(tab.getPage(0));
};
-
+
this.findBar = function(uniqueId, el){
var button = lookup[uniqueId].node;
var node = button && button.parentNode.parentNode;
-
+
return el ? node : node.$dockData;
};
-
+
this.findTabs = function(uniqueId, el){
var bar = lookup[uniqueId].node;
var nodes = bar.vbox.selectNodes("tab");
-
+
if (el)
return apf.getArrayFromNodelist(nodes);
-
+
var list = [];
for (var i = 0; i < nodes.length; i++) {
list.push(nodes[i].$dockData);
}
-
+
return list;
};
-
+
function addBarState(state, beforeBar){
var sections = state.sections;
if (!hasVisibleChildren(sections))
return;
-
+
var bar = this.$addBar(beforeBar, state);
-
+
for (var j = 0; j < sections.length; j++) {
- addSectionState.call(this, sections[j],
- sections[j].position
+ addSectionState.call(this, sections[j],
+ sections[j].position
? bar.childNodes[sections[j].position]
: null, bar);
}
-
+
if (state.expanded > 0)
this.expandBar(bar, state.expanded == 2, true);
}
-
+
function addSectionState(state, beforeState, bar){
var buttons = state.buttons;
if (!hasVisibleChildren(buttons))
return;
-
- var section = this.$addSection(bar,
- beforeState,
+
+ var section = this.$addSection(bar,
+ beforeState,
null, state);
-
+
this.$addMenu(section, state);
-
+
for (var k = 0; k < buttons.length; k++) {
addButtonState.call(this, buttons[k], null, section);
}
}
-
+
function addButtonState(state, before, section){
if (state.hidden > 0)
return;
// code here to throw if no parentNode is set.
section.parentNode;
- this.$addButton(section, before, section.$menu,
+ this.$addButton(section, before, section.$menu,
this.$addPage(
- this.$cbFindPage(state.ext),
+ this.$cbFindPage(state.ext),
before && before.$dockpage,
- section.$menu,
- state.caption,
+ section.$menu,
+ state.caption,
state.caption && state.caption.toLowerCase() || "",
section
), apf.extend(state, this.$cbFindOptions(state.ext) || {}) //@todo options don't need to be late anymore
);
}
-
+
function animate(bar, reverse, callback){
var _self = this;
if (this.animateControl)
this.animateControl.stop();
-
+
this.animating = true;
-
+
bar.show();
bar.vbox.show();
-
+
var from = bar.getWidth();
var to = bar.vbox.getWidth() - apf.getWidthDiff(bar.vbox.$ext);
@@ -606,13 +608,13 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
bar.hide();
else
bar.vbox.setWidth(from);
-
+
var tweens = [
(reverse
? {oHtml: bar.vbox.$ext, type: "width", from: to, to: from}
: {oHtml: bar.vbox.$ext, type: "width", from: from, to: to})
]
-
+
var nodes = bar.vbox.getElementsByTagNameNS(apf.ns.aml, "tab");
nodes.each(function(tab){
tweens.push(reverse
@@ -631,7 +633,7 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
apf.layout.forceResize(bar.vbox.$ext);
},
onfinish : function(){
- setTimeout(function(){
+ setTimeout(function(){
//if (reverse) {
nodes.each(function(tab){
apf.setOpacity(tab.$ext, 1);
@@ -645,30 +647,33 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
}
};
options.onstop = options.onfinish;
-
+
apf.tween.multi(document.body, options);
}
-
+
/**
* Expand a bar
*/
this.expandBar = function (bar, byUser, showAnimation){
if (typeof bar == "number")
bar = lookup[bar].node;
-
+
if (this.$currentMenu)
this.$currentMenu.hide();
-
+
var pNode = bar.parentNode || this.$parentHBox;
if (!bar.vbox) {
var _self = this;
+
+ if (bar.$dockData.minWidth)
+ pNode.minwidth = bar.$dockData.minWidth;
+
bar.vbox = pNode.insertBefore(new apf.vbox({
padding : 0,
width : bar.$dockData && bar.$dockData.width || 260,
splitters : true,
vdock : 1,
- minwidth : 150,
"class" : "dockcol unselectable expandedpanel",
childNodes : [
new apf.button({
@@ -700,7 +705,7 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
_self.$currentMenu.hide();
}
}), bar.vbox);
-
+
bar.splitter.addEventListener("dragstart", function(){
if (!this.previousSibling) {
if (!bar.splitter.parent) {
@@ -710,7 +715,7 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
bar.splitter.$ext.onmousedown();
return false;
}
-
+
bar.vbox.setAttribute("width", "");
bar.vbox.setAttribute("flex", "1");
}
@@ -740,21 +745,21 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
}
});
- bar.splitter.bar =
+ bar.splitter.bar =
bar.vbox.bar = bar;
}
else {
pNode.insertBefore(bar.vbox, bar);
pNode.insertBefore(bar.splitter, bar.vbox);
}
-
+
var vbox = bar.selectNodes("vbox");
-
+
for (var i = 0; i < vbox.length; i++) {
var button = vbox[i].selectSingleNode("button"),
menu = self[button.submenu],
childEl = menu && menu.firstChild;
-
+
if (childEl) {
childEl.extId = button.$dockData.ext[0];
bar.vbox.appendChild(childEl);
@@ -767,10 +772,10 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
if (bar.vbox) {
bar.vbox.show();
- bar.vbox.expanded = true;
+ bar.vbox.expanded = true;
bar.vbox.firstChild.$ext.onmousemove({});
}
-
+
this.findTabs(bar.$dockData.uniqueId, true)
.each(function(tab){
if (!tab.activepage) {
@@ -782,26 +787,26 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
tab.getPage(tab.activepage).$active = true;
}
});
-
+
if (false && showAnimation && this.$cbAnimate())
animate.call(this, bar);
-
+
bar.hide();
bar.expanded = true;
bar.splitter.show();
bar.$dockData.expanded = byUser ? 2 : 1;
-
+
this.$cbChange();
this.resizeMainHbox();
};
-
+
/**
* Collapse a bar
*/
this.collapseBar = function(bar, byUser, showAnimation){
if (typeof bar == "number")
bar = lookup[bar].node;
-
+
bar.$dockData.expanded = byUser ? -2 : -1;
bar.expanded = false;
@@ -820,11 +825,11 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
skip++;
continue;
}*/
-
+
var menu = self[vboxes[i].selectSingleNode("button").submenu];
menu.appendChild(tabs[i]); //-skip
}
-
+
bar.show();
bar.vbox.hide();
if (bar.parentNode)
@@ -837,19 +842,19 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
animate.call(this, bar, true, done);
else
done();
-
+
//Hack for button
bar.firstChild.$ext.onmousemove({});
-
+
this.$cbChange();
this.resizeMainHbox();
};
-
+
this.$isLastBar = function(aml) {
var last = this.$parentHBox.lastChild;
while (last && !last.visible)
last = last.previousSibling;
-
+
return aml == last || aml == last.vbox;
};
@@ -857,7 +862,7 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
var firstBar = this.$parentHBox.firstChild;
if (!firstBar)
return;
-
+
if (!firstBar.visible) {
while (firstBar && !firstBar.visible) {
firstBar = firstBar.nextSibling;
@@ -866,13 +871,13 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
if (firstBar.localName != "bar")
firstBar = firstBar.bar;
-
+
//if (lastBar && !lastBar.visible)
//lastBar = lastBar.vbox;
-
+
return firstBar.visible ? firstBar : firstBar.vbox;
};
-
+
/**
* Starts the docking detection during drag&drop
*/
@@ -880,43 +885,43 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
var last, state = 0, _self = this;
apf.setOpacity(dragged.$ext, 0.2);
-
+
apf.setStyleClass(dragged.$ext, "dragging");
-
+
var lastBar = this.$getLastBar();
var leftEdge = apf.getAbsolutePosition(lastBar.$ext)[0];
var indicator = this.indicator;
-
+
lastInfo = null;
-
+
//Fix, actually bug is in interactive
apf.addListener(document, "mouseup", function(e){
apf.removeListener(document, "mousemove", whiledrag);
apf.removeListener(document, "mouseup", arguments.callee);
});
-
+
apf.addListener(document, "mousemove", whiledrag = function(e){
if (last) {
last.$ext.style.borderBottom = "";
last = null;
}
-
+
if (!e) return;
-
+
if (e.button !== 0) {
document.onmouseup(null, true);
return;
}
-
+
var indicatorTop = indicator.style.top;
dragged.$ext.style.top = "-2000px";
indicator.style.top = "-2000px";
apf.plane.hide();
-
+
var info, aml;
//Adding a column
if (e.clientX > leftEdge - 40 && e.clientX < leftEdge) {
- var isSameColumn = dragged.localName == "vbox"
+ var isSameColumn = dragged.localName == "vbox"
&& dragged.$dockbar == lastBar
&& !dragged.$dockbar.selectNodes("vbox").length;
@@ -930,15 +935,15 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
info = _self.$calcAction(e, original);
aml = last = info.aml;
}
-
+
if (lastInfo && lastInfo.position == info.position && lastInfo.aml == aml) {
indicator.style.top = indicatorTop;
//indicator.style.display = "block";
return;
}
-
+
lastInfo = info;
-
+
if (!aml || !aml.dock && !aml.bar) {
if (!state && false) {
state = 1;
@@ -965,7 +970,7 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
indicator.style.borderColor = borderColor;
indicator.style.marginLeft = "0";
indicator.innerHTML = "";
-
+
if (state && false) {
state = 0;
apf.tween.single(dragged.$ext, {
@@ -978,7 +983,7 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
}
});
}
-
+
var isDropExpanded = _self.isExpandedFull(info.aml);
var width = aml.$ext.offsetWidth;
var height = aml.$ext.offsetHeight;
@@ -987,20 +992,20 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
case "after_button":
indicator.innerHTML = "<div></div><div style='position:absolute'></div>";
indicator.style.border = "1px solid " + borderColor2;
-
+
var pos2 = apf.getAbsolutePosition(aml.parentNode.$ext);
indicator.style.left = (pos2[0] - 1) + "px";
indicator.style.top = pos2[1] + "px";
width = aml.parentNode.$ext.offsetWidth + 1;
height = aml.parentNode.$ext.offsetHeight + 1;
-
+
var divHead = indicator.firstChild;
divHead.style.height = "7px";
divHead.style.backgroundColor = borderColor;
-
+
var div = indicator.childNodes[1];
var oBtn = getOriginal("button", original);
- var isSameElement = aml == oBtn ||
+ var isSameElement = aml == oBtn ||
findNextElement(aml, "button") == oBtn && info.position == "after_button";
if (isSameElement) { //@todo Checks needs to include different representations
if (aml != oBtn)
@@ -1014,13 +1019,13 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
}
else {
div.style.top = (pos[1] - pos2[1]
- + (info.position == "before_button" ? 0 : aml.$ext.offsetHeight)
+ + (info.position == "before_button" ? 0 : aml.$ext.offsetHeight)
) + "px";
div.style.width = "34px";
div.style.margin = "0 2px 0 1px";
div.style.borderBottom = "3px solid " + borderColor;
}
-
+
break;
case "in_section":
if (getOriginal("section", original) == aml.$dockfor) {//@todo move this
@@ -1038,13 +1043,13 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa
width = pNode.$ext.offsetWidth + (!isDropExpanded ? 6 : 2);
height = pNode.$ext.offsetHeight + (!isDropExpanded ? 11 : 0);
indicator.style.borderWidth = "3px 3px 3px 3px";
-
- var compareAml = info.position == "before_page"
- ? aml.previousSibling
+
+ var compareAml = info.position == "before_page"
+ ? aml.previousSibling
: aml.nextSibling;
var originalAml = getOriginal("page", original);
- var matchAml = originalAml == aml
- ? aml
+ var matchAml = originalAml == aml
+ ? aml
: (originalAml == compareAml ? compareAml : false);
var diff = apf.getAbsolutePosition((matchAml || aml).$button, pNode.$ext);
if (matchAml) {
@@ -1058,15 +1063,15 @@ var DockableLayout = module.exports = function(parentHBox, cbFindPage, cbStorePa