mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-08-04 08:51:51 +02:00
* Very very early work on FSE module
This commit is contained in:
parent
f56546cae5
commit
32fdbab88d
7 changed files with 117 additions and 56 deletions
|
@ -380,7 +380,6 @@ function defaultEofFromExtension(ext) {
|
|||
// :TODO: change to display(art, options, cb)
|
||||
// cb(err, mci)
|
||||
|
||||
// :TODO: display({ art : art, client : client, ...}, cb)
|
||||
function display(options, cb) {
|
||||
assert(_.isObject(options));
|
||||
assert(_.isObject(options.client));
|
||||
|
@ -445,7 +444,11 @@ function display(options, cb) {
|
|||
// options.client.term.write(ansi.blinkNormal());
|
||||
}
|
||||
|
||||
cb(null, mciMap);
|
||||
var extraInfo = {
|
||||
height : parser.row - 1
|
||||
};
|
||||
|
||||
cb(null, mciMap, extraInfo);
|
||||
}
|
||||
|
||||
options.client.on('cursor position report', cprListener);
|
||||
|
@ -454,6 +457,7 @@ function display(options, cb) {
|
|||
var nextPauseTermHeight = options.client.term.termHeight;
|
||||
var continous = false;
|
||||
|
||||
|
||||
/*
|
||||
parser.on('row update', function rowUpdate(row) {
|
||||
if(row >= nextPauseTermHeight) {
|
||||
|
|
|
@ -42,8 +42,8 @@ function MenuModule(options) {
|
|||
|
||||
switch(artAsset.type) {
|
||||
case 'art' :
|
||||
theme.displayThemeArt(dispOptions, function displayed(err, mciMap) {
|
||||
cb(err, mciMap);
|
||||
theme.displayThemeArt(dispOptions, function displayed(err, themeArtData) {
|
||||
cb(err, { mciMap : themeArtData.mciMap, height : themeArtData.extraInfo.height } );
|
||||
});
|
||||
break;
|
||||
|
||||
|
@ -76,8 +76,8 @@ function MenuModule(options) {
|
|||
},
|
||||
function displayMenuArt(callback) {
|
||||
if(_.isString(self.menuConfig.art)) {
|
||||
self.displayArtAsset(self.menuConfig.art, function displayed(err, mciMap) {
|
||||
mciData.menu = mciMap;
|
||||
self.displayArtAsset(self.menuConfig.art, function displayed(err, artData) {
|
||||
mciData.menu = artData.mciMap;
|
||||
callback(err);
|
||||
});
|
||||
} else {
|
||||
|
@ -165,13 +165,10 @@ MenuModule.prototype.standardMCIReadyHandler = function(mciData) {
|
|||
// * Standard/prefdefined MCI entries must load both (e.g. %BN is expected to resolve)
|
||||
//
|
||||
var self = this;
|
||||
self.viewControllers = {};
|
||||
|
||||
//var vcOpts = { client : self.client };
|
||||
|
||||
_.forEach(mciData, function entry(mciMap, name) {
|
||||
assert('menu' === name || 'prompt' === name);
|
||||
self.viewControllers[name] = new ViewController( { client : self.client } );
|
||||
self.addViewController(name, new ViewController( { client : self.client } ));
|
||||
});
|
||||
|
||||
var viewsReady = function(err) {
|
||||
|
|
|
@ -158,8 +158,8 @@ function displayThemeArt(options, cb) {
|
|||
font : options.font,
|
||||
};
|
||||
|
||||
art.display(dispOptions, function displayed(err, mciMap) {
|
||||
cb(err, mciMap, artInfo);
|
||||
art.display(dispOptions, function displayed(err, mciMap, extraInfo) {
|
||||
cb(err, { mciMap : mciMap, artInfo : artInfo, extraInfo : extraInfo } );
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
|
@ -39,7 +39,8 @@ function ViewController(options) {
|
|||
//
|
||||
// Process key presses treating form submit mapped
|
||||
// keys special. Everything else is forwarded on to
|
||||
// the focused View, if any. //
|
||||
// the focused View, if any.
|
||||
//
|
||||
if(key) {
|
||||
var submitViewId = self.submitKeyMap[key.name];
|
||||
if(submitViewId) {
|
||||
|
@ -412,6 +413,19 @@ ViewController.prototype.setViewOrder = function(order) {
|
|||
}
|
||||
};
|
||||
|
||||
ViewController.prototype.redrawAll = function(initialFocusId) {
|
||||
this.client.term.write(ansi.hideCursor());
|
||||
|
||||
for(var id in this.views) {
|
||||
if(initialFocusId === id) {
|
||||
continue; // will draw @ focus
|
||||
}
|
||||
this.views[id].redraw();
|
||||
}
|
||||
|
||||
this.client.term.write(ansi.showCursor());
|
||||
};
|
||||
|
||||
ViewController.prototype.loadFromPromptConfig = function(options, cb) {
|
||||
assert(_.isObject(options));
|
||||
assert(_.isObject(options.mciMap));
|
||||
|
@ -459,14 +473,7 @@ ViewController.prototype.loadFromPromptConfig = function(options, cb) {
|
|||
callback(null);
|
||||
},
|
||||
function drawAllViews(callback) {
|
||||
self.client.term.write(ansi.hideCursor());
|
||||
|
||||
for(var id in self.views) {
|
||||
if(initialFocusId === id) {
|
||||
continue; // will draw @ focus
|
||||
}
|
||||
self.views[id].redraw();
|
||||
}
|
||||
self.redrawAll(initialFocusId);
|
||||
callback(null);
|
||||
},
|
||||
function setInitialViewFocus(callback) {
|
||||
|
@ -609,14 +616,7 @@ ViewController.prototype.loadFromMenuConfig = function(options, cb) {
|
|||
callback(null);
|
||||
},
|
||||
function drawAllViews(callback) {
|
||||
self.client.term.write(ansi.hideCursor());
|
||||
|
||||
for(var id in self.views) {
|
||||
if(initialFocusId === id) {
|
||||
continue; // will draw @ focus
|
||||
}
|
||||
self.views[id].redraw();
|
||||
}
|
||||
self.redrawAll(initialFocusId);
|
||||
callback(null);
|
||||
},
|
||||
function setInitialViewFocus(callback) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue