diff --git a/mods/abracadabra.js b/mods/abracadabra.js index c25edfad..47ffdadc 100644 --- a/mods/abracadabra.js +++ b/mods/abracadabra.js @@ -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); diff --git a/mods/menu.hjson b/mods/menu.hjson index 98ff2646..2f59f333 100644 --- a/mods/menu.hjson +++ b/mods/menu.hjson @@ -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 //////////////////////////////////////////////////////////////////////// diff --git a/mods/msg_area_list.js b/mods/msg_area_list.js index 50335257..6a119e74 100644 --- a/mods/msg_area_list.js +++ b/mods/msg_area_list.js @@ -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) { diff --git a/mods/themes/luciano_blocktronics/CHANGE.ANS b/mods/themes/luciano_blocktronics/CHANGE.ANS new file mode 100644 index 00000000..22cd22d8 Binary files /dev/null and b/mods/themes/luciano_blocktronics/CHANGE.ANS differ diff --git a/mods/themes/luciano_blocktronics/MMENU.ANS b/mods/themes/luciano_blocktronics/MMENU.ANS index 2cdc20e1..4b7045c9 100644 Binary files a/mods/themes/luciano_blocktronics/MMENU.ANS and b/mods/themes/luciano_blocktronics/MMENU.ANS differ diff --git a/mods/themes/luciano_blocktronics/MSGMNU.ANS b/mods/themes/luciano_blocktronics/MSGMNU.ANS new file mode 100644 index 00000000..7e0ab8c8 Binary files /dev/null and b/mods/themes/luciano_blocktronics/MSGMNU.ANS differ diff --git a/mods/themes/luciano_blocktronics/theme.hjson b/mods/themes/luciano_blocktronics/theme.hjson index a159fd2b..4101c8e7 100644 --- a/mods/themes/luciano_blocktronics/theme.hjson +++ b/mods/themes/luciano_blocktronics/theme.hjson @@ -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: {