Move util functions into UIConfiguration as they depend on it anyway
This commit is contained in:
parent
2e8af0c917
commit
2d47183dc9
|
@ -393,7 +393,7 @@ ARDOUR_UI::ARDOUR_UI (int *argcp, char **argvp[], const char* localedir, UIConfi
|
|||
/* we don't like certain modifiers */
|
||||
Bindings::set_ignored_state (GDK_LOCK_MASK|GDK_MOD2_MASK|GDK_MOD3_MASK);
|
||||
|
||||
reset_dpi();
|
||||
ARDOUR_UI::config()->reset_dpi ();
|
||||
|
||||
TimeAxisViewItem::set_constant_heights ();
|
||||
|
||||
|
|
|
@ -678,7 +678,7 @@ ARDOUR_UI::editor_realized ()
|
|||
boost::function<void (string)> pc (boost::bind (&ARDOUR_UI::parameter_changed, this, _1));
|
||||
Config->map_parameters (pc);
|
||||
|
||||
reset_dpi ();
|
||||
ARDOUR_UI::config()->reset_dpi ();
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -1011,7 +1011,7 @@ private:
|
|||
{
|
||||
_ui_config->set_font_scale ((long) floor (_dpi_adjustment.get_value() * 1024.));
|
||||
/* XXX: should be triggered from the parameter changed signal */
|
||||
reset_dpi ();
|
||||
_ui_config->reset_dpi ();
|
||||
}
|
||||
|
||||
UIConfiguration* _ui_config;
|
||||
|
|
|
@ -29,6 +29,9 @@
|
|||
|
||||
#include <cairo/cairo.h>
|
||||
|
||||
#include <pango/pangoft2.h> // for fontmap resolution control for GnomeCanvas
|
||||
#include <pango/pangocairo.h> // for fontmap resolution control for GnomeCanvas
|
||||
|
||||
#include <glibmm/miscutils.h>
|
||||
#include <glib/gstdio.h>
|
||||
|
||||
|
@ -142,7 +145,35 @@ UIConfiguration::reset_gtk_theme ()
|
|||
|
||||
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");
|
||||
ARDOUR_UI_UTILS::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);
|
||||
}
|
||||
|
||||
void
|
||||
UIConfiguration::map_parameters (boost::function<void (std::string)>& functor)
|
||||
{
|
||||
|
|
|
@ -75,6 +75,9 @@ class UIConfiguration : public PBD::Stateful
|
|||
ArdourCanvas::Color color_mod (const ArdourCanvas::Color& color, std::string const & modifier) const;
|
||||
ArdourCanvas::HSV color_hsv (const std::string&) const;
|
||||
ArdourCanvas::SVAModifier modifier (const std::string&) const;
|
||||
|
||||
void reset_dpi ();
|
||||
void set_pango_fontsize ();
|
||||
|
||||
sigc::signal<void,std::string> ParameterChanged;
|
||||
void map_parameters (boost::function<void (std::string)>&);
|
||||
|
|
|
@ -21,9 +21,6 @@
|
|||
#include "gtk2ardour-config.h"
|
||||
#endif
|
||||
|
||||
#include <pango/pangoft2.h> // for fontmap resolution control for GnomeCanvas
|
||||
#include <pango/pangocairo.h> // for fontmap resolution control for GnomeCanvas
|
||||
|
||||
#include <cstdlib>
|
||||
#include <clocale>
|
||||
#include <cstring>
|
||||
|
@ -799,34 +796,6 @@ ARDOUR_UI_UTILS::key_is_legal_for_numeric_entry (guint keyval)
|
|||
return false;
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI_UTILS::set_pango_fontsize ()
|
||||
{
|
||||
long val = ARDOUR_UI::config()->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);
|
||||
}
|
||||
|
||||
void
|
||||
ARDOUR_UI_UTILS::reset_dpi ()
|
||||
{
|
||||
long val = ARDOUR_UI::config()->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
|
||||
ARDOUR_UI_UTILS::resize_window_to_proportion_of_monitor (Gtk::Window* window, int max_width, int max_height)
|
||||
{
|
||||
|
|
|
@ -80,8 +80,6 @@ static std::map<std::string, Glib::RefPtr<Gdk::Pixbuf> > xpm_map;
|
|||
const char* const *get_xpm_data (std::string path);
|
||||
std::string longest (std::vector<std::string>&);
|
||||
bool key_is_legal_for_numeric_entry (guint keyval);
|
||||
void reset_dpi ();
|
||||
void set_pango_fontsize ();
|
||||
|
||||
void resize_window_to_proportion_of_monitor (Gtk::Window*, int, int);
|
||||
|
||||
|
|
Loading…
Reference in New Issue