merge with Dev
This commit is contained in:
@@ -393,14 +393,22 @@ LFLens LFDatabase::findLens(const LFCamera &camera, const Glib::ustring &name) c
|
||||
lname = camera.getModel(); // "Standard"
|
||||
}
|
||||
auto found = data_->FindLenses(camera.data_, nullptr, lname.c_str());
|
||||
if (!found) {
|
||||
// try to split the maker from the model of the lens
|
||||
for (size_t pos = 0; !found && pos < name.size(); ) {
|
||||
// try to split the maker from the model of the lens -- we have to
|
||||
// guess a bit here, since there are makers with a multi-word name
|
||||
// (e.g. "Leica Camera AG")
|
||||
if (name.find("f/", pos) == 0) {
|
||||
break; // no need to search further
|
||||
}
|
||||
Glib::ustring make, model;
|
||||
auto i = name.find_first_of(' ');
|
||||
auto i = name.find(' ', pos);
|
||||
if (i != Glib::ustring::npos) {
|
||||
make = name.substr(0, i);
|
||||
model = name.substr(i+1);
|
||||
found = data_->FindLenses(camera.data_, make.c_str(), model.c_str());
|
||||
pos = i+1;
|
||||
} else {
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (found) {
|
||||
|
@@ -67,9 +67,9 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt,
|
||||
}
|
||||
|
||||
editPointCustom = Gtk::manage (new Gtk::ToggleButton ());
|
||||
initButton(*editPointCustom, Glib::ustring("gtk-edit.png"), Gtk::ALIGN_START, false, Glib::ustring(M("CURVEEDITOR_EDITPOINT_HINT")));
|
||||
initButton(*editPointCustom, Glib::ustring("gtk-edit.png"), Gtk::ALIGN_START, false, "CURVEEDITOR_EDITPOINT_HINT");
|
||||
editCustom = Gtk::manage (new Gtk::ToggleButton());
|
||||
initButton(*editCustom, Glib::ustring("editmodehand.png"), Gtk::ALIGN_START, false, Glib::ustring(M("EDIT_PIPETTE_TOOLTIP")));
|
||||
initButton(*editCustom, Glib::ustring("editmodehand.png"), Gtk::ALIGN_START, false, "EDIT_PIPETTE_TOOLTIP");
|
||||
editCustom->hide();
|
||||
copyCustom = Gtk::manage (new Gtk::Button ());
|
||||
initButton(*copyCustom, Glib::ustring("edit-copy.png"), Gtk::ALIGN_END, true);
|
||||
@@ -144,9 +144,9 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt,
|
||||
}
|
||||
|
||||
editPointNURBS = Gtk::manage (new Gtk::ToggleButton ());
|
||||
initButton(*editPointNURBS, Glib::ustring("gtk-edit.png"), Gtk::ALIGN_START, false, Glib::ustring(M("CURVEEDITOR_EDITPOINT_HINT")));
|
||||
initButton(*editPointNURBS, Glib::ustring("gtk-edit.png"), Gtk::ALIGN_START, false, "CURVEEDITOR_EDITPOINT_HINT");
|
||||
editNURBS = Gtk::manage (new Gtk::ToggleButton());
|
||||
initButton(*editNURBS, Glib::ustring("editmodehand.png"), Gtk::ALIGN_START, false, Glib::ustring(M("EDIT_PIPETTE_TOOLTIP")));
|
||||
initButton(*editNURBS, Glib::ustring("editmodehand.png"), Gtk::ALIGN_START, false, "EDIT_PIPETTE_TOOLTIP");
|
||||
editNURBS->hide();
|
||||
copyNURBS = Gtk::manage (new Gtk::Button ());
|
||||
initButton(*copyNURBS, Glib::ustring("edit-copy.png"), Gtk::ALIGN_END, true);
|
||||
@@ -224,7 +224,7 @@ DiagonalCurveEditorSubGroup::DiagonalCurveEditorSubGroup (CurveEditorGroup* prt,
|
||||
shcSelector->set_name("CurveSHCSelector"); // To handle the 4px gap between the SHCSelector and the curve through CSS
|
||||
|
||||
editParam = Gtk::manage (new Gtk::ToggleButton());
|
||||
initButton(*editParam, Glib::ustring("editmodehand.png"), Gtk::ALIGN_START, false, Glib::ustring(M("EDIT_PIPETTE_TOOLTIP")));
|
||||
initButton(*editParam, Glib::ustring("editmodehand.png"), Gtk::ALIGN_START, false, "EDIT_PIPETTE_TOOLTIP");
|
||||
editParam->hide();
|
||||
copyParam = Gtk::manage (new Gtk::Button ());
|
||||
initButton(*copyParam, Glib::ustring("edit-copy.png"), Gtk::ALIGN_END, true);
|
||||
|
@@ -63,9 +63,9 @@ FlatCurveEditorSubGroup::FlatCurveEditorSubGroup (CurveEditorGroup* prt, Glib::u
|
||||
}
|
||||
|
||||
editCPoints = Gtk::manage (new Gtk::ToggleButton());
|
||||
initButton(*editCPoints, Glib::ustring("editmodehand.png"), Gtk::ALIGN_START, false, Glib::ustring(M("EDIT_PIPETTE_TOOLTIP")));
|
||||
initButton(*editCPoints, Glib::ustring("editmodehand.png"), Gtk::ALIGN_START, false, "EDIT_PIPETTE_TOOLTIP");
|
||||
editPointCPoints = Gtk::manage (new Gtk::ToggleButton ());
|
||||
initButton(*editPointCPoints, Glib::ustring("gtk-edit.png"), Gtk::ALIGN_START, false, Glib::ustring(M("CURVEEDITOR_EDITPOINT_HINT")));
|
||||
initButton(*editPointCPoints, Glib::ustring("gtk-edit.png"), Gtk::ALIGN_START, false, "CURVEEDITOR_EDITPOINT_HINT");
|
||||
copyCPoints = Gtk::manage (new Gtk::Button ());
|
||||
initButton(*copyCPoints, Glib::ustring("edit-copy.png"), Gtk::ALIGN_END, true);
|
||||
pasteCPoints = Gtk::manage (new Gtk::Button ());
|
||||
|
@@ -420,7 +420,8 @@ bool LensProfilePanel::setLensfunLens(const Glib::ustring &lens)
|
||||
if (it && (*it)[lf->lensfunModelLens.lens] == lens) {
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
bool first_maker_found = false;
|
||||
for (auto row : lf->lensfunLensModel->children()) {
|
||||
if (lens.find(row[lf->lensfunModelLens.lens]) == 0) {
|
||||
auto &c = row.children();
|
||||
@@ -431,6 +432,11 @@ bool LensProfilePanel::setLensfunLens(const Glib::ustring &lens)
|
||||
return true;
|
||||
}
|
||||
}
|
||||
// we do not break immediately here, because there might be multiple makers
|
||||
// sharing the same prefix (e.g. "Leica" and "Leica Camera AG").
|
||||
// therefore, we break below when the lens doesn't match any of them
|
||||
first_maker_found = true;
|
||||
} else if (first_maker_found) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@@ -19,7 +19,6 @@
|
||||
#include "multilangmgr.h"
|
||||
|
||||
#include <fstream>
|
||||
#include <regex>
|
||||
|
||||
#ifdef WIN32
|
||||
#include <windows.h>
|
||||
@@ -107,59 +106,52 @@ MultiLangMgr::MultiLangMgr ()
|
||||
{
|
||||
}
|
||||
|
||||
MultiLangMgr::MultiLangMgr (const Glib::ustring& fname, MultiLangMgr* fallbackMgr)
|
||||
void MultiLangMgr::load (const std::vector<Glib::ustring> &fnames)
|
||||
{
|
||||
load (fname, fallbackMgr);
|
||||
}
|
||||
translations.clear();
|
||||
|
||||
bool MultiLangMgr::load (const Glib::ustring& fname, MultiLangMgr* fallbackMgr)
|
||||
{
|
||||
this->fallbackMgr.reset(fallbackMgr);
|
||||
|
||||
std::ifstream file(fname.c_str());
|
||||
if (!file.is_open()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
std::map<std::string, Glib::ustring> translations;
|
||||
std::string entry;
|
||||
|
||||
while (std::getline(file, entry)) {
|
||||
|
||||
if (entry.empty() || entry.front() == '#' || entry.front() == '!') {
|
||||
for (const auto& fname : fnames) {
|
||||
if(fname.empty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string key, value;
|
||||
|
||||
std::istringstream line(entry);
|
||||
|
||||
if (!std::getline(line, key, ';') || !std::getline(line, value)) {
|
||||
std::ifstream file(fname.c_str());
|
||||
if (!file.is_open()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
static const std::regex newline("\\\\n");
|
||||
value = std::regex_replace(value, newline, "\n");
|
||||
std::string entry;
|
||||
auto hint = translations.begin();
|
||||
while (std::getline(file, entry)) {
|
||||
|
||||
translations.emplace(key, value);
|
||||
if (entry.empty() || entry.front() == '#' || entry.front() == '!') {
|
||||
continue;
|
||||
}
|
||||
|
||||
std::string key, value;
|
||||
|
||||
std::istringstream line(entry);
|
||||
|
||||
if(std::getline(line, key, ';') && translations.find(key) == translations.end() && std::getline(line, value)) {
|
||||
size_t pos = 0;
|
||||
while((pos = value.find("\\n", pos)) != std::string::npos) {
|
||||
value.replace(pos, 2, "\n");
|
||||
pos++;
|
||||
}
|
||||
hint = translations.emplace_hint(hint, key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
this->translations.swap(translations);
|
||||
return true;
|
||||
}
|
||||
|
||||
Glib::ustring MultiLangMgr::getStr (const std::string& key) const
|
||||
{
|
||||
const auto iterator = translations.find (key);
|
||||
const auto iterator = translations.find(key);
|
||||
|
||||
if (iterator != translations.end ()) {
|
||||
if (iterator != translations.end()) {
|
||||
return iterator->second;
|
||||
}
|
||||
|
||||
if (fallbackMgr) {
|
||||
return fallbackMgr->getStr (key);
|
||||
}
|
||||
|
||||
return key;
|
||||
}
|
||||
|
||||
|
@@ -20,8 +20,8 @@
|
||||
#define _MULTILANGMGR_
|
||||
|
||||
#include <map>
|
||||
#include <memory>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
|
||||
#include <glibmm/ustring.h>
|
||||
|
||||
@@ -29,22 +29,14 @@ class MultiLangMgr
|
||||
{
|
||||
public:
|
||||
MultiLangMgr ();
|
||||
MultiLangMgr (const Glib::ustring& fname, MultiLangMgr* fallbackMgr = nullptr);
|
||||
|
||||
public:
|
||||
bool load (const Glib::ustring& fname, MultiLangMgr* fallbackMgr = nullptr);
|
||||
|
||||
public:
|
||||
Glib::ustring getStr (const std::string& key) const;
|
||||
|
||||
public:
|
||||
static bool isOSLanguageDetectSupported ();
|
||||
static Glib::ustring getOSUserLanguage ();
|
||||
void load(const std::vector<Glib::ustring> &fnames);
|
||||
Glib::ustring getStr(const std::string& key) const;
|
||||
static bool isOSLanguageDetectSupported();
|
||||
static Glib::ustring getOSUserLanguage();
|
||||
|
||||
private:
|
||||
std::map<std::string, Glib::ustring> translations;
|
||||
std::unique_ptr<MultiLangMgr> fallbackMgr;
|
||||
|
||||
};
|
||||
|
||||
extern MultiLangMgr langMgr;
|
||||
|
@@ -2390,7 +2390,7 @@ void Options::load (bool lightweight)
|
||||
}
|
||||
}
|
||||
|
||||
langMgr.load (localeTranslation, new MultiLangMgr (languageTranslation, new MultiLangMgr (defaultTranslation)));
|
||||
langMgr.load ({localeTranslation, languageTranslation, defaultTranslation});
|
||||
|
||||
rtengine::init (&options.rtSettings, argv0, rtdir, !lightweight);
|
||||
}
|
||||
|
@@ -26,12 +26,12 @@
|
||||
using namespace rtengine;
|
||||
using namespace rtengine::procparams;
|
||||
|
||||
PartialPasteDlg* ProfilePanel::partialProfileDlg;
|
||||
PartialPasteDlg* ProfilePanel::partialProfileDlg = nullptr;
|
||||
Gtk::Window* ProfilePanel::parent;
|
||||
|
||||
|
||||
void ProfilePanel::init (Gtk::Window* parent)
|
||||
void ProfilePanel::init (Gtk::Window* parentWindow)
|
||||
{
|
||||
partialProfileDlg = new PartialPasteDlg (Glib::ustring (), parent);
|
||||
parent = parentWindow;
|
||||
}
|
||||
|
||||
void ProfilePanel::cleanup ()
|
||||
@@ -336,6 +336,9 @@ void ProfilePanel::save_clicked (GdkEventButton* event)
|
||||
if (toSave) {
|
||||
if (event->state & Gdk::CONTROL_MASK) {
|
||||
// opening the partial paste dialog window
|
||||
if(!partialProfileDlg) {
|
||||
partialProfileDlg = new PartialPasteDlg (Glib::ustring (), parent);
|
||||
}
|
||||
partialProfileDlg->set_title(M("PROFILEPANEL_SAVEPPASTE"));
|
||||
int i = partialProfileDlg->run();
|
||||
partialProfileDlg->hide();
|
||||
@@ -407,6 +410,9 @@ void ProfilePanel::copy_clicked (GdkEventButton* event)
|
||||
if (toSave) {
|
||||
if (event->state & Gdk::CONTROL_MASK) {
|
||||
// opening the partial paste dialog window
|
||||
if(!partialProfileDlg) {
|
||||
partialProfileDlg = new PartialPasteDlg (Glib::ustring (), parent);
|
||||
}
|
||||
partialProfileDlg->set_title(M("PROFILEPANEL_COPYPPASTE"));
|
||||
int i = partialProfileDlg->run();
|
||||
partialProfileDlg->hide();
|
||||
@@ -475,6 +481,9 @@ void ProfilePanel::load_clicked (GdkEventButton* event)
|
||||
printf("fname=%s\n", fname.c_str());
|
||||
if (event->state & Gdk::CONTROL_MASK) {
|
||||
// opening the partial paste dialog window
|
||||
if(!partialProfileDlg) {
|
||||
partialProfileDlg = new PartialPasteDlg (Glib::ustring (), parent);
|
||||
}
|
||||
partialProfileDlg->set_title(M("PROFILEPANEL_LOADPPASTE"));
|
||||
int i = partialProfileDlg->run();
|
||||
partialProfileDlg->hide();
|
||||
@@ -514,6 +523,9 @@ void ProfilePanel::load_clicked (GdkEventButton* event)
|
||||
if (event->state & Gdk::CONTROL_MASK)
|
||||
// custom.pparams = loadedFile.pparams filtered by ( loadedFile.pedited & partialPaste.pedited )
|
||||
{
|
||||
if(!partialProfileDlg) {
|
||||
partialProfileDlg = new PartialPasteDlg (Glib::ustring (), parent);
|
||||
}
|
||||
partialProfileDlg->applyPaste (custom->pparams, !fillMode->get_active() ? custom->pedited : nullptr, &pp, &pe);
|
||||
} else {
|
||||
// custom.pparams = loadedFile.pparams filtered by ( loadedFile.pedited )
|
||||
@@ -551,6 +563,9 @@ void ProfilePanel::paste_clicked (GdkEventButton* event)
|
||||
}
|
||||
|
||||
if (event->state & Gdk::CONTROL_MASK) {
|
||||
if(!partialProfileDlg) {
|
||||
partialProfileDlg = new PartialPasteDlg (Glib::ustring (), parent);
|
||||
}
|
||||
partialProfileDlg->set_title(M("PROFILEPANEL_PASTEPPASTE"));
|
||||
int i = partialProfileDlg->run();
|
||||
partialProfileDlg->hide();
|
||||
@@ -613,6 +628,9 @@ void ProfilePanel::paste_clicked (GdkEventButton* event)
|
||||
if (event->state & Gdk::CONTROL_MASK)
|
||||
// custom.pparams = clipboard.pparams filtered by ( clipboard.pedited & partialPaste.pedited )
|
||||
{
|
||||
if(!partialProfileDlg) {
|
||||
partialProfileDlg = new PartialPasteDlg (Glib::ustring (), parent);
|
||||
}
|
||||
partialProfileDlg->applyPaste (custom->pparams, !fillMode->get_active() ? custom->pedited : nullptr, &pp, &pe);
|
||||
} else {
|
||||
// custom.pparams = clipboard.pparams filtered by ( clipboard.pedited )
|
||||
@@ -626,6 +644,9 @@ void ProfilePanel::paste_clicked (GdkEventButton* event)
|
||||
if (event->state & Gdk::CONTROL_MASK)
|
||||
// custom.pparams = clipboard.pparams filtered by ( partialPaste.pedited )
|
||||
{
|
||||
if(!partialProfileDlg) {
|
||||
partialProfileDlg = new PartialPasteDlg (Glib::ustring (), parent);
|
||||
}
|
||||
partialProfileDlg->applyPaste (custom->pparams, nullptr, &pp, nullptr);
|
||||
} else {
|
||||
// custom.pparams = clipboard.pparams non filtered
|
||||
|
@@ -66,7 +66,7 @@ protected:
|
||||
ProfileChangeListener* tpc;
|
||||
bool dontupdate;
|
||||
sigc::connection changeconn;
|
||||
|
||||
static Gtk::Window* parent;
|
||||
void changeTo (const rtengine::procparams::PartialProfile* newpp, Glib::ustring profname);
|
||||
|
||||
public:
|
||||
@@ -79,7 +79,7 @@ public:
|
||||
tpc = ppl;
|
||||
}
|
||||
|
||||
static void init (Gtk::Window* parent);
|
||||
static void init (Gtk::Window* parentWindow);
|
||||
static void cleanup ();
|
||||
void storeCurrentValue();
|
||||
void updateProfileList ();
|
||||
|
Reference in New Issue
Block a user