Merge branch 'dev' into rt-cli

This commit is contained in:
Hombre
2017-03-18 18:17:45 +01:00
156 changed files with 7335 additions and 1876 deletions

View File

@@ -42,6 +42,8 @@ Preferences::Preferences (RTWindow *rtwindow)
, rprofiles (nullptr)
, iprofiles (nullptr)
, parent (rtwindow)
, newFont (false)
, newCPFont (false)
{
regex = Glib::Regex::create(THEMEREGEXSTR, Glib::RegexCompileFlags::REGEX_CASELESS);
@@ -57,6 +59,10 @@ Preferences::Preferences (RTWindow *rtwindow)
set_size_request (650, -1);
set_default_size (options.preferencesWidth, options.preferencesHeight);
Pango::FontDescription defaultFont = get_style_context ()->get_font();
initialFontFamily = defaultFont.get_family ();
initialFontSize = defaultFont.get_size () / Pango::SCALE;
Gtk::Box* mainBox = get_content_area ();
//GTK318
#if GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 20
@@ -83,6 +89,7 @@ Preferences::Preferences (RTWindow *rtwindow)
nb->append_page (*getGeneralPanel(), M("PREFERENCES_TAB_GENERAL"));
nb->append_page (*getProcParamsPanel(), M("PREFERENCES_TAB_IMPROC"));
nb->append_page (*getDynProfilePanel(), M("PREFERENCES_TAB_DYNAMICPROFILE"));
nb->append_page (*getFileBrowserPanel(), M("PREFERENCES_TAB_BROWSER"));
nb->append_page (*getColorManagementPanel(), M("PREFERENCES_TAB_COLORMGR"));
nb->append_page (*getBatchProcPanel(), M("PREFERENCES_BATCH_PROCESSING"));
@@ -232,6 +239,7 @@ Gtk::Widget* Preferences::getBatchProcPanel ()
appendBehavList (mi, M("TP_WBALANCE_TEMPERATURE"), ADDSET_WB_TEMPERATURE, true);
appendBehavList (mi, M("TP_WBALANCE_GREEN"), ADDSET_WB_GREEN, true);
appendBehavList (mi, M("TP_WBALANCE_EQBLUERED"), ADDSET_WB_EQUAL, true);
appendBehavList (mi, M("TP_WBALANCE_TEMPBIAS"), ADDSET_WB_TEMPBIAS, true);
mi = behModel->append ();
mi->set_value (behavColumns.label, M("TP_COLORAPP_LABEL"));
@@ -420,6 +428,14 @@ void Preferences::behSetRadioToggled (const Glib::ustring& path)
iter->set_value (behavColumns.badd, false);
}
Gtk::Widget *Preferences::getDynProfilePanel()
{
dynProfilePanel = Gtk::manage(new DynamicProfilePanel());
return dynProfilePanel;
}
Gtk::Widget* Preferences::getProcParamsPanel ()
{
@@ -429,11 +445,13 @@ Gtk::Widget* Preferences::getProcParamsPanel ()
Gtk::VBox* vbpp = Gtk::manage (new Gtk::VBox ());
Gtk::Label* drlab = Gtk::manage (new Gtk::Label (M("PREFERENCES_FORRAW") + ":", Gtk::ALIGN_START));
rprofiles = Gtk::manage (new ProfileStoreComboBox ());
rprofiles->addRow(profileStore.getInternalDynamicPSE());
setExpandAlignProperties(rprofiles, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_CENTER);
rprofiles->set_size_request(50, -1);
rpconn = rprofiles->signal_changed().connect( sigc::mem_fun(*this, &Preferences::forRAWComboChanged) );
Gtk::Label* drimg = Gtk::manage (new Gtk::Label (M("PREFERENCES_FORIMAGE") + ":", Gtk::ALIGN_START));
iprofiles = Gtk::manage (new ProfileStoreComboBox ());
iprofiles->addRow(profileStore.getInternalDynamicPSE());
iprofiles->set_size_request(50, -1);
setExpandAlignProperties(iprofiles, true, false, Gtk::ALIGN_FILL, Gtk::ALIGN_FILL);
ipconn = iprofiles->signal_changed().connect( sigc::mem_fun(*this, &Preferences::forImageComboChanged) );
@@ -1021,7 +1039,11 @@ Gtk::Widget* Preferences::getGeneralPanel ()
fontButton = Gtk::manage( new Gtk::FontButton ());
setExpandAlignProperties(fontButton, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE);
fontButton->set_use_size(true);
fontButton->set_font_name(Glib::ustring::compose("%1 %2", options.fontFamily == "default" ? "sans" : options.fontFamily, options.fontSize));
if (options.fontFamily == "default") {
fontButton->set_font_name (Glib::ustring::compose("%1 %2", initialFontFamily, initialFontSize));
} else {
fontButton->set_font_name (Glib::ustring::compose("%1 %2", options.fontFamily, options.fontSize));
}
themeGrid->attach_next_to(*fontlab, *theme, Gtk::POS_RIGHT, 1, 1);
themeGrid->attach_next_to(*fontButton, *fontlab, Gtk::POS_RIGHT, 1, 1);
@@ -1031,7 +1053,11 @@ Gtk::Widget* Preferences::getGeneralPanel ()
colorPickerFontButton = Gtk::manage( new Gtk::FontButton ());
setExpandAlignProperties(fontButton, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE);
colorPickerFontButton->set_use_size(true);
colorPickerFontButton->set_font_name(Glib::ustring::compose("%1 %2", options.CPFontFamily == "default" ? "sans" : options.CPFontFamily, options.CPFontSize));
if (options.fontFamily == "default") {
colorPickerFontButton->set_font_name (Glib::ustring::compose("%1 %2", initialFontFamily, initialFontSize));
} else {
colorPickerFontButton->set_font_name (Glib::ustring::compose("%1 %2", options.CPFontFamily, options.CPFontSize));
}
themeGrid->attach_next_to(*cpfontlab, *fontButton, Gtk::POS_RIGHT, 1, 1);
themeGrid->attach_next_to(*colorPickerFontButton, *cpfontlab, Gtk::POS_RIGHT, 1, 1);
@@ -1182,6 +1208,7 @@ Gtk::Widget* Preferences::getGeneralPanel ()
langAutoDetectConn = ckbLangAutoDetect->signal_toggled().connect (sigc::mem_fun(*this, &Preferences::langAutoDetectToggled));
tconn = theme->signal_changed().connect( sigc::mem_fun(*this, &Preferences::themeChanged) );
fconn = fontButton->signal_font_set().connect( sigc::mem_fun(*this, &Preferences::fontChanged) );
cpfconn = colorPickerFontButton->signal_font_set().connect( sigc::mem_fun(*this, &Preferences::cpFontChanged) );
return mvbsd;
}
@@ -1571,12 +1598,16 @@ void Preferences::storePreferences ()
moptions.navGuideBrush[3] = butNavGuideCol->get_alpha() / 65535.0;
Pango::FontDescription fd(fontButton->get_font_name());
moptions.fontFamily = fd.get_family();
moptions.fontSize = fd.get_size() / Pango::SCALE;
if (newFont) {
moptions.fontFamily = fd.get_family();
moptions.fontSize = fd.get_size() / Pango::SCALE;
}
Pango::FontDescription cpfd(colorPickerFontButton->get_font_name());
moptions.CPFontFamily = cpfd.get_family();
moptions.CPFontSize = cpfd.get_size() / Pango::SCALE;
if (newCPFont) {
moptions.CPFontFamily = cpfd.get_family();
moptions.CPFontSize = cpfd.get_size() / Pango::SCALE;
}
#ifdef WIN32
moptions.gimpDir = gimpDir->get_filename ();
@@ -1747,6 +1778,7 @@ void Preferences::fillPreferences ()
tconn.block (true);
fconn.block (true);
cpfconn.block (true);
sconn.block (true);
dfconn.block (true);
ffconn.block (true);
@@ -1832,8 +1864,17 @@ void Preferences::fillPreferences ()
butNavGuideCol->set_rgba(NavGuideCol);
butNavGuideCol->set_alpha ( (unsigned short)(moptions.navGuideBrush[3] * 65535.0));
fontButton->set_font_name(Glib::ustring::compose("%1 %2", options.fontFamily == "default" ? "sans" : options.fontFamily, options.fontSize));
colorPickerFontButton->set_font_name(Glib::ustring::compose("%1 %2", options.CPFontFamily == "default" ? "sans" : options.CPFontFamily, options.CPFontSize));
if (options.fontFamily == "default") {
fontButton->set_font_name (Glib::ustring::compose("%1 %2", initialFontFamily, initialFontSize));
} else {
fontButton->set_font_name (Glib::ustring::compose("%1 %2", options.fontFamily, options.fontSize));
}
if (options.CPFontFamily == "default") {
colorPickerFontButton->set_font_name (Glib::ustring::compose("%1 %2", initialFontFamily, initialFontSize));
} else {
colorPickerFontButton->set_font_name (Glib::ustring::compose("%1 %2", options.CPFontFamily, options.CPFontSize));
}
showDateTime->set_active (moptions.fbShowDateTime);
showBasicExif->set_active (moptions.fbShowBasicExif);
@@ -1855,13 +1896,13 @@ void Preferences::fillPreferences ()
if (Glib::file_test (moptions.gimpDir, Glib::FILE_TEST_IS_DIR)) {
gimpDir->set_current_folder (moptions.gimpDir);
} else {
gimpDir->set_current_folder ("");
gimpDir->set_current_folder (Glib::get_home_dir());
}
if (Glib::file_test (moptions.psDir, Glib::FILE_TEST_IS_DIR)) {
psDir->set_current_folder (moptions.psDir);
} else {
psDir->set_current_folder ("");
psDir->set_current_folder (Glib::get_home_dir());
}
#elif defined __APPLE__
@@ -1869,6 +1910,8 @@ void Preferences::fillPreferences ()
if (Glib::file_test (moptions.psDir, Glib::FILE_TEST_IS_DIR)) {
psDir->set_current_folder (moptions.psDir);
} else {
psDir->set_current_folder (Glib::get_home_dir());
}
#endif
@@ -1954,6 +1997,7 @@ void Preferences::fillPreferences ()
addc.block (false);
setc.block (false);
cpfconn.block (false);
fconn.block (false);
tconn.block (false);
sconn.block (false);
@@ -2020,6 +2064,7 @@ void Preferences::okPressed ()
options.copyFrom (&moptions);
options.filterOutParsedExtensions();
Options::save ();
dynProfilePanel->save();
hide ();
}
@@ -2035,7 +2080,11 @@ void Preferences::cancelPressed ()
// set the initial font back
Pango::FontDescription fd(fontButton->get_font_name());
if (fd.get_family() != options.fontFamily && (fd.get_size() / Pango::SCALE) != options.fontSize) {
switchFontTo(options.fontFamily == "default" ? "sans" : options.fontFamily, options.fontSize);
if (options.fontFamily == "default") {
switchFontTo(initialFontFamily, initialFontSize);
} else {
switchFontTo(options.fontFamily, options.fontSize);
}
}
// update the profileStore
@@ -2181,6 +2230,8 @@ void Preferences::updateProfileList()
{
rprofiles->updateProfileList();
iprofiles->updateProfileList();
rprofiles->addRow(profileStore.getInternalDynamicPSE());
iprofiles->addRow(profileStore.getInternalDynamicPSE());
}
void Preferences::restoreValue()
@@ -2230,10 +2281,17 @@ void Preferences::switchThemeTo(Glib::ustring newTheme)
void Preferences::fontChanged ()
{
newFont = true;
Pango::FontDescription fd(fontButton->get_font_name());
switchFontTo(fd.get_family(), fd.get_size() / Pango::SCALE);
}
void Preferences::cpFontChanged ()
{
newCPFont = true;
}
void Preferences::switchFontTo(const Glib::ustring &newFontFamily, const int newFontSize)
{
@@ -2258,6 +2316,13 @@ void Preferences::switchFontTo(const Glib::ustring &newFontFamily, const int new
printf("Error: Can't find the font named \"%s\"\n", newFontFamily.c_str());
}
}
else {
if (fontcss) {
fontcss = Gtk::CssProvider::create();
Glib::RefPtr<Gdk::Screen> screen = Gdk::Screen::get_default();
Gtk::StyleContext::remove_provider_for_screen(screen, fontcss);
}
}
}
void Preferences::workflowUpdate ()