change the way font specifications are used in UI config files
If no font family is specified, enforce use of Sans to match GTK behaviour (which we inadvertently relied on, it appears)
This commit is contained in:
parent
280fc81e05
commit
01df705f70
|
@ -255,45 +255,44 @@ CLOCK_VARS(PunchClock, "punch clock")
|
|||
CLOCK_VARS(SelectionClock, "selection clock")
|
||||
CLOCK_VARS(NudgeClock, "nudge clock")
|
||||
CLOCK_VARS(GenericClock, "clock")
|
||||
|
||||
CANVAS_STRING_VARIABLE(canvasvar_SmallFont, "small font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_SmallerFont, "smaller font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_NormalFont, "normal font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_BigFont, "big font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_LargeFont, "large font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_LargerFont, "larger font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_HugerFont, "huger font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_MassiveFont, "massive font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_SmallBoldFont, "small bold font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_SmallerBoldFont, "smaller bold font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_NormalBoldFont, "normal bold font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_BigBoldFont, "big bold font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_LargeBoldFont, "large bold font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_LargerBoldFont, "larger bold font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_HugerBoldFont, "huger bold font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_MassiveBoldFont, "massive bold font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_SmallItalicFont, "small italic font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_SmallerItalicFont, "smaller italic font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_NormalItalicFont, "normal italic font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_BigItalicFont, "big italic font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_LargeItalicFont, "large italic font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_LargerItalicFont, "larger italic font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_HugerItalicFont, "huger italic font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_MassiveItalicFont, "massive italic font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_SmallMonospaceFont, "small monospace font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_SmallerMonospaceFont, "smaller monospace font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_NormalMonospaceFont, "normal monospace font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_BigMonospaceFont, "big monospace font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_LargeMonospaceFont, "large monospace font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_LargerMonospaceFont, "larger monospace font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_HugerMonospaceFont, "huger monospace font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_MassiveMonospaceFont, "massive monospace font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_SmallBoldMonospaceFont, "small bold monospace font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_SmallerBoldMonospaceFont, "smaller bold monospace font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_NormalBoldMonospaceFont, "normal bold monospace font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_BigBoldMonospaceFont, "big bold monospace font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_LargeBoldMonospaceFont, "large bold monospace font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_LargerBoldMonospaceFont, "larger bold monospace font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_HugerBoldMonospaceFont, "huger bold monospace font")
|
||||
CANVAS_STRING_VARIABLE(canvasvar_MassiveBoldMonospaceFont, "massive bold monospace font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_SmallFont, "small font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_SmallerFont, "smaller font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_NormalFont, "normal font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_BigFont, "big font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_LargeFont, "large font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_LargerFont, "larger font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_HugerFont, "huger font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_MassiveFont, "massive font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_SmallBoldFont, "small bold font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_SmallerBoldFont, "smaller bold font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_NormalBoldFont, "normal bold font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_BigBoldFont, "big bold font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_LargeBoldFont, "large bold font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_LargerBoldFont, "larger bold font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_HugerBoldFont, "huger bold font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_MassiveBoldFont, "massive bold font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_SmallItalicFont, "small italic font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_SmallerItalicFont, "smaller italic font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_NormalItalicFont, "normal italic font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_BigItalicFont, "big italic font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_LargeItalicFont, "large italic font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_LargerItalicFont, "larger italic font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_HugerItalicFont, "huger italic font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_MassiveItalicFont, "massive italic font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_SmallMonospaceFont, "small monospace font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_SmallerMonospaceFont, "smaller monospace font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_NormalMonospaceFont, "normal monospace font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_BigMonospaceFont, "big monospace font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_LargeMonospaceFont, "large monospace font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_LargerMonospaceFont, "larger monospace font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_HugerMonospaceFont, "huger monospace font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_MassiveMonospaceFont, "massive monospace font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_SmallBoldMonospaceFont, "small bold monospace font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_SmallerBoldMonospaceFont, "smaller bold monospace font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_NormalBoldMonospaceFont, "normal bold monospace font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_BigBoldMonospaceFont, "big bold monospace font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_LargeBoldMonospaceFont, "large bold monospace font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_LargerBoldMonospaceFont, "larger bold monospace font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_HugerBoldMonospaceFont, "huger bold monospace font")
|
||||
CANVAS_FONT_VARIABLE(canvasvar_MassiveBoldMonospaceFont, "massive bold monospace font")
|
||||
|
||||
|
|
|
@ -47,11 +47,13 @@ UIConfiguration::UIConfiguration ()
|
|||
#define UI_CONFIG_VARIABLE(Type,var,name,val) var (name,val),
|
||||
#define CANVAS_VARIABLE(var,name) var (name),
|
||||
#define CANVAS_STRING_VARIABLE(var,name) var (name),
|
||||
#define CANVAS_FONT_VARIABLE(var,name) var (name),
|
||||
#include "ui_config_vars.h"
|
||||
#include "canvas_vars.h"
|
||||
#undef UI_CONFIG_VARIABLE
|
||||
#undef CANVAS_VARIABLE
|
||||
#undef CANVAS_STRING_VARIABLE
|
||||
#undef CANVAS_FONT_VARIABLE
|
||||
_dirty (false)
|
||||
{
|
||||
load_state();
|
||||
|
@ -218,11 +220,13 @@ UIConfiguration::get_variables (std::string which_node)
|
|||
#define UI_CONFIG_VARIABLE(Type,var,Name,value) if (node->name() == "UI") { var.add_to_node (*node); }
|
||||
#define CANVAS_VARIABLE(var,Name) if (node->name() == "Canvas") { var.add_to_node (*node); }
|
||||
#define CANVAS_STRING_VARIABLE(var,Name) if (node->name() == "Canvas") { var.add_to_node (*node); }
|
||||
#define CANVAS_FONT_VARIABLE(var,Name) if (node->name() == "Canvas") { var.add_to_node (*node); }
|
||||
#include "ui_config_vars.h"
|
||||
#include "canvas_vars.h"
|
||||
#undef UI_CONFIG_VARIABLE
|
||||
#undef CANVAS_VARIABLE
|
||||
#undef CANVAS_STRING_VARIABLE
|
||||
#undef CANVAS_FONT_VARIABLE
|
||||
|
||||
return *node;
|
||||
}
|
||||
|
@ -270,11 +274,16 @@ UIConfiguration::set_variables (const XMLNode& node)
|
|||
if (var.set_from_node (node)) { \
|
||||
ParameterChanged (name); \
|
||||
}
|
||||
#define CANVAS_FONT_VARIABLE(var,name) \
|
||||
if (var.set_from_node (node)) { \
|
||||
ParameterChanged (name); \
|
||||
}
|
||||
#include "ui_config_vars.h"
|
||||
#include "canvas_vars.h"
|
||||
#undef UI_CONFIG_VARIABLE
|
||||
#undef CANVAS_VARIABLE
|
||||
#undef CANVAS_STRING_VARIABLE
|
||||
#undef CANVAS_FONT_VARIABLE
|
||||
}
|
||||
|
||||
void
|
||||
|
@ -283,9 +292,11 @@ UIConfiguration::pack_canvasvars ()
|
|||
#undef CANVAS_VARIABLE
|
||||
#define CANVAS_VARIABLE(var,name) canvas_colors.insert (std::pair<std::string,ColorVariable<uint32_t>* >(name,&var));
|
||||
#define CANVAS_STRING_VARIABLE(var,name)
|
||||
#define CANVAS_FONT_VARIABLE(var,name)
|
||||
#include "canvas_vars.h"
|
||||
#undef CANVAS_VARIABLE
|
||||
#undef CANVAS_STRING_VARIABLE
|
||||
#undef CANVAS_FONT_VARIABLE
|
||||
}
|
||||
|
||||
uint32_t
|
||||
|
|
|
@ -28,6 +28,8 @@
|
|||
#include "pbd/xml++.h"
|
||||
#include "ardour/configuration_variable.h"
|
||||
|
||||
#include "utils.h"
|
||||
|
||||
/* This is very similar to ARDOUR::ConfigVariable but expects numeric values to
|
||||
* be in hexadecimal. This is because it is intended for use with color
|
||||
* specifications which are easier to scan for issues in "rrggbbaa" format than
|
||||
|
@ -113,9 +115,13 @@ class UIConfiguration : public PBD::Stateful
|
|||
#define CANVAS_STRING_VARIABLE(var,name) \
|
||||
std::string get_##var () const { return var.get(); } \
|
||||
bool set_##var (const std::string& val) { bool ret = var.set (val); if (ret) { ParameterChanged (name); } return ret; }
|
||||
#define CANVAS_FONT_VARIABLE(var,name) \
|
||||
Pango::FontDescription get_##var () const { return sanitized_font (var.get()); } \
|
||||
bool set_##var (const std::string& val) { bool ret = var.set (val); if (ret) { ParameterChanged (name); } return ret; }
|
||||
#include "canvas_vars.h"
|
||||
#undef CANVAS_VARIABLE
|
||||
#undef CANVAS_STRING_VARIABLE
|
||||
#undef CANVAS_FONT_VARIABLE
|
||||
|
||||
private:
|
||||
|
||||
|
@ -129,9 +135,11 @@ class UIConfiguration : public PBD::Stateful
|
|||
#undef CANVAS_VARIABLE
|
||||
#define CANVAS_VARIABLE(var,name) ColorVariable<uint32_t> var;
|
||||
#define CANVAS_STRING_VARIABLE(var,name) ARDOUR::ConfigVariable<std::string> var;
|
||||
#define CANVAS_FONT_VARIABLE(var,name) ARDOUR::ConfigVariable<std::string> var;
|
||||
#include "canvas_vars.h"
|
||||
#undef CANVAS_VARIABLE
|
||||
#undef CANVAS_STRING_VARIABLE
|
||||
#undef CANVAS_FONT_VARIABLE
|
||||
|
||||
XMLNode& state ();
|
||||
bool _dirty;
|
||||
|
|
|
@ -206,6 +206,18 @@ xpm2rgba (const char** xpm, uint32_t& w, uint32_t& h)
|
|||
return (savergb);
|
||||
}
|
||||
|
||||
Pango::FontDescription
|
||||
sanitized_font (std::string const& name)
|
||||
{
|
||||
Pango::FontDescription fd (name);
|
||||
|
||||
if (fd.get_family().empty()) {
|
||||
fd.set_family ("Sans");
|
||||
}
|
||||
|
||||
return fd;
|
||||
}
|
||||
|
||||
Pango::FontDescription
|
||||
get_font_for_style (string widgetname)
|
||||
{
|
||||
|
|
|
@ -57,6 +57,7 @@ unsigned char* xpm2rgba (const char** xpm, uint32_t& w, uint32_t& h);
|
|||
|
||||
ArdourCanvas::Points* get_canvas_points (std::string who, uint32_t npoints);
|
||||
|
||||
Pango::FontDescription sanitized_font (std::string const&);
|
||||
Pango::FontDescription get_font_for_style (std::string widgetname);
|
||||
|
||||
uint32_t rgba_from_style (std::string, uint32_t, uint32_t, uint32_t, uint32_t, std::string = "fg", int = Gtk::STATE_NORMAL, bool = true);
|
||||
|
|
Loading…
Reference in New Issue