Skip to content
Snippets Groups Projects
Commit dc70b7de authored by Rob Swindell's avatar Rob Swindell :speech_balloon:
Browse files

Refactor commit b63b3bb3 (customizable xtrn program section menu)

Use the text.dat strings that corresponded with the previous behavior
(used by console.uselect()). The defaults include new-lines, so removed
some hard-coded console.crlf() calls that were added. If you have a
custom section_header_fmt, you'll likely need to add a \r\n to it.

Allow the "External Program Section" title string to be customized
(separately from section_header_fmt, e.g. for localization).

Save/use the current section.

Mouse-enable the program section list.
parent f962e870
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
...@@ -74,14 +74,16 @@ if(options.clear_screen === undefined) ...@@ -74,14 +74,16 @@ if(options.clear_screen === undefined)
options.clear_screen = true; options.clear_screen = true;
if (options.section_fmt === undefined) if (options.section_fmt === undefined)
options.section_fmt = "\x01y\x01g%3d:\x01n\x01g %s" options.section_fmt = bbs.text(SelectItemFmt);
if (options.section_header_fmt === undefined) if (options.section_header_fmt === undefined)
options.section_header_fmt = "\x01-\x01gSelect \x01hExternal Program Section\x01-\x01g:" options.section_header_fmt = bbs.text(SelectItemHdr);
if(options.section_which === undefined) if(options.section_which === undefined)
options.section_which = "\r\n\x01-\x01gWhich, \x01w\x01h~Q\x01n\x01guit or [1]: \x01h" options.section_which = bbs.text(SelectItemWhich);
if(options.section_header_title === undefined)
options.section_header_title = "External Program Section";
function sort_by_name(a, b) function sort_by_name(a, b)
{ {
...@@ -197,6 +199,7 @@ function external_program_menu(xsec) ...@@ -197,6 +199,7 @@ function external_program_menu(xsec)
function external_section_menu() function external_section_menu()
{ {
var i,j; var i,j;
var xsec=0;
while(bbs.online) { while(bbs.online) {
...@@ -211,7 +214,6 @@ function external_section_menu() ...@@ -211,7 +214,6 @@ function external_section_menu()
break; break;
} }
var xsec=0;
var sec_list=xtrn_area.sec_list.slice(); /* sec_list is a possibly-sorted copy of xtrn_area.sect_list */ var sec_list=xtrn_area.sec_list.slice(); /* sec_list is a possibly-sorted copy of xtrn_area.sect_list */
system.node_list[bbs.node_num-1].aux=0; /* aux is 0, only if at menu */ system.node_list[bbs.node_num-1].aux=0; /* aux is 0, only if at menu */
...@@ -232,25 +234,20 @@ function external_section_menu() ...@@ -232,25 +234,20 @@ function external_section_menu()
if(options.sort) if(options.sort)
sec_list.sort(sort_by_name); sec_list.sort(sort_by_name);
printf(options.section_header_fmt); printf(options.section_header_fmt, options.section_header_title);
console.crlf();
console.crlf();
for (i in sec_list) { for (i = 0; i < sec_list.length; i++) {
printf(options.section_fmt, parseInt(i) + 1, sec_list[i].name); console.add_hotspot(i+1);
console.crlf(); printf(options.section_fmt, i + 1, sec_list[i].name);
} }
bbs.node_sync(); bbs.node_sync();
console.mnemonics(options.section_which); console.mnemonics(format(options.section_which, xsec + 1));
xsec = console.getnum(sec_list.length);
xsec--; // match array index
if(xsec == -1) xsec = console.getnum(sec_list.length, xsec + 1);
xsec = 0; // default option if(xsec < 1)
else if(xsec == -2)
break; break;
xsec--;
} }
external_program_menu(sec_list[xsec].index); external_program_menu(sec_list[xsec].index);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment