Some code cleanups
This commit is contained in:
@@ -661,7 +661,6 @@ void ThumbBrowserBase::arrangeFiles(ThumbBrowserEntryBase* entry)
|
||||
}
|
||||
|
||||
std::vector<int> colWidths;
|
||||
std::vector<int> oldColWidths;
|
||||
|
||||
for (; numOfCols > 0; --numOfCols) {
|
||||
// compute column widths
|
||||
@@ -685,8 +684,13 @@ void ThumbBrowserBase::arrangeFiles(ThumbBrowserEntryBase* entry)
|
||||
}
|
||||
}
|
||||
|
||||
bool arrangeAll = true;
|
||||
// arrange files
|
||||
int curry = 0;
|
||||
size_t ct = 0;
|
||||
if (entry) {
|
||||
std::vector<int> oldColWidths;
|
||||
if (oldNumOfCols == numOfCols) {
|
||||
int oldColsWidth = 0;
|
||||
for (; oldNumOfCols > 0; --oldNumOfCols) {
|
||||
// compute old column widths
|
||||
oldColWidths.assign(oldNumOfCols, 0);
|
||||
@@ -700,17 +704,13 @@ void ThumbBrowserBase::arrangeFiles(ThumbBrowserEntryBase* entry)
|
||||
++j;
|
||||
}
|
||||
}
|
||||
// if not wider than the space available, arrange it and we are ready
|
||||
oldColsWidth = std::accumulate(oldColWidths.begin(), oldColWidths.end(), 0);
|
||||
|
||||
if (oldNumOfCols == 1 || oldColsWidth < availWidth) {
|
||||
if (oldNumOfCols == 1 || std::accumulate(oldColWidths.begin(), oldColWidths.end(), 0) < availWidth) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool arrangeAll = true;
|
||||
if (entry && oldNumOfCols == numOfCols && oldColWidths.size() > 0) {
|
||||
if (oldNumOfCols == numOfCols) {
|
||||
arrangeAll = false;
|
||||
for (int i = 0; i < numOfCols; ++i) {
|
||||
if(colWidths[i] != oldColWidths[i]) {
|
||||
@@ -719,11 +719,7 @@ void ThumbBrowserBase::arrangeFiles(ThumbBrowserEntryBase* entry)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// arrange files
|
||||
int curry = 0;
|
||||
size_t ct = 0;
|
||||
if (entry && !arrangeAll) {
|
||||
if (!arrangeAll) {
|
||||
int i = 0;
|
||||
// Find currently added entry
|
||||
for (; ct < fd.size() && fd[ct] != entry; i += !fd[ct]->filtered, ++ct) {
|
||||
@@ -752,6 +748,7 @@ void ThumbBrowserBase::arrangeFiles(ThumbBrowserEntryBase* entry)
|
||||
curry += rowHeight;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// arrange remaining entries, if any, that's the most expensive part
|
||||
for (; ct < fd.size();) {
|
||||
|
Reference in New Issue
Block a user