More switch style

This commit is contained in:
Bryan Ashby 2016-08-03 22:43:56 -06:00
parent 33f0553ea9
commit 9af9bfe3d0
3 changed files with 123 additions and 123 deletions

View File

@ -78,126 +78,126 @@ MCIViewFactory.prototype.createFromMCI = function(mci, cb) {
// //
switch(mci.code) { switch(mci.code) {
// Text Label (Text View) // Text Label (Text View)
case 'TL' : case 'TL' :
setOption(0, 'textStyle'); setOption(0, 'textStyle');
setOption(1, 'justify'); setOption(1, 'justify');
setWidth(2); setWidth(2);
view = new TextView(options); view = new TextView(options);
break; break;
// Edit Text // Edit Text
case 'ET' : case 'ET' :
setWidth(0); setWidth(0);
setOption(1, 'textStyle'); setOption(1, 'textStyle');
setFocusOption(0, 'focusTextStyle'); setFocusOption(0, 'focusTextStyle');
view = new EditTextView(options); view = new EditTextView(options);
break; break;
// Masked Edit Text // Masked Edit Text
case 'ME' : case 'ME' :
setOption(0, 'textStyle'); setOption(0, 'textStyle');
setFocusOption(0, 'focusTextStyle'); setFocusOption(0, 'focusTextStyle');
view = new MaskEditTextView(options); view = new MaskEditTextView(options);
break; break;
// Multi Line Edit Text // Multi Line Edit Text
case 'MT' : case 'MT' :
// :TODO: apply params // :TODO: apply params
view = new MultiLineEditTextView(options); view = new MultiLineEditTextView(options);
break; break;
// Pre-defined Label (Text View) // Pre-defined Label (Text View)
// :TODO: Currently no real point of PL -- @method replaces this pretty much... probably remove // :TODO: Currently no real point of PL -- @method replaces this pretty much... probably remove
case 'PL' : case 'PL' :
if(mci.args.length > 0) { if(mci.args.length > 0) {
options.text = getPredefinedMCIValue(this.client, mci.args[0]); options.text = getPredefinedMCIValue(this.client, mci.args[0]);
if(options.text) { if(options.text) {
setOption(1, 'textStyle'); setOption(1, 'textStyle');
setOption(2, 'justify'); setOption(2, 'justify');
setWidth(3); setWidth(3);
view = new TextView(options);
}
}
break;
// Button
case 'BT' :
if(mci.args.length > 0) {
options.dimens = { width : parseInt(mci.args[0], 10) };
}
setOption(1, 'textStyle');
setOption(2, 'justify');
setFocusOption(0, 'focusTextStyle');
view = new ButtonView(options);
break;
// Vertial Menu
case 'VM' :
setOption(0, 'itemSpacing');
setOption(1, 'justify');
setOption(2, 'textStyle');
setFocusOption(0, 'focusTextStyle');
view = new VerticalMenuView(options);
break;
// Horizontal Menu
case 'HM' :
setOption(0, 'itemSpacing');
setOption(1, 'textStyle');
setFocusOption(0, 'focusTextStyle');
view = new HorizontalMenuView(options);
break;
case 'SM' :
setOption(0, 'textStyle');
setOption(1, 'justify');
setFocusOption(0, 'focusTextStyle');
view = new SpinnerMenuView(options);
break;
case 'TM' :
if(mci.args.length > 0) {
var styleSG1 = { fg : parseInt(mci.args[0], 10) };
if(mci.args.length > 1) {
styleSG1.bg = parseInt(mci.args[1], 10);
}
options.styleSG1 = ansi.getSGRFromGraphicRendition(styleSG1, true);
}
setFocusOption(0, 'focusTextStyle');
view = new ToggleMenuView(options);
break;
case 'KE' :
view = new KeyEntryView(options);
break;
default :
options.text = getPredefinedMCIValue(this.client, mci.code);
if(_.isString(options.text)) {
setWidth(0);
setOption(1, 'textStyle');
setOption(2, 'justify');
view = new TextView(options); view = new TextView(options);
} }
} break;
break;
// Button
case 'BT' :
if(mci.args.length > 0) {
options.dimens = { width : parseInt(mci.args[0], 10) };
}
setOption(1, 'textStyle');
setOption(2, 'justify');
setFocusOption(0, 'focusTextStyle');
view = new ButtonView(options);
break;
// Vertial Menu
case 'VM' :
setOption(0, 'itemSpacing');
setOption(1, 'justify');
setOption(2, 'textStyle');
setFocusOption(0, 'focusTextStyle');
view = new VerticalMenuView(options);
break;
// Horizontal Menu
case 'HM' :
setOption(0, 'itemSpacing');
setOption(1, 'textStyle');
setFocusOption(0, 'focusTextStyle');
view = new HorizontalMenuView(options);
break;
case 'SM' :
setOption(0, 'textStyle');
setOption(1, 'justify');
setFocusOption(0, 'focusTextStyle');
view = new SpinnerMenuView(options);
break;
case 'TM' :
if(mci.args.length > 0) {
var styleSG1 = { fg : parseInt(mci.args[0], 10) };
if(mci.args.length > 1) {
styleSG1.bg = parseInt(mci.args[1], 10);
}
options.styleSG1 = ansi.getSGRFromGraphicRendition(styleSG1, true);
}
setFocusOption(0, 'focusTextStyle');
view = new ToggleMenuView(options);
break;
case 'KE' :
view = new KeyEntryView(options);
break;
default :
options.text = getPredefinedMCIValue(this.client, mci.code);
if(_.isString(options.text)) {
setWidth(0);
setOption(1, 'textStyle');
setOption(2, 'justify');
view = new TextView(options);
}
break;
} }
return view; return view;

View File

@ -212,13 +212,13 @@ NewScanModule.prototype.mciReady = function(mciData, cb) {
}, },
function performCurrentStepScan(callback) { function performCurrentStepScan(callback) {
switch(self.currentStep) { switch(self.currentStep) {
case 'messageConferences' : case 'messageConferences' :
self.newScanMessageConference( () => { self.newScanMessageConference( () => {
callback(null); // finished callback(null); // finished
}); });
break; break;
default : return callback(null); default : return callback(null);
} }
} }
], ],

