forked from enlightenment/enlightenment
e17: use application 'font class' for changing font used by applications.
- need to add a page for this in look->applications later.. - allow choosing font size by pixels in basic font dialog, this is not too advanced SVN revision: 64612
This commit is contained in:
parent
88f331c878
commit
83d9f1a16f
|
@ -1,3 +1,7 @@
|
||||||
|
/* TODO
|
||||||
|
check http://www.pvv.org/~mariusbu/proposal.html
|
||||||
|
for advances in cross toolkit settings */
|
||||||
|
|
||||||
#include <e.h>
|
#include <e.h>
|
||||||
#include <X11/Xlib.h>
|
#include <X11/Xlib.h>
|
||||||
#include <X11/Xmd.h> /* For CARD16 */
|
#include <X11/Xmd.h> /* For CARD16 */
|
||||||
|
@ -48,6 +52,7 @@ static Eina_List *settings = NULL;
|
||||||
static Eina_Bool running = EINA_FALSE;
|
static Eina_Bool running = EINA_FALSE;
|
||||||
static const char _setting_icon_theme_name[] = "Net/IconThemeName";
|
static const char _setting_icon_theme_name[] = "Net/IconThemeName";
|
||||||
static const char _setting_theme_name[] = "Net/ThemeName";
|
static const char _setting_theme_name[] = "Net/ThemeName";
|
||||||
|
static const char _setting_font_name[] = "Gtk/FontName";
|
||||||
|
|
||||||
static Ecore_X_Atom
|
static Ecore_X_Atom
|
||||||
_e_xsettings_atom_screen_get(int screen_num)
|
_e_xsettings_atom_screen_get(int screen_num)
|
||||||
|
@ -412,6 +417,38 @@ _e_xsettings_theme_set(void)
|
||||||
_e_xsettings_string_set(_setting_theme_name, NULL);
|
_e_xsettings_string_set(_setting_theme_name, NULL);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void
|
||||||
|
_e_xsettings_font_set(void)
|
||||||
|
{
|
||||||
|
E_Font_Default *efd;
|
||||||
|
E_Font_Properties *efp;
|
||||||
|
|
||||||
|
efd = e_font_default_get("application");
|
||||||
|
|
||||||
|
if (efd && efd->font)
|
||||||
|
{
|
||||||
|
efp = e_font_fontconfig_name_parse(efd->font);
|
||||||
|
if (efp->name)
|
||||||
|
{
|
||||||
|
int size = efd->size;
|
||||||
|
char buf[128];
|
||||||
|
/* TODO better way to convert evas font sizes? */
|
||||||
|
if (size < 0) size /= -10;
|
||||||
|
if (size < 5) size = 5;
|
||||||
|
if (size > 25) size = 25;
|
||||||
|
|
||||||
|
snprintf(buf, sizeof(buf), "%s %d", efp->name, size);
|
||||||
|
_e_xsettings_string_set(_setting_font_name, buf);
|
||||||
|
e_font_properties_free(efp);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
e_font_properties_free(efp);
|
||||||
|
}
|
||||||
|
|
||||||
|
_e_xsettings_string_set(_setting_font_name, NULL);
|
||||||
|
}
|
||||||
|
|
||||||
static void
|
static void
|
||||||
_e_xsettings_start(void)
|
_e_xsettings_start(void)
|
||||||
{
|
{
|
||||||
|
@ -420,9 +457,9 @@ _e_xsettings_start(void)
|
||||||
|
|
||||||
if (running) return;
|
if (running) return;
|
||||||
|
|
||||||
DBG("start__________\n");
|
|
||||||
_e_xsettings_theme_set();
|
_e_xsettings_theme_set();
|
||||||
_e_xsettings_icon_theme_set();
|
_e_xsettings_icon_theme_set();
|
||||||
|
_e_xsettings_font_set();
|
||||||
|
|
||||||
EINA_LIST_FOREACH(e_manager_list(), l, man)
|
EINA_LIST_FOREACH(e_manager_list(), l, man)
|
||||||
{
|
{
|
||||||
|
@ -449,7 +486,7 @@ _e_xsettings_stop(void)
|
||||||
Setting *s;
|
Setting *s;
|
||||||
|
|
||||||
if (!running) return;
|
if (!running) return;
|
||||||
DBG("stop__________\n");
|
|
||||||
EINA_LIST_FREE(managers, sm)
|
EINA_LIST_FREE(managers, sm)
|
||||||
{
|
{
|
||||||
if (sm->timer_retry)
|
if (sm->timer_retry)
|
||||||
|
@ -512,6 +549,7 @@ e_xsettings_config_update(void)
|
||||||
{
|
{
|
||||||
_e_xsettings_theme_set();
|
_e_xsettings_theme_set();
|
||||||
_e_xsettings_icon_theme_set();
|
_e_xsettings_icon_theme_set();
|
||||||
|
_e_xsettings_font_set();
|
||||||
_e_xsettings_update();
|
_e_xsettings_update();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,6 +55,7 @@ struct _CFText_Class
|
||||||
|
|
||||||
const E_Text_Class_Pair text_class_predefined_names[ ] = {
|
const E_Text_Class_Pair text_class_predefined_names[ ] = {
|
||||||
{ NULL, N_("Core")},
|
{ NULL, N_("Core")},
|
||||||
|
{ "application", N_("Applications")},
|
||||||
{ "title_bar", N_("Title Bar")},
|
{ "title_bar", N_("Title Bar")},
|
||||||
{ "menu_item", N_("Menu Item")},
|
{ "menu_item", N_("Menu Item")},
|
||||||
{ "menu_title", N_("Menu Title")},
|
{ "menu_title", N_("Menu Title")},
|
||||||
|
@ -380,6 +381,7 @@ _basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
||||||
|
|
||||||
e_font_apply();
|
e_font_apply();
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
|
e_xsettings_config_update();
|
||||||
|
|
||||||
/* Apply to advanced */
|
/* Apply to advanced */
|
||||||
EINA_LIST_FOREACH(cfdata->text_classes, next, tc)
|
EINA_LIST_FOREACH(cfdata->text_classes, next, tc)
|
||||||
|
@ -525,6 +527,7 @@ _basic_init_data_fill(E_Config_Dialog_Data *cfdata)
|
||||||
|
|
||||||
/* Populate size list (Select current font) */
|
/* Populate size list (Select current font) */
|
||||||
_size_list_load(cfdata, cfdata->font_scale_list, init_size, 1);
|
_size_list_load(cfdata, cfdata->font_scale_list, init_size, 1);
|
||||||
|
_size_list_load(cfdata, cfdata->font_px_list, init_size, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
static int
|
static int
|
||||||
|
@ -582,6 +585,7 @@ _advanced_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfda
|
||||||
e_config->font_hinting = cfdata->hinting;
|
e_config->font_hinting = cfdata->hinting;
|
||||||
e_config_save_queue();
|
e_config_save_queue();
|
||||||
e_canvas_rehint();
|
e_canvas_rehint();
|
||||||
|
e_xsettings_config_update();
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue