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

Merge branch 'dd_area_choosers_all_separators_no_collapse' into 'master'

DD area choosers: No sub-board/library collapsing if all have the same separator

See merge request !165
parents 2bf9c6cc 9c59116e
No related branches found
No related tags found
2 merge requests!463MRC mods by Codefenix (2024-10-20),!165DD area choosers: No sub-board/library collapsing if all have the same separator
// $Id: $
/* This is a script that lets the user choose a file area, /* This is a script that lets the user choose a file area,
* with either a lightbar or traditional user interface. * with either a lightbar or traditional user interface.
* *
...@@ -19,6 +17,9 @@ ...@@ -19,6 +17,9 @@
* Fixed lightbar file directory choosing issue when * Fixed lightbar file directory choosing issue when
* using name collapsing (was using the wrong data * using name collapsing (was using the wrong data
* structure) * 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: /* Command-line arguments:
...@@ -56,8 +57,8 @@ if (system.version_num < 31400) ...@@ -56,8 +57,8 @@ if (system.version_num < 31400)
} }
// Version & date variables // Version & date variables
var DD_FILE_AREA_CHOOSER_VERSION = "1.22"; var DD_FILE_AREA_CHOOSER_VERSION = "1.23";
var DD_FILE_AREA_CHOOSER_VER_DATE = "2022-02-12"; var DD_FILE_AREA_CHOOSER_VER_DATE = "2022-03-18";
// Keyboard input key codes // Keyboard input key codes
var CTRL_H = "\x08"; var CTRL_H = "\x08";
...@@ -2006,12 +2007,27 @@ function DDFileAreaChooser_SetUpLibListWithCollapsedDirs() ...@@ -2006,12 +2007,27 @@ function DDFileAreaChooser_SetUpLibListWithCollapsedDirs()
// dirDescs is an object indexed by directory description, // dirDescs is an object indexed by directory description,
// and the value will be how many times it was seen. // and the value will be how many times it was seen.
var dirDescs = {}; 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) 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 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;
if (collapseThisLib)
{
var sepIdx = dirDesc.indexOf(this.dirCollapseSeparator); var sepIdx = dirDesc.indexOf(this.dirCollapseSeparator);
if (sepIdx > -1) if (sepIdx > -1)
dirDesc = truncsp(dirDesc.substr(0, sepIdx)); // Remove trailing whitespace dirDesc = truncsp(dirDesc.substr(0, sepIdx)); // Remove trailing whitespace
}
if (dirDescs.hasOwnProperty(dirDesc)) if (dirDescs.hasOwnProperty(dirDesc))
dirDescs[dirDesc] += 1; dirDescs[dirDesc] += 1;
else else
......
// $Id: $
/* This is a script that lets the user choose a message area, /* This is a script that lets the user choose a message area,
* with either a lightbar or traditional user interface. * with either a lightbar or traditional user interface.
* *
...@@ -22,6 +20,12 @@ ...@@ -22,6 +20,12 @@
* this version. * this version.
* 2022-02-12 Eric Oulashin Version 1.22 * 2022-02-12 Eric Oulashin Version 1.22
* Updated the version to match the file area chooser * 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) ...@@ -64,8 +68,8 @@ if (system.version_num < 31400)
} }
// Version & date variables // Version & date variables
var DD_MSG_AREA_CHOOSER_VERSION = "1.22"; var DD_MSG_AREA_CHOOSER_VERSION = "1.23";
var DD_MSG_AREA_CHOOSER_VER_DATE = "2022-02-12"; var DD_MSG_AREA_CHOOSER_VER_DATE = "2022-03-18";
// Keyboard input key codes // Keyboard input key codes
var CTRL_H = "\x08"; var CTRL_H = "\x08";
...@@ -792,25 +796,12 @@ function DDMsgAreaChooser_SelectMsgArea_Lightbar(pLevel, pGrpIdx, pSubIdx) ...@@ -792,25 +796,12 @@ function DDMsgAreaChooser_SelectMsgArea_Lightbar(pLevel, pGrpIdx, pSubIdx)
continueOn = false; continueOn = false;
} }
else 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 // A message sub-board was not chosen, so we'll have to re-draw
// the header and key help line // the header and key help line
this.DisplayListHdrLines(this.areaChangeHdrLines.length, chooseGroup, pGrpIdx); this.DisplayListHdrLines(this.areaChangeHdrLines.length, chooseGroup, pGrpIdx);
this.WriteKeyHelpLine(); this.WriteKeyHelpLine();
} }
// TODO?
/*
// A sub-board was not chosen, so we'll have to re-draw
// the header and list of message groups.
this.DisplayListHdrLines(this.areaChangeHdrLines.length, chooseGroup, pGrpIdx);
*/
}
} }
else if (level == 2) // Choosing a sub-board else if (level == 2) // Choosing a sub-board
{ {
...@@ -2403,12 +2394,28 @@ function DDMsgAreaChooser_SetUpGrpListWithCollapsedSubBoards() ...@@ -2403,12 +2394,28 @@ function DDMsgAreaChooser_SetUpGrpListWithCollapsedSubBoards()
// dirDescs is an object indexed by sub-board description, // dirDescs is an object indexed by sub-board description,
// and the value will be how many times it was seen. // and the value will be how many times it was seen.
var subBoardDescs = {}; 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) 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 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;
if (collapseThisGroup)
{
var sepIdx = subBoardDesc.indexOf(this.subCollapseSeparator); var sepIdx = subBoardDesc.indexOf(this.subCollapseSeparator);
if (sepIdx > -1) if (sepIdx > -1)
subBoardDesc = truncsp(subBoardDesc.substr(0, sepIdx)); // Remove trailing whitespace subBoardDesc = truncsp(subBoardDesc.substr(0, sepIdx)); // Remove trailing whitespace
}
if (subBoardDescs.hasOwnProperty(subBoardDesc)) if (subBoardDescs.hasOwnProperty(subBoardDesc))
subBoardDescs[subBoardDesc] += 1; subBoardDescs[subBoardDesc] += 1;
else else
......
Digital Distortion Area Choosers Digital Distortion Area Choosers
Version 1.22 Version 1.23
Release date: 2022-02-12 Release date: 2022-03-18
by by
...@@ -441,6 +441,10 @@ Name collapsing for message areas can be configured with the useSubCollapsing ...@@ -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 and subCollapseSeparator options in DDMsgAreaChooser.cfg, and for files, with
the useDirCollapsing and dirCollapseSeparator options in DDFileAreaChooser.cfg. 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 6. DDMsgAreaChooser class: Properties & methods
=============================================== ===============================================
......
...@@ -5,6 +5,9 @@ Revision History (change log) ...@@ -5,6 +5,9 @@ Revision History (change log)
============================= =============================
Version Date Description 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 1.22 2022-01-12 In the file area chooser, fixed a lightbar file directory
choosing issue when using name collapsing (was using the choosing issue when using name collapsing (was using the
wrong data structure) wrong data structure)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment