+void
+UIConfiguration::colors_changed ()
+{
+ reset_gtk_theme ();
+
+ /* In theory, one of these ought to work:
+
+ gtk_rc_reparse_all_for_settings (gtk_settings_get_default(), true);
+ gtk_rc_reset_styles (gtk_settings_get_default());
+
+ but in practice, neither of them do. So just reload the current
+ GTK RC file, which causes a reset of all styles and a redraw
+ */
+
+ parameter_changed ("ui-rc-file");
+}
+
+void
+UIConfiguration::parameter_changed (string param)
+{
+ _dirty = true;
+
+ if (param == "ui-rc-file") {
+ load_rc_file (true);
+ } else if (param == "color-file") {
+ load_color_theme ();
+ }
+
+ save_state ();
+}
+
+void
+UIConfiguration::reset_gtk_theme ()
+{
+ stringstream ss;
+
+ ss << "gtk_color_scheme = \"" << hex;
+
+ for (ColorAliases::iterator g = color_aliases.begin(); g != color_aliases.end(); ++g) {
+
+ if (g->first.find ("gtk_") == 0) {
+ const string gtk_name = g->first.substr (4);
+ ss << gtk_name << ":#" << std::setw (6) << setfill ('0') << (color (g->second) >> 8) << ';';
+ }
+ }
+
+ ss << '"' << dec << endl;
+
+ /* reset GTK color scheme */
+
+ Gtk::Settings::get_default()->property_gtk_color_scheme() = ss.str();
+}
+
+void
+UIConfiguration::reset_dpi ()
+{
+ long val = get_font_scale();
+ set_pango_fontsize ();
+ /* Xft rendering */
+
+ gtk_settings_set_long_property (gtk_settings_get_default(),
+ "gtk-xft-dpi", val, "ardour");
+ DPIReset(); //Emit Signal
+}
+
+void
+UIConfiguration::set_pango_fontsize ()
+{
+ long val = get_font_scale();
+
+ /* FT2 rendering - used by GnomeCanvas, sigh */
+
+#ifndef PLATFORM_WINDOWS
+ pango_ft2_font_map_set_resolution ((PangoFT2FontMap*) pango_ft2_font_map_new(), val/1024, val/1024);
+#endif
+
+ /* Cairo rendering, in case there is any */
+
+ pango_cairo_font_map_set_resolution ((PangoCairoFontMap*) pango_cairo_font_map_get_default(), val/1024);
+}
+
+float
+UIConfiguration::get_ui_scale ()
+{
+ return get_font_scale () / 102400.;
+}
+