* A few updates to experimental per-client child logging

* StatusBarView skeleton
* Code cleanup
* Menus scan specify emulated baud rate
This commit is contained in:
Bryan Ashby 2015-07-02 23:28:39 -06:00
parent 8fecc779d1
commit a241f91546
7 changed files with 75 additions and 11 deletions

View File

@ -29,6 +29,7 @@ exports.disableVT100LineWrapping = disableVT100LineWrapping;
exports.setSyncTERMFont = setSyncTERMFont;
exports.getSyncTERMFontFromAlias = getSyncTERMFontFromAlias;
exports.setCursorStyle = setCursorStyle;
exports.setEmulatedBaudRate = setEmulatedBaudRate;
//
@ -126,7 +127,6 @@ function getBGColorValue(name) {
}
// See http://cvs.synchro.net/cgi-bin/viewcvs.cgi/*checkout*/src/conio/cterm.txt
// :TODO: document
// :TODO: Create mappings for aliases... maybe make this a map to values instead
@ -393,3 +393,24 @@ function goHome() {
function disableVT100LineWrapping() {
return ESC_CSI + '7l';
}
function setEmulatedBaudRate(rate) {
var speed = {
unlimited : 0,
off : 0,
0 : 0,
300 : 1,
600 : 2,
1200 : 3,
2400 : 4,
4800 : 5,
9600 : 6,
19200 : 7,
38400 : 8,
57600 : 9,
76800 : 10,
115200 : 11,
}[rate] || 0;
return 0 === speed ? exports.emulationSpeed() : exports.emulationSpeed(1, speed);
};

View File

@ -330,7 +330,6 @@ function Client(input, output) {
}
if(key || ch) {
//Log.trace( { key : key, ch : ch }, 'User keyboard input');
self.log.trace( { key : key, ch : ch }, 'User keyboard input');
self.emit('key press', ch, key);
@ -392,7 +391,7 @@ Client.prototype.gotoMenuModule = function(options, cb) {
if(err) {
cb(err);
} else {
Log.debug( { menuName : options.name }, 'Goto menu module');
self.log.debug( { menuName : options.name }, 'Goto menu module');
modInst.enter(self);
@ -414,7 +413,7 @@ Client.prototype.defaultHandlerMissingMod = function(err) {
var self = this;
function handler(err) {
Log.error(err);
self.log.error(err);
self.term.write(ansi.resetScreen());
self.term.write('An unrecoverable error has been encountered!\n');

View File

@ -9,9 +9,9 @@ var HorizontalMenuView = require('./horizontal_menu_view.js').HorizontalMenuVie
var SpinnerMenuView = require('./spinner_menu_view.js').SpinnerMenuView;
var ToggleMenuView = require('./toggle_menu_view.js').ToggleMenuView;
var MaskEditTextView = require('./mask_edit_text_view.js').MaskEditTextView;
var StatusBarView = require('./status_bar_view.js').StatusBarView;
//var MultiLineEditTextView = require('./multi_line_edit_text_view.js').MultiLineEditTextView;
var MultiLineEditTextView = require('./multi_line_edit_text_view2.js').MultiLineEditTextView;
var MultiLineEditTextView = require('./multi_line_edit_text_view.js').MultiLineEditTextView;
var Config = require('./config.js').config;
var ansi = require('./ansi_term.js');

View File

@ -152,6 +152,10 @@ MenuModule.prototype.beforeArt = function() {
if(this.menuConfig.options.cls) {
this.client.term.write(ansi.resetScreen());
}
if(_.isNumber(this.menuConfig.options.baudRate)) {
this.client.term.write(ansi.setEmulatedBaudRate(this.menuConfig.options.baudRate));
}
};
MenuModule.prototype.mciReady = function(mciData) {

View File

@ -5,7 +5,6 @@ var View = require('./view.js').View;
var miscUtil = require('./misc_util.js');
var strUtil = require('./string_util.js');
var ansi = require('./ansi_term.js');
//var TextBuffer = require('./text_buffer.js').TextBuffer;
var assert = require('assert');
var _ = require('lodash');
@ -51,12 +50,8 @@ var _ = require('lodash');
//
// To-Do
//
// * Page up/down just divide by and set top index
// * Index pos % for emit scroll events
// * Fix cursor when loading text
// * Some of this shoudl be async'd where there is lots of processing (e.g. word wrap)
// * Word wrapping is a bit broke: cannot fill entire self.dimens.width (off by 1-2)
// * Contigous words will break word wrapping... is not breaking mid word properly
// * Fix backspace when col=0 (e.g. bs to prev line)

44
core/status_bar_view.js Normal file
View File

@ -0,0 +1,44 @@
/* jslint node: true */
'use strict';
var View = require('./view.js').View;
var TextView = require('./text_view.js').TextView;
var assert = require('assert');
var _ = require('lodash');
function StatusBarView(options) {
View.call(this, options);
var self = this;
}
require('util').inherits(StatusBarView, View);
StatusBarView.prototype.redraw = function() {
StatusBarView.super_.prototype.redraw.call(this);
};
StatusBarView.prototype.setPanels = function(panels) {
/*
"panels" : [
{
"text" : "things and stuff",
"width" 20,
...
},
{
"width" : 40 // no text, etc... = spacer
}
]
|---------------------------------------------|
| stuff |
*/
};

View File

@ -202,6 +202,7 @@ View.prototype.setPropertyValue = function(propName, value) {
this.fillChar = value.substr(0, 1);
}
}
break;
case 'submit' :
if(_.isBoolean(value)) {