* Progress on FSE quote builder... WIP!

This commit is contained in:
Bryan Ashby 2015-09-14 22:40:00 -06:00
parent 150de3953e
commit cee7983c5a
4 changed files with 96 additions and 17 deletions

View File

@ -134,6 +134,7 @@ function FullScreenEditorModule(options) {
footerEditor : 2,
footerEditorMenu : 3,
footerView : 4,
quoteBuilder : 5,
help : 50,
}[name];
@ -268,7 +269,7 @@ function FullScreenEditorModule(options) {
this.switchFooter = function(cb) {
var footerName = self.getFooterName();
self.redrawFooter( { footerName : footerName, clear : true }, function artDisplayed(err, artData) {
if(err) {
cb(err);
@ -567,9 +568,58 @@ function FullScreenEditorModule(options) {
//
// Clear body area
//
self.client.term.rawWrite(
ansi.goto(self.header.height, 1) +
ansi.eraseLine(self.body.height));
async.waterfall(
[
function clearAndDisplayArt(callback) {
console.log(self.header.height);
self.client.term.rawWrite(
ansi.goto(self.header.height + 1, 1));
//ansi.eraseLine(2));
theme.displayThemeArt( { name : self.menuConfig.config.art.quote, client : self.client }, function displayed(err, artData) {
callback(err, artData);
});
},
function createViewsIfNecessary(artData, callback) {
var formId = self.getFormId('quoteBuilder');
if(_.isUndefined(self.viewControllers.quoteBuilder)) {
var menuLoadOpts = {
callingMenu : self,
formId : formId,
mciMap : artData.mciMap,
};
self.addViewController(
'quoteBuilder',
new ViewController( { client : self.client, formId : formId } )
).loadFromMenuConfig(menuLoadOpts, function quoteViewsReady(err) {
callback(err);
});
} else {
self.viewControllers.quoteBuilder.redrawAll();
callback(null);
}
},
function loadQuoteLines(callback) {
// :TODO: MLTEV's word wrapping -> line[] stuff needs to be made a public API. This can then be used here and elsewhere.
// ...should not be too bad to do at all
self.viewControllers.quoteBuilder.getView(3).setItems(['Someone said some shit', 'then they said more shit', 'and what not...', 'hurp durp']);
callback(null);
},
function setViewFocus(callback) {
self.viewControllers.quoteBuilder.getView(1).setFocus(false);
self.viewControllers.quoteBuilder.switchFocus(3);
callback(null);
}
],
function complete(err) {
if(err) {
console.log(err) // :TODO: needs real impl.
}
}
);
};
this.observeEditorEvents = function() {

View File

@ -215,10 +215,14 @@ function ViewController(options) {
var initialFocusId = 1;
async.each(Object.keys(config.mci), function entry(mci, nextItem) {
var mciMatch = mci.match(MCI_REGEXP); // :TODO: How to handle auto-generated IDs????
var mciMatch = mci.match(MCI_REGEXP); // :TODO: How to handle auto-generated IDs????
if(null === mciMatch) {
self.client.log.warn( { mci : mci }, 'Unable to parse MCI code');
return;
}
var viewId = parseInt(mciMatch[2]);
assert(!isNaN(viewId));
var viewId = parseInt(mciMatch[2]);
assert(!isNaN(viewId), 'Cannot parse view ID: ' + mciMatch[2]); // shouldn't be possible with RegExp used
if(viewId > highestId) {
highestId = viewId;

View File

@ -521,7 +521,7 @@
"action" : "@method:nextMessage"
},
{
value: { 1: 2 },
value: { 1: 2 }
action: @method:replyMessage
extraArgs: {
menu: messageAreaReplyPost
@ -546,15 +546,16 @@
"action" : "@method:prevMessage"
},
{
"keys" : [ "n", "shift + n" ],
"action" : "@method:nextMessage"
keys: [ "n", "shift + n" ]
action: @method:nextMessage
},
{
"keys" : [ "escape", "q", "shift + q" ],
"action" : "@menu:messageArea"
},
// :TODO: why the fuck is 'r' not working but 'n' for example does?
{
keys: : [ "r", "shift + r" ],
keys: : [ "r", "shift + r" ]
action: @method:replyMessage
extraArgs: {
menu: messageAreaReplyPost
@ -636,19 +637,43 @@
]
}
4: {
mci: {
HM1: {
items: [ "Save", "Discard", "Quote", "Help" ]
},
3: {
HM: {
mci: {
HM1: {
items: [ "Save", "Discard", "Quote", "Help" ]
}
}
submit: {
*: [
{
value: { 1: 2 },
action: @method:editModeQuote
action: @method:editModeMenuQuote
}
]
}
actionKeys: [
{
keys: [ "escape" ]
action: @method:editModeEscPressed
}
]
}
}
5: {
mci: {
MT1: {
width: 79
height: 7
}
VM3: {
//items: [ "just", "testing", "some", "things" ]
width: 79
height: 4
}
}
}
}

Binary file not shown.