From 82f0e4f1171f2bdaae4d617263416e32c585415c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Fl=C3=B6ssie?= Date: Thu, 28 May 2020 11:06:41 +0200 Subject: [PATCH 1/5] Fix LGTM warning popping up in `newlocallab2` --- rtengine/labimage.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rtengine/labimage.cc b/rtengine/labimage.cc index 153af4c75..dd5ec4b05 100644 --- a/rtengine/labimage.cc +++ b/rtengine/labimage.cc @@ -36,7 +36,7 @@ LabImage::~LabImage () void LabImage::CopyFrom(LabImage *Img) { - memcpy(data, Img->data, W * H * 3 * sizeof(float)); + memcpy(data, Img->data, static_cast(W) * H * 3 * sizeof(float)); } void LabImage::getPipetteData (float &v1, float &v2, float &v3, int posX, int posY, int squareSize) From 320408306d6e3b6c95f5a77b0d25c0ee3c317002 Mon Sep 17 00:00:00 2001 From: Pandagrapher Date: Thu, 28 May 2020 12:26:14 +0200 Subject: [PATCH 2/5] Build improvements + fix for window size/position (macOS) (#5771) * Allow using relative path in MacOS for development builds * [macOS] Fixes RT "cache"/"config" folder not located in the right place In actual "dev" branch, RT "cache"/"config" folder is located in "~/Application Support/RawTherapee" folder instead of "~/Library/Application Support/RawTherapee" folder (as in v5.8 release and discribed in RawPedia). Moreover, "CACHE_NAME_SUFFIX" cMake option was not anymore considered. * [macOS] Remember RT window position correctly, fixes #3209 As described in GTK documentation, some OS Windows Manager do not consider setting window size and position before it is completely created (which seems to be the case for macOS). In this commit, restoring window size/position is now done after its creation. Morevover, macOS menu bar height is now considered. --- CMakeLists.txt | 5 +++++ rtgui/config.h.in | 3 ++- rtgui/main.cc | 1 + rtgui/options.cc | 29 ++++++++++--------------- rtgui/rtwindow.cc | 55 ++++++++++++++++++++++++++++++++--------------- rtgui/rtwindow.h | 1 + 6 files changed, 58 insertions(+), 36 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7d66109e0..1c6530734 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -68,6 +68,11 @@ set(CACHE_NAME_SUFFIX "" CACHE STRING "RawTherapee's cache folder suffix") +# For macOS only, OSX_DEV_BUILD option allows using relative paths instead of absolute +# paths. Consequently, for development builds, application can be launching without +# being bundled. However, file access can be restricted for some folder. +option(OSX_DEV_BUILD "Generate macOS development builds" OFF) + # By default we don't use a specific processor target, so PROC_TARGET_NUMBER is # set to 0. Specify other values to optimize for specific processor architecture # as listed in ProcessorTargets.cmake: diff --git a/rtgui/config.h.in b/rtgui/config.h.in index 558c25f76..d3fc58cf7 100644 --- a/rtgui/config.h.in +++ b/rtgui/config.h.in @@ -22,8 +22,9 @@ #cmakedefine BUILD_BUNDLE #cmakedefine HAVE_UNALIGNED_MALLOC +#cmakedefine OSX_DEV_BUILD -#ifdef __APPLE__ +#if defined(__APPLE__) && !defined(OSX_DEV_BUILD) #define DATA_SEARCH_PATH "/Applications/RawTherapee.app/Contents/Resources/share" #define DOC_SEARCH_PATH "/Applications/RawTherapee.app/Contents/Resources" #define CREDITS_SEARCH_PATH "/Applications/RawTherapee.app/Contents/Resources" diff --git a/rtgui/main.cc b/rtgui/main.cc index f669bcf4a..63669f49c 100644 --- a/rtgui/main.cc +++ b/rtgui/main.cc @@ -255,6 +255,7 @@ RTWindow *create_rt_window() //gdk_threads_enter (); RTWindow *rtWindow = new RTWindow(); + rtWindow->setWindowSize(); // Need to be called after RTWindow creation to work with all OS Windows Manager return rtWindow; } diff --git a/rtgui/options.cc b/rtgui/options.cc index 7ae6c24aa..b57a2f29d 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -2325,18 +2325,8 @@ void Options::load(bool lightweight) const gchar* path; Glib::ustring dPath; -#ifdef __APPLE__ - // Build Application Support directory path for macOS. - const char* homedir = g_getenv("HOME"); // This returns the current container data dir in ~/Library - std::string homebuf{homedir}; - int homelength = strlen(homebuf.c_str()); - homebuf[homelength-44] = '\0'; // Terminate string after ${HOME}/Library - std::string homeconfig{homebuf}; - std::strcat(&homeconfig[0], "/Application Support/RawTherapee/config"); - path = homeconfig.c_str(); -#else path = g_getenv("RT_SETTINGS"); -#endif + if (path != nullptr) { rtdir = Glib::ustring(path); @@ -2356,7 +2346,11 @@ void Options::load(bool lightweight) } #else + #ifdef __APPLE__ + rtdir = Glib::build_filename(Glib::ustring(g_get_home_dir()), "/Library/Application Support/", Glib::ustring(CACHEFOLDERNAME), "/config/"); + #else rtdir = Glib::build_filename(Glib::ustring(g_get_user_config_dir()), Glib::ustring(CACHEFOLDERNAME)); + #endif #endif } @@ -2378,14 +2372,9 @@ void Options::load(bool lightweight) rtdir = Glib::build_filename(argv0, "mysettings"); } - // Modify the path of the cache folder to the one provided in RT_CACHE environment variable. Build the cache folder name in macOS. -#ifdef __APPLE__ - std::string homecache{homebuf}; - std::strcat(&homecache[0], "/Application Support/RawTherapee/cache"); - path = homecache.c_str(); -#else + // Modify the path of the cache folder to the one provided in RT_CACHE environment variable. path = g_getenv("RT_CACHE"); -#endif + if (path != nullptr) { cacheBaseDir = Glib::ustring(path); @@ -2400,7 +2389,11 @@ void Options::load(bool lightweight) #ifdef WIN32 cacheBaseDir = Glib::build_filename(rtdir, "cache"); #else + #ifdef __APPLE__ + cacheBaseDir = Glib::build_filename(Glib::ustring(g_get_home_dir()), "/Library/Application Support/", Glib::ustring(CACHEFOLDERNAME), "/cache/"); + #else cacheBaseDir = Glib::build_filename(Glib::ustring(g_get_user_cache_dir()), Glib::ustring(CACHEFOLDERNAME)); + #endif #endif } diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index fc315e1b7..06b11ef73 100644 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -280,23 +280,6 @@ RTWindow::RTWindow () set_default_size (options.windowWidth, options.windowHeight); set_modal (false); - Gdk::Rectangle lMonitorRect; - get_screen()->get_monitor_geometry (std::min (options.windowMonitor, Gdk::Screen::get_default()->get_n_monitors() - 1), lMonitorRect); - - if (options.windowMaximized) { - move (lMonitorRect.get_x(), lMonitorRect.get_y()); - maximize(); - } else { - unmaximize(); - resize (options.windowWidth, options.windowHeight); - - if (options.windowX <= lMonitorRect.get_x() + lMonitorRect.get_width() && options.windowY <= lMonitorRect.get_y() + lMonitorRect.get_height()) { - move (options.windowX, options.windowY); - } else { - move (lMonitorRect.get_x(), lMonitorRect.get_y()); - } - } - on_delete_has_run = false; is_fullscreen = false; property_destroy_with_parent().set_value (false); @@ -1100,6 +1083,44 @@ bool RTWindow::splashClosed (GdkEventAny* event) return true; } +void RTWindow::setWindowSize () +{ + Gdk::Rectangle lMonitorRect; + get_screen()->get_monitor_geometry (std::min (options.windowMonitor, Gdk::Screen::get_default()->get_n_monitors() - 1), lMonitorRect); + +#ifdef __APPLE__ + // Get macOS menu bar height + const Gdk::Rectangle lWorkAreaRect = get_screen()->get_monitor_workarea (std::min (options.windowMonitor, Gdk::Screen::get_default()->get_n_monitors() - 1)); + const int macMenuBarHeight = lWorkAreaRect.get_y(); +#endif + + if (options.windowMaximized) { +#ifdef __APPLE__ + move (lMonitorRect.get_x(), lMonitorRect.get_y() + macMenuBarHeight); +#else + move (lMonitorRect.get_x(), lMonitorRect.get_y()); +#endif + maximize(); + } else { + unmaximize(); + resize (options.windowWidth, options.windowHeight); + +#ifdef __APPLE__ + if (options.windowX <= lMonitorRect.get_x() + lMonitorRect.get_width() && options.windowY <= lMonitorRect.get_y() + lMonitorRect.get_height() - macMenuBarHeight) { + move (options.windowX, options.windowY + macMenuBarHeight); + } else { + move (lMonitorRect.get_x(), lMonitorRect.get_y() + macMenuBarHeight); + } +#else + if (options.windowX <= lMonitorRect.get_x() + lMonitorRect.get_width() && options.windowY <= lMonitorRect.get_y() + lMonitorRect.get_height()) { + move (options.windowX, options.windowY); + } else { + move (lMonitorRect.get_x(), lMonitorRect.get_y()); + } +#endif + } +} + void RTWindow::set_title_decorated (Glib::ustring fname) { Glib::ustring subtitle; diff --git a/rtgui/rtwindow.h b/rtgui/rtwindow.h index c493c2db4..816d5e5b7 100644 --- a/rtgui/rtwindow.h +++ b/rtgui/rtwindow.h @@ -123,6 +123,7 @@ public: { return is_fullscreen; } + void setWindowSize (); void set_title_decorated (Glib::ustring fname); void closeOpenEditors(); void setEditorMode (bool tabbedUI); From 7eb6b7a87550b50db722266590979909a1ef7f09 Mon Sep 17 00:00:00 2001 From: Thanatomanic <6567747+Thanatomanic@users.noreply.github.com> Date: Thu, 28 May 2020 16:29:06 +0200 Subject: [PATCH 3/5] Remove double value in paramsedited.cc --- rtgui/paramsedited.cc | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/rtgui/paramsedited.cc b/rtgui/paramsedited.cc index 511aefaa7..847e9fb5d 100644 --- a/rtgui/paramsedited.cc +++ b/rtgui/paramsedited.cc @@ -520,7 +520,6 @@ void ParamsEdited::set(bool v) wavelet.HSmethod = v; wavelet.Dirmethod = v; wavelet.sigma = v; - wavelet.sigma = v; wavelet.offset = v; wavelet.lowthr = v; wavelet.resconH = v; @@ -3569,4 +3568,4 @@ bool CaptureSharpeningParamsEdited::isUnchanged() const bool RAWParamsEdited::PreprocessWBParamsEdited::isUnchanged() const { return mode; -} \ No newline at end of file +} From 9c4cb505e424290f368c7a94178c48884961382a Mon Sep 17 00:00:00 2001 From: Thanatomanic <6567747+Thanatomanic@users.noreply.github.com> Date: Thu, 28 May 2020 17:00:42 +0200 Subject: [PATCH 4/5] Added missing filmNegListener in initialization list of ImProcCoordinator --- rtengine/improccoordinator.cc | 1 + 1 file changed, 1 insertion(+) diff --git a/rtengine/improccoordinator.cc b/rtengine/improccoordinator.cc index 5261675a0..6b50f3d3d 100644 --- a/rtengine/improccoordinator.cc +++ b/rtengine/improccoordinator.cc @@ -158,6 +158,7 @@ ImProcCoordinator::ImProcCoordinator() : awavListener(nullptr), dehaListener(nullptr), hListener(nullptr), + filmNegListener(nullptr), resultValid(false), params(new procparams::ProcParams), lastOutputProfile("BADFOOD"), From ca605eece6cb799c0e349dd6303c55300ce7e69c Mon Sep 17 00:00:00 2001 From: Ingo Weyrich Date: Fri, 29 May 2020 17:46:17 +0200 Subject: [PATCH 5/5] Better raw crop for FUJIFILM X100V and FUJIFILM X-T4 --- rtengine/camconst.json | 8 +------- rtengine/dcraw.cc | 2 +- 2 files changed, 2 insertions(+), 8 deletions(-) diff --git a/rtengine/camconst.json b/rtengine/camconst.json index 5fc7d4062..8a0b7609a 100644 --- a/rtengine/camconst.json +++ b/rtengine/camconst.json @@ -1295,12 +1295,6 @@ Camera constants: "ranges": { "white": 16100 } }, - { // Quality C - "make_model": [ "FUJIFILM X100V", "FUJIFILM X-T4" ], - "dcraw_matrix": [ 13426,-6334,-1177,-4244,12136,2371,-580,1303,5980 ], // DNG_v12.2 D65 - "raw_crop": [ 0, 5, 6252, 4140 ] - }, - { // Quality C "make_model": "Fujifilm X10", "ranges": { "white": 3788 } @@ -1384,7 +1378,7 @@ Camera constants: }, { // Quality C, only raw crop - "make_model": [ "FUJIFILM X-T3", "FUJIFILM X-T30", "FUJIFILM X-PRO3" ], + "make_model": [ "FUJIFILM X-T3", "FUJIFILM X-T30", "FUJIFILM X-PRO3", "FUJIFILM X100V", "FUJIFILM X-T4" ], "dcraw_matrix": [ 13426,-6334,-1177,-4244,12136,2371,-580,1303,5980 ], // DNG_v11, standard_v2 d65 "raw_crop": [ 0, 5, 6252, 4176] }, diff --git a/rtengine/dcraw.cc b/rtengine/dcraw.cc index edb7dc317..a166ecf15 100644 --- a/rtengine/dcraw.cc +++ b/rtengine/dcraw.cc @@ -10048,7 +10048,7 @@ canon_a5: } else if (!strncmp(model, "X-A3", 4) || !strncmp(model, "X-A5", 4)) { width = raw_width = 6016; height = raw_height = 4014; - } else if (!strcmp(model, "X-Pro3") || !strcmp(model, "X-T3") || !strcmp(model, "X-T30")) { + } else if (!strcmp(model, "X-Pro3") || !strcmp(model, "X-T3") || !strcmp(model, "X-T30") || !strcmp(model, "X-T4") || !strcmp(model, "X100V")) { width = raw_width = 6384; height = raw_height = 4182; }