View File

@ -194,11 +194,11 @@ function FTNMessageScanTossModule() {
let ext; let ext;
switch(flowType) { switch(flowType) {
case 'mail' : ext = `${exportType.toLowerCase()[0]}ut`; break; case 'mail' : ext = `${exportType.toLowerCase()[0]}ut`; break;
case 'ref' : ext = `${exportType.toLowerCase()[0]}lo`; break; case 'ref' : ext = `${exportType.toLowerCase()[0]}lo`; break;
case 'busy' : ext = 'bsy'; break; case 'busy' : ext = 'bsy'; break;
case 'request' : ext = 'req'; break; case 'request' : ext = 'req'; break;
case 'requests' : ext = 'hrq'; break; case 'requests' : ext = 'hrq'; break;
} }
return ext; return ext;
@ -309,8 +309,8 @@ function FTNMessageScanTossModule() {
// Set appropriate attribute flag for export type // Set appropriate attribute flag for export type
// //
switch(this.getExportType(options.nodeConfig)) { switch(this.getExportType(options.nodeConfig)) {
case 'crash' : ftnAttribute |= ftnMailPacket.Packet.Attribute.Crash; break; case 'crash' : ftnAttribute |= ftnMailPacket.Packet.Attribute.Crash; break;
case 'hold' : ftnAttribute |= ftnMailPacket.Packet.Attribute.Hold; break; case 'hold' : ftnAttribute |= ftnMailPacket.Packet.Attribute.Hold; break;
// :TODO: Others? // :TODO: Others?
} }