filecatalog/filebrowser: further optimizations
This commit is contained in:
parent
0840b3ee00
commit
d9c93e77ae
@ -160,7 +160,7 @@ std::vector<Glib::RefPtr<Gdk::Pixbuf> > BatchQueueEntry::getIconsOnImageArea ()
|
||||
return ret;
|
||||
}
|
||||
|
||||
void BatchQueueEntry::getIconSize (int& w, int& h)
|
||||
void BatchQueueEntry::getIconSize (int& w, int& h) const
|
||||
{
|
||||
|
||||
w = savedAsIcon->get_width ();
|
||||
@ -168,7 +168,7 @@ void BatchQueueEntry::getIconSize (int& w, int& h)
|
||||
}
|
||||
|
||||
|
||||
Glib::ustring BatchQueueEntry::getToolTip (int x, int y)
|
||||
Glib::ustring BatchQueueEntry::getToolTip (int x, int y) const
|
||||
{
|
||||
// get the parent class' tooltip first
|
||||
Glib::ustring tooltip = ThumbBrowserEntryBase::getToolTip(x, y);
|
||||
|
@ -69,8 +69,8 @@ public:
|
||||
void removeButtonSet ();
|
||||
|
||||
std::vector<Glib::RefPtr<Gdk::Pixbuf>> getIconsOnImageArea () override;
|
||||
void getIconSize (int& w, int& h) override;
|
||||
Glib::ustring getToolTip (int x, int y) override;
|
||||
void getIconSize (int& w, int& h) const override;
|
||||
Glib::ustring getToolTip (int x, int y) const override;
|
||||
|
||||
// bqentryupdatelistener interface
|
||||
void updateImage (guint8* img, int w, int h, int origw, int origh, guint8* newOPreview) override;
|
||||
|
@ -121,13 +121,12 @@ void FileBrowserEntry::calcThumbnailSize ()
|
||||
|
||||
std::vector<Glib::RefPtr<Gdk::Pixbuf>> FileBrowserEntry::getIconsOnImageArea ()
|
||||
{
|
||||
if (!thumbnail) {
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<Glib::RefPtr<Gdk::Pixbuf>> ret;
|
||||
|
||||
if (!thumbnail) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (thumbnail->hasProcParams() && editedIcon) {
|
||||
ret.push_back(editedIcon);
|
||||
}
|
||||
@ -145,13 +144,12 @@ std::vector<Glib::RefPtr<Gdk::Pixbuf> > FileBrowserEntry::getIconsOnImageArea ()
|
||||
|
||||
std::vector<Glib::RefPtr<Gdk::Pixbuf>> FileBrowserEntry::getSpecificityIconsOnImageArea ()
|
||||
{
|
||||
if (!thumbnail) {
|
||||
return {};
|
||||
}
|
||||
|
||||
std::vector<Glib::RefPtr<Gdk::Pixbuf>> ret;
|
||||
|
||||
if (!thumbnail) {
|
||||
return ret;
|
||||
}
|
||||
|
||||
if (thumbnail->isHDR() && hdr) {
|
||||
ret.push_back (hdr);
|
||||
}
|
||||
@ -188,7 +186,7 @@ void FileBrowserEntry::customBackBufferUpdate (Cairo::RefPtr<Cairo::Context> c)
|
||||
}
|
||||
}
|
||||
|
||||
void FileBrowserEntry::getIconSize (int& w, int& h)
|
||||
void FileBrowserEntry::getIconSize (int& w, int& h) const
|
||||
{
|
||||
|
||||
w = editedIcon->get_width ();
|
||||
@ -286,29 +284,24 @@ void FileBrowserEntry::_updateImage(rtengine::IImage8* img, double s, const rten
|
||||
bool FileBrowserEntry::motionNotify (int x, int y)
|
||||
{
|
||||
|
||||
bool b = ThumbBrowserEntryBase::motionNotify (x, y);
|
||||
const bool b = ThumbBrowserEntryBase::motionNotify(x, y);
|
||||
|
||||
int ix = x - startx - ofsX;
|
||||
int iy = y - starty - ofsY;
|
||||
const int ix = x - startx - ofsX;
|
||||
const int iy = y - starty - ofsY;
|
||||
|
||||
Inspector* inspector = parent->getInspector();
|
||||
|
||||
if (inspector && inspector->isActive() && !parent->isInTabMode()) {
|
||||
rtengine::Coord2D coord(-1., -1.);
|
||||
getPosInImgSpace(x, y, coord);
|
||||
const rtengine::Coord2D coord(getPosInImgSpace(x, y));
|
||||
|
||||
if (coord.x != -1.) {
|
||||
if (!wasInside) {
|
||||
inspector->switchImage(filename);
|
||||
}
|
||||
|
||||
wasInside = true;
|
||||
}
|
||||
inspector->mouseMove(coord, 0);
|
||||
} else {
|
||||
if (wasInside) {
|
||||
wasInside = false;
|
||||
rtengine::Coord2D coord(-1, -1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -95,7 +95,7 @@ public:
|
||||
|
||||
std::vector<Glib::RefPtr<Gdk::Pixbuf>> getIconsOnImageArea () override;
|
||||
std::vector<Glib::RefPtr<Gdk::Pixbuf>> getSpecificityIconsOnImageArea () override;
|
||||
void getIconSize (int& w, int& h) override;
|
||||
void getIconSize (int& w, int& h) const override;
|
||||
|
||||
// thumbnaillistener interface
|
||||
void procParamsChanged (Thumbnail* thm, int whoChangedIt) override;
|
||||
|
@ -37,9 +37,6 @@
|
||||
#include "batchqueue.h"
|
||||
#include "placesbrowser.h"
|
||||
|
||||
#define BENCHMARK
|
||||
#include "../rtengine/StopWatch.h"
|
||||
|
||||
using namespace std;
|
||||
|
||||
#define CHECKTIME 2000
|
||||
@ -568,7 +565,7 @@ void FileCatalog::closeDir ()
|
||||
|
||||
std::vector<Glib::ustring> FileCatalog::getFileList()
|
||||
{
|
||||
BENCHFUN
|
||||
|
||||
std::vector<Glib::ustring> names;
|
||||
|
||||
const std::set<std::string>& extensions = options.parsedExtensionsSet;
|
||||
@ -626,9 +623,9 @@ std::vector<Glib::ustring> FileCatalog::getFileList()
|
||||
|
||||
void FileCatalog::dirSelected (const Glib::ustring& dirname, const Glib::ustring& openfile)
|
||||
{
|
||||
BENCHFUN
|
||||
|
||||
try {
|
||||
Glib::RefPtr<Gio::File> dir = Gio::File::create_for_path (dirname);
|
||||
const Glib::RefPtr<Gio::File> dir = Gio::File::create_for_path(dirname);
|
||||
|
||||
if (!dir) {
|
||||
return;
|
||||
@ -1681,7 +1678,7 @@ void FileCatalog::filterChanged ()
|
||||
|
||||
void FileCatalog::reparseDirectory ()
|
||||
{
|
||||
BENCHFUN
|
||||
|
||||
if (selectedDirectory.empty()) {
|
||||
return;
|
||||
}
|
||||
|
@ -87,7 +87,7 @@ public:
|
||||
|
||||
/** @brief Get the on/off state
|
||||
*/
|
||||
bool isActive()
|
||||
bool isActive() const
|
||||
{
|
||||
return active;
|
||||
};
|
||||
|
@ -197,8 +197,7 @@ void RTImage::updateImages()
|
||||
Glib::RefPtr<Gdk::Pixbuf> RTImage::createPixbufFromFile (const Glib::ustring& fileName)
|
||||
{
|
||||
Cairo::RefPtr<Cairo::ImageSurface> imgSurf = createImgSurfFromFile(fileName);
|
||||
Glib::RefPtr<Gdk::Pixbuf> pixbuf = Gdk::Pixbuf::create(imgSurf, 0, 0, imgSurf->get_width(), imgSurf->get_height());
|
||||
return pixbuf;
|
||||
return Gdk::Pixbuf::create(imgSurf, 0, 0, imgSurf->get_width(), imgSurf->get_height());
|
||||
}
|
||||
|
||||
Cairo::RefPtr<Cairo::ImageSurface> RTImage::createImgSurfFromFile (const Glib::ustring& fileName)
|
||||
|
@ -157,9 +157,6 @@ ThumbBrowserEntryBase::ThumbBrowserEntryBase (const Glib::ustring& fname) :
|
||||
collate_name(getPaddedName(dispname).casefold_collate_key()),
|
||||
thumbnail(nullptr),
|
||||
filename(fname),
|
||||
shortname(dispname),
|
||||
exifline(""),
|
||||
datetimeline(""),
|
||||
selected(false),
|
||||
drawable(false),
|
||||
filtered(false),
|
||||
@ -439,7 +436,6 @@ void ThumbBrowserEntryBase::getTextSizes (int& infow, int& infoh)
|
||||
Gtk::Widget* w = parent->getDrawingArea ();
|
||||
|
||||
// calculate dimensions of the text based fields
|
||||
dispname = shortname;
|
||||
|
||||
Glib::RefPtr<Pango::Context> context = w->get_pango_context () ;
|
||||
context->set_font_description (w->get_style_context()->get_font());
|
||||
@ -449,7 +445,7 @@ void ThumbBrowserEntryBase::getTextSizes (int& infow, int& infoh)
|
||||
Pango::FontDescription fontd = context->get_font_description ();
|
||||
fontd.set_weight (Pango::WEIGHT_BOLD);
|
||||
context->set_font_description (fontd);
|
||||
Glib::RefPtr<Pango::Layout> fn = w->create_pango_layout(shortname);
|
||||
Glib::RefPtr<Pango::Layout> fn = w->create_pango_layout(dispname);
|
||||
fn->get_pixel_size (fnlabw, fnlabh);
|
||||
|
||||
// calculate cummulated height of all info fields
|
||||
@ -672,16 +668,15 @@ void ThumbBrowserEntryBase::setOffset (int x, int y)
|
||||
}
|
||||
}
|
||||
|
||||
bool ThumbBrowserEntryBase::inside (int x, int y)
|
||||
bool ThumbBrowserEntryBase::inside (int x, int y) const
|
||||
{
|
||||
|
||||
return x > ofsX + startx && x < ofsX + startx + exp_width && y > ofsY + starty && y < ofsY + starty + exp_height;
|
||||
}
|
||||
|
||||
void ThumbBrowserEntryBase::getPosInImgSpace (int x, int y, rtengine::Coord2D &coord)
|
||||
rtengine::Coord2D ThumbBrowserEntryBase::getPosInImgSpace (int x, int y) const
|
||||
{
|
||||
|
||||
coord.x = coord.y = -1.;
|
||||
rtengine::Coord2D coord(-1., -1.);
|
||||
|
||||
if (preview) {
|
||||
x -= ofsX + startx;
|
||||
@ -692,9 +687,10 @@ void ThumbBrowserEntryBase::getPosInImgSpace (int x, int y, rtengine::Coord2D &c
|
||||
coord.y = double(y - prey) / double(preh);
|
||||
}
|
||||
}
|
||||
return coord;
|
||||
}
|
||||
|
||||
bool ThumbBrowserEntryBase::insideWindow (int x, int y, int w, int h)
|
||||
bool ThumbBrowserEntryBase::insideWindow (int x, int y, int w, int h) const
|
||||
{
|
||||
|
||||
return !(ofsX + startx > x + w || ofsX + startx + exp_width < x || ofsY + starty > y + h || ofsY + starty + exp_height < y);
|
||||
@ -710,12 +706,6 @@ std::vector<Glib::RefPtr<Gdk::Pixbuf> > ThumbBrowserEntryBase::getSpecificityIco
|
||||
return std::vector<Glib::RefPtr<Gdk::Pixbuf> >();
|
||||
}
|
||||
|
||||
void ThumbBrowserEntryBase::getIconSize(int& w, int& h)
|
||||
{
|
||||
w = 0;
|
||||
h = 0;
|
||||
}
|
||||
|
||||
bool ThumbBrowserEntryBase::motionNotify (int x, int y)
|
||||
{
|
||||
|
||||
@ -734,9 +724,9 @@ bool ThumbBrowserEntryBase::releaseNotify (int button, int type, int bstate, int
|
||||
return buttonSet ? buttonSet->releaseNotify (x, y) : false;
|
||||
}
|
||||
|
||||
Glib::ustring ThumbBrowserEntryBase::getToolTip (int x, int y)
|
||||
Glib::ustring ThumbBrowserEntryBase::getToolTip (int x, int y) const
|
||||
{
|
||||
Glib::ustring tooltip = "";
|
||||
Glib::ustring tooltip;
|
||||
|
||||
if (buttonSet) {
|
||||
tooltip = buttonSet->getToolTip(x, y);
|
||||
@ -748,11 +738,11 @@ Glib::ustring ThumbBrowserEntryBase::getToolTip (int x, int y)
|
||||
tooltip = dispname;
|
||||
|
||||
if (withFilename < WFNAME_FULL) {
|
||||
if (options.fbShowDateTime && datetimeline != "") {
|
||||
if (options.fbShowDateTime && !datetimeline.empty()) {
|
||||
tooltip += Glib::ustring("\n") + datetimeline;
|
||||
}
|
||||
|
||||
if (options.fbShowBasicExif && exifline != "") {
|
||||
if (options.fbShowBasicExif && !exifline.empty()) {
|
||||
tooltip += Glib::ustring("\n") + exifline;
|
||||
}
|
||||
}
|
||||
|
@ -16,8 +16,7 @@
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
#ifndef _THUMBNAILBROWSERENTRYBASE_
|
||||
#define _THUMBNAILBROWSERENTRYBASE_
|
||||
#pragma once
|
||||
|
||||
#include <atomic>
|
||||
|
||||
@ -101,7 +100,6 @@ public:
|
||||
|
||||
// thumbnail preview properties:
|
||||
Glib::ustring filename;
|
||||
Glib::ustring shortname;
|
||||
Glib::ustring exifline;
|
||||
Glib::ustring datetimeline;
|
||||
|
||||
@ -130,11 +128,11 @@ public:
|
||||
virtual void draw (Cairo::RefPtr<Cairo::Context> cc);
|
||||
|
||||
void addButtonSet (LWButtonSet* bs);
|
||||
int getMinimalHeight ()
|
||||
int getMinimalHeight () const
|
||||
{
|
||||
return height;
|
||||
}
|
||||
int getMinimalWidth ()
|
||||
int getMinimalWidth () const
|
||||
{
|
||||
return width;
|
||||
}
|
||||
@ -168,9 +166,9 @@ public:
|
||||
return ofsY + starty;
|
||||
}
|
||||
|
||||
bool inside (int x, int y);
|
||||
void getPosInImgSpace (int x, int y, rtengine::Coord2D &coord);
|
||||
bool insideWindow (int x, int y, int w, int h);
|
||||
bool inside (int x, int y) const;
|
||||
rtengine::Coord2D getPosInImgSpace (int x, int y) const;
|
||||
bool insideWindow (int x, int y, int w, int h) const;
|
||||
void setPosition (int x, int y, int w, int h);
|
||||
void setOffset (int x, int y);
|
||||
|
||||
@ -179,33 +177,29 @@ public:
|
||||
return collate_name < other.collate_name;
|
||||
}
|
||||
|
||||
ThumbBrowserEntryBase* getOriginal () const;
|
||||
void setOriginal (ThumbBrowserEntryBase* original);
|
||||
|
||||
virtual void refreshThumbnailImage () {}
|
||||
virtual void refreshThumbnailImage () = 0;
|
||||
virtual void refreshQuickThumbnailImage () {}
|
||||
virtual void calcThumbnailSize () {}
|
||||
virtual void calcThumbnailSize () = 0;
|
||||
|
||||
virtual void drawProgressBar (Glib::RefPtr<Gdk::Window> win, const Gdk::RGBA& foregr, const Gdk::RGBA& backgr, int x, int w, int y, int h) {}
|
||||
|
||||
virtual std::vector<Glib::RefPtr<Gdk::Pixbuf>> getIconsOnImageArea ();
|
||||
virtual std::vector<Glib::RefPtr<Gdk::Pixbuf>> getSpecificityIconsOnImageArea ();
|
||||
virtual void getIconSize (int& w, int& h);
|
||||
virtual void getIconSize (int& w, int& h) const = 0;
|
||||
|
||||
virtual bool motionNotify (int x, int y);
|
||||
virtual bool pressNotify (int button, int type, int bstate, int x, int y);
|
||||
virtual bool releaseNotify (int button, int type, int bstate, int x, int y);
|
||||
virtual Glib::ustring getToolTip (int x, int y);
|
||||
};
|
||||
virtual Glib::ustring getToolTip (int x, int y) const;
|
||||
|
||||
inline ThumbBrowserEntryBase* ThumbBrowserEntryBase::getOriginal() const
|
||||
inline ThumbBrowserEntryBase* getOriginal() const
|
||||
{
|
||||
return original;
|
||||
}
|
||||
|
||||
inline void ThumbBrowserEntryBase::setOriginal(ThumbBrowserEntryBase* original)
|
||||
inline void setOriginal(ThumbBrowserEntryBase* original)
|
||||
{
|
||||
this->original = original;
|
||||
}
|
||||
|
||||
#endif
|
||||
};
|
||||
|
Loading…
x
Reference in New Issue
Block a user