Merge pull request +7734 from c9/git-ui

[WIP] Git ui first iteration
pull/124/head
Harutyun Amirjanyan 2015-08-07 14:25:50 +04:00
commit d73b3ef3dc
13 zmienionych plików z 79 dodań i 31 usunięć

Wyświetl plik

@ -700,6 +700,13 @@ module.exports = function(options) {
staticPrefix: staticPrefix + "/plugins/c9.ide.collab/notifications" staticPrefix: staticPrefix + "/plugins/c9.ide.collab/notifications"
}, },
]; ];
if (options.standalone || options.local) {
plugins.push(
"plugins/c9.ide.scm/status",
"plugins/c9.ide.scm/editor"
);
}
if (packaging || !devel) { if (packaging || !devel) {
plugins.push({ plugins.push({

Wyświetl plik

@ -56,9 +56,7 @@ var Marker = function(parentEl) {
}; };
this.update = function(config) { this.update = function(config) {
var config = config || this.config; if (!config) return;
if (!config)
return;
this.config = config; this.config = config;

4
node_modules/ace/lib/ace/lib/dom.js wygenerowano vendored
Wyświetl plik

@ -46,7 +46,7 @@ exports.createElement = function(tag, ns) {
}; };
exports.hasCssClass = function(el, name) { exports.hasCssClass = function(el, name) {
var classes = (el.className || "").split(/\s+/g); var classes = (el.className + "").split(/\s+/g);
return classes.indexOf(name) !== -1; return classes.indexOf(name) !== -1;
}; };
@ -84,7 +84,7 @@ exports.toggleCssClass = function(el, name) {
add = false; add = false;
classes.splice(index, 1); classes.splice(index, 1);
} }
if(add) if (add)
classes.push(name); classes.push(name);
el.className = classes.join(" "); el.className = classes.join(" ");

Wyświetl plik

@ -76,7 +76,7 @@ function DefaultHandlers(mouseHandler) {
title = provider.getTooltipText ? provider.getTooltipText(node) : provider.getText(node); title = provider.getTooltipText ? provider.getTooltipText(node) : provider.getText(node);
} }
if (editor.container.title != title) if (!editor.tooltip && editor.container.title != title)
editor.container.title = title; editor.container.title = title;
this.updateHoverState(node); this.updateHoverState(node);
}; };

Wyświetl plik

@ -2,6 +2,7 @@ define(function(require, exports, module) {
"use strict"; "use strict";
var dom = require("ace/lib/dom"); var dom = require("ace/lib/dom");
var lang = require("ace/lib/lang"); var lang = require("ace/lib/lang");
var MouseEvent = require("./mouse/mouse_event").MouseEvent;
dom.importCssString(".no-events * {pointer-events:none!important}"); dom.importCssString(".no-events * {pointer-events:none!important}");
function Tooltip(tree) { function Tooltip(tree) {
this.tree = tree; this.tree = tree;
@ -9,7 +10,8 @@ function Tooltip(tree) {
this.tree.on("mousewheel", this.onMouseMove.bind(this, null)); this.tree.on("mousewheel", this.onMouseMove.bind(this, null));
this.tree.renderer.scroller.addEventListener("mouseout", this.onMouseOut.bind(this)); this.tree.renderer.scroller.addEventListener("mouseout", this.onMouseOut.bind(this));
this.setUp(); this.setUp();
// this.tree.renderer.on("afterRender", this.updateNodeClass.bind(this)); this.update = this.update.bind(this);
this.tree.renderer.on("afterRender", this.updateNodeClass.bind(this));
this.clearDelayed = lang.delayedCall(this.onMouseMove.bind(this), 50); this.clearDelayed = lang.delayedCall(this.onMouseMove.bind(this), 50);
} }
@ -20,7 +22,7 @@ function Tooltip(tree) {
this.root.className = container.className + " no-events"; this.root.className = container.className + " no-events";
this.root.style.cssText = "border: 0px;margin: 0px;" this.root.style.cssText = "border: 0px;margin: 0px;"
+ "position: absolute; bottom: initial; right: initial; width: auto; height: auto;" + "position: absolute; bottom: initial; right: initial; width: auto; height: auto;"
+ "overflow: visible;z-index: 1000000; white-space: pre;" + "overflow: visible;z-index: 190000; white-space: pre;"
+ "pointer-events: none"; + "pointer-events: none";
// var color = dom.computedStyle(container).backgroundColor; // var color = dom.computedStyle(container).backgroundColor;
// if (!color) // if (!color)
@ -28,20 +30,24 @@ function Tooltip(tree) {
document.body.appendChild(this.root); document.body.appendChild(this.root);
}; };
this.updateNode = function(treeNode) { this.updateNode = function(treeDomNode) {
if (this.node) { if (this.node) {
this.node.parentNode.removeChild(this.node); this.node.parentNode.removeChild(this.node);
this.node = null; this.node = null;
} }
this.treeNode = treeNode; this.treeDomNode = treeDomNode;
if (!treeNode) { var rect = treeDomNode && treeDomNode.getBoundingClientRect();
var maxW = this.tree.renderer.layerConfig.width;
if (!rect || treeDomNode.lastChild.getBoundingClientRect().right <= maxW) {
this.root.style.display = "none"; this.root.style.display = "none";
return; return;
} }
// if (rect.width )
this.root.className = this.tree.container.className + " no-events"; this.root.className = this.tree.container.className + " no-events";
this.root.style.display = ""; this.root.style.display = "";
var rect = treeNode.getBoundingClientRect();
this.node = treeNode.cloneNode(true); this.node = treeDomNode.cloneNode(true);
this.node.style.margin = "0px"; this.node.style.margin = "0px";
this.root.appendChild(this.node); this.root.appendChild(this.node);
@ -50,10 +56,11 @@ function Tooltip(tree) {
}; };
this.updateNodeClass = function() { this.updateNodeClass = function() {
if (this.node && this.treeNode) { if (this.node && this.treeDomNode) {
if (this.treeNode.parentNode == this.tree.renderer.$cellLayer.element) if (this.treeDomNode.parentNode == this.tree.renderer.$cellLayer.element) {
this.node.className = this.treeNode.className; this.node.className = this.treeDomNode.className;
else this.root.className = this.tree.container.className + " no-events";
} else
this.updateNode(null); this.updateNode(null);
} }
}; };
@ -67,20 +74,25 @@ function Tooltip(tree) {
}; };
this.onMouseMove = function(ev) { this.onMouseMove = function(ev) {
var target = ev && ev.domEvent.target; var node = ev && ev.getNode && ev.getNode();
while (target && !dom.hasCssClass(target, "tree-row")) { if (node == this.treeNode)
target = target.parentElement;
}
if (target == this.treeNode)
return; return;
this.updateNode(target); this.treeNode = node;
if (target) if (node)
this.clearDelayed.cancel(); this.clearDelayed.cancel();
this.tree.renderer.on("afterRender", this.update);
}; };
this.update = function() {
var renderer = this.tree.renderer;
renderer.off("afterRender", this.update);
var i = renderer.layerConfig.vRange.indexOf(this.treeNode);
var domNode = renderer.$cellLayer.getDomNodeAtIndex(i + renderer.layerConfig.firstRow);
this.updateNode(domNode, this.treeNode);
};
this.onMouseOut = function(e) { this.onMouseOut = function(e) {
this.onMouseMove({domEvent: e}) this.onMouseMove();
}; };
this.onMouseOver = function(ev) { this.onMouseOver = function(ev) {
this.clearDelayed.schedule(); this.clearDelayed.schedule();

Wyświetl plik

@ -105,6 +105,7 @@ var Tree = function(element, cellWidth, cellHeight) {
} }
this.provider = provider; this.provider = provider;
this.model = provider; // TODO remove provider in favor of model
if (provider) { if (provider) {
this.renderer.setDataProvider(provider); this.renderer.setDataProvider(provider);

Wyświetl plik

@ -110,6 +110,7 @@ var VirtualRenderer = function(container, cellWidth, cellHeight) {
h: 0 h: 0
}; };
this.$scrollIntoView = null;
this.$loop = new RenderLoop( this.$loop = new RenderLoop(
this.$renderChanges.bind(this), this.$renderChanges.bind(this),
@ -142,6 +143,7 @@ var VirtualRenderer = function(container, cellWidth, cellHeight) {
**/ **/
this.setDataProvider = function(provider) { this.setDataProvider = function(provider) {
this.provider = provider; this.provider = provider;
this.model = provider;
if (this.scrollMargin.top && provider && provider.getScrollTop() <= 0) if (this.scrollMargin.top && provider && provider.getScrollTop() <= 0)
provider.setScrollTop(-this.scrollMargin.top); provider.setScrollTop(-this.scrollMargin.top);
@ -300,6 +302,12 @@ var VirtualRenderer = function(container, cellWidth, cellHeight) {
// provider.setScrollTop(this.getScrollTop()); // provider.setScrollTop(this.getScrollTop());
changes |= this.CHANGE_SCROLL; changes |= this.CHANGE_SCROLL;
} }
if (this.$scrollIntoView)
if (this.$scrollIntoView.model == this.model) {
this.scrollCaretIntoView(this.$scrollIntoView.caret, this.$scrollIntoView.offset);
this.$scrollIntoView = null;
}
} }
if (width && (force || size.width != width)) { if (width && (force || size.width != width)) {
@ -517,6 +525,9 @@ var VirtualRenderer = function(container, cellWidth, cellHeight) {
this.$updateScrollBar(); this.$updateScrollBar();
this._signal("afterRender"); this._signal("afterRender");
if (this.$scrollIntoView)
this.$scrollIntoView = null;
}; };
@ -688,6 +699,14 @@ var VirtualRenderer = function(container, cellWidth, cellHeight) {
* Scrolls the Caret into the first visible area of the editor * Scrolls the Caret into the first visible area of the editor
**/ **/
this.scrollCaretIntoView = function(caret, offset) { this.scrollCaretIntoView = function(caret, offset) {
this.$scrollIntoView = {
caret: caret,
offset: offset,
scrollTop: this.scrollTop,
model: this.model,
height: this.$size.scrollerHeight
};
// the editor is not visible // the editor is not visible
if (this.$size.scrollerHeight === 0) if (this.$size.scrollerHeight === 0)
return; return;
@ -703,8 +722,7 @@ var VirtualRenderer = function(container, cellWidth, cellHeight) {
var height = nodePos.height; var height = nodePos.height;
var left = 0; var left = 0;
var width = 0; var width = 0;
if (this.scrollTop > top) { if (this.scrollTop > top) {
if (offset) if (offset)
top -= offset * this.$size.scrollerHeight; top -= offset * this.$size.scrollerHeight;
@ -726,6 +744,8 @@ var VirtualRenderer = function(container, cellWidth, cellHeight) {
} else if (scrollLeft + this.$size.scrollerWidth < left + width) { } else if (scrollLeft + this.$size.scrollerWidth < left + width) {
this.provider.setScrollLeft(Math.round(left + width - this.$size.scrollerWidth)); this.provider.setScrollLeft(Math.round(left + width - this.$size.scrollerWidth));
} }
this.$scrollIntoView.scrollTop = this.scrollTop;
}; };
/** /**

Wyświetl plik

@ -106,7 +106,7 @@
"c9.ide.run.build": "#ad45874c88", "c9.ide.run.build": "#ad45874c88",
"c9.ide.run.debug.xdebug": "#3b1520f83d", "c9.ide.run.debug.xdebug": "#3b1520f83d",
"c9.ide.save": "#cc613b6ead", "c9.ide.save": "#cc613b6ead",
"c9.ide.scm": "#undefined", "c9.ide.scm": "#f3847917b8",
"c9.ide.terminal.monitor": "#b52a3f2144", "c9.ide.terminal.monitor": "#b52a3f2144",
"c9.ide.theme.flat": "#2de8414db7", "c9.ide.theme.flat": "#2de8414db7",
"c9.ide.threewaymerge": "#229382aa0b", "c9.ide.threewaymerge": "#229382aa0b",

Wyświetl plik

@ -1672,6 +1672,11 @@ define(function(require, exports, module) {
*/ */
defineSyntax: defineSyntax, defineSyntax: defineSyntax,
/**
* @ignore
*/
getSyntaxForPath: getSyntaxForPath,
/** /**
* @ignore this is used by statusbar * @ignore this is used by statusbar
*/ */

Wyświetl plik

@ -12,7 +12,7 @@
.box-shadow(~"inset 1px 1px @{button-glossy-hover-shadow-color}, inset -1px -1px @{button-glossy-hover-shadow-color}"); .box-shadow(~"inset 1px 1px @{button-glossy-hover-shadow-color}, inset -1px -1px @{button-glossy-hover-shadow-color}");
text-shadow: @button-glossy-hover-text-shadow; text-shadow: @button-glossy-hover-text-shadow;
} }
.c9-toolbarbutton-glossyDown { .c9-toolbarbutton-glossyDown, .c9-toolbarbutton-glossyActive {
border: 1px solid @button-glossy-active-border-color; border: 1px solid @button-glossy-active-border-color;
.gradient(~"linear-gradient(top, @{button-glossy-active-background-1} 0%, @{button-glossy-active-background-2} 55%, @{button-glossy-active-background-3} 55%, @{button-glossy-active-background-4} 100%)"); .gradient(~"linear-gradient(top, @{button-glossy-active-background-1} 0%, @{button-glossy-active-background-2} 55%, @{button-glossy-active-background-3} 55%, @{button-glossy-active-background-4} 100%)");
.box-shadow(~"inset 1px 1px @{button-glossy-active-shadow-color}, inset -1px -1px @{button-glossy-active-shadow-color}"); .box-shadow(~"inset 1px 1px @{button-glossy-active-shadow-color}, inset -1px -1px @{button-glossy-active-shadow-color}");

Wyświetl plik

@ -30,6 +30,7 @@ define(function(require, exports, module) {
var showError = imports["dialog.error"].show; var showError = imports["dialog.error"].show;
var Tree = require("ace_tree/tree"); var Tree = require("ace_tree/tree");
var Tooltip = require("ace_tree/tooltip");
var TreeEditor = require("ace_tree/edit"); var TreeEditor = require("ace_tree/edit");
var markup = require("text!./tree.xml"); var markup = require("text!./tree.xml");
@ -237,6 +238,8 @@ define(function(require, exports, module) {
tree.setDataProvider(fsCache.model); tree.setDataProvider(fsCache.model);
tree.setOption("enableDragDrop", true); tree.setOption("enableDragDrop", true);
// tree.tooltip = new Tooltip(tree);
fsCache.model.$indentSize = 12; fsCache.model.$indentSize = 12;
fsCache.model.getIconHTML = function(node) { fsCache.model.getIconHTML = function(node) {
var icon = node.isFolder ? "folder" : util.getFileIcon(node.label); var icon = node.isFolder ? "folder" : util.getFileIcon(node.label);

Wyświetl plik

@ -203,7 +203,8 @@ apf.vbox = function(struct, tagName) {
var nodes = this.childNodes; var nodes = this.childNodes;
for (var i = 0, l = nodes.length; i < l; i++) { for (var i = 0, l = nodes.length; i < l; i++) {
if ((node = nodes[i]).nodeFunc != apf.NODE_VISIBLE || !node.$amlLoaded) //|| node.visible === false var node = nodes[i];
if (node.nodeFunc != apf.NODE_VISIBLE || !node.$amlLoaded) //|| node.visible === false
continue; continue;
node.$ext.style.textAlign = apf.getStyle(node.$ext, "textAlign") || "left"; node.$ext.style.textAlign = apf.getStyle(node.$ext, "textAlign") || "left";

Wyświetl plik

@ -22,7 +22,8 @@ var places = {
Ace: { Ace: {
kitchen_sink: ["/static/lib/ace/kitchen-sink.html", "/../lib/ace/test/tests.html"], kitchen_sink: ["/static/lib/ace/kitchen-sink.html", "/../lib/ace/test/tests.html"],
tree: "/static/lib/ace_tree/demo.html", tree: "/static/lib/ace_tree/demo.html",
list: "/static/lib/ace_tree/list_demo.html" list: "/static/lib/ace_tree/list_demo.html",
diff: "/static/plugins/c9.ide.scm/diff/index.html"
}, },
Treehugger: { Treehugger: {
test: "/static/lib/treehugger/test.html" test: "/static/lib/treehugger/test.html"