Merge pull request #5376 from Beep6581/filecatalog_speedups
Filecatalog speedups
This commit is contained in:
commit
fd6453d1a8
@ -27,6 +27,10 @@ Cairo::RefPtr<RTSurface> BatchQueueButtonSet::cancelIcon;
|
||||
Cairo::RefPtr<RTSurface> BatchQueueButtonSet::headIcon;
|
||||
Cairo::RefPtr<RTSurface> BatchQueueButtonSet::tailIcon;
|
||||
|
||||
Glib::ustring BatchQueueButtonSet::moveHeadToolTip;
|
||||
Glib::ustring BatchQueueButtonSet::moveEndToolTip;
|
||||
Glib::ustring BatchQueueButtonSet::cancelJobToolTip;
|
||||
|
||||
BatchQueueButtonSet::BatchQueueButtonSet (BatchQueueEntry* myEntry)
|
||||
{
|
||||
|
||||
@ -34,10 +38,13 @@ BatchQueueButtonSet::BatchQueueButtonSet (BatchQueueEntry* myEntry)
|
||||
cancelIcon = Cairo::RefPtr<RTSurface>(new RTSurface("cancel-small.png"));
|
||||
headIcon = Cairo::RefPtr<RTSurface>(new RTSurface("goto-start-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;
|
||||
}
|
||||
|
||||
add (new LWButton (headIcon, 8, myEntry, LWButton::Left, LWButton::Center, M("FILEBROWSER_POPUPMOVEHEAD")));
|
||||
add (new LWButton (tailIcon, 9, myEntry, LWButton::Left, LWButton::Center, M("FILEBROWSER_POPUPMOVEEND")));
|
||||
add (new LWButton (cancelIcon, 10, myEntry, LWButton::Right, LWButton::Center, M("FILEBROWSER_POPUPCANCELJOB")));
|
||||
add(new LWButton(headIcon, 8, myEntry, LWButton::Left, LWButton::Center, &moveHeadToolTip));
|
||||
add(new LWButton(tailIcon, 9, myEntry, LWButton::Left, LWButton::Center, &moveEndToolTip));
|
||||
add(new LWButton(cancelIcon, 10, myEntry, LWButton::Right, LWButton::Center, &cancelJobToolTip));
|
||||
}
|
||||
|
@ -34,6 +34,10 @@ public:
|
||||
static Cairo::RefPtr<RTSurface> headIcon;
|
||||
static Cairo::RefPtr<RTSurface> tailIcon;
|
||||
|
||||
static Glib::ustring moveHeadToolTip;
|
||||
static Glib::ustring moveEndToolTip;
|
||||
static Glib::ustring cancelJobToolTip;
|
||||
|
||||
explicit BatchQueueButtonSet (BatchQueueEntry* myEntry);
|
||||
};
|
||||
|
||||
|
@ -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;
|
||||
|
@ -38,6 +38,13 @@
|
||||
|
||||
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)
|
||||
: 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%")),
|
||||
@ -61,11 +68,18 @@ CropWindow::CropWindow (ImageArea* parent, bool isLowUpdatePriority_, bool isDet
|
||||
|
||||
titleHeight = ih;
|
||||
|
||||
bZoomOut = new LWButton (Cairo::RefPtr<RTSurface>(new RTSurface("magnifier-minus-small.png")), 0, nullptr, LWButton::Left, LWButton::Center, "Zoom Out");
|
||||
bZoomIn = new LWButton (Cairo::RefPtr<RTSurface>(new RTSurface("magnifier-plus-small.png")), 1, nullptr, LWButton::Left, LWButton::Center, "Zoom In");
|
||||
bZoom100 = new LWButton (Cairo::RefPtr<RTSurface>(new RTSurface("magnifier-1to1-small.png")), 2, nullptr, LWButton::Left, LWButton::Center, "Zoom 100/%");
|
||||
if (!initialized) {
|
||||
zoomOuttt = "Zoom Out";
|
||||
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");
|
||||
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 (bZoomIn);
|
||||
|
@ -47,6 +47,12 @@ public:
|
||||
class ImageArea;
|
||||
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
|
||||
ImgEditState state; // current state of user (see enum State)
|
||||
|
@ -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)
|
||||
|
@ -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;
|
||||
|
@ -565,39 +565,44 @@ void FileCatalog::closeDir ()
|
||||
|
||||
std::vector<Glib::ustring> FileCatalog::getFileList()
|
||||
{
|
||||
|
||||
std::vector<Glib::ustring> names;
|
||||
|
||||
std::set<Glib::ustring> extensions;
|
||||
for (const auto& parsedExt : options.parsedExtensions) {
|
||||
extensions.emplace (parsedExt.lowercase ());
|
||||
}
|
||||
const std::set<std::string>& extensions = options.parsedExtensionsSet;
|
||||
|
||||
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) {
|
||||
try {
|
||||
auto file = enumerator->next_file ();
|
||||
const auto file = enumerator->next_file();
|
||||
if (!file) {
|
||||
break;
|
||||
}
|
||||
|
||||
const Glib::ustring fname = file->get_name ();
|
||||
if (file->get_file_type() == Gio::FILE_TYPE_DIRECTORY) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (!options.fbShowHidden && file->is_hidden()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const Glib::ustring fname = file->get_name();
|
||||
const auto lastdot = fname.find_last_of('.');
|
||||
|
||||
auto lastdot = fname.find_last_of ('.');
|
||||
if (lastdot >= fname.length() - 1) {
|
||||
continue;
|
||||
}
|
||||
|
||||
const auto fext = fname.substr (lastdot + 1).lowercase ();
|
||||
if (extensions.count (fext) == 0) {
|
||||
if (extensions.find(fname.substr(lastdot + 1).lowercase()) == extensions.end()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
names.emplace_back (Glib::build_filename (selectedDirectory, fname));
|
||||
names.push_back(Glib::build_filename(selectedDirectory, fname));
|
||||
} catch (Glib::Exception& exception) {
|
||||
if (options.rtSettings.verbose) {
|
||||
std::cerr << exception.what() << std::endl;
|
||||
@ -620,7 +625,7 @@ void FileCatalog::dirSelected (const Glib::ustring& dirname, const Glib::ustring
|
||||
{
|
||||
|
||||
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;
|
||||
@ -636,16 +641,14 @@ void FileCatalog::dirSelected (const Glib::ustring& dirname, const Glib::ustring
|
||||
}
|
||||
|
||||
selectedDirectory = dir->get_parse_name();
|
||||
//printf("FileCatalog::dirSelected selectedDirectory = %s\n",selectedDirectory.c_str());
|
||||
|
||||
BrowsePath->set_text(selectedDirectory);
|
||||
buttonBrowsePath->set_image(*iRefreshWhite);
|
||||
fileNameList = getFileList();
|
||||
|
||||
for (unsigned int i = 0; i < fileNameList.size(); i++) {
|
||||
Glib::RefPtr<Gio::File> f = Gio::File::create_for_path(fileNameList[i]);
|
||||
|
||||
if (f->get_parse_name() != openfile) { // if we opened a file at the beginning don't add it again
|
||||
checkAndAddFile (f);
|
||||
if (openfile.empty() || fileNameList[i] != openfile) { // if we opened a file at the beginning don't add it again
|
||||
addFile(fileNameList[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -696,9 +699,8 @@ void FileCatalog::_refreshProgressBar ()
|
||||
// In tab mode, no progress bar at all
|
||||
// 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
|
||||
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
|
||||
|
||||
Gtk::Notebook *nb = (Gtk::Notebook *)(filepanel->get_parent());
|
||||
Gtk::Grid* grid = Gtk::manage(new Gtk::Grid());
|
||||
Gtk::Label *label = nullptr;
|
||||
@ -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 );
|
||||
fc.add_button( M("GENERAL_CANCEL"), Gtk::RESPONSE_CANCEL);
|
||||
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
|
||||
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
|
||||
|
||||
if( fc.run() == Gtk::RESPONSE_OK ) {
|
||||
Glib::ustring dest_Dir = fc.get_current_folder();
|
||||
options.lastCopyMovePath = fc.get_current_folder();
|
||||
|
||||
// iterate through selected files
|
||||
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);
|
||||
|
||||
// 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;
|
||||
|
||||
if (moveRequested && (src_Dir == dest_Dir)) {
|
||||
if (moveRequested && (src_Dir == options.lastCopyMovePath)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -1085,7 +1091,7 @@ void FileCatalog::copyMoveRequested(const std::vector<FileBrowserEntry*>& tbe, b
|
||||
// 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);
|
||||
// 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;
|
||||
i_copyindex++;
|
||||
}
|
||||
@ -1682,21 +1688,20 @@ void FileCatalog::reparseDirectory ()
|
||||
return;
|
||||
}
|
||||
|
||||
std::vector<Glib::ustring> nfileNameList = getFileList ();
|
||||
|
||||
// check if a thumbnailed file has been deleted
|
||||
const std::vector<ThumbBrowserEntryBase*>& t = fileBrowser->getEntries();
|
||||
std::vector<Glib::ustring> fileNamesToDel;
|
||||
|
||||
for (size_t i = 0; i < t.size(); i++)
|
||||
if (!Glib::file_test (t[i]->filename, Glib::FILE_TEST_EXISTS)) {
|
||||
fileNamesToDel.push_back (t[i]->filename);
|
||||
for (const auto& entry : t) {
|
||||
if (!Glib::file_test(entry->filename, Glib::FILE_TEST_EXISTS)) {
|
||||
fileNamesToDel.push_back(entry->filename);
|
||||
}
|
||||
}
|
||||
|
||||
for (size_t i = 0; i < fileNamesToDel.size(); i++) {
|
||||
delete fileBrowser->delEntry (fileNamesToDel[i]);
|
||||
cacheMgr->deleteEntry (fileNamesToDel[i]);
|
||||
previewsLoaded--;
|
||||
for (const auto& toDelete : fileNamesToDel) {
|
||||
delete fileBrowser->delEntry(toDelete);
|
||||
cacheMgr->deleteEntry(toDelete);
|
||||
--previewsLoaded;
|
||||
}
|
||||
|
||||
if (!fileNamesToDel.empty()) {
|
||||
@ -1704,22 +1709,20 @@ void FileCatalog::reparseDirectory ()
|
||||
}
|
||||
|
||||
// check if a new file has been added
|
||||
for (size_t i = 0; i < nfileNameList.size(); i++) {
|
||||
bool found = false;
|
||||
|
||||
for (size_t j = 0; j < fileNameList.size(); j++)
|
||||
if (nfileNameList[i] == fileNameList[j]) {
|
||||
found = true;
|
||||
break;
|
||||
// build a set of collate-keys for faster search
|
||||
std::set<std::string> oldNames;
|
||||
for (const auto& oldName : fileNameList) {
|
||||
oldNames.insert(oldName.collate_key());
|
||||
}
|
||||
|
||||
if (!found) {
|
||||
checkAndAddFile (Gio::File::create_for_parse_name (nfileNameList[i]));
|
||||
fileNameList = getFileList();
|
||||
for (const auto& newName : fileNameList) {
|
||||
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)
|
||||
@ -1736,41 +1739,12 @@ 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 (!file) {
|
||||
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);
|
||||
if (!fName.empty()) {
|
||||
previewLoader->add(selectedDirectoryId, fName, this);
|
||||
previewsToLoad++;
|
||||
|
||||
} catch(Gio::Error&) {}
|
||||
}
|
||||
}
|
||||
|
||||
void FileCatalog::addAndOpenFile (const Glib::ustring& fname)
|
||||
@ -1787,22 +1761,21 @@ void FileCatalog::addAndOpenFile (const Glib::ustring& fname)
|
||||
|
||||
try {
|
||||
|
||||
auto info = file->query_info ();
|
||||
const auto info = file->query_info();
|
||||
|
||||
if (!info) {
|
||||
return;
|
||||
}
|
||||
|
||||
Glib::ustring ext;
|
||||
|
||||
auto lastdot = info->get_name().find_last_of ('.');
|
||||
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)) {
|
||||
if (!options.is_extention_enabled(info->get_name().substr(lastdot + 1))) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
// if supported, load thumbnail first
|
||||
const auto tmb = cacheMgr->getEntry(file->get_parse_name());
|
||||
@ -1829,27 +1802,30 @@ void FileCatalog::addAndOpenFile (const Glib::ustring& fname)
|
||||
void FileCatalog::emptyTrash ()
|
||||
{
|
||||
|
||||
const std::vector<ThumbBrowserEntryBase*> t = fileBrowser->getEntries ();
|
||||
const auto& t = fileBrowser->getEntries();
|
||||
std::vector<FileBrowserEntry*> toDel;
|
||||
|
||||
for (size_t i = 0; i < t.size(); i++)
|
||||
if ((static_cast<FileBrowserEntry*>(t[i]))->thumbnail->getStage() == 1) {
|
||||
toDel.push_back (static_cast<FileBrowserEntry*>(t[i]));
|
||||
for (const auto entry : t) {
|
||||
if ((static_cast<FileBrowserEntry*>(entry))->thumbnail->getStage() == 1) {
|
||||
toDel.push_back(static_cast<FileBrowserEntry*>(entry));
|
||||
}
|
||||
|
||||
}
|
||||
if (toDel.size() > 0) {
|
||||
deleteRequested(toDel, false, false);
|
||||
trashChanged();
|
||||
}
|
||||
}
|
||||
|
||||
bool FileCatalog::trashIsEmpty ()
|
||||
{
|
||||
const std::vector<ThumbBrowserEntryBase*> t = fileBrowser->getEntries ();
|
||||
|
||||
for (size_t i = 0; i < t.size(); i++)
|
||||
if ((static_cast<FileBrowserEntry*>(t[i]))->thumbnail->getStage() == 1) {
|
||||
const auto& t = fileBrowser->getEntries();
|
||||
|
||||
for (const auto entry : t) {
|
||||
if ((static_cast<FileBrowserEntry*>(entry))->thumbnail->getStage() == 1) {
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -141,7 +141,7 @@ private:
|
||||
IdleRegister idle_register;
|
||||
|
||||
void addAndOpenFile (const Glib::ustring& fname);
|
||||
void checkAndAddFile (Glib::RefPtr<Gio::File> info);
|
||||
void addFile (const Glib::ustring& fName);
|
||||
std::vector<Glib::ustring> getFileList ();
|
||||
BrowserFilter getFilter ();
|
||||
void trashChanged ();
|
||||
|
@ -29,12 +29,14 @@ Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::unRankIcon;
|
||||
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::trashIcon;
|
||||
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::unTrashIcon;
|
||||
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::processIcon;
|
||||
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::colorLabelIcon_0;
|
||||
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::colorLabelIcon_1;
|
||||
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::colorLabelIcon_2;
|
||||
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::colorLabelIcon_3;
|
||||
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::colorLabelIcon_4;
|
||||
Cairo::RefPtr<RTSurface> FileThumbnailButtonSet::colorLabelIcon_5;
|
||||
std::array<Cairo::RefPtr<RTSurface>, 6> FileThumbnailButtonSet::colorLabelIcon;
|
||||
|
||||
Glib::ustring FileThumbnailButtonSet::processToolTip;
|
||||
Glib::ustring FileThumbnailButtonSet::unrankToolTip;
|
||||
Glib::ustring FileThumbnailButtonSet::trashToolTip;
|
||||
Glib::ustring FileThumbnailButtonSet::untrashToolTip;
|
||||
Glib::ustring FileThumbnailButtonSet::colorLabelToolTip;
|
||||
std::array<Glib::ustring, 5> FileThumbnailButtonSet::rankToolTip;
|
||||
|
||||
FileThumbnailButtonSet::FileThumbnailButtonSet (FileBrowserEntry* myEntry)
|
||||
{
|
||||
@ -46,32 +48,36 @@ FileThumbnailButtonSet::FileThumbnailButtonSet (FileBrowserEntry* myEntry)
|
||||
trashIcon = Cairo::RefPtr<RTSurface>(new RTSurface("trash-small.png"));
|
||||
unTrashIcon = Cairo::RefPtr<RTSurface>(new RTSurface("trash-remove-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;
|
||||
}
|
||||
|
||||
add (new LWButton (processIcon, 6, myEntry, LWButton::Left, LWButton::Center, M("FILEBROWSER_POPUPPROCESS")));
|
||||
add (new LWButton (unRankIcon, 0, myEntry, LWButton::Left, LWButton::Center, M("FILEBROWSER_UNRANK_TOOLTIP")));
|
||||
add(new LWButton(processIcon, 6, myEntry, LWButton::Left, LWButton::Center, &processToolTip));
|
||||
add(new LWButton(unRankIcon, 0, myEntry, LWButton::Left, LWButton::Center, &unrankToolTip));
|
||||
|
||||
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 (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"));
|
||||
add(new LWButton(trashIcon, 7, myEntry, LWButton::Right, LWButton::Center, &trashToolTip));
|
||||
add(new LWButton(colorLabelIcon[0], 8, myEntry, LWButton::Right, LWButton::Center, &colorLabelToolTip));
|
||||
}
|
||||
|
||||
void FileThumbnailButtonSet::setRank (int stars)
|
||||
@ -85,28 +91,8 @@ void FileThumbnailButtonSet::setRank (int stars)
|
||||
void FileThumbnailButtonSet::setColorLabel (int colorLabel)
|
||||
{
|
||||
|
||||
if (colorLabel == 0) {
|
||||
buttons[8]->setIcon (colorLabelIcon_0); //transparent label
|
||||
}
|
||||
|
||||
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);
|
||||
if (colorLabel >= 0 && colorLabel <= 5) {
|
||||
buttons[8]->setIcon(colorLabelIcon[colorLabel]);
|
||||
}
|
||||
}
|
||||
|
||||
@ -114,5 +100,5 @@ void FileThumbnailButtonSet::setInTrash (bool inTrash)
|
||||
{
|
||||
|
||||
buttons[7]->setIcon(inTrash ? unTrashIcon : trashIcon);
|
||||
buttons[7]->setToolTip (inTrash ? M("FILEBROWSER_POPUPUNTRASH") : M("FILEBROWSER_POPUPTRASH"));
|
||||
buttons[7]->setToolTip(inTrash ? &untrashToolTip : &trashToolTip);
|
||||
}
|
||||
|
@ -19,6 +19,8 @@
|
||||
#ifndef _FILETHUMBNAILBUTTONSET_
|
||||
#define _FILETHUMBNAILBUTTONSET_
|
||||
|
||||
#include <array>
|
||||
|
||||
#include "lwbuttonset.h"
|
||||
#include <gtkmm.h>
|
||||
#include "filebrowserentry.h"
|
||||
@ -38,12 +40,14 @@ public:
|
||||
static Cairo::RefPtr<RTSurface> unTrashIcon;
|
||||
static Cairo::RefPtr<RTSurface> processIcon;
|
||||
|
||||
static Cairo::RefPtr<RTSurface> colorLabelIcon_0;
|
||||
static Cairo::RefPtr<RTSurface> colorLabelIcon_1;
|
||||
static Cairo::RefPtr<RTSurface> colorLabelIcon_2;
|
||||
static Cairo::RefPtr<RTSurface> colorLabelIcon_3;
|
||||
static Cairo::RefPtr<RTSurface> colorLabelIcon_4;
|
||||
static Cairo::RefPtr<RTSurface> colorLabelIcon_5;
|
||||
static std::array<Cairo::RefPtr<RTSurface>, 6> colorLabelIcon;
|
||||
|
||||
static Glib::ustring processToolTip;
|
||||
static Glib::ustring unrankToolTip;
|
||||
static Glib::ustring trashToolTip;
|
||||
static Glib::ustring untrashToolTip;
|
||||
static Glib::ustring colorLabelToolTip;
|
||||
static std::array<Glib::ustring, 5> rankToolTip;
|
||||
|
||||
explicit FileThumbnailButtonSet (FileBrowserEntry* myEntry);
|
||||
void setRank (int stars);
|
||||
|
@ -87,7 +87,7 @@ public:
|
||||
|
||||
/** @brief Get the on/off state
|
||||
*/
|
||||
bool isActive()
|
||||
bool isActive() const
|
||||
{
|
||||
return active;
|
||||
};
|
||||
|
@ -19,7 +19,7 @@
|
||||
#include "lwbutton.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)
|
||||
{
|
||||
|
||||
@ -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;
|
||||
@ -45,7 +45,7 @@ void LWButton::setPosition (int x, int y)
|
||||
ypos = y;
|
||||
}
|
||||
|
||||
void LWButton::getPosition (int& x, int& y)
|
||||
void LWButton::getPosition (int& x, int& y) const
|
||||
{
|
||||
|
||||
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;
|
||||
@ -82,7 +82,7 @@ void LWButton::setColors (const Gdk::RGBA& bg, const Gdk::RGBA& fg)
|
||||
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;
|
||||
@ -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;
|
||||
va = valign;
|
||||
}
|
||||
|
||||
Glib::ustring LWButton::getToolTip (int x, int y)
|
||||
Glib::ustring LWButton::getToolTip (int x, int y) const
|
||||
{
|
||||
|
||||
if (inside(x, y)) {
|
||||
return toolTip;
|
||||
if (toolTip) {
|
||||
return *toolTip;
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
} else {
|
||||
return "";
|
||||
}
|
||||
}
|
||||
|
||||
void LWButton::setToolTip (const Glib::ustring& tooltip)
|
||||
void LWButton::setToolTip (Glib::ustring* tooltip)
|
||||
{
|
||||
|
||||
toolTip = tooltip;
|
||||
|
@ -49,26 +49,26 @@ private:
|
||||
LWButtonListener* listener;
|
||||
int actionCode;
|
||||
void* actionData;
|
||||
Glib::ustring toolTip;
|
||||
Glib::ustring* toolTip;
|
||||
|
||||
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 getAlignment (Alignment& ha, Alignment& va);
|
||||
void getSize (int& minw, int& minh) const;
|
||||
void getAlignment (Alignment& ha, Alignment& va) const;
|
||||
void setPosition (int x, int y);
|
||||
void getPosition (int& x, int& y);
|
||||
bool inside (int x, int y);
|
||||
void getPosition (int& x, int& y) const;
|
||||
bool inside (int x, int y) const;
|
||||
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 setToolTip (const Glib::ustring& tooltip);
|
||||
void setToolTip (Glib::ustring* tooltip);
|
||||
|
||||
bool motionNotify (int x, int y);
|
||||
bool pressNotify (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)
|
||||
{
|
||||
|
@ -18,7 +18,7 @@
|
||||
*/
|
||||
#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;
|
||||
h = 0;
|
||||
|
||||
for (size_t i = 0; i < buttons.size(); i++) {
|
||||
for (const auto entry : buttons) {
|
||||
int bw, bh;
|
||||
buttons[i]->getSize (bw, bh);
|
||||
entry->getSize(bw, bh);
|
||||
w += bw;
|
||||
|
||||
if (bh > h) {
|
||||
h = bh;
|
||||
}
|
||||
h = std::max(bh, 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;
|
||||
getMinimalDimensions (mw, mh);
|
||||
|
||||
|
@ -369,6 +369,7 @@ void Options::setDefaults()
|
||||
multiUser = true;
|
||||
profilePath = "profiles";
|
||||
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
|
||||
thumbSize = 160;
|
||||
thumbSizeTab = 160;
|
||||
@ -412,6 +413,7 @@ void Options::setDefaults()
|
||||
favorites.clear();
|
||||
parseExtensionsEnabled.clear();
|
||||
parsedExtensions.clear();
|
||||
parsedExtensionsSet.clear();
|
||||
renameUseTemplates = false;
|
||||
renameTemplates.clear();
|
||||
thumbnailZoomRatios.clear();
|
||||
@ -648,10 +650,12 @@ Options* Options::copyFrom(Options* other)
|
||||
void Options::filterOutParsedExtensions()
|
||||
{
|
||||
parsedExtensions.clear();
|
||||
parsedExtensionsSet.clear();
|
||||
|
||||
for (unsigned int i = 0; i < parseExtensions.size(); i++)
|
||||
if (parseExtensionsEnabled[i]) {
|
||||
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", "LastLensProfileDir", lastLensProfileDir);
|
||||
safeDirGet(keyFile, "Dialogs", "LastICCProfCreatorDir", lastICCProfCreatorDir);
|
||||
safeDirGet(keyFile, "Dialogs", "LastCopyMovePath", lastCopyMovePath);
|
||||
|
||||
if (keyFile.has_key("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", "LastLensProfileDir", lastLensProfileDir);
|
||||
keyFile.set_string("Dialogs", "LastICCProfCreatorDir", lastICCProfCreatorDir);
|
||||
keyFile.set_string("Dialogs", "LastCopyMovePath", lastCopyMovePath);
|
||||
keyFile.set_boolean("Dialogs", "GimpPluginShowInfoDialog", gimpPluginShowInfoDialog);
|
||||
|
||||
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
|
||||
*/
|
||||
bool Options::has_retained_extention(Glib::ustring fname)
|
||||
bool Options::has_retained_extention(const Glib::ustring& fname)
|
||||
{
|
||||
|
||||
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 parsedExtensionsSet.find(getExtension(fname).lowercase()) != parsedExtensionsSet.end();
|
||||
}
|
||||
|
||||
/*
|
||||
* 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++)
|
||||
if (parseExtensions[j].casefold() == ext.casefold()) {
|
||||
return j >= (int)parseExtensionsEnabled.size() || parseExtensionsEnabled[j];
|
||||
}
|
||||
|
||||
return false;
|
||||
return parsedExtensionsSet.find(ext.lowercase()) != parsedExtensionsSet.end();
|
||||
}
|
||||
|
||||
Glib::ustring Options::getUserProfilePath()
|
||||
|
@ -19,6 +19,7 @@
|
||||
#ifndef _OPTIONS_
|
||||
#define _OPTIONS_
|
||||
|
||||
#include <set>
|
||||
#include <gtkmm.h>
|
||||
#include "../rtengine/rtengine.h"
|
||||
#include <exception>
|
||||
@ -174,6 +175,7 @@ public:
|
||||
Glib::ustring startupPath;
|
||||
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
|
||||
Glib::ustring lastCopyMovePath;
|
||||
Glib::ustring loadSaveProfilePath;
|
||||
Glib::ustring lastSaveAsPath;
|
||||
int saveAsDialogWidth;
|
||||
@ -259,6 +261,7 @@ public:
|
||||
std::vector<Glib::ustring> parseExtensions; // List containing all extensions type
|
||||
std::vector<int> parseExtensionsEnabled; // List of bool to retain extension or not
|
||||
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;
|
||||
bool autoSaveTpOpen;
|
||||
//std::vector<int> crvOpen;
|
||||
@ -422,8 +425,8 @@ public:
|
||||
Glib::ustring getGlobalProfilePath();
|
||||
Glib::ustring findProfilePath (Glib::ustring &profName);
|
||||
bool is_parse_extention (Glib::ustring fname);
|
||||
bool has_retained_extention (Glib::ustring fname);
|
||||
bool is_extention_enabled (Glib::ustring ext);
|
||||
bool has_retained_extention (const Glib::ustring& fname);
|
||||
bool is_extention_enabled (const Glib::ustring& ext);
|
||||
bool is_defProfRawMissing();
|
||||
bool is_bundledDefProfRawMissing();
|
||||
bool is_defProfImgMissing();
|
||||
|
@ -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)
|
||||
|
@ -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);
|
||||
|
@ -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