Further speedups for filebrowser
This commit is contained in:
@@ -601,6 +601,7 @@ void FileBrowser::addEntry_ (FileBrowserEntry* entry)
|
||||
entry->getThumbButtonSet()->setInTrash(entry->thumbnail->getStage());
|
||||
entry->getThumbButtonSet()->setButtonListener(this);
|
||||
entry->resize(getThumbnailHeight());
|
||||
entry->filtered = !checkFilter(entry);
|
||||
|
||||
// find place in abc order
|
||||
{
|
||||
@@ -621,7 +622,7 @@ void FileBrowser::addEntry_ (FileBrowserEntry* entry)
|
||||
|
||||
initEntry(entry);
|
||||
}
|
||||
redraw ();
|
||||
redraw(false);
|
||||
}
|
||||
|
||||
FileBrowserEntry* FileBrowser::delEntry (const Glib::ustring& fname)
|
||||
|
||||
@@ -563,7 +563,7 @@ void ThumbBrowserBase::configScrollBars ()
|
||||
}
|
||||
}
|
||||
|
||||
void ThumbBrowserBase::arrangeFiles()
|
||||
void ThumbBrowserBase::arrangeFiles(bool checkfilter)
|
||||
{
|
||||
MYREADERLOCK(l, entryRW);
|
||||
|
||||
@@ -572,17 +572,17 @@ void ThumbBrowserBase::arrangeFiles()
|
||||
//GThreadLock lock;
|
||||
|
||||
int rowHeight = 0;
|
||||
|
||||
for (unsigned int i = 0; i < fd.size(); i++) {
|
||||
for (const auto entry : fd) {
|
||||
if (checkfilter) {
|
||||
// apply filter
|
||||
fd[i]->filtered = !checkFilter (fd[i]);
|
||||
entry->filtered = !checkFilter(entry);
|
||||
}
|
||||
|
||||
// compute size of the items
|
||||
if (!fd[i]->filtered && fd[i]->getMinimalHeight() > rowHeight) {
|
||||
rowHeight = fd[i]->getMinimalHeight ();
|
||||
if (!entry->filtered) {
|
||||
rowHeight = std::max(entry->getMinimalHeight(), rowHeight);
|
||||
}
|
||||
}
|
||||
|
||||
if (arrangement == TB_Horizontal) {
|
||||
numOfCols = 1;
|
||||
|
||||
@@ -667,9 +667,9 @@ void ThumbBrowserBase::arrangeFiles()
|
||||
}
|
||||
|
||||
if (ct < fd.size()) {
|
||||
fd[ct]->setPosition(currx, curry, colWidths[i % numOfCols], rowHeight);
|
||||
fd[ct]->setPosition(currx, curry, colWidths[i], rowHeight);
|
||||
fd[ct]->drawable = true;
|
||||
currx += colWidths[i % numOfCols];
|
||||
currx += colWidths[i];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -970,11 +970,11 @@ bool ThumbBrowserBase::Internal::on_scroll_event (GdkEventScroll* event)
|
||||
}
|
||||
|
||||
|
||||
void ThumbBrowserBase::redraw ()
|
||||
void ThumbBrowserBase::redraw (bool checkfilter)
|
||||
{
|
||||
|
||||
GThreadLock lock;
|
||||
arrangeFiles ();
|
||||
arrangeFiles(checkfilter);
|
||||
queue_draw();
|
||||
}
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ protected:
|
||||
|
||||
std::set<Glib::ustring> editedFiles;
|
||||
|
||||
void arrangeFiles ();
|
||||
void arrangeFiles (bool checkfilter = true);
|
||||
void zoomChanged (bool zoomIn);
|
||||
|
||||
public:
|
||||
@@ -201,7 +201,7 @@ public:
|
||||
return fd;
|
||||
}
|
||||
void on_style_updated () override;
|
||||
void redraw (); // arrange files and draw area
|
||||
void redraw (bool checkfilter = true); // arrange files and draw area
|
||||
void refreshThumbImages (); // refresh thumbnail sizes, re-generate thumbnail images, arrange and draw
|
||||
void refreshQuickThumbImages (); // refresh thumbnail sizes, re-generate thumbnail images, arrange and draw
|
||||
void refreshEditedState (const std::set<Glib::ustring>& efiles);
|
||||
|
||||
Reference in New Issue
Block a user