diff --git a/xtrn/DDAreaChoosers/DDFileAreaChooser.js b/xtrn/DDAreaChoosers/DDFileAreaChooser.js index c938cf3b859b80074fe4a266cefab582b8da9593..55b570278168f36b2d54398c902cbf2fe6f0eb91 100644 --- a/xtrn/DDAreaChoosers/DDFileAreaChooser.js +++ b/xtrn/DDAreaChoosers/DDFileAreaChooser.js @@ -1,5 +1,3 @@ -// $Id: $ - /* This is a script that lets the user choose a file area, * with either a lightbar or traditional user interface. * @@ -19,6 +17,9 @@ * Fixed lightbar file directory choosing issue when * using name collapsing (was using the wrong data * structure) + * 2022-03-18 Eric Oulashin Version 1.23 + * For directory collapsing, if there's only one subdirectory, + * then it won't be collapsed. */ /* Command-line arguments: @@ -56,8 +57,8 @@ if (system.version_num < 31400) } // Version & date variables -var DD_FILE_AREA_CHOOSER_VERSION = "1.22"; -var DD_FILE_AREA_CHOOSER_VER_DATE = "2022-02-12"; +var DD_FILE_AREA_CHOOSER_VERSION = "1.23"; +var DD_FILE_AREA_CHOOSER_VER_DATE = "2022-03-18"; // Keyboard input key codes var CTRL_H = "\x08"; @@ -2006,12 +2007,27 @@ function DDFileAreaChooser_SetUpLibListWithCollapsedDirs() // dirDescs is an object indexed by directory description, // and the value will be how many times it was seen. var dirDescs = {}; + // First, count the number of directories that have the separator. + // If all of the group's directories have the separator, then we + // won't collapse the directories. + var numDirsWithSeparator = 0; + for (var dirIdx = 0; dirIdx < file_area.lib_list[libIdx].dir_list.length; ++dirIdx) + { + var dirDesc = file_area.lib_list[libIdx].dir_list[dirIdx].description; + if (dirDesc.indexOf(this.dirCollapseSeparator) > -1) + ++numDirsWithSeparator; + } + // Whether or not to use sub-board collapsing for this file library + var collapseThisLib = (numDirsWithSeparator > 0 && numDirsWithSeparator < file_area.lib_list[libIdx].dir_list.length); for (var dirIdx = 0; dirIdx < file_area.lib_list[libIdx].dir_list.length; ++dirIdx) { var dirDesc = file_area.lib_list[libIdx].dir_list[dirIdx].description; - var sepIdx = dirDesc.indexOf(this.dirCollapseSeparator); - if (sepIdx > -1) - dirDesc = truncsp(dirDesc.substr(0, sepIdx)); // Remove trailing whitespace + if (collapseThisLib) + { + var sepIdx = dirDesc.indexOf(this.dirCollapseSeparator); + if (sepIdx > -1) + dirDesc = truncsp(dirDesc.substr(0, sepIdx)); // Remove trailing whitespace + } if (dirDescs.hasOwnProperty(dirDesc)) dirDescs[dirDesc] += 1; else diff --git a/xtrn/DDAreaChoosers/DDMsgAreaChooser.js b/xtrn/DDAreaChoosers/DDMsgAreaChooser.js index d0ad3d4eca9dc86ae0f1d9ba0c497e073001f93c..3570f5559b7fa355c202800bbf4809dedf7b0fcb 100644 --- a/xtrn/DDAreaChoosers/DDMsgAreaChooser.js +++ b/xtrn/DDAreaChoosers/DDMsgAreaChooser.js @@ -1,5 +1,3 @@ -// $Id: $ - /* This is a script that lets the user choose a message area, * with either a lightbar or traditional user interface. * @@ -22,6 +20,12 @@ * this version. * 2022-02-12 Eric Oulashin Version 1.22 * Updated the version to match the file area chooser + * 2022-03-18 Eric Oulashin Version 1.23 + * For sub-board collapsing, if there's only one sub-group, + * then it won't be collapsed. + * Also fixed an issue: Using Q to quit out of the 2nd level + * (sub-board/sub-group) for lightbar mode no longer quits + * out of the chooser altogether. * */ @@ -64,8 +68,8 @@ if (system.version_num < 31400) } // Version & date variables -var DD_MSG_AREA_CHOOSER_VERSION = "1.22"; -var DD_MSG_AREA_CHOOSER_VER_DATE = "2022-02-12"; +var DD_MSG_AREA_CHOOSER_VERSION = "1.23"; +var DD_MSG_AREA_CHOOSER_VER_DATE = "2022-03-18"; // Keyboard input key codes var CTRL_H = "\x08"; @@ -793,23 +797,10 @@ function DDMsgAreaChooser_SelectMsgArea_Lightbar(pLevel, pGrpIdx, pSubIdx) } else { - // If using sub-board name collapsing or the sub-board changed (probably - // at level 3 because sub-board collapsing is enabled), then exit here. - if (this.useSubCollapsing || bbs.cursub_code != subCodeBackup) - continueOn = false; - else - { - // A message sub-board was not chosen, so we'll have to re-draw - // the header and key help line - this.DisplayListHdrLines(this.areaChangeHdrLines.length, chooseGroup, pGrpIdx); - this.WriteKeyHelpLine(); - } - // TODO? - /* - // A sub-board was not chosen, so we'll have to re-draw - // the header and list of message groups. + // A message sub-board was not chosen, so we'll have to re-draw + // the header and key help line this.DisplayListHdrLines(this.areaChangeHdrLines.length, chooseGroup, pGrpIdx); - */ + this.WriteKeyHelpLine(); } } else if (level == 2) // Choosing a sub-board @@ -2403,12 +2394,28 @@ function DDMsgAreaChooser_SetUpGrpListWithCollapsedSubBoards() // dirDescs is an object indexed by sub-board description, // and the value will be how many times it was seen. var subBoardDescs = {}; + // First, count the number of sub-boards that have the separator. + // If all of the group's sub-boards have the separator, then we + // won't collapse the sub-boards. + var numSubBoardsWithSeparator = 0; + for (var subIdx = 0; subIdx < msg_area.grp_list[grpIdx].sub_list.length; ++subIdx) + { + var subBoardDesc = msg_area.grp_list[grpIdx].sub_list[subIdx].description; + if (subBoardDesc.indexOf(this.subCollapseSeparator) > -1) + ++numSubBoardsWithSeparator; + } + // Whether or not to use sub-board collapsing for this group + var collapseThisGroup = (numSubBoardsWithSeparator > 0 && numSubBoardsWithSeparator < msg_area.grp_list[grpIdx].sub_list.length); + // Go through and build the group list for (var subIdx = 0; subIdx < msg_area.grp_list[grpIdx].sub_list.length; ++subIdx) { var subBoardDesc = msg_area.grp_list[grpIdx].sub_list[subIdx].description; - var sepIdx = subBoardDesc.indexOf(this.subCollapseSeparator); - if (sepIdx > -1) - subBoardDesc = truncsp(subBoardDesc.substr(0, sepIdx)); // Remove trailing whitespace + if (collapseThisGroup) + { + var sepIdx = subBoardDesc.indexOf(this.subCollapseSeparator); + if (sepIdx > -1) + subBoardDesc = truncsp(subBoardDesc.substr(0, sepIdx)); // Remove trailing whitespace + } if (subBoardDescs.hasOwnProperty(subBoardDesc)) subBoardDescs[subBoardDesc] += 1; else diff --git a/xtrn/DDAreaChoosers/readme.txt b/xtrn/DDAreaChoosers/readme.txt index e13f786b944bb1194c2ea297ca015bdf7b294044..0039f6adbd90f32075e3aea744c2e6f71b30e9f1 100644 --- a/xtrn/DDAreaChoosers/readme.txt +++ b/xtrn/DDAreaChoosers/readme.txt @@ -1,6 +1,6 @@ Digital Distortion Area Choosers - Version 1.22 - Release date: 2022-02-12 + Version 1.23 + Release date: 2022-03-18 by @@ -441,6 +441,10 @@ Name collapsing for message areas can be configured with the useSubCollapsing and subCollapseSeparator options in DDMsgAreaChooser.cfg, and for files, with the useDirCollapsing and dirCollapseSeparator options in DDFileAreaChooser.cfg. +If all of the sub-boards in a message group or all directories in a file library +have the same separator, then those will not be collapsed, since that would +result in only a single 2nd-tier selection, which would not be useful. + 6. DDMsgAreaChooser class: Properties & methods =============================================== diff --git a/xtrn/DDAreaChoosers/revision_history.txt b/xtrn/DDAreaChoosers/revision_history.txt index 28940160894060c242b15949472cd18312038876..f364e2a79d336e6fbfc1051b5438938985d6ad46 100644 --- a/xtrn/DDAreaChoosers/revision_history.txt +++ b/xtrn/DDAreaChoosers/revision_history.txt @@ -5,6 +5,9 @@ Revision History (change log) ============================= Version Date Description ------- ---- ----------- +1.23 2022-03-18 For message sub-board/file directory collapsing, if there + is only one sub-group/sub-library, then it won't be + collapsed, as that wouldn't be very useful. 1.22 2022-01-12 In the file area chooser, fixed a lightbar file directory choosing issue when using name collapsing (was using the wrong data structure)