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

Only indicate one template sub/dir (with '*') per group/lib

... as pointed out by Nelgin. You can toggle more than one sub-board/directory's "template" option to "Yes". But only the first such sub/dir is actually the template, so only indicate the first such sub with a splat ('*').
parent d9ea5425
No related branches found
No related tags found
1 merge request!463MRC mods by Codefenix (2024-10-20)
Pipeline #950 passed
...@@ -166,6 +166,7 @@ void sub_cfg(uint grpnum) ...@@ -166,6 +166,7 @@ void sub_cfg(uint grpnum)
if(uifc.changes && cfg.grp[grpnum]->sort) if(uifc.changes && cfg.grp[grpnum]->sort)
sort_subs(grpnum); sort_subs(grpnum);
int maxlen = 0; int maxlen = 0;
bool template_shown = false;
for(i=0,j=0;i<cfg.total_subs && j<MAX_OPTS;i++) for(i=0,j=0;i<cfg.total_subs && j<MAX_OPTS;i++)
if(cfg.sub[i]->grp==grpnum) { if(cfg.sub[i]->grp==grpnum) {
subnum[j]=i; subnum[j]=i;
...@@ -187,7 +188,9 @@ void sub_cfg(uint grpnum) ...@@ -187,7 +188,9 @@ void sub_cfg(uint grpnum)
default: /* Defeat stupid GCC warning */ default: /* Defeat stupid GCC warning */
break; break;
} }
sprintf(str, "%-*s %c", name_len, name, cfg.sub[i]->misc&SUB_TEMPLATE ? '*' : ' '); sprintf(str, "%-*s %c", name_len, name, (cfg.sub[i]->misc&SUB_TEMPLATE && !template_shown) ? '*' : ' ');
if(cfg.sub[i]->misc&SUB_TEMPLATE)
template_shown = true;
truncsp(str); truncsp(str);
len += sprintf(opt[j] + strlen(opt[j]), "%s", str); len += sprintf(opt[j] + strlen(opt[j]), "%s", str);
if(len > maxlen) if(len > maxlen)
......
...@@ -979,6 +979,7 @@ void dir_cfg(uint libnum) ...@@ -979,6 +979,7 @@ void dir_cfg(uint libnum)
if(uifc.changes && cfg.lib[libnum]->sort) if(uifc.changes && cfg.lib[libnum]->sort)
sort_dirs(libnum); sort_dirs(libnum);
int maxlen = 0; int maxlen = 0;
bool template_shown = false;
for(i=0,j=0;i<cfg.total_dirs && j<MAX_OPTS;i++) { for(i=0,j=0;i<cfg.total_dirs && j<MAX_OPTS;i++) {
if(cfg.dir[i]->lib != libnum) if(cfg.dir[i]->lib != libnum)
continue; continue;
...@@ -996,7 +997,9 @@ void dir_cfg(uint libnum) ...@@ -996,7 +997,9 @@ void dir_cfg(uint libnum)
default: /* Defeat stupid GCC warning */ default: /* Defeat stupid GCC warning */
break; break;
} }
sprintf(str, "%-*s %c", name_len, name, cfg.dir[i]->misc&DIR_TEMPLATE ? '*' : ' '); sprintf(str, "%-*s %c", name_len, name, (cfg.dir[i]->misc&DIR_TEMPLATE && !template_shown) ? '*' : ' ');
if(cfg.dir[i]->misc&DIR_TEMPLATE)
template_shown = true;
truncsp(str); truncsp(str);
int len = sprintf(opt[j], "%s", str); int len = sprintf(opt[j], "%s", str);
if(len > maxlen) if(len > maxlen)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment