Further speedups for filebrowser
This commit is contained in:
parent
d68b33effc
commit
bbdd774afb
@ -592,15 +592,16 @@ void FileBrowser::addEntry_ (FileBrowserEntry* entry)
|
||||
{
|
||||
entry->selected = false;
|
||||
entry->drawable = false;
|
||||
entry->framed = editedFiles.find (entry->filename) != editedFiles.end();
|
||||
entry->framed = editedFiles.find(entry->filename) != editedFiles.end();
|
||||
|
||||
// add button set to the thumbbrowserentry
|
||||
entry->addButtonSet (new FileThumbnailButtonSet (entry));
|
||||
entry->getThumbButtonSet()->setRank (entry->thumbnail->getRank());
|
||||
entry->getThumbButtonSet()->setColorLabel (entry->thumbnail->getColorLabel());
|
||||
entry->getThumbButtonSet()->setInTrash (entry->thumbnail->getStage());
|
||||
entry->getThumbButtonSet()->setButtonListener (this);
|
||||
entry->resize (getThumbnailHeight());
|
||||
entry->addButtonSet(new FileThumbnailButtonSet(entry));
|
||||
entry->getThumbButtonSet()->setRank(entry->thumbnail->getRank());
|
||||
entry->getThumbButtonSet()->setColorLabel(entry->thumbnail->getColorLabel());
|
||||
entry->getThumbButtonSet()->setInTrash(entry->thumbnail->getStage());
|
||||
entry->getThumbButtonSet()->setButtonListener(this);
|
||||
entry->resize(getThumbnailHeight());
|
||||
entry->filtered = !checkFilter(entry);
|
||||
|
||||
// find place in abc order
|
||||
{
|
||||
@ -619,9 +620,9 @@ void FileBrowser::addEntry_ (FileBrowserEntry* entry)
|
||||
entry
|
||||
);
|
||||
|
||||
initEntry (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++) {
|
||||
// apply filter
|
||||
fd[i]->filtered = !checkFilter (fd[i]);
|
||||
for (const auto entry : fd) {
|
||||
if (checkfilter) {
|
||||
// apply filter
|
||||
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,12 +970,12 @@ bool ThumbBrowserBase::Internal::on_scroll_event (GdkEventScroll* event)
|
||||
}
|
||||
|
||||
|
||||
void ThumbBrowserBase::redraw ()
|
||||
void ThumbBrowserBase::redraw (bool checkfilter)
|
||||
{
|
||||
|
||||
GThreadLock lock;
|
||||
arrangeFiles ();
|
||||
queue_draw ();
|
||||
arrangeFiles(checkfilter);
|
||||
queue_draw();
|
||||
}
|
||||
|
||||
void ThumbBrowserBase::zoomChanged (bool zoomIn)
|
||||
|
@ -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);
|
||||
|
Loading…
x
Reference in New Issue
Block a user