diff --git a/rtdata/options/options.lin b/rtdata/options/options.lin index 02016e9e4..9ece4c775 100644 --- a/rtdata/options/options.lin +++ b/rtdata/options/options.lin @@ -72,6 +72,10 @@ SaveParamsWithFile=false SaveParamsToCache=true LoadParamsFromLocation=0 +# if this is set to a path of a custom program, it will receive the EXIFs as parameters and must generate a PP3 preset file for the given RAW/JPG +# Parameters: +CustomProfileBuilder= + [GUI] WindowWidth=900 WindowHeight=560 diff --git a/rtdata/options/options.osx b/rtdata/options/options.osx index f05215ae6..c7dde9d11 100644 --- a/rtdata/options/options.osx +++ b/rtdata/options/options.osx @@ -72,6 +72,10 @@ SaveParamsWithFile=false SaveParamsToCache=true LoadParamsFromLocation=0 +# if this is set to a path of a custom program, it will receive the EXIFs as parameters and must generate a PP3 preset file for the given RAW/JPG +# Parameters: +CustomProfileBuilder= + [GUI] WindowWidth=900 WindowHeight=560 diff --git a/rtdata/options/options.win b/rtdata/options/options.win index 8834ed124..f7571d6c6 100644 --- a/rtdata/options/options.win +++ b/rtdata/options/options.win @@ -72,6 +72,11 @@ SaveParamsWithFile=false SaveParamsToCache=true LoadParamsFromLocation=0 +# if this is set to a path of a custom program, it will receive the EXIFs as parameters and must generate a PP3 preset file for the given RAW/JPG +# Parameters: +CustomProfileBuilder= + + [GUI] WindowWidth=900 WindowHeight=560 diff --git a/rtgui/cropwindow.cc b/rtgui/cropwindow.cc index 4274ba4df..ef4635f11 100644 --- a/rtgui/cropwindow.cc +++ b/rtgui/cropwindow.cc @@ -93,12 +93,13 @@ CropWindow::CropWindow (ImageArea* parent, rtengine::StagedImageProcessor* ipc_) minWidth = bsw + iw + 2*sideBorderWidth; setSize (100, 100); + zoom11(); cropHandler.newImage (ipc_); cropHandler.setPosition (0,0); cropHandler.setEnabled (true); cropHandler.setCropHandlerListener (this); - zoom11(); + state = SNormal; } diff --git a/rtgui/editorpanel.cc b/rtgui/editorpanel.cc index c567fe1b5..fe5400bef 100644 --- a/rtgui/editorpanel.cc +++ b/rtgui/editorpanel.cc @@ -340,17 +340,33 @@ void EditorPanel::open (Thumbnail* tmb, rtengine::InitialImage* isrc) { // try to load the last saved parameters from the cache or from the paramfile file ProcParams* ldprof = NULL; + + Glib::ustring defProf = openThm->getType()==FT_Raw ? options.defProfRaw : options.defProfImg; + + const CacheImageData* cfs=openThm->getCacheImageData(); + if (!options.customProfileBuilder.empty() && !openThm->hasProcParams() && cfs && cfs->exifValid) { + std::ostringstream strm; + strm << Glib::ustring("\"") << options.customProfileBuilder << Glib::ustring("\" \"") << openThm->getFileName() << Glib::ustring("\" \""); + strm << options.rtdir << Glib::ustring("/") << options.profilePath << Glib::ustring("/") << defProf << Glib::ustring(".pp3"); + strm << Glib::ustring("\" ") << cfs->fnumber << Glib::ustring(" ") << cfs->shutter << Glib::ustring(" "); + strm << cfs->focalLen << Glib::ustring(" ") << cfs->iso << Glib::ustring(" \""); + strm << cfs->lens << Glib::ustring("\" \"") << cfs->camera << Glib::ustring("\""); + + bool success = safe_spawn_command_line_sync (strm.str()); + + // Now they SHOULD be there, so try to load them + if (success) openThm->loadProcParams(); + } + if (openThm->hasProcParams()) { ldprof = new ProcParams (); *ldprof = openThm->getProcParams (); } + rtengine::ImageSource* is=isrc->getImageSource(); is->setProgressListener( this ); // initialize profile - if (openThm->getType()!=FT_Raw) - profilep->initProfile (options.defProfImg, ldprof, NULL); - else - profilep->initProfile (options.defProfRaw, ldprof, NULL); + profilep->initProfile (defProf, ldprof, NULL); openThm->addThumbnailListener (this); info_toggled (); diff --git a/rtgui/options.cc b/rtgui/options.cc index fbb4065e6..25af21c41 100644 --- a/rtgui/options.cc +++ b/rtgui/options.cc @@ -212,6 +212,7 @@ if (keyFile.has_group ("Profiles")) { if (keyFile.has_key ("Profiles", "SaveParamsWithFile")) saveParamsFile = keyFile.get_boolean ("Profiles", "SaveParamsWithFile"); if (keyFile.has_key ("Profiles", "SaveParamsToCache")) saveParamsCache = keyFile.get_boolean ("Profiles", "SaveParamsToCache"); if (keyFile.has_key ("Profiles", "LoadParamsFromLocation")) paramsLoadLocation = (PPLoadLocation)keyFile.get_integer ("Profiles", "LoadParamsFromLocation"); + if (keyFile.has_key ("Profiles", "CustomProfileBuilder")) customProfileBuilder = keyFile.get_string ("Profiles", "CustomProfileBuilder"); } if (keyFile.has_group ("File Browser")) { @@ -371,6 +372,7 @@ int Options::saveToFile (Glib::ustring fname) { keyFile.set_boolean ("Profiles", "SaveParamsWithFile", saveParamsFile); keyFile.set_boolean ("Profiles", "SaveParamsToCache", saveParamsCache); keyFile.set_integer ("Profiles", "LoadParamsFromLocation", paramsLoadLocation); + keyFile.set_string ("Profiles", "CustomProfileBuilder", customProfileBuilder); keyFile.set_string ("GUI", "Font", font); keyFile.set_integer ("GUI", "WindowWidth", windowWidth); diff --git a/rtgui/options.h b/rtgui/options.h index da848cd50..ce92ee03f 100644 --- a/rtgui/options.h +++ b/rtgui/options.h @@ -107,6 +107,7 @@ class Options { Glib::ustring gimpDir; Glib::ustring psDir; Glib::ustring customEditorProg; + Glib::ustring customProfileBuilder; int editorToSendTo; int maxThumbnailHeight; int maxCacheEntries; diff --git a/rtgui/safegtk.cc b/rtgui/safegtk.cc index 5660ae799..8c441862a 100644 --- a/rtgui/safegtk.cc +++ b/rtgui/safegtk.cc @@ -187,3 +187,24 @@ bool safe_spawn_command_line_async (const Glib::ustring& cmd_utf8) #endif return success; } + +bool safe_spawn_command_line_sync (const Glib::ustring& cmd_utf8) +{ + std::string cmd; + std::string stdOut; + std::string stdErr; + + bool success = false; + + int exitStatus=-1; + try { + cmd = Glib::filename_from_utf8(cmd_utf8); + printf ("command line: |%s|\n", cmd.c_str()); + + // if it crashes here on windows, make sure you have the GTK runtime files gspawn-win32-helper*.exe files in RT directory + Glib::spawn_command_line_sync (cmd,NULL,NULL, &exitStatus); + } catch (Glib::Exception& ex) { + printf ("%s\n", ex.what().c_str()); + } + return (exitStatus==0); +} diff --git a/rtgui/safegtk.h b/rtgui/safegtk.h index 18030db38..b9b597aaa 100644 --- a/rtgui/safegtk.h +++ b/rtgui/safegtk.h @@ -24,6 +24,7 @@ void safe_build_file_list (Glib::RefPtr &dir, std::vector &dir, std::vector &subDirs, bool add_hidden); bool safe_spawn_command_line_async (const Glib::ustring& cmd_utf8); +bool safe_spawn_command_line_sync (const Glib::ustring& cmd_utf8); Glib::ustring safe_locale_to_utf8 (const std::string& src); // from rtengine std::string safe_locale_from_utf8 (const Glib::ustring& utf8_str);