Some changes suggested by @Floessie

This commit is contained in:
Ingo Weyrich 2019-11-26 19:42:48 +01:00
parent 2a4891827d
commit 79431ffa1d
15 changed files with 44 additions and 45 deletions

View File

@ -5396,7 +5396,7 @@ void ImProcFunctions::getAutoExp (const LUTu &histogram, int histcompr, double
octile[count] += histogram[j];
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);
}
}
@ -5409,7 +5409,7 @@ void ImProcFunctions::getAutoExp (const LUTu &histogram, int histcompr, double
octile[count] += histogram[j];
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);
}
}

View File

@ -147,7 +147,7 @@ int BatchQueue::getThumbnailHeight ()
return std::max(std::min(options.thumbSizeQueue, 200), 10);
}
void BatchQueue::rightClicked (ThumbBrowserEntryBase* entry)
void BatchQueue::rightClicked ()
{
pmenu.popup (3, this->eventTime);
}

View File

@ -74,7 +74,7 @@ public:
void error(const Glib::ustring& descr) override;
rtengine::ProcessingJob* imageReady(rtengine::IImagefloat* img) override;
void rightClicked (ThumbBrowserEntryBase* entry) override;
void rightClicked () override;
void doubleClicked (ThumbBrowserEntryBase* entry) override;
bool keyPressed (GdkEventKey* event) override;
void buttonPressed (LWButton* button, int actionCode, void* actionData) override;

View File

@ -137,43 +137,47 @@ bool ExtProgStore::searchProgram (const Glib::ustring& name,
action.name = name;
action.target = (allowRaw ? 1 : 2);
auto& filePath = action.filePathEXE;
if (maxVer > 0) {
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;
}
if (!exePath86.empty ()) {
if (!exePath86.empty()) {
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;
}
}
filePath.clear();
}
} else {
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;
}
if (!exePath86.empty ()) {
if (!exePath86.empty()) {
filePath = progFilesDirx86 + "\\" + exePath86;
if (Glib::file_test (filePath, Glib::FILE_TEST_EXISTS)) {
if (Glib::file_test(filePath, Glib::FILE_TEST_EXISTS)) {
break;
}
}
filePath.clear();
} while (false);
}

View File

@ -90,41 +90,36 @@ ThumbBrowserEntryBase* selectOriginalEntry (ThumbBrowserEntryBase* original, Thu
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
BasenameMap byBasename;
std::map<Glib::ustring, std::vector<ThumbBrowserEntryBase*>> byBasename;
for (EntryIterator entry = entries.begin (); entry != entries.end (); ++entry) {
const Glib::ustring basename = Glib::path_get_basename ((*entry)->filename.lowercase());
for (const auto entry : entries) {
const auto basename = Glib::path_get_basename(entry->filename.lowercase());
const Glib::ustring::size_type pos = basename.find_last_of ('.');
if (pos >= basename.length () - 1) {
(*entry)->setOriginal (nullptr);
const auto pos = basename.find_last_of('.');
if (pos >= basename.length() - 1) {
entry->setOriginal(nullptr);
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
for (BasenameIterator bucket = byBasename.begin (); bucket != byBasename.end (); ++bucket) {
const EntryVector& lentries = bucket->second;
for (const auto& bucket : byBasename) {
const auto& lentries = bucket.second;
ThumbBrowserEntryBase* original = nullptr;
// Select the most likely original in a first pass...
for (EntryIterator entry = lentries.begin (); entry != lentries.end (); ++entry) {
original = selectOriginalEntry (original, *entry);
for (const auto entry : lentries) {
original = selectOriginalEntry(original, entry);
}
// ...and link all other images to it in a second pass.
for (EntryIterator entry = lentries.begin (); entry != lentries.end (); ++entry) {
(*entry)->setOriginal (*entry != original ? original : nullptr);
for (const auto entry : lentries) {
entry->setOriginal(entry != original ? original : nullptr);
}
}
}
@ -487,7 +482,7 @@ FileBrowser::~FileBrowser ()
delete[] amiExtProg;
}
void FileBrowser::rightClicked (ThumbBrowserEntryBase* entry)
void FileBrowser::rightClicked ()
{
{

View File

@ -174,7 +174,7 @@ public:
void buttonPressed (LWButton* button, int actionCode, void* actionData) override;
void redrawNeeded (LWButton* button) override;
bool checkFilter (ThumbBrowserEntryBase* entry) const override;
void rightClicked (ThumbBrowserEntryBase* entry) override;
void rightClicked () override;
void doubleClicked (ThumbBrowserEntryBase* entry) override;
bool keyPressed (GdkEventKey* event) override;

View File

@ -948,19 +948,19 @@ bool MyScrolledWindow::on_scroll_event (GdkEventScroll* event)
double step = adjust->get_step_increment();
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) {
scroll->set_value(value2);
}
} 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) {
scroll->set_value(value2);
}
} 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) {
scroll->set_value(value2);

View File

@ -289,7 +289,7 @@ void LockableColorPicker::getImagePosition (rtengine::Coord &imgPos) const
imgPos = position;
}
void LockableColorPicker::getScreenPosition (rtengine::Coord &screenPos)
void LockableColorPicker::getScreenPosition (rtengine::Coord &screenPos) const
{
if (cropWindow) {
cropWindow->imageCoordToScreen(position.x, position.y, screenPos.x, screenPos.y);

View File

@ -80,7 +80,7 @@ public:
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 getImagePosition (rtengine::Coord &imgPos) const;
void getScreenPosition (rtengine::Coord &screenPos);
void getScreenPosition (rtengine::Coord &screenPos) const;
Size getSize () const;
bool isOver (int x, int y);
void setValidity (Validity isValid);

View File

@ -79,8 +79,8 @@ class ProgressConnector
static int emitEndSignalUI (void* data)
{
sigc::signal0<bool>* lopEnd = (sigc::signal0<bool>*) data;
int r = lopEnd->emit ();
const sigc::signal0<bool>* lopEnd = reinterpret_cast<sigc::signal0<bool>*>(data);
const int r = lopEnd->emit ();
delete lopEnd;
return r;

View File

@ -44,7 +44,7 @@ extern unsigned char initialGdkScale;
static gboolean
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);
}

View File

@ -967,7 +967,7 @@ void ThumbBrowserBase::buttonPressed (int x, int y, int button, GdkEventType typ
}
MYWRITERLOCK_RELEASE(l);
rightClicked (fileDescr);
rightClicked ();
}
} // end of MYWRITERLOCK(l, entryRW);

View File

@ -225,7 +225,7 @@ public:
{
return true;
}
virtual void rightClicked (ThumbBrowserEntryBase* entry) {}
virtual void rightClicked () = 0;
virtual void doubleClicked (ThumbBrowserEntryBase* entry) {}
virtual bool keyPressed (GdkEventKey* event)
{

View File

@ -590,7 +590,7 @@ void Thumbnail::decreaseRef ()
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 th_ = th;

View File

@ -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
rtengine::IImage8* processThumbImage (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 getOriginalSize (int& w, int& h);