add wrap: printMargin

This commit is contained in:
nightwing 2013-03-14 18:07:46 +04:00
commit 82f496a11f
3 changed files with 46 additions and 13 deletions

View file

@ -354,7 +354,7 @@ var VirtualRenderer = function(container, theme) {
this.adjustWrapLimit = function() {
var availableWidth = this.$size.scrollerWidth - this.$padding * 2;
var limit = Math.floor(availableWidth / this.characterWidth);
return this.session.adjustWrapLimit(limit);
return this.session.adjustWrapLimit(limit, this.$showPrintMargin && this.$printMarginColumn);
};
/**
@ -493,6 +493,9 @@ var VirtualRenderer = function(container, theme) {
var style = this.$printMarginEl.style;
style.left = ((this.characterWidth * this.$printMarginColumn) + this.$padding) + "px";
style.visibility = this.$showPrintMargin ? "visible" : "hidden";
if (this.session && this.session.$wrap == -1)
this.adjustWrapLimit();
};
/**
@ -1353,6 +1356,17 @@ config.defineOptions(VirtualRenderer.prototype, "renderer", {
set: function() { this.$updatePrintMargin(); },
initialValue: 80
},
printMargin: {
set: function(val) {
if (typeof val == "number")
this.$printMarginColumn = val;
this.$showPrintMargin = !!val;
this.$updatePrintMargin();
},
get: function() {
return this.$showPrintMargin && this.$printMarginColumn;
}
},
showGutter: {
set: function(show){
this.$gutter.style.display = show ? "block" : "none";
@ -1401,6 +1415,21 @@ config.defineOptions(VirtualRenderer.prototype, "renderer", {
this.$loop.schedule(this.CHANGE_SCROLL);
},
initialValue: false
},
fontSize: {
set: function(size) {
if (typeof size == "number")
size = size + "px";
this.container.style.fontSize = size;
this.updateFontSize();
},
initialValue: 12
},
fontFamily: {
set: function(name) {
this.container.style.fontFamily = name;
this.updateFontSize();
}
}
});