Merge pull request #5376 from Beep6581/filecatalog_speedups

Filecatalog speedups
This commit is contained in:
Ingo Weyrich 2019-07-21 21:53:32 +02:00 committed by GitHub
commit fd6453d1a8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
24 changed files with 350 additions and 382 deletions

View File

@ -27,6 +27,10 @@ Cairo::RefPtr<RTSurface> BatchQueueButtonSet::cancelIcon;
Cairo::RefPtr<RTSurface> BatchQueueButtonSet::headIcon; Cairo::RefPtr<RTSurface> BatchQueueButtonSet::headIcon;
Cairo::RefPtr<RTSurface> BatchQueueButtonSet::tailIcon; Cairo::RefPtr<RTSurface> BatchQueueButtonSet::tailIcon;
Glib::ustring BatchQueueButtonSet::moveHeadToolTip;
Glib::ustring BatchQueueButtonSet::moveEndToolTip;
Glib::ustring BatchQueueButtonSet::cancelJobToolTip;
BatchQueueButtonSet::BatchQueueButtonSet (BatchQueueEntry* myEntry) BatchQueueButtonSet::BatchQueueButtonSet (BatchQueueEntry* myEntry)
{ {
@ -34,10 +38,13 @@ BatchQueueButtonSet::BatchQueueButtonSet (BatchQueueEntry* myEntry)
cancelIcon = Cairo::RefPtr<RTSurface>(new RTSurface("cancel-small.png")); cancelIcon = Cairo::RefPtr<RTSurface>(new RTSurface("cancel-small.png"));
headIcon = Cairo::RefPtr<RTSurface>(new RTSurface("goto-start-small.png")); headIcon = Cairo::RefPtr<RTSurface>(new RTSurface("goto-start-small.png"));
tailIcon = Cairo::RefPtr<RTSurface>(new RTSurface("goto-end-small.png")); tailIcon = Cairo::RefPtr<RTSurface>(new RTSurface("goto-end-small.png"));
moveHeadToolTip = M("FILEBROWSER_POPUPMOVEHEAD");
moveEndToolTip = M("FILEBROWSER_POPUPMOVEEND");
cancelJobToolTip = M("FILEBROWSER_POPUPCANCELJOB");
iconsLoaded = true; iconsLoaded = true;
} }
add (new LWButton (headIcon, 8, myEntry, LWButton::Left, LWButton::Center, M("FILEBROWSER_POPUPMOVEHEAD"))); add(new LWButton(headIcon, 8, myEntry, LWButton::Left, LWButton::Center, &moveHeadToolTip));
add (new LWButton (tailIcon, 9, myEntry, LWButton::Left, LWButton::Center, M("FILEBROWSER_POPUPMOVEEND"))); add(new LWButton(tailIcon, 9, myEntry, LWButton::Left, LWButton::Center, &moveEndToolTip));
add (new LWButton (cancelIcon, 10, myEntry, LWButton::Right, LWButton::Center, M("FILEBROWSER_POPUPCANCELJOB"))); add(new LWButton(cancelIcon, 10, myEntry, LWButton::Right, LWButton::Center, &cancelJobToolTip));
} }

View File

@ -34,6 +34,10 @@ public:
static Cairo::RefPtr<RTSurface> headIcon; static Cairo::RefPtr<RTSurface> headIcon;
static Cairo::RefPtr<RTSurface> tailIcon; static Cairo::RefPtr<RTSurface> tailIcon;
static Glib::ustring moveHeadToolTip;
static Glib::ustring moveEndToolTip;
static Glib::ustring cancelJobToolTip;
explicit BatchQueueButtonSet (BatchQueueEntry* myEntry); explicit BatchQueueButtonSet (BatchQueueEntry* myEntry);
}; };

View File

