Some changes suggested by @Floessie
This commit is contained in:
parent
2a4891827d
commit
79431ffa1d
@ -5396,7 +5396,7 @@ void ImProcFunctions::getAutoExp (const LUTu &histogram, int histcompr, double
|
|||||||
octile[count] += histogram[j];
|
octile[count] += histogram[j];
|
||||||
|
|
||||||
if (octile[count] > sum / 8.f || (count == 7 && octile[count] > sum / 16.f)) {
|
if (octile[count] > sum / 8.f || (count == 7 && octile[count] > sum / 16.f)) {
|
||||||
octile[count] = xlog (1. + (float)j) / log (2.f);
|
octile[count] = xlog (1. + j) / log (2.f);
|
||||||
count++;// = min(count+1,7);
|
count++;// = min(count+1,7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -5409,7 +5409,7 @@ void ImProcFunctions::getAutoExp (const LUTu &histogram, int histcompr, double
|
|||||||
octile[count] += histogram[j];
|
octile[count] += histogram[j];
|
||||||
|
|
||||||
if (octile[count] > sum / 8.f || (count == 7 && octile[count] > sum / 16.f)) {
|
if (octile[count] > sum / 8.f || (count == 7 && octile[count] > sum / 16.f)) {
|
||||||
octile[count] = xlog (1. + (float)j) / log (2.f);
|
octile[count] = xlog (1. + j) / log (2.f);
|
||||||
count++;// = min(count+1,7);
|
count++;// = min(count+1,7);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -147,7 +147,7 @@ int BatchQueue::getThumbnailHeight ()
|
|||||||
return std::max(std::min(options.thumbSizeQueue, 200), 10);
|
return std::max(std::min(options.thumbSizeQueue, 200), 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
void BatchQueue::rightClicked (ThumbBrowserEntryBase* entry)
|
void BatchQueue::rightClicked ()
|
||||||
{
|
{
|
||||||
pmenu.popup (3, this->eventTime);
|
pmenu.popup (3, this->eventTime);
|
||||||
}
|
}
|
||||||
|
@ -74,7 +74,7 @@ public:
|
|||||||
void error(const Glib::ustring& descr) override;
|
void error(const Glib::ustring& descr) override;
|
||||||
rtengine::ProcessingJob* imageReady(rtengine::IImagefloat* img) override;
|
rtengine::ProcessingJob* imageReady(rtengine::IImagefloat* img) override;
|
||||||
|
|
||||||
void rightClicked (ThumbBrowserEntryBase* entry) override;
|
void rightClicked () override;
|
||||||
void doubleClicked (ThumbBrowserEntryBase* entry) override;
|
void doubleClicked (ThumbBrowserEntryBase* entry) override;
|
||||||
bool keyPressed (GdkEventKey* event) override;
|
bool keyPressed (GdkEventKey* event) override;
|
||||||
void buttonPressed (LWButton* button, int actionCode, void* actionData) override;
|
void buttonPressed (LWButton* button, int actionCode, void* actionData) override;
|
||||||
|
@ -137,43 +137,47 @@ bool ExtProgStore::searchProgram (const Glib::ustring& name,
|
|||||||
action.name = name;
|
action.name = name;
|
||||||
action.target = (allowRaw ? 1 : 2);
|
action.target = (allowRaw ? 1 : 2);
|
||||||
|
|
||||||
|
auto& filePath = action.filePathEXE;
|
||||||
|
|
||||||
if (maxVer > 0) {
|
if (maxVer > 0) {
|
||||||
|
|
||||||
for (auto ver = maxVer; ver >= 0; ver--) {
|
for (auto ver = maxVer; ver >= 0; ver--) {
|
||||||
|
|
||||||
auto filePath = progFilesDir + "\\" + Glib::ustring::compose(exePath, ver);
|
filePath = progFilesDir + "\\" + Glib::ustring::compose(exePath, ver);
|
||||||
|
|
||||||
if (Glib::file_test (filePath, Glib::FILE_TEST_EXISTS)) {
|
if (Glib::file_test(filePath, Glib::FILE_TEST_EXISTS)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!exePath86.empty ()) {
|
if (!exePath86.empty()) {
|
||||||
|
|
||||||
filePath = progFilesDirx86 + "\\" + Glib::ustring::compose(exePath86, ver);
|
filePath = progFilesDirx86 + "\\" + Glib::ustring::compose(exePath86, ver);
|
||||||
|
|
||||||
if (Glib::file_test (filePath, Glib::FILE_TEST_EXISTS)) {
|
if (Glib::file_test(filePath, Glib::FILE_TEST_EXISTS)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
filePath.clear();
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
||||||
do {
|
do {
|
||||||
|
|
||||||
auto filePath = progFilesDir + "\\" + exePath;
|
filePath = progFilesDir + "\\" + exePath;
|
||||||
|
|
||||||
if (Glib::file_test (filePath, Glib::FILE_TEST_EXISTS)) {
|
if (Glib::file_test(filePath, Glib::FILE_TEST_EXISTS)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!exePath86.empty ()) {
|
if (!exePath86.empty()) {
|
||||||
|
|
||||||
filePath = progFilesDirx86 + "\\" + exePath86;
|
filePath = progFilesDirx86 + "\\" + exePath86;
|
||||||
|
|
||||||
if (Glib::file_test (filePath, Glib::FILE_TEST_EXISTS)) {
|
if (Glib::file_test(filePath, Glib::FILE_TEST_EXISTS)) {
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
filePath.clear();
|
||||||
} while (false);
|
} while (false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -90,41 +90,36 @@ ThumbBrowserEntryBase* selectOriginalEntry (ThumbBrowserEntryBase* original, Thu
|
|||||||
|
|
||||||
void findOriginalEntries (const std::vector<ThumbBrowserEntryBase*>& entries)
|
void findOriginalEntries (const std::vector<ThumbBrowserEntryBase*>& entries)
|
||||||
{
|
{
|
||||||
typedef std::vector<ThumbBrowserEntryBase*> EntryVector;
|
|
||||||
typedef EntryVector::const_iterator EntryIterator;
|
|
||||||
typedef std::map<Glib::ustring, EntryVector> BasenameMap;
|
|
||||||
typedef BasenameMap::const_iterator BasenameIterator;
|
|
||||||
|
|
||||||
// Sort all entries into buckets by basename without extension
|
// Sort all entries into buckets by basename without extension
|
||||||
BasenameMap byBasename;
|
std::map<Glib::ustring, std::vector<ThumbBrowserEntryBase*>> byBasename;
|
||||||
|
|
||||||
for (EntryIterator entry = entries.begin (); entry != entries.end (); ++entry) {
|
for (const auto entry : entries) {
|
||||||
const Glib::ustring basename = Glib::path_get_basename ((*entry)->filename.lowercase());
|
const auto basename = Glib::path_get_basename(entry->filename.lowercase());
|
||||||
|
|
||||||
const Glib::ustring::size_type pos = basename.find_last_of ('.');
|
const auto pos = basename.find_last_of('.');
|
||||||
if (pos >= basename.length () - 1) {
|
if (pos >= basename.length() - 1) {
|
||||||
(*entry)->setOriginal (nullptr);
|
entry->setOriginal(nullptr);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
const Glib::ustring withoutExtension = basename.substr (0, pos);
|
const auto withoutExtension = basename.substr(0, pos);
|
||||||
|
|
||||||
byBasename[withoutExtension].push_back (*entry);
|
byBasename[withoutExtension].push_back(entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Find the original image for each bucket
|
// Find the original image for each bucket
|
||||||
for (BasenameIterator bucket = byBasename.begin (); bucket != byBasename.end (); ++bucket) {
|
for (const auto& bucket : byBasename) {
|
||||||
const EntryVector& lentries = bucket->second;
|
const auto& lentries = bucket.second;
|
||||||
ThumbBrowserEntryBase* original = nullptr;
|
ThumbBrowserEntryBase* original = nullptr;
|
||||||
|
|
||||||
// Select the most likely original in a first pass...
|
// Select the most likely original in a first pass...
|
||||||
for (EntryIterator entry = lentries.begin (); entry != lentries.end (); ++entry) {
|
for (const auto entry : lentries) {
|
||||||
original = selectOriginalEntry (original, *entry);
|
original = selectOriginalEntry(original, entry);
|
||||||
}
|
}
|
||||||
|
|
||||||
// ...and link all other images to it in a second pass.
|
// ...and link all other images to it in a second pass.
|
||||||
for (EntryIterator entry = lentries.begin (); entry != lentries.end (); ++entry) {
|
for (const auto entry : lentries) {
|
||||||
(*entry)->setOriginal (*entry != original ? original : nullptr);
|
entry->setOriginal(entry != original ? original : nullptr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -487,7 +482,7 @@ FileBrowser::~FileBrowser ()
|
|||||||
delete[] amiExtProg;
|
delete[] amiExtProg;
|
||||||
}
|
}
|
||||||
|
|
||||||
void FileBrowser::rightClicked (ThumbBrowserEntryBase* entry)
|
void FileBrowser::rightClicked ()
|
||||||
{
|
{
|
||||||
|
|
||||||
{
|
{
|
||||||
|
@ -174,7 +174,7 @@ public:
|
|||||||
void buttonPressed (LWButton* button, int actionCode, void* actionData) override;
|
void buttonPressed (LWButton* button, int actionCode, void* actionData) override;
|
||||||
void redrawNeeded (LWButton* button) override;
|
void redrawNeeded (LWButton* button) override;
|
||||||
bool checkFilter (ThumbBrowserEntryBase* entry) const override;
|
bool checkFilter (ThumbBrowserEntryBase* entry) const override;
|
||||||
void rightClicked (ThumbBrowserEntryBase* entry) override;
|
void rightClicked () override;
|
||||||
void doubleClicked (ThumbBrowserEntryBase* entry) override;
|
void doubleClicked (ThumbBrowserEntryBase* entry) override;
|
||||||
bool keyPressed (GdkEventKey* event) override;
|
bool keyPressed (GdkEventKey* event) override;
|
||||||
|
|
||||||
|
@ -948,19 +948,19 @@ bool MyScrolledWindow::on_scroll_event (GdkEventScroll* event)
|
|||||||
double step = adjust->get_step_increment();
|
double step = adjust->get_step_increment();
|
||||||
|
|
||||||
if (event->direction == GDK_SCROLL_DOWN) {
|
if (event->direction == GDK_SCROLL_DOWN) {
|
||||||
double value2 = rtengine::min<double>(value + step, upperBound);
|
const double value2 = rtengine::min<double>(value + step, upperBound);
|
||||||
|
|
||||||
if (value2 != value) {
|
if (value2 != value) {
|
||||||
scroll->set_value(value2);
|
scroll->set_value(value2);
|
||||||
}
|
}
|
||||||
} else if (event->direction == GDK_SCROLL_UP) {
|
} else if (event->direction == GDK_SCROLL_UP) {
|
||||||
double value2 = rtengine::max<double>(value - step, lowerBound);
|
const double value2 = rtengine::max<double>(value - step, lowerBound);
|
||||||
|
|
||||||
if (value2 != value) {
|
if (value2 != value) {
|
||||||
scroll->set_value(value2);
|
scroll->set_value(value2);
|
||||||
}
|
}
|
||||||
} else if (event->direction == GDK_SCROLL_SMOOTH) {
|
} else if (event->direction == GDK_SCROLL_SMOOTH) {
|
||||||
double value2 = rtengine::LIM<double>(value + event->delta_y * step, lowerBound, upperBound);
|
const double value2 = rtengine::LIM<double>(value + event->delta_y * step, lowerBound, upperBound);
|
||||||
|
|
||||||
if (value2 != value) {
|
if (value2 != value) {
|
||||||
scroll->set_value(value2);
|
scroll->set_value(value2);
|
||||||
|
@ -289,7 +289,7 @@ void LockableColorPicker::getImagePosition (rtengine::Coord &imgPos) const
|
|||||||
imgPos = position;
|
imgPos = position;
|
||||||
}
|
}
|
||||||
|
|
||||||
void LockableColorPicker::getScreenPosition (rtengine::Coord &screenPos)
|
void LockableColorPicker::getScreenPosition (rtengine::Coord &screenPos) const
|
||||||
{
|
{
|
||||||
if (cropWindow) {
|
if (cropWindow) {
|
||||||
cropWindow->imageCoordToScreen(position.x, position.y, screenPos.x, screenPos.y);
|
cropWindow->imageCoordToScreen(position.x, position.y, screenPos.x, screenPos.y);
|
||||||
|
@ -80,7 +80,7 @@ public:
|
|||||||
void setPosition (const rtengine::Coord &newPos);
|
void setPosition (const rtengine::Coord &newPos);
|
||||||
void setRGB (const float R, const float G, const float B, const float previewR, const float previewG, const float previewB);
|
void setRGB (const float R, const float G, const float B, const float previewR, const float previewG, const float previewB);
|
||||||
void getImagePosition (rtengine::Coord &imgPos) const;
|
void getImagePosition (rtengine::Coord &imgPos) const;
|
||||||
void getScreenPosition (rtengine::Coord &screenPos);
|
void getScreenPosition (rtengine::Coord &screenPos) const;
|
||||||
Size getSize () const;
|
Size getSize () const;
|
||||||
bool isOver (int x, int y);
|
bool isOver (int x, int y);
|
||||||
void setValidity (Validity isValid);
|
void setValidity (Validity isValid);
|
||||||
|
@ -79,8 +79,8 @@ class ProgressConnector
|
|||||||
static int emitEndSignalUI (void* data)
|
static int emitEndSignalUI (void* data)
|
||||||
{
|
{
|
||||||
|
|
||||||
sigc::signal0<bool>* lopEnd = (sigc::signal0<bool>*) data;
|
const sigc::signal0<bool>* lopEnd = reinterpret_cast<sigc::signal0<bool>*>(data);
|
||||||
int r = lopEnd->emit ();
|
const int r = lopEnd->emit ();
|
||||||
delete lopEnd;
|
delete lopEnd;
|
||||||
|
|
||||||
return r;
|
return r;
|
||||||
|
@ -44,7 +44,7 @@ extern unsigned char initialGdkScale;
|
|||||||
static gboolean
|
static gboolean
|
||||||
osx_should_quit_cb (GtkosxApplication *app, gpointer data)
|
osx_should_quit_cb (GtkosxApplication *app, gpointer data)
|
||||||
{
|
{
|
||||||
RTWindow *rtWin = static_cast<RTWindow*>(data);
|
RTWindow * const rtWin = static_cast<RTWindow*>(data);
|
||||||
return rtWin->on_delete_event (0);
|
return rtWin->on_delete_event (0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -967,7 +967,7 @@ void ThumbBrowserBase::buttonPressed (int x, int y, int button, GdkEventType typ
|
|||||||
}
|
}
|
||||||
|
|
||||||
MYWRITERLOCK_RELEASE(l);
|
MYWRITERLOCK_RELEASE(l);
|
||||||
rightClicked (fileDescr);
|
rightClicked ();
|
||||||
}
|
}
|
||||||
} // end of MYWRITERLOCK(l, entryRW);
|
} // end of MYWRITERLOCK(l, entryRW);
|
||||||
|
|
||||||
|
@ -225,7 +225,7 @@ public:
|
|||||||
{
|
{
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
virtual void rightClicked (ThumbBrowserEntryBase* entry) {}
|
virtual void rightClicked () = 0;
|
||||||
virtual void doubleClicked (ThumbBrowserEntryBase* entry) {}
|
virtual void doubleClicked (ThumbBrowserEntryBase* entry) {}
|
||||||
virtual bool keyPressed (GdkEventKey* event)
|
virtual bool keyPressed (GdkEventKey* event)
|
||||||
{
|
{
|
||||||
|
@ -590,7 +590,7 @@ void Thumbnail::decreaseRef ()
|
|||||||
cachemgr->closeThumbnail (this);
|
cachemgr->closeThumbnail (this);
|
||||||
}
|
}
|
||||||
|
|
||||||
int Thumbnail::getThumbnailWidth (const int &h, const rtengine::procparams::ProcParams *pparams) const
|
int Thumbnail::getThumbnailWidth (const int h, const rtengine::procparams::ProcParams *pparams) const
|
||||||
{
|
{
|
||||||
int tw_ = tw;
|
int tw_ = tw;
|
||||||
int th_ = th;
|
int th_ = th;
|
||||||
|
@ -119,7 +119,7 @@ public:
|
|||||||
// unsigned char* getThumbnailImage (int &w, int &h, int fixwh=1); // fixwh = 0: fix w and calculate h, =1: fix h and calculate w
|
// unsigned char* getThumbnailImage (int &w, int &h, int fixwh=1); // fixwh = 0: fix w and calculate h, =1: fix h and calculate w
|
||||||
rtengine::IImage8* processThumbImage (const rtengine::procparams::ProcParams& pparams, int h, double& scale);
|
rtengine::IImage8* processThumbImage (const rtengine::procparams::ProcParams& pparams, int h, double& scale);
|
||||||
rtengine::IImage8* upgradeThumbImage (const rtengine::procparams::ProcParams& pparams, int h, double& scale);
|
rtengine::IImage8* upgradeThumbImage (const rtengine::procparams::ProcParams& pparams, int h, double& scale);
|
||||||
int getThumbnailWidth (const int &h, const rtengine::procparams::ProcParams *pparams = nullptr) const;
|
int getThumbnailWidth (int h, const rtengine::procparams::ProcParams *pparams = nullptr) const;
|
||||||
void getFinalSize (const rtengine::procparams::ProcParams& pparams, int& w, int& h);
|
void getFinalSize (const rtengine::procparams::ProcParams& pparams, int& w, int& h);
|
||||||
void getOriginalSize (int& w, int& h);
|
void getOriginalSize (int& w, int& h);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user