Merge branch 'dev' into psgtk3
This commit is contained in:
commit
9d16f2ac95
@ -41,6 +41,8 @@ Preferences::Preferences (RTWindow *rtwindow)
|
|||||||
, rprofiles (nullptr)
|
, rprofiles (nullptr)
|
||||||
, iprofiles (nullptr)
|
, iprofiles (nullptr)
|
||||||
, parent (rtwindow)
|
, parent (rtwindow)
|
||||||
|
, newFont (false)
|
||||||
|
, newCPFont (false)
|
||||||
{
|
{
|
||||||
regex = Glib::Regex::create(THEMEREGEXSTR, Glib::RegexCompileFlags::REGEX_CASELESS);
|
regex = Glib::Regex::create(THEMEREGEXSTR, Glib::RegexCompileFlags::REGEX_CASELESS);
|
||||||
|
|
||||||
@ -56,6 +58,10 @@ Preferences::Preferences (RTWindow *rtwindow)
|
|||||||
set_size_request (650, -1);
|
set_size_request (650, -1);
|
||||||
set_default_size (options.preferencesWidth, options.preferencesHeight);
|
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 ();
|
Gtk::Box* mainBox = get_content_area ();
|
||||||
//GTK318
|
//GTK318
|
||||||
#if GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 20
|
#if GTK_MAJOR_VERSION == 3 && GTK_MINOR_VERSION < 20
|
||||||
@ -1032,7 +1038,11 @@ Gtk::Widget* Preferences::getGeneralPanel ()
|
|||||||
fontButton = Gtk::manage( new Gtk::FontButton ());
|
fontButton = Gtk::manage( new Gtk::FontButton ());
|
||||||
setExpandAlignProperties(fontButton, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE);
|
setExpandAlignProperties(fontButton, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE);
|
||||||
fontButton->set_use_size(true);
|
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(*fontlab, *theme, Gtk::POS_RIGHT, 1, 1);
|
||||||
themeGrid->attach_next_to(*fontButton, *fontlab, Gtk::POS_RIGHT, 1, 1);
|
themeGrid->attach_next_to(*fontButton, *fontlab, Gtk::POS_RIGHT, 1, 1);
|
||||||
@ -1042,7 +1052,11 @@ Gtk::Widget* Preferences::getGeneralPanel ()
|
|||||||
colorPickerFontButton = Gtk::manage( new Gtk::FontButton ());
|
colorPickerFontButton = Gtk::manage( new Gtk::FontButton ());
|
||||||
setExpandAlignProperties(fontButton, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE);
|
setExpandAlignProperties(fontButton, false, false, Gtk::ALIGN_FILL, Gtk::ALIGN_BASELINE);
|
||||||
colorPickerFontButton->set_use_size(true);
|
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(*cpfontlab, *fontButton, Gtk::POS_RIGHT, 1, 1);
|
||||||
themeGrid->attach_next_to(*colorPickerFontButton, *cpfontlab, Gtk::POS_RIGHT, 1, 1);
|
themeGrid->attach_next_to(*colorPickerFontButton, *cpfontlab, Gtk::POS_RIGHT, 1, 1);
|
||||||
@ -1193,6 +1207,7 @@ Gtk::Widget* Preferences::getGeneralPanel ()
|
|||||||
langAutoDetectConn = ckbLangAutoDetect->signal_toggled().connect (sigc::mem_fun(*this, &Preferences::langAutoDetectToggled));
|
langAutoDetectConn = ckbLangAutoDetect->signal_toggled().connect (sigc::mem_fun(*this, &Preferences::langAutoDetectToggled));
|
||||||
tconn = theme->signal_changed().connect( sigc::mem_fun(*this, &Preferences::themeChanged) );
|
tconn = theme->signal_changed().connect( sigc::mem_fun(*this, &Preferences::themeChanged) );
|
||||||
fconn = fontButton->signal_font_set().connect( sigc::mem_fun(*this, &Preferences::fontChanged) );
|
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;
|
return mvbsd;
|
||||||
}
|
}
|
||||||
@ -1582,12 +1597,16 @@ void Preferences::storePreferences ()
|
|||||||
moptions.navGuideBrush[3] = butNavGuideCol->get_alpha() / 65535.0;
|
moptions.navGuideBrush[3] = butNavGuideCol->get_alpha() / 65535.0;
|
||||||
|
|
||||||
Pango::FontDescription fd(fontButton->get_font_name());
|
Pango::FontDescription fd(fontButton->get_font_name());
|
||||||
moptions.fontFamily = fd.get_family();
|
if (newFont) {
|
||||||
moptions.fontSize = fd.get_size() / Pango::SCALE;
|
moptions.fontFamily = fd.get_family();
|
||||||
|
moptions.fontSize = fd.get_size() / Pango::SCALE;
|
||||||
|
}
|
||||||
|
|
||||||
Pango::FontDescription cpfd(colorPickerFontButton->get_font_name());
|
Pango::FontDescription cpfd(colorPickerFontButton->get_font_name());
|
||||||
moptions.CPFontFamily = cpfd.get_family();
|
if (newCPFont) {
|
||||||
moptions.CPFontSize = cpfd.get_size() / Pango::SCALE;
|
moptions.CPFontFamily = cpfd.get_family();
|
||||||
|
moptions.CPFontSize = cpfd.get_size() / Pango::SCALE;
|
||||||
|
}
|
||||||
|
|
||||||
#ifdef WIN32
|
#ifdef WIN32
|
||||||
moptions.gimpDir = gimpDir->get_filename ();
|
moptions.gimpDir = gimpDir->get_filename ();
|
||||||
@ -1758,6 +1777,7 @@ void Preferences::fillPreferences ()
|
|||||||
|
|
||||||
tconn.block (true);
|
tconn.block (true);
|
||||||
fconn.block (true);
|
fconn.block (true);
|
||||||
|
cpfconn.block (true);
|
||||||
sconn.block (true);
|
sconn.block (true);
|
||||||
dfconn.block (true);
|
dfconn.block (true);
|
||||||
ffconn.block (true);
|
ffconn.block (true);
|
||||||
@ -1843,8 +1863,17 @@ void Preferences::fillPreferences ()
|
|||||||
butNavGuideCol->set_rgba(NavGuideCol);
|
butNavGuideCol->set_rgba(NavGuideCol);
|
||||||
butNavGuideCol->set_alpha ( (unsigned short)(moptions.navGuideBrush[3] * 65535.0));
|
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));
|
if (options.fontFamily == "default") {
|
||||||
colorPickerFontButton->set_font_name(Glib::ustring::compose("%1 %2", options.CPFontFamily == "default" ? "sans" : options.CPFontFamily, options.CPFontSize));
|
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);
|
showDateTime->set_active (moptions.fbShowDateTime);
|
||||||
showBasicExif->set_active (moptions.fbShowBasicExif);
|
showBasicExif->set_active (moptions.fbShowBasicExif);
|
||||||
@ -1965,6 +1994,7 @@ void Preferences::fillPreferences ()
|
|||||||
|
|
||||||
addc.block (false);
|
addc.block (false);
|
||||||
setc.block (false);
|
setc.block (false);
|
||||||
|
cpfconn.block (false);
|
||||||
fconn.block (false);
|
fconn.block (false);
|
||||||
tconn.block (false);
|
tconn.block (false);
|
||||||
sconn.block (false);
|
sconn.block (false);
|
||||||
@ -2047,7 +2077,11 @@ void Preferences::cancelPressed ()
|
|||||||
// set the initial font back
|
// set the initial font back
|
||||||
Pango::FontDescription fd(fontButton->get_font_name());
|
Pango::FontDescription fd(fontButton->get_font_name());
|
||||||
if (fd.get_family() != options.fontFamily && (fd.get_size() / Pango::SCALE) != options.fontSize) {
|
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
|
// update the profileStore
|
||||||
@ -2244,10 +2278,17 @@ void Preferences::switchThemeTo(Glib::ustring newTheme)
|
|||||||
void Preferences::fontChanged ()
|
void Preferences::fontChanged ()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
newFont = true;
|
||||||
Pango::FontDescription fd(fontButton->get_font_name());
|
Pango::FontDescription fd(fontButton->get_font_name());
|
||||||
switchFontTo(fd.get_family(), fd.get_size() / Pango::SCALE);
|
switchFontTo(fd.get_family(), fd.get_size() / Pango::SCALE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Preferences::cpFontChanged ()
|
||||||
|
{
|
||||||
|
|
||||||
|
newCPFont = true;
|
||||||
|
}
|
||||||
|
|
||||||
void Preferences::switchFontTo(const Glib::ustring &newFontFamily, const int newFontSize)
|
void Preferences::switchFontTo(const Glib::ustring &newFontFamily, const int newFontSize)
|
||||||
{
|
{
|
||||||
|
|
||||||
@ -2272,6 +2313,13 @@ void Preferences::switchFontTo(const Glib::ustring &newFontFamily, const int new
|
|||||||
printf("Error: Can't find the font named \"%s\"\n", newFontFamily.c_str());
|
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 ()
|
void Preferences::workflowUpdate ()
|
||||||
|
@ -208,10 +208,13 @@ class Preferences : public Gtk::Dialog, public ProfileStoreListener
|
|||||||
Glib::ustring storedValueImg;
|
Glib::ustring storedValueImg;
|
||||||
|
|
||||||
Options moptions;
|
Options moptions;
|
||||||
sigc::connection tconn, sconn, fconn, addc, setc, dfconn, ffconn, bpconn, rpconn, ipconn;
|
sigc::connection tconn, sconn, fconn, cpfconn, addc, setc, dfconn, ffconn, bpconn, rpconn, ipconn;
|
||||||
sigc::connection autoMonProfileConn, sndEnableConn, langAutoDetectConn, autocielabConn;
|
sigc::connection autoMonProfileConn, sndEnableConn, langAutoDetectConn, autocielabConn;
|
||||||
Glib::ustring initialTheme;
|
Glib::ustring initialTheme;
|
||||||
Glib::ustring initialFont;
|
Glib::ustring initialFontFamily;
|
||||||
|
int initialFontSize;
|
||||||
|
bool newFont;
|
||||||
|
bool newCPFont;
|
||||||
|
|
||||||
void fillPreferences ();
|
void fillPreferences ();
|
||||||
void storePreferences ();
|
void storePreferences ();
|
||||||
@ -222,6 +225,7 @@ class Preferences : public Gtk::Dialog, public ProfileStoreListener
|
|||||||
void workflowUpdate();
|
void workflowUpdate();
|
||||||
void themeChanged ();
|
void themeChanged ();
|
||||||
void fontChanged ();
|
void fontChanged ();
|
||||||
|
void cpFontChanged ();
|
||||||
void forRAWComboChanged ();
|
void forRAWComboChanged ();
|
||||||
void forImageComboChanged ();
|
void forImageComboChanged ();
|
||||||
void layoutComboChanged ();
|
void layoutComboChanged ();
|
||||||
|
Loading…
x
Reference in New Issue
Block a user