@ -148,7 +148,7 @@ void BatchQueueEntry::removeButtonSet ()
buttonSet = nullptr; buttonSet = nullptr;
} }
std::vector<Glib::RefPtr<Gdk::Pixbuf> > BatchQueueEntry::getIconsOnImageArea () std::vector<Glib::RefPtr<Gdk::Pixbuf>> BatchQueueEntry::getIconsOnImageArea ()
{ {
std::vector<Glib::RefPtr<Gdk::Pixbuf> > ret; std::vector<Glib::RefPtr<Gdk::Pixbuf> > ret;
@ -160,7 +160,7 @@ std::vector<Glib::RefPtr<Gdk::Pixbuf> > BatchQueueEntry::getIconsOnImageArea ()
return ret; return ret;
} }
void BatchQueueEntry::getIconSize (int& w, int& h) void BatchQueueEntry::getIconSize (int& w, int& h) const
{ {
w = savedAsIcon->get_width (); 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 // get the parent class' tooltip first
Glib::ustring tooltip = ThumbBrowserEntryBase::getToolTip(x, y); Glib::ustring tooltip = ThumbBrowserEntryBase::getToolTip(x, y);

View File

@ -68,9 +68,9 @@ public:
void removeButtonSet (); void removeButtonSet ();
std::vector<Glib::RefPtr<Gdk::Pixbuf> > getIconsOnImageArea () override; std::vector<Glib::RefPtr<Gdk::Pixbuf>> getIconsOnImageArea () override;
void getIconSize (int& w, int& h) override; void getIconSize (int& w, int& h) const override;
Glib::ustring getToolTip (int x, int y) override; Glib::ustring getToolTip (int x, int y) const override;
// bqentryupdatelistener interface // bqentryupdatelistener interface
void updateImage (guint8* img, int w, int h, int origw, int origh, guint8* newOPreview) override; void updateImage (guint8* img, int w, int h, int origw, int origh, guint8* newOPreview) override;

View File

@ -38,6 +38,13 @@
using namespace rtengine; using namespace rtengine;
bool CropWindow::initialized = false;
Glib::ustring CropWindow::zoomOuttt;
Glib::ustring CropWindow::zoomIntt;
Glib::ustring CropWindow::zoom100tt;
Glib::ustring CropWindow::closett;
CropWindow::CropWindow (ImageArea* parent, bool isLowUpdatePriority_, bool isDetailWindow) CropWindow::CropWindow (ImageArea* parent, bool isLowUpdatePriority_, bool isDetailWindow)
: ObjectMOBuffer(parent), state(SNormal), press_x(0), press_y(0), action_x(0), action_y(0), pickedObject(-1), pickModifierKey(0), rot_deg(0), onResizeArea(false), deleted(false), : ObjectMOBuffer(parent), state(SNormal), press_x(0), press_y(0), action_x(0), action_y(0), pickedObject(-1), pickModifierKey(0), rot_deg(0), onResizeArea(false), deleted(false),
fitZoomEnabled(true), fitZoom(false), cursor_type(CSArrow), /*isLowUpdatePriority(isLowUpdatePriority_),*/ hoveredPicker(nullptr), cropLabel(Glib::ustring("100%")), fitZoomEnabled(true), fitZoom(false), cursor_type(CSArrow), /*isLowUpdatePriority(isLowUpdatePriority_),*/ hoveredPicker(nullptr), cropLabel(Glib::ustring("100%")),
@ -61,11 +68,18 @@ CropWindow::CropWindow (ImageArea* parent, bool isLowUpdatePriority_, bool isDet
titleHeight = ih; titleHeight = ih;
bZoomOut = new LWButton (Cairo::RefPtr<RTSurface>(new RTSurface("magnifier-minus-small.png")), 0, nullptr, LWButton::Left, LWButton::Center, "Zoom Out"); if (!initialized) {
bZoomIn = new LWButton (Cairo::RefPtr<RTSurface>(new RTSurface("magnifier-plus-small.png")), 1, nullptr, LWButton::Left, LWButton::Center, "Zoom In"); zoomOuttt = "Zoom Out";
bZoom100 = new LWButton (Cairo::RefPtr<RTSurface>(new RTSurface("magnifier-1to1-small.png")), 2, nullptr, LWButton::Left, LWButton::Center, "Zoom 100/%"); zoomIntt = "Zoom In";
zoom100tt = "Zoom 100/%";
closett = "Close";
initialized = true;
}
bZoomOut = new LWButton(Cairo::RefPtr<RTSurface>(new RTSurface("magnifier-minus-small.png")), 0, nullptr, LWButton::Left, LWButton::Center, &zoomOuttt);
bZoomIn = new LWButton(Cairo::RefPtr<RTSurface>(new RTSurface("magnifier-plus-small.png")), 1, nullptr, LWButton::Left, LWButton::Center, &zoomIntt);
bZoom100 = new LWButton(Cairo::RefPtr<RTSurface>(new RTSurface("magnifier-1to1-small.png")), 2, nullptr, LWButton::Left, LWButton::Center, &zoom100tt);
//bZoomFit = new LWButton (Cairo::RefPtr<RTSurface>(new RTSurface("magnifier-fit.png")), 3, NULL, LWButton::Left, LWButton::Center, "Zoom Fit"); //bZoomFit = new LWButton (Cairo::RefPtr<RTSurface>(new RTSurface("magnifier-fit.png")), 3, NULL, LWButton::Left, LWButton::Center, "Zoom Fit");
bClose = new LWButton (Cairo::RefPtr<RTSurface>(new RTSurface("cancel-small.png")), 4, nullptr, LWButton::Right, LWButton::Center, "Close"); bClose = new LWButton(Cairo::RefPtr<RTSurface>(new RTSurface("cancel-small.png")), 4, nullptr, LWButton::Right, LWButton::Center, &closett);
buttonSet.add (bZoomOut); buttonSet.add (bZoomOut);
buttonSet.add (bZoomIn); buttonSet.add (bZoomIn);

View File

@ -47,6 +47,12 @@ public:
class ImageArea; class ImageArea;
class CropWindow : public LWButtonListener, public CropDisplayHandler, public EditCoordSystem, public ObjectMOBuffer class CropWindow : public LWButtonListener, public CropDisplayHandler, public EditCoordSystem, public ObjectMOBuffer
{ {
static bool initialized;
static Glib::ustring zoomOuttt;
static Glib::ustring zoomIntt;
static Glib::ustring zoom100tt;
static Glib::ustring closett;
// state management // state management
ImgEditState state; // current state of user (see enum State) ImgEditState state; // current state of user (see enum State)

View File

@ -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)

View File

@ -119,39 +119,37 @@ void FileBrowserEntry::calcThumbnailSize ()
} }
} }
std::vector<Glib::RefPtr<Gdk::Pixbuf> > FileBrowserEntry::getIconsOnImageArea () std::vector<Glib::RefPtr<Gdk::Pixbuf>> FileBrowserEntry::getIconsOnImageArea ()
{ {
std::vector<Glib::RefPtr<Gdk::Pixbuf> > ret;
if (!thumbnail) { if (!thumbnail) {
return ret; return {};
} }
std::vector<Glib::RefPtr<Gdk::Pixbuf>> ret;
if (thumbnail->hasProcParams() && editedIcon) { if (thumbnail->hasProcParams() && editedIcon) {
ret.push_back (editedIcon); ret.push_back(editedIcon);
} }
if (thumbnail->isRecentlySaved() && recentlySavedIcon) { if (thumbnail->isRecentlySaved() && recentlySavedIcon) {
ret.push_back (recentlySavedIcon); ret.push_back(recentlySavedIcon);
} }
if (thumbnail->isEnqueued () && enqueuedIcon) { if (thumbnail->isEnqueued () && enqueuedIcon) {
ret.push_back (enqueuedIcon); ret.push_back(enqueuedIcon);
} }
return ret; return ret;
} }
std::vector<Glib::RefPtr<Gdk::Pixbuf> > FileBrowserEntry::getSpecificityIconsOnImageArea () std::vector<Glib::RefPtr<Gdk::Pixbuf>> FileBrowserEntry::getSpecificityIconsOnImageArea ()
{ {
std::vector<Glib::RefPtr<Gdk::Pixbuf> > ret;
if (!thumbnail) { if (!thumbnail) {
return ret; return {};
} }
std::vector<Glib::RefPtr<Gdk::Pixbuf>> ret;
if (thumbnail->isHDR() && hdr) { if (thumbnail->isHDR() && hdr) {
ret.push_back (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 (); w = editedIcon->get_width ();
@ -286,34 +284,29 @@ void FileBrowserEntry::_updateImage(rtengine::IImage8* img, double s, const rten
bool FileBrowserEntry::motionNotify (int x, int y) 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; const int ix = x - startx - ofsX;
int iy = y - starty - ofsY; const int iy = y - starty - ofsY;
Inspector* inspector = parent->getInspector(); Inspector* inspector = parent->getInspector();
if (inspector && inspector->isActive() && !parent->isInTabMode()) { if (inspector && inspector->isActive() && !parent->isInTabMode()) {
rtengine::Coord2D coord(-1., -1.); const rtengine::Coord2D coord(getPosInImgSpace(x, y));
getPosInImgSpace(x, y, coord);
if (coord.x != -1.) { if (coord.x != -1.) {
if (!wasInside) { if (!wasInside) {
inspector->switchImage(filename); inspector->switchImage(filename);
}
wasInside = true; wasInside = true;
}
inspector->mouseMove(coord, 0); inspector->mouseMove(coord, 0);
} else { } else {
if (wasInside) {
wasInside = false; wasInside = false;
rtengine::Coord2D coord(-1, -1);
}
} }
} }
if (inside (x, y)) { if (inside(x, y)) {
updateCursor (ix, iy); updateCursor(ix, iy);
} }
if (state == SRotateSelecting) { if (state == SRotateSelecting) {

View File

@ -93,9 +93,9 @@ public:
void refreshQuickThumbnailImage () override; void refreshQuickThumbnailImage () override;
void calcThumbnailSize () override; void calcThumbnailSize () override;
std::vector<Glib::RefPtr<Gdk::Pixbuf> > getIconsOnImageArea () override; std::vector<Glib::RefPtr<Gdk::Pixbuf>> getIconsOnImageArea () override;
std::vector<Glib::RefPtr<Gdk::Pixbuf> > getSpecificityIconsOnImageArea () 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 // thumbnaillistener interface
void procParamsChanged (Thumbnail* thm, int whoChangedIt) override; void procParamsChanged (Thumbnail* thm, int whoChangedIt) override;

View File

@ -563,44 +563,49 @@ void FileCatalog::closeDir ()
redrawAll (); redrawAll ();
} }
std::vector<Glib::ustring> FileCatalog::getFileList () std::vector<Glib::ustring> FileCatalog::getFileList()
{ {
std::vector<Glib::ustring> names; std::vector<Glib::ustring> names;
std::set<Glib::ustring> extensions; const std::set<std::string>& extensions = options.parsedExtensionsSet;
for (const auto& parsedExt : options.parsedExtensions) {
extensions.emplace (parsedExt.lowercase ());
}
try { try {
auto dir = Gio::File::create_for_path (selectedDirectory); const auto dir = Gio::File::create_for_path(selectedDirectory);
auto enumerator = dir->enumerate_children ("standard::name"); auto enumerator = dir->enumerate_children("standard::name,standard::type,standard::is-hidden");
while (true) { while (true) {
try { try {
auto file = enumerator->next_file (); const auto file = enumerator->next_file();
if (!file) { if (!file) {
break; break;
} }
const Glib::ustring fname = file->get_name (); if (file->get_file_type() == Gio::FILE_TYPE_DIRECTORY) {
auto lastdot = fname.find_last_of ('.');
if (lastdot >= fname.length () - 1) {
continue; continue;
} }
const auto fext = fname.substr (lastdot + 1).lowercase (); if (!options.fbShowHidden && file->is_hidden()) {
if (extensions.count (fext) == 0) {
continue; continue;
} }
names.emplace_back (Glib::build_filename (selectedDirectory, fname)); const Glib::ustring fname = file->get_name();
const auto lastdot = fname.find_last_of('.');
if (lastdot >= fname.length() - 1) {
continue;
}
if (extensions.find(fname.substr(lastdot + 1).lowercase()) == extensions.end()) {
continue;
}
names.push_back(Glib::build_filename(selectedDirectory, fname));
} catch (Glib::Exception& exception) { } catch (Glib::Exception& exception) {
if (options.rtSettings.verbose) { if (options.rtSettings.verbose) {
std::cerr << exception.what () << std::endl; std::cerr << exception.what() << std::endl;
} }
} }
} }
@ -620,13 +625,13 @@ void FileCatalog::dirSelected (const Glib::ustring& dirname, const Glib::ustring
{ {
try { 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) { if (!dir) {
return; return;
} }
closeDir (); closeDir();
previewsToLoad = 0; previewsToLoad = 0;
previewsLoaded = 0; previewsLoaded = 0;
@ -636,16 +641,14 @@ void FileCatalog::dirSelected (const Glib::ustring& dirname, const Glib::ustring
} }
selectedDirectory = dir->get_parse_name(); selectedDirectory = dir->get_parse_name();
//printf("FileCatalog::dirSelected selectedDirectory = %s\n",selectedDirectory.c_str());
BrowsePath->set_text (selectedDirectory); BrowsePath->set_text(selectedDirectory);
buttonBrowsePath->set_image (*iRefreshWhite); buttonBrowsePath->set_image(*iRefreshWhite);
fileNameList = getFileList (); fileNameList = getFileList();
for (unsigned int i = 0; i < fileNameList.size(); i++) { for (unsigned int i = 0; i < fileNameList.size(); i++) {
Glib::RefPtr<Gio::File> f = Gio::File::create_for_path(fileNameList[i]); if (openfile.empty() || fileNameList[i] != openfile) { // if we opened a file at the beginning don't add it again
addFile(fileNameList[i]);
if (f->get_parse_name() != openfile) { // if we opened a file at the beginning don't add it again
checkAndAddFile (f);
} }
} }
@ -696,34 +699,33 @@ void FileCatalog::_refreshProgressBar ()
// In tab mode, no progress bar at all // In tab mode, no progress bar at all
// Also mention that this progress bar only measures the FIRST pass (quick thumbnails) // Also mention that this progress bar only measures the FIRST pass (quick thumbnails)
// The second, usually longer pass is done multithreaded down in the single entries and is NOT measured by this // The second, usually longer pass is done multithreaded down in the single entries and is NOT measured by this
if (!inTabMode) { if (!inTabMode && (!previewsToLoad || std::floor(100.f * previewsLoaded / previewsToLoad) != std::floor(100.f * (previewsLoaded - 1) / previewsToLoad))) {
GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected GThreadLock lock; // All GUI access from idle_add callbacks or separate thread HAVE to be protected
Gtk::Notebook *nb = (Gtk::Notebook *)(filepanel->get_parent()); Gtk::Notebook *nb = (Gtk::Notebook *)(filepanel->get_parent());
Gtk::Grid* grid = Gtk::manage (new Gtk::Grid ()); Gtk::Grid* grid = Gtk::manage(new Gtk::Grid());
Gtk::Label *label = nullptr; Gtk::Label *label = nullptr;
if (!previewsToLoad ) { if (!previewsToLoad) {
grid->attach_next_to(*Gtk::manage (new RTImage ("folder-closed.png")), options.mainNBVertical ? Gtk::POS_TOP : Gtk::POS_RIGHT, 1, 1); grid->attach_next_to(*Gtk::manage(new RTImage("folder-closed.png")), options.mainNBVertical ? Gtk::POS_TOP : Gtk::POS_RIGHT, 1, 1);
int filteredCount = min(fileBrowser->getNumFiltered(), previewsLoaded); int filteredCount = min(fileBrowser->getNumFiltered(), previewsLoaded);
label = Gtk::manage (new Gtk::Label (M("MAIN_FRAME_FILEBROWSER") + label = Gtk::manage(new Gtk::Label(M("MAIN_FRAME_FILEBROWSER") +
(filteredCount != previewsLoaded ? " [" + Glib::ustring::format(filteredCount) + "/" : " (") (filteredCount != previewsLoaded ? " [" + Glib::ustring::format(filteredCount) + "/" : " (")
+ Glib::ustring::format(previewsLoaded) + + Glib::ustring::format(previewsLoaded) +
(filteredCount != previewsLoaded ? "]" : ")"))); (filteredCount != previewsLoaded ? "]" : ")")));
} else { } else {
grid->attach_next_to(*Gtk::manage (new RTImage ("magnifier.png")), options.mainNBVertical ? Gtk::POS_TOP : Gtk::POS_RIGHT, 1, 1); grid->attach_next_to(*Gtk::manage(new RTImage("magnifier.png")), options.mainNBVertical ? Gtk::POS_TOP : Gtk::POS_RIGHT, 1, 1);
label = Gtk::manage (new Gtk::Label (M("MAIN_FRAME_FILEBROWSER") + " [" + Glib::ustring::format(std::fixed, std::setprecision(0), std::setw(3), (double)previewsLoaded / previewsToLoad * 100 ) + "%]" )); label = Gtk::manage(new Gtk::Label(M("MAIN_FRAME_FILEBROWSER") + " [" + Glib::ustring::format(std::fixed, std::setprecision(0), std::setw(3), (double)previewsLoaded / previewsToLoad * 100 ) + "%]" ));
filepanel->loadingThumbs("", (double)previewsLoaded / previewsToLoad); filepanel->loadingThumbs("", (double)previewsLoaded / previewsToLoad);
} }
if( options.mainNBVertical ) { if (options.mainNBVertical) {
label->set_angle(90); label->set_angle(90);
} }
grid->attach_next_to(*label, options.mainNBVertical ? Gtk::POS_TOP : Gtk::POS_RIGHT, 1, 1); grid->attach_next_to(*label, options.mainNBVertical ? Gtk::POS_TOP : Gtk::POS_RIGHT, 1, 1);
grid->set_tooltip_markup (M("MAIN_FRAME_FILEBROWSER_TOOLTIP")); grid->set_tooltip_markup(M("MAIN_FRAME_FILEBROWSER_TOOLTIP"));
grid->show_all (); grid->show_all();
if (nb) { if (nb) {
nb->set_tab_label(*filepanel, *grid); nb->set_tab_label(*filepanel, *grid);
@ -1005,12 +1007,16 @@ void FileCatalog::copyMoveRequested(const std::vector<FileBrowserEntry*>& tbe, b
Gtk::FileChooserDialog fc (getToplevelWindow (this), fc_title, Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER ); Gtk::FileChooserDialog fc (getToplevelWindow (this), fc_title, Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER );
fc.add_button( M("GENERAL_CANCEL"), Gtk::RESPONSE_CANCEL); fc.add_button( M("GENERAL_CANCEL"), Gtk::RESPONSE_CANCEL);
fc.add_button( M("GENERAL_OK"), Gtk::RESPONSE_OK); fc.add_button( M("GENERAL_OK"), Gtk::RESPONSE_OK);
if (!options.lastCopyMovePath.empty() && Glib::file_test(options.lastCopyMovePath, Glib::FILE_TEST_IS_DIR)) {
fc.set_current_folder(options.lastCopyMovePath);
} else {
// open dialog at the 1-st file's path // open dialog at the 1-st file's path
fc.set_filename(tbe[0]->filename); fc.set_current_folder(Glib::path_get_dirname(tbe[0]->filename));
}
//!!! TODO prevent dialog closing on "enter" key press //!!! TODO prevent dialog closing on "enter" key press
if( fc.run() == Gtk::RESPONSE_OK ) { if( fc.run() == Gtk::RESPONSE_OK ) {
Glib::ustring dest_Dir = fc.get_current_folder(); options.lastCopyMovePath = fc.get_current_folder();
// iterate through selected files // iterate through selected files
for (unsigned int i = 0; i < tbe.size(); i++) { for (unsigned int i = 0; i < tbe.size(); i++) {
@ -1027,10 +1033,10 @@ void FileCatalog::copyMoveRequested(const std::vector<FileBrowserEntry*>& tbe, b
Glib::ustring fname_Ext = getExtension(fname); Glib::ustring fname_Ext = getExtension(fname);
// construct destination File Paths // construct destination File Paths
Glib::ustring dest_fPath = Glib::build_filename (dest_Dir, fname); Glib::ustring dest_fPath = Glib::build_filename (options.lastCopyMovePath, fname);
Glib::ustring dest_fPath_param = dest_fPath + paramFileExtension; Glib::ustring dest_fPath_param = dest_fPath + paramFileExtension;
if (moveRequested && (src_Dir == dest_Dir)) { if (moveRequested && (src_Dir == options.lastCopyMovePath)) {
continue; continue;
} }
@ -1085,7 +1091,7 @@ void FileCatalog::copyMoveRequested(const std::vector<FileBrowserEntry*>& tbe, b
// adjust destination fname to avoid conflicts (append "_<index>", preserve extension) // adjust destination fname to avoid conflicts (append "_<index>", preserve extension)
Glib::ustring dest_fname = Glib::ustring::compose("%1%2%3%4%5", fname_noExt, "_", i_copyindex, ".", fname_Ext); Glib::ustring dest_fname = Glib::ustring::compose("%1%2%3%4%5", fname_noExt, "_", i_copyindex, ".", fname_Ext);
// re-construct destination File Paths // re-construct destination File Paths
dest_fPath = Glib::build_filename (dest_Dir, dest_fname); dest_fPath = Glib::build_filename (options.lastCopyMovePath, dest_fname);
dest_fPath_param = dest_fPath + paramFileExtension; dest_fPath_param = dest_fPath + paramFileExtension;
i_copyindex++; i_copyindex++;
} }
@ -1677,49 +1683,46 @@ void FileCatalog::reparseDirectory ()
return; return;
} }
if (!Glib::file_test (selectedDirectory, Glib::FILE_TEST_IS_DIR)) { if (!Glib::file_test(selectedDirectory, Glib::FILE_TEST_IS_DIR)) {
closeDir (); closeDir();
return; return;
} }
std::vector<Glib::ustring> nfileNameList = getFileList ();
// check if a thumbnailed file has been deleted // check if a thumbnailed file has been deleted
const std::vector<ThumbBrowserEntryBase*>& t = fileBrowser->getEntries (); const std::vector<ThumbBrowserEntryBase*>& t = fileBrowser->getEntries();
std::vector<Glib::ustring> fileNamesToDel; std::vector<Glib::ustring> fileNamesToDel;
for (size_t i = 0; i < t.size(); i++) for (const auto& entry : t) {
if (!Glib::file_test (t[i]->filename, Glib::FILE_TEST_EXISTS)) { if (!Glib::file_test(entry->filename, Glib::FILE_TEST_EXISTS)) {
fileNamesToDel.push_back (t[i]->filename); fileNamesToDel.push_back(entry->filename);
}
} }
for (size_t i = 0; i < fileNamesToDel.size(); i++) { for (const auto& toDelete : fileNamesToDel) {
delete fileBrowser->delEntry (fileNamesToDel[i]); delete fileBrowser->delEntry(toDelete);
cacheMgr->deleteEntry (fileNamesToDel[i]); cacheMgr->deleteEntry(toDelete);
previewsLoaded--; --previewsLoaded;
} }
if (!fileNamesToDel.empty ()) { if (!fileNamesToDel.empty()) {
_refreshProgressBar(); _refreshProgressBar();
} }
// check if a new file has been added // check if a new file has been added
for (size_t i = 0; i < nfileNameList.size(); i++) { // build a set of collate-keys for faster search
bool found = false; std::set<std::string> oldNames;
for (const auto& oldName : fileNameList) {
for (size_t j = 0; j < fileNameList.size(); j++) oldNames.insert(oldName.collate_key());
if (nfileNameList[i] == fileNameList[j]) {
found = true;
break;
} }
if (!found) { fileNameList = getFileList();
checkAndAddFile (Gio::File::create_for_parse_name (nfileNameList[i])); for (const auto& newName : fileNameList) {
_refreshProgressBar (); if (oldNames.find(newName.collate_key()) == oldNames.end()) {
addFile(newName);
_refreshProgressBar();
} }
} }
fileNameList = nfileNameList;
} }
void FileCatalog::on_dir_changed (const Glib::RefPtr<Gio::File>& file, const Glib::RefPtr<Gio::File>& other_file, Gio::FileMonitorEvent event_type, bool internal) void FileCatalog::on_dir_changed (const Glib::RefPtr<Gio::File>& file, const Glib::RefPtr<Gio::File>& other_file, Gio::FileMonitorEvent event_type, bool internal)
@ -1736,85 +1739,55 @@ void FileCatalog::on_dir_changed (const Glib::RefPtr<Gio::File>& file, const Gli
} }
} }
void FileCatalog::checkAndAddFile (Glib::RefPtr<Gio::File> file) void FileCatalog::addFile (const Glib::ustring& fName)
{ {
if (!fName.empty()) {
if (!file) { previewLoader->add(selectedDirectoryId, fName, this);
return;
}
try {
const auto info = file->query_info("standard::*");
if (!info || info->get_file_type() == Gio::FILE_TYPE_DIRECTORY) {
return;
}
if (!options.fbShowHidden && info->is_hidden()) {
return;
}
Glib::ustring ext;
const auto lastdot = info->get_name().find_last_of('.');
if (lastdot != Glib::ustring::npos) {
ext = info->get_name().substr(lastdot + 1);
}
if (!options.is_extention_enabled(ext)) {
return;
}
previewLoader->add(selectedDirectoryId, file->get_parse_name(), this);
previewsToLoad++; previewsToLoad++;
}
} catch(Gio::Error&) {}
} }
void FileCatalog::addAndOpenFile (const Glib::ustring& fname) void FileCatalog::addAndOpenFile (const Glib::ustring& fname)
{ {
auto file = Gio::File::create_for_path (fname); auto file = Gio::File::create_for_path(fname);
if (!file ) { if (!file ) {
return; return;
} }
if (!file->query_exists ()) { if (!file->query_exists()) {
return; return;
} }
try { try {
auto info = file->query_info (); const auto info = file->query_info();
if (!info) { if (!info) {
return; return;
} }
Glib::ustring ext; const auto lastdot = info->get_name().find_last_of('.');
auto lastdot = info->get_name().find_last_of ('.');
if (lastdot != Glib::ustring::npos) { if (lastdot != Glib::ustring::npos) {
ext = info->get_name ().substr (lastdot + 1); if (!options.is_extention_enabled(info->get_name().substr(lastdot + 1))) {
return;
} }
} else {
if (!options.is_extention_enabled(ext)) {
return; return;
} }
// if supported, load thumbnail first // if supported, load thumbnail first
const auto tmb = cacheMgr->getEntry (file->get_parse_name ()); const auto tmb = cacheMgr->getEntry(file->get_parse_name());
if (!tmb) { if (!tmb) {
return; return;
} }
FileBrowserEntry* entry = new FileBrowserEntry (tmb, file->get_parse_name ()); FileBrowserEntry* entry = new FileBrowserEntry(tmb, file->get_parse_name());
previewReady (selectedDirectoryId, entry); previewReady(selectedDirectoryId, entry);
// open the file // open the file
tmb->increaseRef (); tmb->increaseRef();
idle_register.add( idle_register.add(
[this, tmb]() -> bool [this, tmb]() -> bool
{ {
@ -1829,27 +1802,30 @@ void FileCatalog::addAndOpenFile (const Glib::ustring& fname)
void FileCatalog::emptyTrash () void FileCatalog::emptyTrash ()
{ {
const std::vector<ThumbBrowserEntryBase*> t = fileBrowser->getEntries (); const auto& t = fileBrowser->getEntries();
std::vector<FileBrowserEntry*> toDel; std::vector<FileBrowserEntry*> toDel;
for (size_t i = 0; i < t.size(); i++) for (const auto entry : t) {
if ((static_cast<FileBrowserEntry*>(t[i]))->thumbnail->getStage() == 1) { if ((static_cast<FileBrowserEntry*>(entry))->thumbnail->getStage() == 1) {
toDel.push_back (static_cast<FileBrowserEntry*>(t[i])); toDel.push_back(static_cast<FileBrowserEntry*>(entry));
} }
}
deleteRequested (toDel, false, false); if (toDel.size() > 0) {
deleteRequested(toDel, false, false);
trashChanged(); trashChanged();
}
} }
bool FileCatalog::trashIsEmpty () bool FileCatalog::trashIsEmpty ()
{ {
const std::vector<ThumbBrowserEntryBase*> t = fileBrowser->getEntries ();
for (size_t i = 0; i < t.size(); i++) const auto& t = fileBrowser->getEntries();
if ((static_cast<FileBrowserEntry*>(t[i]))->thumbnail->getStage() == 1) {
for (const auto entry : t) {
if ((static_cast<FileBrowserEntry*>(entry))->thumbnail->getStage() == 1) {
return false; return false;
} }
}
return true; return true;
} }

View File

@ -141,7 +141,7 @@ private:
IdleRegister idle_register; IdleRegister idle_register;
void addAndOpenFile (const Glib::ustring& fname); void addAndOpenFile (const Glib::ustring& fname);
void checkAndAddFile (Glib::RefPtr<Gio::File> info); void addFile (const Glib::ustring& fName);
std::vector<Glib::ustring> getFileList (); std::vector<Glib::ustring> getFileList ();
BrowserFilter getFilter (); BrowserFilter getFilter ();
void trashChanged (); void trashChanged ();

View File

@ -29,12 +29,14 @@ Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::unRankIcon;
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::trashIcon; Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::trashIcon;
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::unTrashIcon; Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::unTrashIcon;
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::processIcon; Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::processIcon;
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::colorLabelIcon_0; std::array<Cairo::RefPtr<RTSurface>, 6> FileThumbnailButtonSet::colorLabelIcon;
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::colorLabelIcon_1;
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::colorLabelIcon_2; Glib::ustring FileThumbnailButtonSet::processToolTip;
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::colorLabelIcon_3; Glib::ustring FileThumbnailButtonSet::unrankToolTip;
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::colorLabelIcon_4; Glib::ustring FileThumbnailButtonSet::trashToolTip;
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::colorLabelIcon_5; Glib::ustring FileThumbnailButtonSet::untrashToolTip;
Glib::ustring FileThumbnailButtonSet::colorLabelToolTip;
std::array<Glib::ustring, 5> FileThumbnailButtonSet::rankToolTip;
FileThumbnailButtonSet::FileThumbnailButtonSet (FileBrowserEntry* myEntry) FileThumbnailButtonSet::FileThumbnailButtonSet (FileBrowserEntry* myEntry)
{ {
@ -46,73 +48,57 @@ FileThumbnailButtonSet::FileThumbnailButtonSet (FileBrowserEntry* myEntry)
trashIcon = Cairo::RefPtr<RTSurface>(new RTSurface("trash-small.png")); trashIcon = Cairo::RefPtr<RTSurface>(new RTSurface("trash-small.png"));
unTrashIcon = Cairo::RefPtr<RTSurface>(new RTSurface("trash-remove-small.png")); unTrashIcon = Cairo::RefPtr<RTSurface>(new RTSurface("trash-remove-small.png"));
processIcon = Cairo::RefPtr<RTSurface>(new RTSurface("gears-small.png")); processIcon = Cairo::RefPtr<RTSurface>(new RTSurface("gears-small.png"));
colorLabelIcon[0] = Cairo::RefPtr<RTSurface>(new RTSurface("circle-empty-gray-small.png"));
colorLabelIcon[1] = Cairo::RefPtr<RTSurface>(new RTSurface("circle-red-small.png"));
colorLabelIcon[2] = Cairo::RefPtr<RTSurface>(new RTSurface("circle-yellow-small.png"));
colorLabelIcon[3] = Cairo::RefPtr<RTSurface>(new RTSurface("circle-green-small.png"));
colorLabelIcon[4] = Cairo::RefPtr<RTSurface>(new RTSurface("circle-blue-small.png"));
colorLabelIcon[5] = Cairo::RefPtr<RTSurface>(new RTSurface("circle-purple-small.png"));
processToolTip = M("FILEBROWSER_POPUPPROCESS");
unrankToolTip = M("FILEBROWSER_UNRANK_TOOLTIP");
trashToolTip = M("FILEBROWSER_POPUPTRASH");
untrashToolTip = M("FILEBROWSER_POPUPUNTRASH");
colorLabelToolTip = M("FILEBROWSER_COLORLABEL_TOOLTIP");
rankToolTip[0] = M("FILEBROWSER_RANK1_TOOLTIP");
rankToolTip[1] = M("FILEBROWSER_RANK2_TOOLTIP");
rankToolTip[2] = M("FILEBROWSER_RANK3_TOOLTIP");
rankToolTip[3] = M("FILEBROWSER_RANK4_TOOLTIP");
rankToolTip[4] = M("FILEBROWSER_RANK5_TOOLTIP");
colorLabelIcon_0 = Cairo::RefPtr<RTSurface>(new RTSurface("circle-empty-gray-small.png"));
colorLabelIcon_1 = Cairo::RefPtr<RTSurface>(new RTSurface("circle-red-small.png"));
colorLabelIcon_2 = Cairo::RefPtr<RTSurface>(new RTSurface("circle-yellow-small.png"));
colorLabelIcon_3 = Cairo::RefPtr<RTSurface>(new RTSurface("circle-green-small.png"));
colorLabelIcon_4 = Cairo::RefPtr<RTSurface>(new RTSurface("circle-blue-small.png"));
colorLabelIcon_5 = Cairo::RefPtr<RTSurface>(new RTSurface("circle-purple-small.png"));;
iconsLoaded = true; iconsLoaded = true;
} }
add (new LWButton (processIcon, 6, myEntry, LWButton::Left, LWButton::Center, M("FILEBROWSER_POPUPPROCESS"))); add(new LWButton(processIcon, 6, myEntry, LWButton::Left, LWButton::Center, &processToolTip));
add (new LWButton (unRankIcon, 0, myEntry, LWButton::Left, LWButton::Center, M("FILEBROWSER_UNRANK_TOOLTIP"))); add(new LWButton(unRankIcon, 0, myEntry, LWButton::Left, LWButton::Center, &unrankToolTip));
for (int i = 0; i < 5; i++) { for (int i = 0; i < 5; i++) {
add (new LWButton (rankIcon, i + 1, myEntry, LWButton::Left)); add(new LWButton(rankIcon, i + 1, myEntry, LWButton::Left, LWButton::Center, &rankToolTip[i]));
} }
add (new LWButton (trashIcon, 7, myEntry, LWButton::Right, LWButton::Center, M("FILEBROWSER_POPUPTRASH"))); add(new LWButton(trashIcon, 7, myEntry, LWButton::Right, LWButton::Center, &trashToolTip));
add(new LWButton(colorLabelIcon[0], 8, myEntry, LWButton::Right, LWButton::Center, &colorLabelToolTip));
add (new LWButton (colorLabelIcon_0, 8, myEntry, LWButton::Right, LWButton::Center, M("FILEBROWSER_COLORLABEL_TOOLTIP")));
buttons[2]->setToolTip (M("FILEBROWSER_RANK1_TOOLTIP"));
buttons[3]->setToolTip (M("FILEBROWSER_RANK2_TOOLTIP"));
buttons[4]->setToolTip (M("FILEBROWSER_RANK3_TOOLTIP"));
buttons[5]->setToolTip (M("FILEBROWSER_RANK4_TOOLTIP"));
buttons[6]->setToolTip (M("FILEBROWSER_RANK5_TOOLTIP"));
} }
void FileThumbnailButtonSet::setRank (int stars) void FileThumbnailButtonSet::setRank (int stars)
{ {
for (int i = 1; i <= 5; i++) { for (int i = 1; i <= 5; i++) {
buttons[i + 1]->setIcon (i <= stars ? rankIcon : gRankIcon); buttons[i + 1]->setIcon(i <= stars ? rankIcon : gRankIcon);
} }
} }
void FileThumbnailButtonSet::setColorLabel (int colorLabel) void FileThumbnailButtonSet::setColorLabel (int colorLabel)
{ {
if (colorLabel == 0) { if (colorLabel >= 0 && colorLabel <= 5) {
buttons[8]->setIcon (colorLabelIcon_0); //transparent label buttons[8]->setIcon(colorLabelIcon[colorLabel]);
}
if (colorLabel == 1) {
buttons[8]->setIcon (colorLabelIcon_1);
}
if (colorLabel == 2) {
buttons[8]->setIcon (colorLabelIcon_2);
}
if (colorLabel == 3) {
buttons[8]->setIcon (colorLabelIcon_3);
}
if (colorLabel == 4) {
buttons[8]->setIcon (colorLabelIcon_4);
}
if (colorLabel == 5) {
buttons[8]->setIcon (colorLabelIcon_5);
} }
} }
void FileThumbnailButtonSet::setInTrash (bool inTrash) void FileThumbnailButtonSet::setInTrash (bool inTrash)
{ {
buttons[7]->setIcon (inTrash ? unTrashIcon : trashIcon); buttons[7]->setIcon(inTrash ? unTrashIcon : trashIcon);
buttons[7]->setToolTip (inTrash ? M("FILEBROWSER_POPUPUNTRASH") : M("FILEBROWSER_POPUPTRASH")); buttons[7]->setToolTip(inTrash ? &untrashToolTip : &trashToolTip);
} }

View File

@ -19,6 +19,8 @@
#ifndef _FILETHUMBNAILBUTTONSET_ #ifndef _FILETHUMBNAILBUTTONSET_
#define _FILETHUMBNAILBUTTONSET_ #define _FILETHUMBNAILBUTTONSET_
#include <array>
#include "lwbuttonset.h" #include "lwbuttonset.h"
#include <gtkmm.h> #include <gtkmm.h>
#include "filebrowserentry.h" #include "filebrowserentry.h"
@ -38,12 +40,14 @@ public:
static Cairo::RefPtr<RTSurface> unTrashIcon; static Cairo::RefPtr<RTSurface> unTrashIcon;
static Cairo::RefPtr<RTSurface> processIcon; static Cairo::RefPtr<RTSurface> processIcon;
static Cairo::RefPtr<RTSurface> colorLabelIcon_0; static std::array<Cairo::RefPtr<RTSurface>, 6> colorLabelIcon;
static Cairo::RefPtr<RTSurface> colorLabelIcon_1;
static Cairo::RefPtr<RTSurface> colorLabelIcon_2; static Glib::ustring processToolTip;
static Cairo::RefPtr<RTSurface> colorLabelIcon_3; static Glib::ustring unrankToolTip;
static Cairo::RefPtr<RTSurface> colorLabelIcon_4; static Glib::ustring trashToolTip;
static Cairo::RefPtr<RTSurface> colorLabelIcon_5; static Glib::ustring untrashToolTip;
static Glib::ustring colorLabelToolTip;
static std::array<Glib::ustring, 5> rankToolTip;
explicit FileThumbnailButtonSet (FileBrowserEntry* myEntry); explicit FileThumbnailButtonSet (FileBrowserEntry* myEntry);
void setRank (int stars); void setRank (int stars);

View File

@ -87,7 +87,7 @@ public:
/** @brief Get the on/off state /** @brief Get the on/off state
*/ */
bool isActive() bool isActive() const
{ {
return active; return active;
}; };

View File

@ -19,7 +19,7 @@
#include "lwbutton.h" #include "lwbutton.h"
#include "guiutils.h" #include "guiutils.h"
LWButton::LWButton (Cairo::RefPtr<RTSurface> i, int aCode, void* aData, Alignment ha, Alignment va, Glib::ustring tooltip) LWButton::LWButton (Cairo::RefPtr<RTSurface> i, int aCode, void* aData, Alignment ha, Alignment va, Glib::ustring* tooltip)
: xpos(0), ypos(0), halign(ha), valign(va), icon(i), bgr(0.0), bgg(0.0), bgb(0.0), fgr(0.0), fgg(0.0), fgb(0.0), state(Normal), listener(nullptr), actionCode(aCode), actionData(aData), toolTip(tooltip) : xpos(0), ypos(0), halign(ha), valign(va), icon(i), bgr(0.0), bgg(0.0), bgb(0.0), fgr(0.0), fgg(0.0), fgb(0.0), state(Normal), listener(nullptr), actionCode(aCode), actionData(aData), toolTip(tooltip)
{ {
@ -31,7 +31,7 @@ LWButton::LWButton (Cairo::RefPtr<RTSurface> i, int aCode, void* aData, Alignmen
} }
} }
void LWButton::getSize (int& minw, int& minh) void LWButton::getSize (int& minw, int& minh) const
{ {
minw = w; minw = w;
@ -45,7 +45,7 @@ void LWButton::setPosition (int x, int y)
ypos = y; ypos = y;
} }
void LWButton::getPosition (int& x, int& y) void LWButton::getPosition (int& x, int& y) const
{ {
x = xpos; x = xpos;
@ -65,7 +65,7 @@ void LWButton::setIcon (Cairo::RefPtr<RTSurface> i)
} }
} }
Cairo::RefPtr<RTSurface> LWButton::getIcon () Cairo::RefPtr<RTSurface> LWButton::getIcon () const
{ {
return icon; return icon;
@ -82,7 +82,7 @@ void LWButton::setColors (const Gdk::RGBA& bg, const Gdk::RGBA& fg)
fgb = fg.get_blue (); fgb = fg.get_blue ();
} }
bool LWButton::inside (int x, int y) bool LWButton::inside (int x, int y) const
{ {
return x > xpos && x < xpos + w && y > ypos && y < ypos + h; return x > xpos && x < xpos + w && y > ypos && y < ypos + h;
@ -210,24 +210,27 @@ void LWButton::redraw (Cairo::RefPtr<Cairo::Context> context)
} }
} }
void LWButton::getAlignment (Alignment& ha, Alignment& va) void LWButton::getAlignment (Alignment& ha, Alignment& va) const
{ {
ha = halign; ha = halign;
va = valign; va = valign;
} }
Glib::ustring LWButton::getToolTip (int x, int y) Glib::ustring LWButton::getToolTip (int x, int y) const
{ {
if (inside(x, y)) {
if (inside (x, y)) { if (toolTip) {
return toolTip; return *toolTip;
} else {
return "";
}
} else { } else {
return ""; return "";
} }
} }
void LWButton::setToolTip (const Glib::ustring& tooltip) void LWButton::setToolTip (Glib::ustring* tooltip)
{ {
toolTip = tooltip; toolTip = tooltip;

View File

@ -49,26 +49,26 @@ private:
LWButtonListener* listener; LWButtonListener* listener;
int actionCode; int actionCode;
void* actionData; void* actionData;
Glib::ustring toolTip; Glib::ustring* toolTip;
public: public:
LWButton (Cairo::RefPtr<RTSurface> i, int aCode, void* aData, Alignment ha = Left, Alignment va = Center, Glib::ustring tooltip = ""); LWButton (Cairo::RefPtr<RTSurface> i, int aCode, void* aData, Alignment ha = Left, Alignment va = Center, Glib::ustring* tooltip = nullptr);
void getSize (int& minw, int& minh); void getSize (int& minw, int& minh) const;
void getAlignment (Alignment& ha, Alignment& va); void getAlignment (Alignment& ha, Alignment& va) const;
void setPosition (int x, int y); void setPosition (int x, int y);
void getPosition (int& x, int& y); void getPosition (int& x, int& y) const;
bool inside (int x, int y); bool inside (int x, int y) const;
void setIcon (Cairo::RefPtr<RTSurface> i); void setIcon (Cairo::RefPtr<RTSurface> i);
Cairo::RefPtr<RTSurface> getIcon (); Cairo::RefPtr<RTSurface> getIcon () const;
void setColors (const Gdk::RGBA& bg, const Gdk::RGBA& fg); void setColors (const Gdk::RGBA& bg, const Gdk::RGBA& fg);
void setToolTip (const Glib::ustring& tooltip); void setToolTip (Glib::ustring* tooltip);
bool motionNotify (int x, int y); bool motionNotify (int x, int y);
bool pressNotify (int x, int y); bool pressNotify (int x, int y);
bool releaseNotify (int x, int y); bool releaseNotify (int x, int y);
Glib::ustring getToolTip (int x, int y); Glib::ustring getToolTip (int x, int y) const;
void setButtonListener (LWButtonListener* bl) void setButtonListener (LWButtonListener* bl)
{ {

View File

@ -18,7 +18,7 @@
*/ */
#include "lwbuttonset.h" #include "lwbuttonset.h"
LWButtonSet::LWButtonSet () : aw(0), ah(0), ax(0), ay(0) LWButtonSet::LWButtonSet () : aw(0), ah(0), ax(-1), ay(-1)
{ {
} }
@ -42,20 +42,21 @@ void LWButtonSet::getMinimalDimensions (int& w, int& h)
w = 0; w = 0;
h = 0; h = 0;
for (size_t i = 0; i < buttons.size(); i++) { for (const auto entry : buttons) {
int bw, bh; int bw, bh;
buttons[i]->getSize (bw, bh); entry->getSize(bw, bh);
w += bw; w += bw;
h = std::max(bh, h);
if (bh > h) {
h = bh;
}
} }
} }
void LWButtonSet::arrangeButtons (int x, int y, int w, int h) void LWButtonSet::arrangeButtons (int x, int y, int w, int h)
{ {
if (x == ax && y == ay && w == aw && (h == -1 || h == ah )) {
return;
}
int mw, mh; int mw, mh;
getMinimalDimensions (mw, mh); getMinimalDimensions (mw, mh);

View File

@ -369,6 +369,7 @@ void Options::setDefaults()
multiUser = true; multiUser = true;
profilePath = "profiles"; profilePath = "profiles";
loadSaveProfilePath = ""; // will be corrected in load as otherwise construction fails loadSaveProfilePath = ""; // will be corrected in load as otherwise construction fails
lastCopyMovePath = "";
version = "0.0.0.0"; // temporary value; will be correctly set in RTWindow::on_realize version = "0.0.0.0"; // temporary value; will be correctly set in RTWindow::on_realize
thumbSize = 160; thumbSize = 160;
thumbSizeTab = 160; thumbSizeTab = 160;
@ -412,6 +413,7 @@ void Options::setDefaults()
favorites.clear(); favorites.clear();
parseExtensionsEnabled.clear(); parseExtensionsEnabled.clear();
parsedExtensions.clear(); parsedExtensions.clear();
parsedExtensionsSet.clear();
renameUseTemplates = false; renameUseTemplates = false;
renameTemplates.clear(); renameTemplates.clear();
thumbnailZoomRatios.clear(); thumbnailZoomRatios.clear();
@ -648,10 +650,12 @@ Options* Options::copyFrom(Options* other)
void Options::filterOutParsedExtensions() void Options::filterOutParsedExtensions()
{ {
parsedExtensions.clear(); parsedExtensions.clear();
parsedExtensionsSet.clear();
for (unsigned int i = 0; i < parseExtensions.size(); i++) for (unsigned int i = 0; i < parseExtensions.size(); i++)
if (parseExtensionsEnabled[i]) { if (parseExtensionsEnabled[i]) {
parsedExtensions.push_back(parseExtensions[i].lowercase()); parsedExtensions.push_back(parseExtensions[i].lowercase());
parsedExtensionsSet.emplace(parseExtensions[i].lowercase());
} }
} }
@ -1836,6 +1840,7 @@ void Options::readFromFile(Glib::ustring fname)
safeDirGet(keyFile, "Dialogs", "LastProfilingReferenceDir", lastProfilingReferenceDir); safeDirGet(keyFile, "Dialogs", "LastProfilingReferenceDir", lastProfilingReferenceDir);
safeDirGet(keyFile, "Dialogs", "LastLensProfileDir", lastLensProfileDir); safeDirGet(keyFile, "Dialogs", "LastLensProfileDir", lastLensProfileDir);
safeDirGet(keyFile, "Dialogs", "LastICCProfCreatorDir", lastICCProfCreatorDir); safeDirGet(keyFile, "Dialogs", "LastICCProfCreatorDir", lastICCProfCreatorDir);
safeDirGet(keyFile, "Dialogs", "LastCopyMovePath", lastCopyMovePath);
if (keyFile.has_key("Dialogs", "GimpPluginShowInfoDialog")) { if (keyFile.has_key("Dialogs", "GimpPluginShowInfoDialog")) {
gimpPluginShowInfoDialog = keyFile.get_boolean("Dialogs", "GimpPluginShowInfoDialog"); gimpPluginShowInfoDialog = keyFile.get_boolean("Dialogs", "GimpPluginShowInfoDialog");
@ -2229,6 +2234,7 @@ void Options::saveToFile(Glib::ustring fname)
keyFile.set_string("Dialogs", "LastProfilingReferenceDir", lastProfilingReferenceDir); keyFile.set_string("Dialogs", "LastProfilingReferenceDir", lastProfilingReferenceDir);
keyFile.set_string("Dialogs", "LastLensProfileDir", lastLensProfileDir); keyFile.set_string("Dialogs", "LastLensProfileDir", lastLensProfileDir);
keyFile.set_string("Dialogs", "LastICCProfCreatorDir", lastICCProfCreatorDir); keyFile.set_string("Dialogs", "LastICCProfCreatorDir", lastICCProfCreatorDir);
keyFile.set_string("Dialogs", "LastCopyMovePath", lastCopyMovePath);
keyFile.set_boolean("Dialogs", "GimpPluginShowInfoDialog", gimpPluginShowInfoDialog); keyFile.set_boolean("Dialogs", "GimpPluginShowInfoDialog", gimpPluginShowInfoDialog);
keyFile.set_string("Lensfun", "DBDirectory", rtSettings.lensfunDbDirectory); keyFile.set_string("Lensfun", "DBDirectory", rtSettings.lensfunDbDirectory);
@ -2464,36 +2470,17 @@ bool Options::is_parse_extention(Glib::ustring fname)
/* /*
* return true if fname ends with one of the retained image file extensions * return true if fname ends with one of the retained image file extensions
*/ */
bool Options::has_retained_extention(Glib::ustring fname) bool Options::has_retained_extention(const Glib::ustring& fname)
{ {
return parsedExtensionsSet.find(getExtension(fname).lowercase()) != parsedExtensionsSet.end();
Glib::ustring ext = getExtension(fname).lowercase();
if (!ext.empty()) {
// there is an extension to the filename
// look out if it has one of the retained extensions
for (unsigned int i = 0; i < parsedExtensions.size(); i++) {
if (ext == parsedExtensions[i]) {
return true;
}
}
}
return false;
} }
/* /*
* return true if ext is an enabled extension * return true if ext is an enabled extension
*/ */
bool Options::is_extention_enabled(Glib::ustring ext) bool Options::is_extention_enabled(const Glib::ustring& ext)
{ {
for (int j = 0; j < (int)parseExtensions.size(); j++) return parsedExtensionsSet.find(ext.lowercase()) != parsedExtensionsSet.end();
if (parseExtensions[j].casefold() == ext.casefold()) {
return j >= (int)parseExtensionsEnabled.size() || parseExtensionsEnabled[j];
}
return false;
} }
Glib::ustring Options::getUserProfilePath() Glib::ustring Options::getUserProfilePath()

View File

@ -19,6 +19,7 @@
#ifndef _OPTIONS_ #ifndef _OPTIONS_
#define _OPTIONS_ #define _OPTIONS_
#include <set>
#include <gtkmm.h> #include <gtkmm.h>
#include "../rtengine/rtengine.h" #include "../rtengine/rtengine.h"
#include <exception> #include <exception>
@ -174,6 +175,7 @@ public:
Glib::ustring startupPath; Glib::ustring startupPath;
Glib::ustring profilePath; // can be an absolute or relative path; depending on this value, bundled profiles may not be found Glib::ustring profilePath; // can be an absolute or relative path; depending on this value, bundled profiles may not be found
bool useBundledProfiles; // only used if multiUser == true bool useBundledProfiles; // only used if multiUser == true
Glib::ustring lastCopyMovePath;
Glib::ustring loadSaveProfilePath; Glib::ustring loadSaveProfilePath;
Glib::ustring lastSaveAsPath; Glib::ustring lastSaveAsPath;
int saveAsDialogWidth; int saveAsDialogWidth;
@ -259,6 +261,7 @@ public:
std::vector<Glib::ustring> parseExtensions; // List containing all extensions type std::vector<Glib::ustring> parseExtensions; // List containing all extensions type
std::vector<int> parseExtensionsEnabled; // List of bool to retain extension or not std::vector<int> parseExtensionsEnabled; // List of bool to retain extension or not
std::vector<Glib::ustring> parsedExtensions; // List containing all retained extensions (lowercase) std::vector<Glib::ustring> parsedExtensions; // List containing all retained extensions (lowercase)
std::set<std::string> parsedExtensionsSet; // Set containing all retained extensions (lowercase)
std::vector<int> tpOpen; std::vector<int> tpOpen;
bool autoSaveTpOpen; bool autoSaveTpOpen;
//std::vector<int> crvOpen; //std::vector<int> crvOpen;
@ -422,8 +425,8 @@ public:
Glib::ustring getGlobalProfilePath(); Glib::ustring getGlobalProfilePath();
Glib::ustring findProfilePath (Glib::ustring &profName); Glib::ustring findProfilePath (Glib::ustring &profName);
bool is_parse_extention (Glib::ustring fname); bool is_parse_extention (Glib::ustring fname);
bool has_retained_extention (Glib::ustring fname); bool has_retained_extention (const Glib::ustring& fname);
bool is_extention_enabled (Glib::ustring ext); bool is_extention_enabled (const Glib::ustring& ext);
bool is_defProfRawMissing(); bool is_defProfRawMissing();
bool is_bundledDefProfRawMissing(); bool is_bundledDefProfRawMissing();
bool is_defProfImgMissing(); bool is_defProfImgMissing();

View File

@ -197,8 +197,7 @@ void RTImage::updateImages()
Glib::RefPtr<Gdk::Pixbuf> RTImage::createPixbufFromFile (const Glib::ustring& fileName) Glib::RefPtr<Gdk::Pixbuf> RTImage::createPixbufFromFile (const Glib::ustring& fileName)
{ {
Cairo::RefPtr<Cairo::ImageSurface> imgSurf = createImgSurfFromFile(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 Gdk::Pixbuf::create(imgSurf, 0, 0, imgSurf->get_width(), imgSurf->get_height());
return pixbuf;
} }
Cairo::RefPtr<Cairo::ImageSurface> RTImage::createImgSurfFromFile (const Glib::ustring& fileName) Cairo::RefPtr<Cairo::ImageSurface> RTImage::createImgSurfFromFile (const Glib::ustring& fileName)

View File

@ -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)

View File

@ -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);

View File

@ -157,9 +157,6 @@ ThumbBrowserEntryBase::ThumbBrowserEntryBase (const Glib::ustring& fname) :
collate_name(getPaddedName(dispname).casefold_collate_key()), collate_name(getPaddedName(dispname).casefold_collate_key()),
thumbnail(nullptr), thumbnail(nullptr),
filename(fname), filename(fname),
shortname(dispname),
exifline(""),
datetimeline(""),
selected(false), selected(false),
drawable(false), drawable(false),
filtered(false), filtered(false),
@ -439,7 +436,6 @@ void ThumbBrowserEntryBase::getTextSizes (int& infow, int& infoh)
Gtk::Widget* w = parent->getDrawingArea (); Gtk::Widget* w = parent->getDrawingArea ();
// calculate dimensions of the text based fields // calculate dimensions of the text based fields
dispname = shortname;
Glib::RefPtr<Pango::Context> context = w->get_pango_context () ; Glib::RefPtr<Pango::Context> context = w->get_pango_context () ;
context->set_font_description (w->get_style_context()->get_font()); 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 (); Pango::FontDescription fontd = context->get_font_description ();
fontd.set_weight (Pango::WEIGHT_BOLD); fontd.set_weight (Pango::WEIGHT_BOLD);
context->set_font_description (fontd); 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); fn->get_pixel_size (fnlabw, fnlabh);
// calculate cummulated height of all info fields // 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; 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
{ {
rtengine::Coord2D coord(-1., -1.);
coord.x = coord.y = -1.;
if (preview) { if (preview) {
x -= ofsX + startx; x -= ofsX + startx;
@ -692,15 +687,16 @@ void ThumbBrowserEntryBase::getPosInImgSpace (int x, int y, rtengine::Coord2D &c
coord.y = double(y - prey) / double(preh); 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); return !(ofsX + startx > x + w || ofsX + startx + exp_width < x || ofsY + starty > y + h || ofsY + starty + exp_height < y);
} }
std::vector<Glib::RefPtr<Gdk::Pixbuf> > ThumbBrowserEntryBase::getIconsOnImageArea() std::vector<Glib::RefPtr<Gdk::Pixbuf>> ThumbBrowserEntryBase::getIconsOnImageArea()
{ {
return std::vector<Glib::RefPtr<Gdk::Pixbuf> >(); return std::vector<Glib::RefPtr<Gdk::Pixbuf> >();
} }
@ -710,12 +706,6 @@ std::vector<Glib::RefPtr<Gdk::Pixbuf> > ThumbBrowserEntryBase::getSpecificityIco
return std::vector<Glib::RefPtr<Gdk::Pixbuf> >(); 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) bool ThumbBrowserEntryBase::motionNotify (int x, int y)
{ {
@ -734,12 +724,12 @@ bool ThumbBrowserEntryBase::releaseNotify (int button, int type, int bstate, int
return buttonSet ? buttonSet->releaseNotify (x, y) : false; 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) { if (buttonSet) {
tooltip = buttonSet->getToolTip (x, y); tooltip = buttonSet->getToolTip(x, y);
} }
// Always show the filename in the tooltip since the filename in the thumbnail could be truncated. // Always show the filename in the tooltip since the filename in the thumbnail could be truncated.
@ -748,11 +738,11 @@ Glib::ustring ThumbBrowserEntryBase::getToolTip (int x, int y)
tooltip = dispname; tooltip = dispname;
if (withFilename < WFNAME_FULL) { if (withFilename < WFNAME_FULL) {
if (options.fbShowDateTime && datetimeline != "") { if (options.fbShowDateTime && !datetimeline.empty()) {
tooltip += Glib::ustring("\n") + datetimeline; tooltip += Glib::ustring("\n") + datetimeline;
} }
if (options.fbShowBasicExif && exifline != "") { if (options.fbShowBasicExif && !exifline.empty()) {
tooltip += Glib::ustring("\n") + exifline; tooltip += Glib::ustring("\n") + exifline;
} }
} }

View File

@ -16,8 +16,7 @@
* You should have received a copy of the GNU General Public License * You should have received a copy of the GNU General Public License
* along with RawTherapee. If not, see <http://www.gnu.org/licenses/>. * along with RawTherapee. If not, see <http://www.gnu.org/licenses/>.
*/ */
#ifndef _THUMBNAILBROWSERENTRYBASE_ #pragma once
#define _THUMBNAILBROWSERENTRYBASE_
#include <atomic> #include <atomic>
@ -82,8 +81,8 @@ protected:
Glib::RefPtr<BackBuffer> backBuffer; Glib::RefPtr<BackBuffer> backBuffer;
bool bbSelected, bbFramed; bool bbSelected, bbFramed;
guint8* bbPreview; guint8* bbPreview;
std::vector<Glib::RefPtr<Gdk::Pixbuf> > bbIcons; std::vector<Glib::RefPtr<Gdk::Pixbuf>> bbIcons;
std::vector<Glib::RefPtr<Gdk::Pixbuf> > bbSpecificityIcons; std::vector<Glib::RefPtr<Gdk::Pixbuf>> bbSpecificityIcons;
CursorShape cursor_type; CursorShape cursor_type;
void drawFrame (Cairo::RefPtr<Cairo::Context> cr, const Gdk::RGBA& bg, const Gdk::RGBA& fg); void drawFrame (Cairo::RefPtr<Cairo::Context> cr, const Gdk::RGBA& bg, const Gdk::RGBA& fg);
@ -101,7 +100,6 @@ public:
// thumbnail preview properties: // thumbnail preview properties:
Glib::ustring filename; Glib::ustring filename;
Glib::ustring shortname;
Glib::ustring exifline; Glib::ustring exifline;
Glib::ustring datetimeline; Glib::ustring datetimeline;
@ -130,11 +128,11 @@ public:
virtual void draw (Cairo::RefPtr<Cairo::Context> cc); virtual void draw (Cairo::RefPtr<Cairo::Context> cc);
void addButtonSet (LWButtonSet* bs); void addButtonSet (LWButtonSet* bs);
int getMinimalHeight () int getMinimalHeight () const
{ {
return height; return height;
} }
int getMinimalWidth () int getMinimalWidth () const
{ {
return width; return width;
} }
@ -168,9 +166,9 @@ public:
return ofsY + starty; return ofsY + starty;
} }
bool inside (int x, int y); bool inside (int x, int y) const;
void getPosInImgSpace (int x, int y, rtengine::Coord2D &coord); rtengine::Coord2D getPosInImgSpace (int x, int y) const;
bool insideWindow (int x, int y, int w, int h); bool insideWindow (int x, int y, int w, int h) const;
void setPosition (int x, int y, int w, int h); void setPosition (int x, int y, int w, int h);
void setOffset (int x, int y); void setOffset (int x, int y);
@ -179,33 +177,29 @@ public:
return collate_name < other.collate_name; return collate_name < other.collate_name;
} }
ThumbBrowserEntryBase* getOriginal () const; virtual void refreshThumbnailImage () = 0;
void setOriginal (ThumbBrowserEntryBase* original);
virtual void refreshThumbnailImage () {}
virtual void refreshQuickThumbnailImage () {} 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 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>> getIconsOnImageArea ();
virtual std::vector<Glib::RefPtr<Gdk::Pixbuf> > getSpecificityIconsOnImageArea (); 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 motionNotify (int x, int y);
virtual bool pressNotify (int button, int type, int bstate, 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 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; return original;
} }
inline void ThumbBrowserEntryBase::setOriginal(ThumbBrowserEntryBase* original) inline void setOriginal(ThumbBrowserEntryBase* original)
{ {
this->original = original; this->original = original;
} }
#endif };