mirror of
https://github.com/NuSkooler/enigma-bbs.git
synced 2025-08-05 01:11:36 +02:00
Pardon the noise. More tab to space conversion!
This commit is contained in:
parent
c3635bb26b
commit
1d8be6b014
128 changed files with 8017 additions and 8017 deletions
|
@ -1,25 +1,25 @@
|
|||
/* jslint node: true */
|
||||
'use strict';
|
||||
|
||||
// ENiGMA½
|
||||
const TextView = require('./text_view.js').TextView;
|
||||
const EditTextView = require('./edit_text_view.js').EditTextView;
|
||||
const ButtonView = require('./button_view.js').ButtonView;
|
||||
const VerticalMenuView = require('./vertical_menu_view.js').VerticalMenuView;
|
||||
const HorizontalMenuView = require('./horizontal_menu_view.js').HorizontalMenuView;
|
||||
const SpinnerMenuView = require('./spinner_menu_view.js').SpinnerMenuView;
|
||||
const ToggleMenuView = require('./toggle_menu_view.js').ToggleMenuView;
|
||||
const MaskEditTextView = require('./mask_edit_text_view.js').MaskEditTextView;
|
||||
const KeyEntryView = require('./key_entry_view.js');
|
||||
const MultiLineEditTextView = require('./multi_line_edit_text_view.js').MultiLineEditTextView;
|
||||
const getPredefinedMCIValue = require('./predefined_mci.js').getPredefinedMCIValue;
|
||||
const ansi = require('./ansi_term.js');
|
||||
// ENiGMA½
|
||||
const TextView = require('./text_view.js').TextView;
|
||||
const EditTextView = require('./edit_text_view.js').EditTextView;
|
||||
const ButtonView = require('./button_view.js').ButtonView;
|
||||
const VerticalMenuView = require('./vertical_menu_view.js').VerticalMenuView;
|
||||
const HorizontalMenuView = require('./horizontal_menu_view.js').HorizontalMenuView;
|
||||
const SpinnerMenuView = require('./spinner_menu_view.js').SpinnerMenuView;
|
||||
const ToggleMenuView = require('./toggle_menu_view.js').ToggleMenuView;
|
||||
const MaskEditTextView = require('./mask_edit_text_view.js').MaskEditTextView;
|
||||
const KeyEntryView = require('./key_entry_view.js');
|
||||
const MultiLineEditTextView = require('./multi_line_edit_text_view.js').MultiLineEditTextView;
|
||||
const getPredefinedMCIValue = require('./predefined_mci.js').getPredefinedMCIValue;
|
||||
const ansi = require('./ansi_term.js');
|
||||
|
||||
// deps
|
||||
const assert = require('assert');
|
||||
const _ = require('lodash');
|
||||
// deps
|
||||
const assert = require('assert');
|
||||
const _ = require('lodash');
|
||||
|
||||
exports.MCIViewFactory = MCIViewFactory;
|
||||
exports.MCIViewFactory = MCIViewFactory;
|
||||
|
||||
function MCIViewFactory(client) {
|
||||
this.client = client;
|
||||
|
@ -29,9 +29,9 @@ MCIViewFactory.UserViewCodes = [
|
|||
'TL', 'ET', 'ME', 'MT', 'PL', 'BT', 'VM', 'HM', 'SM', 'TM', 'KE',
|
||||
|
||||
//
|
||||
// XY is a special MCI code that allows finding positions
|
||||
// and counts for key lookup, but does not explicitly
|
||||
// represent a visible View on it's own
|
||||
// XY is a special MCI code that allows finding positions
|
||||
// and counts for key lookup, but does not explicitly
|
||||
// represent a visible View on it's own
|
||||
//
|
||||
'XY',
|
||||
];
|
||||
|
@ -43,14 +43,14 @@ MCIViewFactory.prototype.createFromMCI = function(mci) {
|
|||
|
||||
var view;
|
||||
var options = {
|
||||
client : this.client,
|
||||
id : mci.id,
|
||||
ansiSGR : mci.SGR,
|
||||
ansiFocusSGR : mci.focusSGR,
|
||||
position : { row : mci.position[0], col : mci.position[1] },
|
||||
client : this.client,
|
||||
id : mci.id,
|
||||
ansiSGR : mci.SGR,
|
||||
ansiFocusSGR : mci.focusSGR,
|
||||
position : { row : mci.position[0], col : mci.position[1] },
|
||||
};
|
||||
|
||||
// :TODO: These should use setPropertyValue()!
|
||||
// :TODO: These should use setPropertyValue()!
|
||||
function setOption(pos, name) {
|
||||
if(mci.args.length > pos && mci.args[pos].length > 0) {
|
||||
options[name] = mci.args[pos];
|
||||
|
@ -73,44 +73,44 @@ MCIViewFactory.prototype.createFromMCI = function(mci) {
|
|||
}
|
||||
|
||||
//
|
||||
// Note: Keep this in sync with UserViewCodes above!
|
||||
// Note: Keep this in sync with UserViewCodes above!
|
||||
//
|
||||
switch(mci.code) {
|
||||
// Text Label (Text View)
|
||||
// Text Label (Text View)
|
||||
case 'TL' :
|
||||
setOption(0, 'textStyle');
|
||||
setOption(1, 'justify');
|
||||
setOption(0, 'textStyle');
|
||||
setOption(1, 'justify');
|
||||
setWidth(2);
|
||||
|
||||
view = new TextView(options);
|
||||
break;
|
||||
|
||||
// Edit Text
|
||||
// Edit Text
|
||||
case 'ET' :
|
||||
setWidth(0);
|
||||
|
||||
setOption(1, 'textStyle');
|
||||
setFocusOption(0, 'focusTextStyle');
|
||||
setOption(1, 'textStyle');
|
||||
setFocusOption(0, 'focusTextStyle');
|
||||
|
||||
view = new EditTextView(options);
|
||||
break;
|
||||
|
||||
// Masked Edit Text
|
||||
// Masked Edit Text
|
||||
case 'ME' :
|
||||
setOption(0, 'textStyle');
|
||||
setFocusOption(0, 'focusTextStyle');
|
||||
setOption(0, 'textStyle');
|
||||
setFocusOption(0, 'focusTextStyle');
|
||||
|
||||
view = new MaskEditTextView(options);
|
||||
break;
|
||||
|
||||
// Multi Line Edit Text
|
||||
// Multi Line Edit Text
|
||||
case 'MT' :
|
||||
// :TODO: apply params
|
||||
// :TODO: apply params
|
||||
view = new MultiLineEditTextView(options);
|
||||
break;
|
||||
|
||||
// Pre-defined Label (Text View)
|
||||
// :TODO: Currently no real point of PL -- @method replaces this pretty much... probably remove
|
||||
// Pre-defined Label (Text View)
|
||||
// :TODO: Currently no real point of PL -- @method replaces this pretty much... probably remove
|
||||
case 'PL' :
|
||||
if(mci.args.length > 0) {
|
||||
options.text = getPredefinedMCIValue(this.client, mci.args[0]);
|
||||
|
@ -124,7 +124,7 @@ MCIViewFactory.prototype.createFromMCI = function(mci) {
|
|||
}
|
||||
break;
|
||||
|
||||
// Button
|
||||
// Button
|
||||
case 'BT' :
|
||||
if(mci.args.length > 0) {
|
||||
options.dimens = { width : parseInt(mci.args[0], 10) };
|
||||
|
@ -138,32 +138,32 @@ MCIViewFactory.prototype.createFromMCI = function(mci) {
|
|||
view = new ButtonView(options);
|
||||
break;
|
||||
|
||||
// Vertial Menu
|
||||
// Vertial Menu
|
||||
case 'VM' :
|
||||
setOption(0, 'itemSpacing');
|
||||
setOption(1, 'justify');
|
||||
setOption(2, 'textStyle');
|
||||
setOption(0, 'itemSpacing');
|
||||
setOption(1, 'justify');
|
||||
setOption(2, 'textStyle');
|
||||
|
||||
setFocusOption(0, 'focusTextStyle');
|
||||
setFocusOption(0, 'focusTextStyle');
|
||||
|
||||
view = new VerticalMenuView(options);
|
||||
break;
|
||||
|
||||
// Horizontal Menu
|
||||
// Horizontal Menu
|
||||
case 'HM' :
|
||||
setOption(0, 'itemSpacing');
|
||||
setOption(1, 'textStyle');
|
||||
setOption(0, 'itemSpacing');
|
||||
setOption(1, 'textStyle');
|
||||
|
||||
setFocusOption(0, 'focusTextStyle');
|
||||
setFocusOption(0, 'focusTextStyle');
|
||||
|
||||
view = new HorizontalMenuView(options);
|
||||
break;
|
||||
|
||||
case 'SM' :
|
||||
setOption(0, 'textStyle');
|
||||
setOption(1, 'justify');
|
||||
setOption(0, 'textStyle');
|
||||
setOption(1, 'justify');
|
||||
|
||||
setFocusOption(0, 'focusTextStyle');
|
||||
setFocusOption(0, 'focusTextStyle');
|
||||
|
||||
view = new SpinnerMenuView(options);
|
||||
break;
|
||||
|
@ -177,7 +177,7 @@ MCIViewFactory.prototype.createFromMCI = function(mci) {
|
|||
options.styleSG1 = ansi.getSGRFromGraphicRendition(styleSG1, true);
|
||||
}
|
||||
|
||||
setFocusOption(0, 'focusTextStyle');
|
||||
setFocusOption(0, 'focusTextStyle');
|
||||
|
||||
view = new ToggleMenuView(options);
|
||||
break;
|
||||
|
@ -191,8 +191,8 @@ MCIViewFactory.prototype.createFromMCI = function(mci) {
|
|||
if(_.isString(options.text)) {
|
||||
setWidth(0);
|
||||
|
||||
setOption(1, 'textStyle');
|
||||
setOption(2, 'justify');
|
||||
setOption(1, 'textStyle');
|
||||
setOption(2, 'justify');
|
||||
|
||||
view = new TextView(options);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue