Skip to content
Snippets Groups Projects
Commit 20997dea authored by Kayz's avatar Kayz Committed by Rob Swindell
Browse files

xtrnmenu v3.1 = fix issue with singlecolumn_margin not working very well,...

xtrnmenu v3.1 = fix issue with singlecolumn_margin not working very well, streamline menuconfig when bulk-adding items
parent bf19aa0a
No related branches found
No related tags found
No related merge requests found
......@@ -20,7 +20,10 @@ clear_screen = true
; uncomment and modify any of the below to change the look of the external programs menu
; to remove titles or underline, set to the text ' '
;multicolumn_separator: " "
;singlecolumn_margin=7
; set the singlecolumn margin to the number of lines of your footer, if you have one
;singlecolumn_margin=2
;header_fmt: \1n\1c\1h%s \1n\1cExternal Programs:\r\n\r\n
;titles: \1n\1cKey \1h\xb3\1n\1c Name \1n\1c
multicolumn_fmt: \1h\1c%3s \xb3 \1n\1c%-32.32s \1h
......
......@@ -168,12 +168,6 @@ ExternalMenus.prototype.getOptions = function(menutype, menuid) {
? this.xtrn_custommenu_options.singlecolumn_margin : this.options.singlecolumn_margin;
if (typeof bbs !== "undefined") {
this.options.singlecolumn_height = (typeof this.xtrn_custommenu_options.singlecolumn_height !== "undefined")
? this.xtrn_custommenu_options.singlecolumn_height : this.options.singlecolumn_height;
if (this.options.singlecolumn_height === undefined)
this.options.singlecolumn_height = console.screen_rows - this.options.singlecolumn_margin;
// override and turn off multicolumn if terminal width is less than 80
if (console.screen_columns < 80)
options.multicolumn = false;
......
......@@ -637,8 +637,18 @@ function external_menu_custom(menuid)
// then display that, otherwise dynamiic
if (!bbs.menu("xtrnmenu_" + menuid, P_NOERROR)) {
// determine lines left. we can't know the size of the footer so
// let the sysop use singlecolumn_margin to specify that. Below
// calcution will always leave room for titles and underline even
// if they aren't rendered
var linesleft = console.screen_rows - console.line_counter - options.singlecolumn_margin
- 2 - 2; // -2 for header_fmt/crlf and -2 for crlf and footer
if(options.titles.trimRight() != '') linesleft = linesleft - 1;
if(options.underline.trimRight() != '') linesleft = linesleft - 2;
multicolumn = menuitemsfiltered.length > linesleft;
// if no custom menu file in text/menu, create a dynamic one
multicolumn = options.multicolumn && menuitemsfiltered.length > options.singlecolumn_height;
printf(options.header_fmt, menuobj.title);
if(options.titles.trimRight() != '')
write(options.titles);
......@@ -760,8 +770,8 @@ function external_menu_custom(menuid)
if (selected_index == j) {
if (menuitemsfiltered[j].type == 'quit') {
printf(multicolumn ? return_multicolumn_fmt_inverse : return_singlecolumn_fmt_inverse,
menuitemsfiltered[i].input.toString().toUpperCase(),
menuitemsfiltered[i].title,
menuitemsfiltered[j].input.toString().toUpperCase(),
menuitemsfiltered[j].title,
''
);
} else {
......@@ -1066,8 +1076,18 @@ function special_menu(menutype, title, itemcount) {
type: 'quit',
});
// determine lines left. we can't know the size of the footer so
// let the sysop use singlecolumn_margin to specify that. Below
// calcution will always leave room for titles and underline even
// if they aren't rendered
var linesleft = console.screen_rows - console.line_counter - options.singlecolumn_margin
- 2 - 2; // -2 for header_fmt/crlf and -2 for crlf and footer
if(options.titles.trimRight() != '') linesleft = linesleft - 1;
if(options.underline.trimRight() != '') linesleft = linesleft - 2;
multicolumn = menuitemsfiltered.length > linesleft;
// if no custom menu file in text/menu, create a dynamic one
multicolumn = options.multicolumn && menuitemsfiltered.length > options.singlecolumn_height;
printf(options.header_fmt, title);
if(options.titles.trimRight() != '')
write(options.titles);
......@@ -1462,9 +1482,17 @@ function search_menu(title, itemcount) {
type: 'quit',
});
// if no custom menu file in text/menu, create a dynamic one
multicolumn = options.multicolumn && menuitemsfiltered.length > options.singlecolumn_height;
// determine lines left. we can't know the size of the footer so
// let the sysop use singlecolumn_margin to specify that. Below
// calcution will always leave room for titles and underline even
// if they aren't rendered
var linesleft = console.screen_rows - console.line_counter - options.singlecolumn_margin
- 2 - 2; // -2 for header_fmt/crlf and -2 for crlf and footer
if(options.titles.trimRight() != '') linesleft = linesleft - 1;
if(options.underline.trimRight() != '') linesleft = linesleft - 2;
multicolumn = menuitemsfiltered.length > linesleft;
if(options.titles.trimRight() != '')
write(options.titles);
if(multicolumn) {
......@@ -1825,9 +1853,18 @@ function favorites_menu(title, itemcount) {
target: '',
type: 'remove'
});
// if no custom menu file in text/menu, create a dynamic one
multicolumn = options.multicolumn && menuitemsfiltered.length > options.singlecolumn_height;
// determine lines left. we can't know the size of the footer so
// let the sysop use singlecolumn_margin to specify that. Below
// calcution will always leave room for titles and underline even
// if they aren't rendered
var linesleft = console.screen_rows - console.line_counter - options.singlecolumn_margin
- 2 - 2; // -2 for header_fmt/crlf and -2 for crlf and footer
if(options.titles.trimRight() != '') linesleft = linesleft - 1;
if(options.underline.trimRight() != '') linesleft = linesleft - 2;
multicolumn = menuitemsfiltered.length > linesleft;
printf(options.header_fmt, title);
if(options.titles.trimRight() != '')
write(options.titles);
......
This diff is collapsed.
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment