diff --git a/rtengine/imageio.cc b/rtengine/imageio.cc index d252b501f..01bbddf13 100644 --- a/rtengine/imageio.cc +++ b/rtengine/imageio.cc @@ -867,8 +867,8 @@ int ImageIO::loadTIFF (Glib::ustring fname) ); #endif - float minVal = min( min( minValue[0], minValue[1] ), minValue[2] ); - float maxVal = max( max( maxValue[0], maxValue[1] ), maxValue[2] ); + float minVal = rtengine::min(minValue[0], minValue[1], minValue[2]); + float maxVal = rtengine::max(maxValue[0], maxValue[1], maxValue[2]); normalizeFloat(minVal, maxVal); } diff --git a/rtengine/lcp.cc b/rtengine/lcp.cc index 554634e5f..c09d2d9be 100644 --- a/rtengine/lcp.cc +++ b/rtengine/lcp.cc @@ -447,7 +447,7 @@ int LCPProfile::filterBadFrames(double maxAvgDevFac, int minFramesLeft) } if (aPersModel[pm]->hasModeData(2)) { - errChrom += std::max(std::max(aPersModel[pm]->chromRG.mean_error, aPersModel[pm]->chromG.mean_error), aPersModel[pm]->chromBG.mean_error); + errChrom += rtengine::max(aPersModel[pm]->chromRG.mean_error, aPersModel[pm]->chromG.mean_error, aPersModel[pm]->chromBG.mean_error); chromCount++; } } diff --git a/rtgui/CMakeLists.txt b/rtgui/CMakeLists.txt index fe2e0c844..47daf8ea8 100644 --- a/rtgui/CMakeLists.txt +++ b/rtgui/CMakeLists.txt @@ -227,7 +227,7 @@ add_dependencies(rth-cli UpdateInfo) # Set executables targets properties, i.e. output filename and compile flags # for "Debug" builds, open a console in all cases for Windows version if((WIN32) AND NOT(UPPER_CMAKE_BUILD_TYPE STREQUAL "DEBUG")) -set_target_properties(rth PROPERTIES LINK_FLAGS "-mwindows") + set_target_properties(rth PROPERTIES LINK_FLAGS "-mwindows") endif() set_target_properties(rth PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS}" OUTPUT_NAME rawtherapee) set_target_properties(rth-cli PROPERTIES COMPILE_FLAGS "${CMAKE_CXX_FLAGS}" OUTPUT_NAME rawtherapee-cli) diff --git a/rtgui/editwindow.cc b/rtgui/editwindow.cc index 7782de87c..65e26275f 100644 --- a/rtgui/editwindow.cc +++ b/rtgui/editwindow.cc @@ -28,11 +28,11 @@ // Check if the system has more than one display and option is set bool EditWindow::isMultiDisplayEnabled() { - return options.multiDisplayMode > 0 && Gdk::Screen::get_default()->get_n_monitors () > 1; + return options.multiDisplayMode > 0 && Gdk::Screen::get_default()->get_n_monitors() > 1; } // Should only be created once, auto-creates window on correct display -EditWindow* EditWindow::getInstance(RTWindow* p) +EditWindow* EditWindow::getInstance(RTWindow* p, bool restore) { struct EditWindowInstance { @@ -40,23 +40,17 @@ EditWindow* EditWindow::getInstance(RTWindow* p) explicit EditWindowInstance(RTWindow* p) : editWnd(p) { - // Determine the other display and maximize the window on that - const Glib::RefPtr< Gdk::Window >& wnd = p->get_window(); - int monNo = p->get_screen()->get_monitor_at_window (wnd); - - Gdk::Rectangle lMonitorRect; - editWnd.get_screen()->get_monitor_geometry(isMultiDisplayEnabled() ? (monNo == 0 ? 1 : 0) : monNo, lMonitorRect); - editWnd.move(lMonitorRect.get_x(), lMonitorRect.get_y()); - editWnd.maximize(); } }; static EditWindowInstance instance_(p); - instance_.editWnd.show_all(); + if(restore) { + instance_.editWnd.restoreWindow(); + } return &instance_.editWnd; } -EditWindow::EditWindow (RTWindow* p) : parent(p) , isFullscreen(false) +EditWindow::EditWindow (RTWindow* p) : parent(p) , isFullscreen(false), isClosed(true) { Glib::ustring fName = "rt-logo-tiny.png"; @@ -71,9 +65,9 @@ EditWindow::EditWindow (RTWindow* p) : parent(p) , isFullscreen(false) set_title_decorated(""); set_modal(false); set_resizable(true); + set_default_size(options.meowWidth, options.meowHeight); property_destroy_with_parent().set_value(false); - //signal_window_state_event().connect( sigc::mem_fun(*this, &EditWindow::on_window_state_event) ); mainNB = Gtk::manage (new Gtk::Notebook ()); mainNB->set_scrollable (true); @@ -85,7 +79,46 @@ EditWindow::EditWindow (RTWindow* p) : parent(p) , isFullscreen(false) mainBox->pack_start (*mainNB); add (*mainBox); - show_all (); + +} + +void EditWindow::restoreWindow() { + + if(isClosed) { + int meowMonitor = 0; + if(isMultiDisplayEnabled()) { + if(options.meowMonitor >= 0) { // use display from last session if available + meowMonitor = std::min(options.meowMonitor, Gdk::Screen::get_default()->get_n_monitors()); + } else { // Determine the other display + const Glib::RefPtr< Gdk::Window >& wnd = parent->get_window(); + meowMonitor = parent->get_screen()->get_monitor_at_window(wnd) == 0 ? 1 : 0; + } + } + + Gdk::Rectangle lMonitorRect; + get_screen()->get_monitor_geometry(meowMonitor, lMonitorRect); + if(options.meowMaximized) { + move(lMonitorRect.get_x(), lMonitorRect.get_y()); + maximize(); + } else { + resize(options.meowWidth, options.meowHeight); + if(options.meowX <= lMonitorRect.get_x() + lMonitorRect.get_width() && options.meowY <= lMonitorRect.get_y() + lMonitorRect.get_height()) { + move(options.meowX, options.meowY); + } else { + move(lMonitorRect.get_x(), lMonitorRect.get_y()); + } + } + show_all(); + + isFullscreen = options.meowFullScreen; + + if(isFullscreen) { + fullscreen(); + } + + isClosed = false; + } + } void EditWindow::on_realize () @@ -95,6 +128,19 @@ void EditWindow::on_realize () editWindowCursorManager.init (get_window()); } +bool EditWindow::on_configure_event(GdkEventConfigure* event) +{ + if (get_realized() && is_visible()) { + if(!is_maximized()) { + get_position(options.meowX, options.meowY); + get_size(options.meowWidth, options.meowHeight); + } + options.meowMaximized = is_maximized(); + } + + return Gtk::Widget::on_configure_event(event); +} + /* HOMBRE: Disabling this since it's maximized when opened anyway. * Someday, the EditorWindow migh save it own position and state, so it'll have to be uncommented bool EditWindow::on_window_state_event(GdkEventWindowState* event) @@ -189,6 +235,14 @@ bool EditWindow::selectEditorPanel(const std::string &name) return false; } +void EditWindow::toFront () +{ + // when using the secondary window on the same monitor as the primary window we need to present the secondary window. + // If we don't, it will stay in background when opening 2nd, 3rd... editor, which is annoying + // It will also deiconify the window + present(); +} + bool EditWindow::keyPressed (GdkEventKey* event) { bool ctrl = event->state & GDK_CONTROL_MASK; @@ -216,22 +270,70 @@ bool EditWindow::keyPressed (GdkEventKey* event) void EditWindow::toggleFullscreen () { isFullscreen ? unfullscreen() : fullscreen(); - isFullscreen = !isFullscreen; + options.meowFullScreen = isFullscreen = !isFullscreen; } +void EditWindow::writeOptions() { + + if(is_visible()) { + if(isMultiDisplayEnabled()) { + options.meowMonitor = get_screen()->get_monitor_at_window(get_window()); + } + + options.meowMaximized = is_maximized(); + get_position(options.meowX, options.meowY); + get_size(options.meowWidth,options.meowHeight); + } +} bool EditWindow::on_delete_event(GdkEventAny* event) { - // Check if any editor is still processing, and do NOT quit if so. Otherwise crashes and inconsistent caches - bool isProcessing = false; - for ( std::set ::iterator iter = filesEdited.begin(); iter != filesEdited.end() && !isProcessing; ++iter ) { + if (!closeOpenEditors()) { + return true; + } + + writeOptions(); + hide(); + isClosed = true; + + return false; +} + +bool EditWindow::isProcessing () +{ + for ( std::set ::iterator iter = filesEdited.begin(); iter != filesEdited.end(); ++iter ) { if (epanels[*iter]->getIsProcessing()) { - isProcessing = true; + return true; } } - if (isProcessing) { - return true; + return false; +} + +bool EditWindow::closeOpenEditors() +{ + // Check if any editor is still processing, and do NOT quit if so. Otherwise crashes and inconsistent caches + if (isProcessing()) { + return false; + } + + if (epanels.size()) { + int page = mainNB->get_current_page(); + Gtk::Widget *w = mainNB->get_nth_page(page); + bool optionsWritten = false; + + for (std::map::iterator i = epanels.begin(); i != epanels.end(); ++i) { + if (i->second == w) { + i->second->writeOptions(); + optionsWritten = true; + } + } + + if (!optionsWritten) { + // fallback solution: save the options of the first editor panel + std::map::iterator i = epanels.begin(); + i->second->writeOptions(); + } } for ( std::set ::iterator iter = filesEdited.begin(); iter != filesEdited.end(); ++iter ) { @@ -239,12 +341,10 @@ bool EditWindow::on_delete_event(GdkEventAny* event) } epanels.clear(); - filesEdited.clear(); parent->fpanel->refreshEditedState (filesEdited); - hide (); - return false; + return true; } void EditWindow::set_title_decorated(Glib::ustring fname) diff --git a/rtgui/editwindow.h b/rtgui/editwindow.h index 320b47b40..8cf93dbf8 100644 --- a/rtgui/editwindow.h +++ b/rtgui/editwindow.h @@ -33,27 +33,33 @@ private: std::map epanels; bool isFullscreen; + bool isClosed; void toggleFullscreen (); + void restoreWindow(); public: // Check if the system has more than one display and option is set static bool isMultiDisplayEnabled(); // Should only be created once, auto-creates window on correct display - static EditWindow* getInstance(RTWindow* p); + static EditWindow* getInstance(RTWindow* p, bool restore = true); explicit EditWindow (RTWindow* p); + void writeOptions(); void addEditorPanel (EditorPanel* ep, const std::string &name); void remEditorPanel (EditorPanel* ep); bool selectEditorPanel(const std::string &name); + bool closeOpenEditors(); + bool isProcessing(); + void toFront(); bool keyPressed (GdkEventKey* event); + bool on_configure_event(GdkEventConfigure* event); bool on_delete_event(GdkEventAny* event); //bool on_window_state_event(GdkEventWindowState* event); void on_mainNB_switch_page(Gtk::Widget* page, guint page_num); void set_title_decorated(Glib::ustring fname); - void on_realize (); }; diff --git a/rtgui/history.cc b/rtgui/history.cc index dcc29261c..8523c2600 100644 --- a/rtgui/history.cc +++ b/rtgui/history.cc @@ -51,10 +51,9 @@ History::History (bool bookmarkSupport) : historyVPaned(nullptr), blistener(null historyModel = Gtk::ListStore::create (historyColumns); hTreeView->set_model (historyModel); hTreeView->set_headers_visible (false); - hTreeView->set_hscroll_policy (Gtk::SCROLL_MINIMUM); - hTreeView->set_vscroll_policy (Gtk::SCROLL_NATURAL); - hTreeView->set_size_request (80, -1); - hTreeView->set_resize_mode (Gtk::RESIZE_QUEUE); + hTreeView->set_hscroll_policy(Gtk::SCROLL_MINIMUM); + hTreeView->set_vscroll_policy(Gtk::SCROLL_NATURAL); + hTreeView->set_size_request(80, -1); Gtk::CellRendererText *changecrt = Gtk::manage (new Gtk::CellRendererText()); changecrt->property_ellipsize() = Pango::ELLIPSIZE_END; diff --git a/rtgui/indclippedpanel.cc b/rtgui/indclippedpanel.cc index 2a3330b5c..72180b31a 100644 --- a/rtgui/indclippedpanel.cc +++ b/rtgui/indclippedpanel.cc @@ -51,8 +51,8 @@ IndicateClippedPanel::IndicateClippedPanel (ImageArea* ia) : imageArea(ia) indclippedh->set_active (options.showClippedHighlights); indclippeds->set_active (options.showClippedShadows); - pack_start (*indclippedh, Gtk::PACK_SHRINK, 0); pack_start (*indclippeds, Gtk::PACK_SHRINK, 0); + pack_start (*indclippedh, Gtk::PACK_SHRINK, 0); indclippedh->signal_toggled().connect( sigc::mem_fun(*this, &IndicateClippedPanel::buttonToggled) ); indclippeds->signal_toggled().connect( sigc::mem_fun(*this, &IndicateClippedPanel::buttonToggled) ); diff --git a/rtgui/main-cli.cc b/rtgui/main-cli.cc index d262d5feb..4cb0cbd7d 100644 --- a/rtgui/main-cli.cc +++ b/rtgui/main-cli.cc @@ -294,6 +294,7 @@ int processLineParams( int argc, char **argv ) Glib::ustring outputPath = ""; std::vector processingParams; bool outputDirectory = false; + bool leaveUntouched = false; bool overwriteFiles = false; bool sideProcParams = false; bool copyParamsFile = false; @@ -324,7 +325,11 @@ int processLineParams( int argc, char **argv ) #if ECLIPSE_ARGS outputPath = outputPath.substr(1, outputPath.length()-2); #endif - if( Glib::file_test (outputPath, Glib::FILE_TEST_IS_DIR)) { + if(outputPath.substr(0,9) == "/dev/null") { + outputPath.assign("/dev/null"); // removing any useless chars or filename + outputDirectory = false; + leaveUntouched = true; + } else if(Glib::file_test (outputPath, Glib::FILE_TEST_IS_DIR)) { outputDirectory = true; } } @@ -696,9 +701,13 @@ int processLineParams( int argc, char **argv ) Glib::ustring::size_type ext = s.find_last_of('.'); outputFile = Glib::build_filename(outputPath, s.substr(0, ext) + "." + outputType); } else { - Glib::ustring s = outputPath; - Glib::ustring::size_type ext = s.find_last_of('.'); - outputFile = s.substr(0, ext) + "." + outputType; + if (leaveUntouched) { + outputFile = outputPath; + } else { + Glib::ustring s = outputPath; + Glib::ustring::size_type ext = s.find_last_of('.'); + outputFile = s.substr(0, ext) + "." + outputType; + } } if( inputFile == outputFile) { diff --git a/rtgui/options.cc b/rtgui/options.cc index 554882839..b7c569131 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -299,6 +299,13 @@ void Options::setDefaults () windowX = 0; windowY = 0; windowMaximized = true; + meowMonitor = -1; + meowFullScreen = false; + meowMaximized = true; + meowWidth = 1200; + meowHeight = 680; + meowX = 0; + meowY = 0; saveAsDialogWidth = 920; saveAsDialogHeight = 680; savesParamsAtExit = true; @@ -1304,6 +1311,34 @@ int Options::readFromFile (Glib::ustring fname) windowY = keyFile.get_integer ("GUI", "WindowY"); } + if (keyFile.has_key ("GUI", "MeowMonitor")) { + meowMonitor = keyFile.get_integer ("GUI", "MeowMonitor"); + } + + if (keyFile.has_key ("GUI", "MeowFullScreen")) { + meowFullScreen = keyFile.get_boolean ("GUI", "MeowFullScreen"); + } + + if (keyFile.has_key ("GUI", "MeowMaximized")) { + meowMaximized = keyFile.get_boolean ("GUI", "MeowMaximized"); + } + + if (keyFile.has_key ("GUI", "MeowWidth")) { + meowWidth = keyFile.get_integer ("GUI", "MeowWidth"); + } + + if (keyFile.has_key ("GUI", "MeowHeight")) { + meowHeight = keyFile.get_integer ("GUI", "MeowHeight"); + } + + if (keyFile.has_key ("GUI", "MeowX")) { + meowX = keyFile.get_integer ("GUI", "MeowX"); + } + + if (keyFile.has_key ("GUI", "MeowY")) { + meowY = keyFile.get_integer ("GUI", "MeowY"); + } + if (keyFile.has_key ("GUI", "WindowMaximized")) { windowMaximized = keyFile.get_boolean ("GUI", "WindowMaximized"); } @@ -2071,6 +2106,13 @@ int Options::saveToFile (Glib::ustring fname) keyFile.set_integer ("GUI", "WindowHeight", windowHeight); keyFile.set_integer ("GUI", "WindowX", windowX); keyFile.set_integer ("GUI", "WindowY", windowY); + keyFile.set_integer ("GUI", "MeowMonitor", meowMonitor); + keyFile.set_boolean ("GUI", "MeowFullScreen", meowFullScreen); + keyFile.set_boolean ("GUI", "MeowMaximized", meowMaximized); + keyFile.set_integer ("GUI", "MeowWidth", meowWidth); + keyFile.set_integer ("GUI", "MeowHeight", meowHeight); + keyFile.set_integer ("GUI", "MeowX", meowX); + keyFile.set_integer ("GUI", "MeowY", meowY); keyFile.set_boolean ("GUI", "WindowMaximized", windowMaximized); keyFile.set_integer ("GUI", "DetailWindowWidth", detailWindowWidth); keyFile.set_integer ("GUI", "DetailWindowHeight", detailWindowHeight); diff --git a/rtgui/options.h b/rtgui/options.h index 40429075e..e1e45aba0 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -133,11 +133,18 @@ public: bool browserDirPanelOpened; bool editorFilmStripOpened; int historyPanelWidth; - int windowWidth; - int windowHeight; int windowX; int windowY; + int windowWidth; + int windowHeight; bool windowMaximized; + int meowMonitor; + bool meowFullScreen; + bool meowMaximized; + int meowWidth; + int meowHeight; + int meowX; + int meowY; int detailWindowWidth; int detailWindowHeight; int dirBrowserWidth; diff --git a/rtgui/retinex.cc b/rtgui/retinex.cc index 6da77f8e3..bf88a85e4 100644 --- a/rtgui/retinex.cc +++ b/rtgui/retinex.cc @@ -657,7 +657,7 @@ void Retinex::writeOptions (std::vector &tpOpen) void Retinex::updateToolState (std::vector &tpOpen) { - if (tpOpen.size() == 10) { + if (tpOpen.size() >= 10) { expsettings->set_expanded (tpOpen.at (9)); } } diff --git a/rtgui/rtwindow.cc b/rtgui/rtwindow.cc index a94fafa36..174d6ba2e 100644 --- a/rtgui/rtwindow.cc +++ b/rtgui/rtwindow.cc @@ -124,7 +124,6 @@ RTWindow::RTWindow () set_title_decorated(""); set_resizable(true); - set_resize_mode(Gtk::ResizeMode::RESIZE_QUEUE); set_decorated(true); set_default_size(options.windowWidth, options.windowHeight); set_modal(false); @@ -339,12 +338,21 @@ void RTWindow::on_realize () } } +bool RTWindow::on_configure_event(GdkEventConfigure* event) +{ + if (!is_maximized() && is_visible()) { + get_size(options.windowWidth, options.windowHeight); + get_position (options.windowX, options.windowY); + } + + return Gtk::Widget::on_configure_event(event); +} + bool RTWindow::on_window_state_event(GdkEventWindowState* event) { if (event->changed_mask & GDK_WINDOW_STATE_MAXIMIZED) { options.windowMaximized = event->new_window_state & GDK_WINDOW_STATE_MAXIMIZED; } - return Gtk::Widget::on_window_state_event(event); } @@ -385,6 +393,7 @@ void RTWindow::addEditorPanel (EditorPanel* ep, const std::string &name) EditWindow * wndEdit = EditWindow::getInstance(this); wndEdit->show(); wndEdit->addEditorPanel(ep, name); + wndEdit->toFront(); } else { ep->setParent (this); ep->setParentWindow(this); @@ -462,6 +471,7 @@ bool RTWindow::selectEditorPanel(const std::string &name) if (wndEdit->selectEditorPanel(name)) { set_title_decorated(name); + wndEdit->toFront(); return true; } } else { @@ -585,9 +595,17 @@ bool RTWindow::on_delete_event(GdkEventAny* event) // Check if any editor is still processing, and do NOT quit if so. Otherwise crashes and inconsistent caches bool isProcessing = false; + EditWindow* editWindow = nullptr; + if (isSingleTabMode() || simpleEditor) { isProcessing = epanel->getIsProcessing(); + } else if (options.multiDisplayMode > 0) { + editWindow = EditWindow::getInstance(this, false); + + if (editWindow->isProcessing ()) { + return true; + } } else { int pageCount = mainNB->get_n_pages(); @@ -613,10 +631,15 @@ bool RTWindow::on_delete_event(GdkEventAny* event) if ((isSingleTabMode() || simpleEditor) && epanel->isRealized()) { epanel->saveProfile(); epanel->writeOptions (); - } else { + } + else { + if (options.multiDisplayMode > 0) { + editWindow->closeOpenEditors(); + editWindow->writeOptions(); + } // Storing the options of the last EditorPanel before Gtk destroys everything // Look at the active panel first, if any, otherwise look at the first one (sorted on the filename) - if (epanels.size()) { + else if (epanels.size()) { int page = mainNB->get_current_page(); Gtk::Widget *w = mainNB->get_nth_page(page); bool optionsWritten = false; @@ -826,7 +849,7 @@ void RTWindow::set_title_decorated(Glib::ustring fname) set_title(versionStr + subtitle); } -void RTWindow::CloseOpenEditors() +void RTWindow::closeOpenEditors() { std::map::const_iterator itr; itr = epanels.begin(); @@ -850,7 +873,7 @@ bool RTWindow::isEditorPanel(guint pageNum) void RTWindow::setEditorMode(bool tabbedUI) { MoveFileBrowserToMain(); - CloseOpenEditors(); + closeOpenEditors(); SetMainCurrent(); if(tabbedUI) { diff --git a/rtgui/rtwindow.h b/rtgui/rtwindow.h index a57f7b4a3..faad5f849 100644 --- a/rtgui/rtwindow.h +++ b/rtgui/rtwindow.h @@ -80,6 +80,7 @@ public: void addBatchQueueJobs (std::vector &entries); bool keyPressed (GdkEventKey* event); + bool on_configure_event(GdkEventConfigure* event); bool on_delete_event(GdkEventAny* event); bool on_window_state_event(GdkEventWindowState* event); void on_mainNB_switch_page(Gtk::Widget* widget, guint page_num); @@ -115,7 +116,7 @@ public: return is_fullscreen; } void set_title_decorated(Glib::ustring fname); - void CloseOpenEditors(); + void closeOpenEditors(); void setEditorMode(bool tabbedUI); void createSetmEditor(); }; diff --git a/rtgui/toolpanelcoord.cc b/rtgui/toolpanelcoord.cc index 55023b4d6..c8d4d185d 100644 --- a/rtgui/toolpanelcoord.cc +++ b/rtgui/toolpanelcoord.cc @@ -600,8 +600,9 @@ void ToolPanelCoordinator::updateToolState() temp.push_back (options.tpOpen.at (i + expList.size())); } - wavelet->updateToolState (temp); - wavelet->setExpanded (true); + wavelet->updateToolState(temp); + wavelet->setExpanded(true); + retinex->updateToolState(temp); } } diff --git a/rtgui/wavelet.cc b/rtgui/wavelet.cc index 1fea0cd54..b61c9acd4 100644 --- a/rtgui/wavelet.cc +++ b/rtgui/wavelet.cc @@ -3040,7 +3040,7 @@ void Wavelet::writeOptions(std::vector &tpOpen) void Wavelet::updateToolState(std::vector &tpOpen) { - if(tpOpen.size() == 9) { + if(tpOpen.size() >= 9) { expsettings->set_expanded(tpOpen.at(0)); expcontrast->set_expanded(tpOpen.at(1)); expchroma->set_expanded(tpOpen.at(2)); diff --git a/tools/osx/executable_loader.in b/tools/osx/executable_loader.in index 42fbdd968..c36695d9e 100644 --- a/tools/osx/executable_loader.in +++ b/tools/osx/executable_loader.in @@ -17,7 +17,7 @@ etc="${resources}"/etc # export GTK_EXE_PREFIX="${resources}" # export GTK_DATA_PREFIX="${resources}" -# export XDG_DATA_DIRS="${resources}/share" +export XDG_DATA_DIRS="${resources}/share" # export GTK_IM_MODULE_FILE="${etc}/gtk-3.0/gtk.immodules" export DYLD_LIBRARY_PATH="${lib}" @@ -41,9 +41,11 @@ export RT_CACHE="${HOME}/Library/Application Support/RawTherapee/cache" case "$1" in -psn_*) shift ;; esac -if [[ -d "/tmp/RawTherapee.app" ]]; then - rm -rf "/tmp/RawTherapee.app" -fi -ln -sf "${app}" /tmp + +# Commented-out as part of "crash-on-startup part 2" fix, see https://github.com/Beep6581/RawTherapee/issues/3882#issuecomment-311703141 +#if [[ -d "/tmp/RawTherapee.app" ]]; then +# rm -rf "/tmp/RawTherapee.app" +#fi +#ln -sf "${app}" /tmp exec "${cwd}/rawtherapee-bin" "$@" diff --git a/tools/osx/macosx_bundle.sh b/tools/osx/macosx_bundle.sh index 159a9e91d..c819fae76 100644 --- a/tools/osx/macosx_bundle.sh +++ b/tools/osx/macosx_bundle.sh @@ -16,11 +16,11 @@ fMagenta="$(tput setaf 5)" fRed="$(tput setaf 1)" function msg { - printf "\n${fBold}-- %s${fNormal}\n" "${@}" + printf "\\n${fBold}-- %s${fNormal}\\n" "${@}" } function msgError { - printf "\n${fBold}Error:${fNormal}\n%s\n" "${@}" + printf "\\n${fBold}Error:${fNormal}\\n%s\\n" "${@}" } function GetDependencies { @@ -28,9 +28,9 @@ function GetDependencies { } function CheckLink { - GetDependencies "$1" | while read; do + GetDependencies "$1" | while read -r; do local dest="${LIB}/$(basename "${REPLY}")" - test -f "${dest}" || { ditto --arch ${arch} "${REPLY}" "${dest}"; CheckLink "${dest}"; } + test -f "${dest}" || { ditto --arch "${arch}" "${REPLY}" "${dest}"; CheckLink "${dest}"; } done } @@ -121,14 +121,15 @@ ditto --arch "${arch}" {"${GTK_PREFIX}/lib","${LIB}"}/gdk-pixbuf-2.0 ditto --arch "${arch}" {"${GTK_PREFIX}/lib","${LIB}"}/gtk-3.0 msg "Removing static libraries and cache files:" -find -E "${LIB}" -type f -regex '.*\.(a|la|cache)$' | while read; do rm "${REPLY}"; done +find -E "${LIB}" -type f -regex '.*\.(a|la|cache)$' | while read -r; do rm "${REPLY}"; done msg "Copying configuration files from ${GTK_PREFIX}:" install -d "${ETC}/gtk-3.0" cp "${GTK_PREFIX}/etc/gtk-3.0/im-multipress.conf" "${ETC}/gtk-3.0" "${GTK_PREFIX}/bin/gdk-pixbuf-query-loaders" "${LIB}"/gdk-pixbuf-2.0/*/loaders/*.so > "${ETC}/gtk-3.0/gdk-pixbuf.loaders" "${GTK_PREFIX}/bin/gtk-query-immodules-3.0" "${LIB}"/gtk-3.0/*/immodules/*.so > "${ETC}/gtk-3.0/gtk.immodules" -sed -i "" -e "s|${PWD}|/tmp|" "${ETC}/gtk-3.0/gdk-pixbuf.loaders" "${ETC}/gtk-3.0/gtk.immodules" +#sed -i "" -e "s|${PWD}|/tmp|" "${ETC}/gtk-3.0/gdk-pixbuf.loaders" "${ETC}/gtk-3.0/gtk.immodules" +sed -i "" -e "s|${PWD}/RawTherapee.app/Contents/|@executable_path/../|" "${ETC}/gtk-3.0/gdk-pixbuf.loaders" "${ETC}/gtk-3.0/gtk.immodules" ditto {"${GTK_PREFIX}","${RESOURCES}"}/share/glib-2.0/schemas "${GTK_PREFIX}/bin/glib-compile-schemas" "${RESOURCES}/share/glib-2.0/schemas" @@ -154,13 +155,13 @@ ditto {"${GTK_PREFIX}","${RESOURCES}"}/share/icons/Adwaita/index.theme # fi # Install names -find -E "${CONTENTS}" -type f -regex '.*/(rawtherapee|.*\.(dylib|so))' | while read x; do +find -E "${CONTENTS}" -type f -regex '.*/(rawtherapee-cli|rawtherapee|.*\.(dylib|so))' | while read -r x; do msg "Modifying install names: ${x}" { # id case ${x} in *.dylib) echo " install_name_tool -id '@rpath/$(basename "${x}")' '${x}'";; esac # names - GetDependencies "${x}" | while read y; do + GetDependencies "${x}" | while read -r y; do echo " install_name_tool -change '${y}' '@rpath/$(basename "${y}")' '${x}'" done } | bash -v