* Work on area change + theme

* Work on msg menu + theme
This commit is contained in:
Bryan Ashby 2015-10-14 23:09:10 -06:00
parent 171ee75043
commit a5c2e6f50b
7 changed files with 107 additions and 81 deletions

View File

@ -119,7 +119,7 @@ function AbracadabraModule(options) {
function complete(err) { function complete(err) {
if(err) { if(err) {
self.lastError = err; self.lastError = err;
self.fallbackModule(); self.client.fallbackMenuModule();
} else { } else {
self.finishedLoading(); self.finishedLoading();
} }
@ -147,17 +147,13 @@ function AbracadabraModule(options) {
var doorInstance = new door.Door(this.client, exeInfo); var doorInstance = new door.Door(this.client, exeInfo);
doorInstance.on('finished', function doorFinished() { doorInstance.on('finished', function doorFinished() {
self.fallbackModule(); self.client.fallbackMenuModule();
}); });
self.client.term.write(ansi.resetScreen()); self.client.term.write(ansi.resetScreen());
doorInstance.run(); doorInstance.run();
}; };
this.fallbackModule = function() {
self.client.gotoMenuModule( { name : self.menuConfig.fallback } );
};
} }
require('util').inherits(AbracadabraModule, MenuModule); require('util').inherits(AbracadabraModule, MenuModule);

View File

@ -309,7 +309,7 @@
MT1: { MT1: {
width: 79 width: 79
height: 14 height: 14
argName: message argName: `
mode: edit mode: edit
} }
} }
@ -426,12 +426,16 @@
"action" : "@menu:doorLORD" "action" : "@menu:doorLORD"
}, },
*/ */
{
value: { command: "E" }
action: @menu:doorTestExample
}
{ {
"value" : { "command" : "L" }, "value" : { "command" : "L" },
"action" : "@menu:mainMenuLastCallers" "action" : "@menu:mainMenuLastCallers"
}, },
{ {
"value" : { "command" : "U" }, "value" : { "command" : "Y" },
"action" : "@menu:mainMenuUserStats" "action" : "@menu:mainMenuUserStats"
}, },
{ {
@ -490,51 +494,41 @@
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
// Message Area Related // Message Area Related
/////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////
"messageArea" : { messageArea: {
"module" : "msg_area", module: msg_area
"art" : "MSGAREA", art: MSGMNU
"desc" : "Message Area", desc: Message Area
"prompt" : "menuCommand", prompt: menuCommand
"submit" : [ submit: [
{ {
"value" : { "command" : "N" }, value: { command: "P" }
"action" : "@menu:messageAreaNewPost"//, action: @menu:messageAreaNewPost
//"extraArgs" : { "messageAreaId" : 123 } }
},
{ {
"value" : { "command" : "C" }, value: { command: "C" }
"action" : "@menu:messageAreaChangeCurrentArea" action: @menu:messageAreaChangeCurrentArea
}, }
{ {
"value" : { "command" : "L" }, value: { command: "L" }
"action" : "@menu:messageAreaMessageList" action: @menu:messageAreaMessageList
}, }
/*{
"value" : { "command" : "A" },
"action" : "@method:changeArea"
},
*/
{ {
"value" : { "command" : "Q" }, value: { command: "Q" }
"action" : "@menu:mainMenu" action: @menu:mainMenu
}, }
{ {
"value" : 1, value: 1
"action" : "@menu:messageArea" action: @menu:messageArea
} }
] ]
}, }
"messageAreaChangeCurrentArea" : { messageAreaChangeCurrentArea: {
"art" : "msg_area_list.ans", art: CHANGE
"module" : "msg_area_list", module: msg_area_list
"fallback" : "messageArea",
"form" : { "form" : {
"0" : { "0" : {
"VM" : {
"mci" : { "mci" : {
"VM1" : { "VM1" : {
"widht" : 30,
"height" : 10,
"focus" : true, "focus" : true,
"submit" : true, "submit" : true,
"argName" : "area" "argName" : "area"
@ -550,13 +544,12 @@
}, },
"actionKeys" : [ "actionKeys" : [
{ {
"keys" : [ "escape" ], keys: [ "escape", "q", "shift + q" ]
"action" : "@menu:messageArea" action: @systemMethod:fallbackMenu
} }
] ]
} }
} }
}
}, },
messageAreaMessageList: { messageAreaMessageList: {
module: msg_list module: msg_list
@ -584,7 +577,7 @@
actionKeys: [ actionKeys: [
{ {
keys: [ "escape", "q", "shift + q" ] keys: [ "escape", "q", "shift + q" ]
action: @menu:messageArea action: @systemMethod:fallbackMenu
} }
] ]
} }
@ -1008,6 +1001,15 @@
] ]
} }
}, },
doorTestExample: {
module: abracadabra
config: {
name: example
dropFileType: DOOR
cmd: "/usr/bin/dosemu"
args: [ "-quiet", "-f", "/home/nuskooler/DOS/X/LORD/dosemu.conf", "X:\\SLOWMO.EXE 1 120 X:\\LORD\\LAIRANS.ANS"]
}
}
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////
// Mods // Mods
//////////////////////////////////////////////////////////////////////// ////////////////////////////////////////////////////////////////////////

View File

@ -33,6 +33,11 @@ exports.moduleInfo = {
|TI Current time |TI Current time
*/ */
var MciCodesIds = {
AreaList : 1,
CurrentArea : 2,
};
function MessageAreaListModule(options) { function MessageAreaListModule(options) {
MenuModule.call(this, options); MenuModule.call(this, options);
@ -40,14 +45,6 @@ function MessageAreaListModule(options) {
this.messageAreas = messageArea.getAvailableMessageAreas(); this.messageAreas = messageArea.getAvailableMessageAreas();
if(_.isObject(this.menuConfig.config)) {
if(_.isString(this.menuConfig.config.entryFormat)) {
this.entryFormat = this.menuConfig.config.entryFormat;
}
}
this.entryFormat = this.entryFormat || '( {index} ) - {desc}';
this.menuMethods = { this.menuMethods = {
changeArea : function(formData, extraArgs) { changeArea : function(formData, extraArgs) {
if(1 === formData.submitId) { if(1 === formData.submitId) {
@ -58,26 +55,26 @@ function MessageAreaListModule(options) {
self.client.term.pipeWrite('\n|00Cannot change area: ' + err.message + '\n'); self.client.term.pipeWrite('\n|00Cannot change area: ' + err.message + '\n');
setTimeout(function timeout() { setTimeout(function timeout() {
self.client.gotoMenuModule( { name : self.menuConfig.fallback } ); self.client.fallbackMenuModule();
}, 1000); }, 1000);
} else { } else {
self.client.gotoMenuModule( { name : self.menuConfig.fallback } ); self.client.fallbackMenuModule();
} }
}); });
} }
} }
}; };
this.setViewText = function(id, text) {
var v = self.viewControllers.areaList.getView(id);
if(v) {
v.setText(text);
}
};
} }
require('util').inherits(MessageAreaListModule, MenuModule); require('util').inherits(MessageAreaListModule, MenuModule);
/*
MessageAreaListModule.prototype.enter = function(client) {
this.messageAreas = messageArea.getAvailableMessageAreas();
MessageAreaListModule.super_.prototype.enter.call(this, client);
};
*/
MessageAreaListModule.prototype.mciReady = function(mciData, cb) { MessageAreaListModule.prototype.mciReady = function(mciData, cb) {
var self = this; var self = this;
@ -102,16 +99,34 @@ MessageAreaListModule.prototype.mciReady = function(mciData, cb) {
}); });
}, },
function populateAreaListView(callback) { function populateAreaListView(callback) {
var listFormat = self.menuConfig.config.listFormat || '{index} ) - {desc}';
var focusListFormat = self.menuConfig.config.focusListFormat || listFormat;
var areaListItems = []; var areaListItems = [];
var focusListItems = [];
for(var i = 0; i < self.messageAreas.length; ++i) { for(var i = 0; i < self.messageAreas.length; ++i) {
areaListItems.push(self.entryFormat.format( areaListItems.push(listFormat.format(
{ index : i, name : self.messageAreas[i].name, desc : self.messageAreas[i].desc } )
);
focusListItems.push(focusListFormat.format(
{ index : i, name : self.messageAreas[i].name, desc : self.messageAreas[i].desc } ) { index : i, name : self.messageAreas[i].name, desc : self.messageAreas[i].desc } )
); );
} }
var areaListView = vc.getView(1); var areaListView = vc.getView(1);
areaListView.setItems(areaListItems); areaListView.setItems(areaListItems);
areaListView.setFocusItems(focusListItems);
areaListView.redraw(); areaListView.redraw();
callback(null);
},
function populateTextViews(callback) {
// :TODO: populate current message area desc!
//self.setViewText(MciCodesIds.CurrentArea,
callback(null);
} }
], ],
function complete(err) { function complete(err) {

Binary file not shown.

Binary file not shown.

View File

@ -81,6 +81,19 @@
} }
} }
messageAreaChangeCurrentArea: {
config: {
listFormat: "|00|01|37{index} |00|37- |36{desc}"
focusListFormat: "|00|42|30{index} - {desc}"
}
mci: {
VM1: {
width: 26
height: 19
}
}
}
messageAreaViewPost: { messageAreaViewPost: {
0: { 0: {
mci: { mci: {