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->selected = false;
|
||||||
entry->drawable = 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
|
// add button set to the thumbbrowserentry
|
||||||
entry->addButtonSet (new FileThumbnailButtonSet (entry));
|
entry->addButtonSet(new FileThumbnailButtonSet(entry));
|
||||||
entry->getThumbButtonSet()->setRank (entry->thumbnail->getRank());
|
entry->getThumbButtonSet()->setRank(entry->thumbnail->getRank());
|
||||||
entry->getThumbButtonSet()->setColorLabel (entry->thumbnail->getColorLabel());
|
entry->getThumbButtonSet()->setColorLabel(entry->thumbnail->getColorLabel());
|
||||||
entry->getThumbButtonSet()->setInTrash (entry->thumbnail->getStage());
|
entry->getThumbButtonSet()->setInTrash(entry->thumbnail->getStage());
|
||||||
entry->getThumbButtonSet()->setButtonListener (this);
|
entry->getThumbButtonSet()->setButtonListener(this);
|
||||||
entry->resize (getThumbnailHeight());
|
entry->resize(getThumbnailHeight());
|
||||||
|
entry->filtered = !checkFilter(entry);
|
||||||
|
|
||||||
// find place in abc order
|
// find place in abc order
|
||||||
{
|
{
|
||||||
@ -619,9 +620,9 @@ void FileBrowser::addEntry_ (FileBrowserEntry* entry)
|
|||||||
entry
|
entry
|
||||||
);
|
);
|
||||||
|
|
||||||
initEntry (entry);
|
initEntry(entry);
|
||||||
}
|
}
|
||||||
redraw ();
|
redraw(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
FileBrowserEntry* FileBrowser::delEntry (const Glib::ustring& fname)
|
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);
|
MYREADERLOCK(l, entryRW);
|
||||||
|
|
||||||
@ -572,17 +572,17 @@ void ThumbBrowserBase::arrangeFiles()
|
|||||||
//GThreadLock lock;
|
//GThreadLock lock;
|
||||||
|
|
||||||
int rowHeight = 0;
|
int rowHeight = 0;
|
||||||
|
for (const auto entry : fd) {
|
||||||
for (unsigned int i = 0; i < fd.size(); i++) {
|
if (checkfilter) {
|
||||||
// apply filter
|
// apply filter
|
||||||
fd[i]->filtered = !checkFilter (fd[i]);
|
entry->filtered = !checkFilter(entry);
|
||||||
|
}
|
||||||
|
|
||||||
// compute size of the items
|
// compute size of the items
|
||||||
if (!fd[i]->filtered && fd[i]->getMinimalHeight() > rowHeight) {
|
if (!entry->filtered) {
|
||||||
rowHeight = fd[i]->getMinimalHeight ();
|
rowHeight = std::max(entry->getMinimalHeight(), rowHeight);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (arrangement == TB_Horizontal) {
|
if (arrangement == TB_Horizontal) {
|
||||||
numOfCols = 1;
|
numOfCols = 1;
|
||||||
|
|
||||||
@ -667,9 +667,9 @@ void ThumbBrowserBase::arrangeFiles()
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (ct < fd.size()) {
|
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;
|
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;
|
GThreadLock lock;
|
||||||
arrangeFiles ();
|
arrangeFiles(checkfilter);
|
||||||
queue_draw ();
|
queue_draw();
|
||||||
}
|
}
|
||||||
|
|
||||||
void ThumbBrowserBase::zoomChanged (bool zoomIn)
|
void ThumbBrowserBase::zoomChanged (bool zoomIn)
|
||||||
|
@ -179,7 +179,7 @@ protected:
|
|||||||
|
|
||||||
std::set<Glib::ustring> editedFiles;
|
std::set<Glib::ustring> editedFiles;
|
||||||
|
|
||||||
void arrangeFiles ();
|
void arrangeFiles (bool checkfilter = true);
|
||||||
void zoomChanged (bool zoomIn);
|
void zoomChanged (bool zoomIn);
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@ -201,7 +201,7 @@ public:
|
|||||||
return fd;
|
return fd;
|
||||||
}
|
}
|
||||||
void on_style_updated () override;
|
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 refreshThumbImages (); // refresh thumbnail sizes, re-generate thumbnail images, arrange and draw
|
||||||
void refreshQuickThumbImages (); // 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);
|
void refreshEditedState (const std::set<Glib::ustring>& efiles);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user