Skip to content

Commit 9159c6c

Browse files
committed
Missing controls when enabling both HTML_CODE_FOLDER and CREATE_SUBDIRS
1 parent 0ed044b commit 9159c6c

File tree

4 files changed

+19
-10
lines changed

4 files changed

+19
-10
lines changed

src/htmlgen.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -2825,7 +2825,7 @@ static void writeDefaultQuickLinks(TextStream &t,bool compact,
28252825
QCString initCodeFold;
28262826
if (Config_getBool(HTML_CODE_FOLDING))
28272827
{
2828-
initCodeFold="init_codefold();";
2828+
initCodeFold=QCString("init_codefold(") + (relPath.isEmpty() ? "0" : "1") + ");";
28292829
}
28302830
if (Config_getBool(SEARCHENGINE))
28312831
{

templates/html/darkmode_settings.css

+2
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@
152152
--fold-line-color: #808080;
153153
--fold-minus-image: url('minusd.svg');
154154
--fold-plus-image: url('plusd.svg');
155+
--fold-minus-image-relpath: url('../../minusd.svg');
156+
--fold-plus-image-relpath: url('../../plusd.svg');
155157

156158
/** font-family */
157159
--font-family-normal: Roboto,sans-serif;

templates/html/dynsections.js

+14-9
Original file line numberDiff line numberDiff line change
@@ -122,17 +122,18 @@ function toggleInherit(id)
122122
}
123123

124124
var opened=true;
125-
var plusImg = "var(--fold-plus-image)";
126-
var minusImg = "var(--fold-minus-image)";
125+
// in case HTML_COLORSTYLE is LIGHT or DARK the vars will be replaced, so we write them out explicitly and use double quotes
126+
var plusImg = [ "var(--fold-plus-image)", "var(--fold-plus-image-relpath)" ];
127+
var minusImg = [ "var(--fold-minus-image)", "var(--fold-minus-image-relpath)" ];
127128

128129
// toggle all folding blocks
129-
function codefold_toggle_all() {
130+
function codefold_toggle_all(relPath) {
130131
if (opened) {
131-
$('#fold_all').css('background-image',plusImg);
132+
$('#fold_all').css('background-image',plusImg[relPath]);
132133
$('div[id^=foldopen]').hide();
133134
$('div[id^=foldclosed]').show();
134135
} else {
135-
$('#fold_all').css('background-image',minusImg);
136+
$('#fold_all').css('background-image',minusImg[relPath]);
136137
$('div[id^=foldopen]').show();
137138
$('div[id^=foldclosed]').hide();
138139
}
@@ -144,7 +145,7 @@ function codefold_toggle(id) {
144145
$('#foldopen'+id).toggle();
145146
$('#foldclosed'+id).toggle();
146147
}
147-
function init_codefold() {
148+
function init_codefold(relPath) {
148149
$('span[class=lineno]').css(
149150
{'padding-right':'4px',
150151
'margin-right':'2px',
@@ -153,7 +154,9 @@ function init_codefold() {
153154
'background':'linear-gradient(var(--fold-line-color),var(--fold-line-color)) no-repeat 46px/2px 100%'
154155
});
155156
// add global toggle to first line
156-
$('span[class=lineno]:first').append('<span class="fold" id="fold_all" onclick="javascript:codefold_toggle_all();" style="background-image:'+minusImg+';"></span>');
157+
$('span[class=lineno]:first').append('<span class="fold" id="fold_all" '+
158+
'onclick="javascript:codefold_toggle_all('+relPath+');" '+
159+
'style="background-image:'+minusImg[relPath]+';"></span>');
157160
// add vertical lines to other rows
158161
$('span[class=lineno]').not(':eq(0)').append('<span class="fold"></span>');
159162
// add toggle controls to lines with fold divs
@@ -164,7 +167,9 @@ function init_codefold() {
164167
var start = $(this).attr('data-start');
165168
var end = $(this).attr('data-end');
166169
// replace normal fold span with controls for the first line of a foldable fragment
167-
$(this).find('span[class=fold]:first').replaceWith('<span class="fold" onclick="javascript:codefold_toggle(\''+id+'\');" style="background-image:'+minusImg+';"></span>');
170+
$(this).find('span[class=fold]:first').replaceWith('<span class="fold" '+
171+
'onclick="javascript:codefold_toggle(\''+id+'\');" '+
172+
'style="background-image:'+minusImg[relPath]+';"></span>');
168173
// append div for folded (closed) representation
169174
$(this).after('<div id="foldclosed'+id+'" class="foldclosed" style="display:none;"></div>');
170175
// extract the first line from the "open" section to represent closed content
@@ -176,7 +181,7 @@ function init_codefold() {
176181
$(line).html($(line).html().replace(new RegExp('\\s*'+start+'\\s*$','g'),''));
177182
}
178183
// replace minus with plus symbol
179-
$(line).find('span[class=fold]').css('background-image',plusImg);
184+
$(line).find('span[class=fold]').css('background-image',plusImg[relPath]);
180185
// append ellipsis
181186
$(line).append(' '+start+'<a href="javascript:codefold_toggle(\''+id+'\')">&#8230;</a>'+end);
182187
// insert constructed line into closed div

templates/html/lightmode_settings.css

+2
Original file line numberDiff line numberDiff line change
@@ -152,6 +152,8 @@
152152
--fold-line-color: #808080;
153153
--fold-minus-image: url('minus.svg');
154154
--fold-plus-image: url('plus.svg');
155+
--fold-minus-image-relpath: url('../../minus.svg');
156+
--fold-plus-image-relpath: url('../../plus.svg');
155157

156158
/** font-family */
157159
--font-family-normal: Roboto,sans-serif;

0 commit comments

Comments
 (0)