Fix filtered horizontal thumbs

Take two images, the first in portrait, the second in landscape
orientation. Mark the second with a red dot and filter for red.
Now open that image in SETM. The top tumb is too slim.
This commit is contained in:
Flössie
2017-07-07 20:26:10 +02:00
parent c30683f5f6
commit c792facb73

View File

@@ -523,63 +523,49 @@ void ThumbBrowserBase::arrangeFiles ()
// We could lock it one more time, there's no harm excepted (negligible) speed penalty // We could lock it one more time, there's no harm excepted (negligible) speed penalty
//GThreadLock lock; //GThreadLock lock;
int N = fd.size (); const int N = fd.size();
// apply filter
for (int i = 0; i < N; i++) {
fd[i]->filtered = !checkFilter (fd[i]);
}
int rowHeight = 0; int rowHeight = 0;
for (int i = 0; i < N; i++) {
// apply filter
fd[i]->filtered = !checkFilter (fd[i]);
// compute size of the items // compute size of the items
for (int i = 0; i < N; i++)
if (!fd[i]->filtered && fd[i]->getMinimalHeight() > rowHeight) { if (!fd[i]->filtered && fd[i]->getMinimalHeight() > rowHeight) {
rowHeight = fd[i]->getMinimalHeight (); rowHeight = fd[i]->getMinimalHeight ();
} }
}
if (arrangement == TB_Horizontal) { if (arrangement == TB_Horizontal) {
numOfCols = 1; numOfCols = 1;
int numOfRows = 1;
// if (rowHeight>0) {
// numOfRows = (internal.get_height()+rowHeight/2)/rowHeight;
// if (numOfRows<1)
// numOfRows = 1;
// }
int ct = 0; int ct = 0;
int currx = 0; int currx = 0;
while (ct < N) { while (ct < N) {
// find widest item in the column
int maxw = 0;
for (int i = 0; ct + i < N && i < numOfRows; i++)
if (fd[ct + i]->getMinimalWidth() > maxw) {
maxw = fd[ct + i]->getMinimalWidth ();
}
// arrange items in the column // arrange items in the column
int curry = 0; int curry = 0;
for (int i = 0; ct < N && i < numOfRows; i++, ct++) {
while (ct < N && fd[ct]->filtered) { while (ct < N && fd[ct]->filtered) {
fd[ct++]->drawable = false; fd[ct++]->drawable = false;
} }
if (ct < N) { if (ct < N) {
fd[ct]->setPosition (currx, curry, maxw, rowHeight); const int maxw = fd[ct]->getMinimalWidth();
fd[ct]->drawable = true;
curry += rowHeight;
}
}
fd[ct]->setPosition(currx, curry, maxw, rowHeight);
fd[ct]->drawable = true;
currx += maxw; currx += maxw;
curry += rowHeight;
++ct;
}
} }
MYREADERLOCK_RELEASE(l); MYREADERLOCK_RELEASE(l);
// This will require a Writer access // This will require a Writer access
resizeThumbnailArea (currx, numOfRows * rowHeight); resizeThumbnailArea (currx, rowHeight);
} else { } else {
int availWidth = internal.get_width(); int availWidth = internal.get_width();
// initial number of columns // initial number of columns