Skip to content
Snippets Groups Projects
Commit abe8a260 authored by mcmlxxix's avatar mcmlxxix
Browse files

added word_wrap toggle to Frame() objects (default off), set word_wrap on for...

added word_wrap toggle to Frame() objects (default off), set word_wrap on for chat views in Layout() objects
parent 2f596c37
No related branches found
No related tags found
No related merge requests found
...@@ -133,24 +133,25 @@ function Frame(x,y,width,height,attr,parent) { ...@@ -133,24 +133,25 @@ function Frame(x,y,width,height,attr,parent) {
open:false, open:false,
ctrl_a:false, ctrl_a:false,
id:0 id:0
} };
var settings = { var settings = {
v_scroll:true, v_scroll:true,
h_scroll:false, h_scroll:false,
scrollbars:false, scrollbars:false,
lf_strict:true, lf_strict:true,
checkbounds:true, checkbounds:true,
transparent:false transparent:false,
} word_wrap:false
};
var relations = { var relations = {
parent:undefined, parent:undefined,
child:[] child:[]
} };
var position = { var position = {
cursor:new Cursor(0,0,this), cursor:new Cursor(0,0,this),
offset:new Offset(0,0,this), offset:new Offset(0,0,this),
stored:new Cursor(0,0,this) stored:new Cursor(0,0,this)
} };
/* protected properties */ /* protected properties */
this.__defineGetter__("child", function() { this.__defineGetter__("child", function() {
...@@ -290,6 +291,15 @@ function Frame(x,y,width,height,attr,parent) { ...@@ -290,6 +291,15 @@ function Frame(x,y,width,height,attr,parent) {
else else
throw("non-boolean v_scroll: " + bool); throw("non-boolean v_scroll: " + bool);
}); });
this.__defineGetter__("word_wrap", function() {
return settings.word_wrap;
});
this.__defineSetter__("word_wrap", function(bool) {
if(typeof bool == "boolean")
settings.word_wrap=bool;
else
throw("non-boolean word_wrap: " + bool);
});
this.__defineGetter__("h_scroll", function() { this.__defineGetter__("h_scroll", function() {
return settings.h_scroll; return settings.h_scroll;
}); });
...@@ -322,6 +332,7 @@ function Frame(x,y,width,height,attr,parent) { ...@@ -322,6 +332,7 @@ function Frame(x,y,width,height,attr,parent) {
px += position.offset.x; px += position.offset.x;
py += position.offset.y; py += position.offset.y;
} }
//I don't remember why I did this, but it was probably important at the time
//if(!properties.data[py] || !properties.data[py][px]) //if(!properties.data[py] || !properties.data[py][px])
if(!properties.data[py]) if(!properties.data[py])
throw("Frame.setData() - invalid coordinates: " + px + "," + py); throw("Frame.setData() - invalid coordinates: " + px + "," + py);
...@@ -831,6 +842,8 @@ function Frame(x,y,width,height,attr,parent) { ...@@ -831,6 +842,8 @@ function Frame(x,y,width,height,attr,parent) {
this.putmsg = function(str,attr) { this.putmsg = function(str,attr) {
if(str == undefined) if(str == undefined)
return; return;
if(settings.word_wrap)
str = word_wrap(str,this.width);
str = str.toString().split(''); str = str.toString().split('');
var curattr = attr; var curattr = attr;
if(!curattr) if(!curattr)
......
...@@ -533,6 +533,7 @@ function LayoutView(title,frame,parent) { ...@@ -533,6 +533,7 @@ function LayoutView(title,frame,parent) {
} }
properties.chat = tab.chat; properties.chat = tab.chat;
tab.frame.lf_strict = false; tab.frame.lf_strict = false;
tab.frame.word_wrap = true;
tab.hotkeys = false; tab.hotkeys = false;
break; break;
case "FRAME": case "FRAME":
...@@ -692,7 +693,7 @@ function LayoutView(title,frame,parent) { ...@@ -692,7 +693,7 @@ function LayoutView(title,frame,parent) {
/* view tab object, meant to inhabit a layout view. /* view tab object, meant to inhabit a layout view.
* will generally occupy the same space as other view tabs * will generally occupy the same space as other view tabs
* within a given view, cannot be effectively instantiated * within a given view, cannot be effectively instantiated
* on its own, but rather through ViewFrame.addTab() */ * on its own, but rather through LayoutView.addTab() */
function ViewTab(title,frame,parent) { function ViewTab(title,frame,parent) {
/* private properties */ /* private properties */
var properties={ var properties={
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment