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

View File

@ -309,7 +309,7 @@
MT1: {
width: 79
height: 14
argName: message
argName: `
mode: edit
}
}
@ -426,12 +426,16 @@
"action" : "@menu:doorLORD"
},
*/
{
value: { command: "E" }
action: @menu:doorTestExample
}
{
"value" : { "command" : "L" },
"action" : "@menu:mainMenuLastCallers"
},
{
"value" : { "command" : "U" },
"value" : { "command" : "Y" },
"action" : "@menu:mainMenuUserStats"
},
{
@ -490,71 +494,60 @@
///////////////////////////////////////////////////////////////////////
// Message Area Related
///////////////////////////////////////////////////////////////////////
"messageArea" : {
"module" : "msg_area",
"art" : "MSGAREA",
"desc" : "Message Area",
"prompt" : "menuCommand",
"submit" : [
messageArea: {
module: msg_area
art: MSGMNU
desc: Message Area
prompt: menuCommand
submit: [
{
"value" : { "command" : "N" },
"action" : "@menu:messageAreaNewPost"//,
//"extraArgs" : { "messageAreaId" : 123 }
},
value: { command: "P" }
action: @menu:messageAreaNewPost
}
{
"value" : { "command" : "C" },
"action" : "@menu:messageAreaChangeCurrentArea"
},
value: { command: "C" }
action: @menu:messageAreaChangeCurrentArea
}
{
"value" : { "command" : "L" },
"action" : "@menu:messageAreaMessageList"
},
/*{
"value" : { "command" : "A" },
"action" : "@method:changeArea"
},
*/
value: { command: "L" }
action: @menu:messageAreaMessageList
}
{
"value" : { "command" : "Q" },
"action" : "@menu:mainMenu"
},
value: { command: "Q" }
action: @menu:mainMenu
}
{
"value" : 1,
"action" : "@menu:messageArea"
value: 1
action: @menu:messageArea
}
]
},
"messageAreaChangeCurrentArea" : {
"art" : "msg_area_list.ans",
"module" : "msg_area_list",
"fallback" : "messageArea",
}
messageAreaChangeCurrentArea: {
art: CHANGE
module: msg_area_list
"form" : {
"0" : {
"VM" : {
"mci" : {
"VM1" : {
"widht" : 30,
"height" : 10,
"focus" : true,
"submit" : true,
"argName" : "area"
}
},
"submit" : {
"*" : [
{
"value" : { "area" : null },
"action" : "@method:changeArea"
}
]
},
"actionKeys" : [
"mci" : {
"VM1" : {
"focus" : true,
"submit" : true,
"argName" : "area"
}
},
"submit" : {
"*" : [
{
"keys" : [ "escape" ],
"action" : "@menu:messageArea"
"value" : { "area" : null },
"action" : "@method:changeArea"
}
]
}
},
"actionKeys" : [
{
keys: [ "escape", "q", "shift + q" ]
action: @systemMethod:fallbackMenu
}
]
}
}
},
@ -584,7 +577,7 @@
actionKeys: [
{
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
////////////////////////////////////////////////////////////////////////

View File

@ -33,6 +33,11 @@ exports.moduleInfo = {
|TI Current time
*/
var MciCodesIds = {
AreaList : 1,
CurrentArea : 2,
};
function MessageAreaListModule(options) {
MenuModule.call(this, options);
@ -40,44 +45,36 @@ function MessageAreaListModule(options) {
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 = {
changeArea : function(formData, extraArgs) {
if(1 === formData.submitId) {
var areaName = self.messageAreas[formData.value.area].name;
messageArea.changeMessageArea(self.client, areaName, function areaChanged(err) {
messageArea.changeMessageArea(self.client, areaName, function areaChanged(err) {
if(err) {
self.client.term.pipeWrite('\n|00Cannot change area: ' + err.message + '\n');
setTimeout(function timeout() {
self.client.gotoMenuModule( { name : self.menuConfig.fallback } );
self.client.fallbackMenuModule();
}, 1000);
} 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);
/*
MessageAreaListModule.prototype.enter = function(client) {
this.messageAreas = messageArea.getAvailableMessageAreas();
MessageAreaListModule.super_.prototype.enter.call(this, client);
};
*/
MessageAreaListModule.prototype.mciReady = function(mciData, cb) {
var self = this;
@ -102,16 +99,34 @@ MessageAreaListModule.prototype.mciReady = function(mciData, cb) {
});
},
function populateAreaListView(callback) {
var listFormat = self.menuConfig.config.listFormat || '{index} ) - {desc}';
var focusListFormat = self.menuConfig.config.focusListFormat || listFormat;
var areaListItems = [];
var focusListItems = [];
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 } )
);
}
var areaListView = vc.getView(1);
areaListView.setItems(areaListItems);
areaListView.setFocusItems(focusListItems);
areaListView.redraw();
callback(null);
},
function populateTextViews(callback) {
// :TODO: populate current message area desc!
//self.setViewText(MciCodesIds.CurrentArea,
callback(null);
}
],
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: {
0: {
mci: {