2006-04-01 01:59:40 -08:00
|
|
|
#include "e.h"
|
|
|
|
|
2012-07-02 01:09:17 -07:00
|
|
|
typedef struct _E_Font_Size_Data E_Font_Size_Data;
|
2006-04-01 01:59:40 -08:00
|
|
|
typedef struct _E_Text_Class_Pair E_Text_Class_Pair;
|
2012-07-02 01:09:17 -07:00
|
|
|
typedef struct _CFText_Class CFText_Class;
|
2006-04-01 01:59:40 -08:00
|
|
|
|
2012-07-02 01:09:17 -07:00
|
|
|
static void *_create_data(E_Config_Dialog *cfd);
|
|
|
|
static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
|
|
|
static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
2006-04-01 01:59:40 -08:00
|
|
|
static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
2012-07-02 01:09:17 -07:00
|
|
|
static int _advanced_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata);
|
2006-10-11 02:02:40 -07:00
|
|
|
static Evas_Object *_advanced_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata);
|
2006-04-01 01:59:40 -08:00
|
|
|
|
2012-07-02 01:09:17 -07:00
|
|
|
static void _basic_font_cb_change(void *data, Evas_Object *obj);
|
|
|
|
static void _basic_enable_cb_change(void *data, Evas_Object *obj);
|
|
|
|
static void _basic_init_data_fill(E_Config_Dialog_Data *cfdata);
|
2007-05-03 16:19:40 -07:00
|
|
|
|
2012-07-02 01:09:17 -07:00
|
|
|
static void _adv_class_cb_change(void *data, Evas_Object *obj);
|
|
|
|
static void _adv_enabled_font_cb_change(void *data, Evas_Object *obj);
|
|
|
|
static void _adv_enabled_fallback_cb_change(void *data, Evas_Object *obj);
|
|
|
|
static void _adv_font_cb_change(void *data, Evas_Object *obj);
|
|
|
|
static void _adv_style_cb_change(void *data, Evas_Object *obj);
|
|
|
|
static void _size_cb_change(void *data);
|
2007-05-03 16:19:40 -07:00
|
|
|
|
2012-07-02 01:09:17 -07:00
|
|
|
static int _sort_fonts(const void *data1, const void *data2);
|
|
|
|
static void _font_list_load(E_Config_Dialog_Data *cfdata, const char *cur_font);
|
|
|
|
static void _size_list_load(E_Config_Dialog_Data *cfdata, Eina_List *size_list, Evas_Font_Size cur_size, int clear);
|
|
|
|
static void _class_list_load(E_Config_Dialog_Data *cfdata);
|
|
|
|
static void _font_preview_update(E_Config_Dialog_Data *cfdata);
|
2007-05-03 16:19:40 -07:00
|
|
|
|
2012-07-02 01:09:17 -07:00
|
|
|
static Eina_Bool _font_hash_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata);
|
2008-02-11 22:02:17 -08:00
|
|
|
|
2007-05-03 16:19:40 -07:00
|
|
|
struct _E_Font_Size_Data
|
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
|
|
|
const char *size_str;
|
|
|
|
Evas_Font_Size size;
|
|
|
|
};
|
2006-04-01 01:59:40 -08:00
|
|
|
|
|
|
|
struct _E_Text_Class_Pair
|
|
|
|
{
|
2007-05-19 12:15:37 -07:00
|
|
|
const char *class_name;
|
|
|
|
const char *class_description;
|
2006-04-01 01:59:40 -08:00
|
|
|
};
|
|
|
|
|
|
|
|
struct _CFText_Class
|
|
|
|
{
|
2012-07-02 01:09:17 -07:00
|
|
|
const char *class_name;
|
|
|
|
const char *class_description;
|
|
|
|
const char *font;
|
|
|
|
const char *style;
|
|
|
|
Evas_Font_Size size;
|
2012-08-08 03:49:07 -07:00
|
|
|
unsigned char enabled;
|
2006-04-01 01:59:40 -08:00
|
|
|
};
|
|
|
|
|
2012-07-02 01:09:17 -07:00
|
|
|
const E_Text_Class_Pair text_class_predefined_names[] = {
|
|
|
|
{ NULL, N_("Core")},
|
|
|
|
{ "application", N_("Applications")},
|
|
|
|
{ "title_bar", N_("Title Bar")},
|
|
|
|
{ "menu_item", N_("Menu Item")},
|
|
|
|
{ "menu_title", N_("Menu Title")},
|
|
|
|
{ "tb_plain", N_("Textblock Plain")},
|
|
|
|
{ "tb_light", N_("Textblock Light")},
|
|
|
|
{ "tb_big", N_("Textblock Big")},
|
|
|
|
{ "move_text", N_("Move Text")},
|
|
|
|
{ "resize_text", N_("Resize Text")},
|
|
|
|
{ "winlist_title", N_("Winlist Title")},
|
|
|
|
{ "configure", N_("Settings Heading")},
|
|
|
|
{ "about_title", N_("About Title")},
|
|
|
|
{ "about_version", N_("About Version")},
|
|
|
|
{ "button_text", N_("Button Text")},
|
|
|
|
{ "desklock_title", N_("Desklock Title")},
|
|
|
|
{ "desklock_passwd", N_("Desklock Password")},
|
|
|
|
{ "dialog_error", N_("Dialog Error")},
|
|
|
|
{ "exebuf_command", N_("Exebuf Command")},
|
|
|
|
{ "init_title", N_("Splash Title")},
|
|
|
|
{ "init_text", N_("Splash Text")},
|
|
|
|
{ "init_version", N_("Splash Version")},
|
|
|
|
{ "clock", N_("Digital Clock")},
|
|
|
|
|
|
|
|
{ NULL, N_("Widgets")},
|
|
|
|
{ "entry", N_("Entry")},
|
|
|
|
{ "frame", N_("Frame")},
|
|
|
|
{ "label", N_("Label")},
|
|
|
|
{ "button", N_("Buttons")},
|
|
|
|
{ "slider", N_("Slider")},
|
|
|
|
{ "radio_button", N_("Radio Buttons")},
|
|
|
|
{ "check_button", N_("Check Buttons")},
|
|
|
|
{ "tlist", N_("Text List Item")},
|
|
|
|
{ "ilist_item", N_("List Item")},
|
|
|
|
{ "ilist_header", N_("List Header")},
|
|
|
|
|
|
|
|
{ NULL, N_("Filemanager")},
|
|
|
|
{ "fileman_typebuf", N_("Typebuf")},
|
|
|
|
{ "fileman_icon", N_("Icon")},
|
|
|
|
{ "desktop_icon", N_("Desktop Icon")},
|
|
|
|
|
|
|
|
{ NULL, N_("Modules")},
|
|
|
|
{ "module_small", N_("Small")},
|
|
|
|
{ "module_normal", N_("Normal")},
|
|
|
|
{ "module_large", N_("Large")},
|
|
|
|
{ "module_small_s", N_("Small Styled")},
|
|
|
|
{ "module_normal_s", N_("Normal Styled")},
|
|
|
|
{ "module_large_s", N_("Large Styled")},
|
|
|
|
|
|
|
|
{ NULL, NULL}
|
2006-04-01 01:59:40 -08:00
|
|
|
};
|
2007-05-19 12:15:37 -07:00
|
|
|
|
2006-04-01 01:59:40 -08:00
|
|
|
struct _E_Config_Dialog_Data
|
|
|
|
{
|
|
|
|
E_Config_Dialog *cfd;
|
2012-07-02 01:09:17 -07:00
|
|
|
Evas *evas;
|
2006-04-01 01:59:40 -08:00
|
|
|
|
|
|
|
/* Text Classes */
|
2012-07-02 01:09:17 -07:00
|
|
|
Eina_List *text_classes;
|
2007-04-05 04:59:10 -07:00
|
|
|
|
|
|
|
/* Font Data */
|
2012-07-02 01:09:17 -07:00
|
|
|
Eina_Hash *font_hash;
|
|
|
|
Eina_List *font_list;
|
|
|
|
Eina_List *font_px_list;
|
|
|
|
Eina_List *font_scale_list;
|
2007-04-05 04:59:10 -07:00
|
|
|
|
2006-04-01 01:59:40 -08:00
|
|
|
/* Current data */
|
2012-07-02 01:09:17 -07:00
|
|
|
const char *cur_font;
|
|
|
|
const char *cur_style;
|
|
|
|
double cur_size;
|
|
|
|
int cur_enabled;
|
2012-08-08 03:49:07 -07:00
|
|
|
CFText_Class *cur_class;
|
2009-09-11 14:24:02 -07:00
|
|
|
|
2006-04-01 01:59:40 -08:00
|
|
|
/* Font Fallbacks */
|
2012-07-02 01:09:17 -07:00
|
|
|
int cur_fallbacks_enabled;
|
2009-09-11 14:24:02 -07:00
|
|
|
|
2006-04-01 01:59:40 -08:00
|
|
|
/* Font Hinting */
|
2012-07-02 01:09:17 -07:00
|
|
|
int hinting;
|
2009-09-11 14:24:02 -07:00
|
|
|
|
2006-04-01 01:59:40 -08:00
|
|
|
struct
|
2012-07-02 01:09:17 -07:00
|
|
|
{
|
|
|
|
/* Font Classes */
|
|
|
|
Evas_Object *class_list;
|
|
|
|
Evas_Object *font_list;
|
|
|
|
Evas_Object *style_list;
|
|
|
|
Evas_Object *size_list;
|
|
|
|
Evas_Object *enabled;
|
|
|
|
Evas_Object *preview;
|
|
|
|
|
|
|
|
/* Font Fallbacks */
|
|
|
|
Evas_Object *fallback_list; /* Selecting a list entry starts edit*/
|
|
|
|
} gui;
|
2006-04-01 01:59:40 -08:00
|
|
|
};
|
|
|
|
|
2010-01-22 12:28:39 -08:00
|
|
|
E_Config_Dialog *
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
e_int_config_fonts(E_Comp *comp, const char *params __UNUSED__)
|
2006-04-01 01:59:40 -08:00
|
|
|
{
|
|
|
|
E_Config_Dialog *cfd;
|
|
|
|
E_Config_Dialog_View *v;
|
|
|
|
|
2009-12-04 14:37:18 -08:00
|
|
|
if (e_config_dialog_find("E", "appearance/fonts")) return NULL;
|
2006-04-01 01:59:40 -08:00
|
|
|
v = E_NEW(E_Config_Dialog_View, 1);
|
2009-09-11 14:24:02 -07:00
|
|
|
|
2009-12-04 14:37:18 -08:00
|
|
|
v->create_cfdata = _create_data;
|
|
|
|
v->free_cfdata = _free_data;
|
|
|
|
v->basic.create_widgets = _basic_create_widgets;
|
|
|
|
v->basic.apply_cfdata = _basic_apply_data;
|
2006-10-11 02:02:40 -07:00
|
|
|
v->advanced.create_widgets = _advanced_create_widgets;
|
2009-12-04 14:37:18 -08:00
|
|
|
v->advanced.apply_cfdata = _advanced_apply_data;
|
2009-09-11 14:24:02 -07:00
|
|
|
|
compositor rewrite / charlie-foxtrot situation
huge fustercluck commit because there wasn't really a way to separate out the changes. better to just rip it all out at once.
* compositor and window management completely rewritten. this was the goal for E19, but it pretty much required everything existing to be scrapped since it wasn't optimized, streamlined, or sensible. now instead of having the compositor strapped to the window manager like an outboard motor, it's housed more like an automobile engine.
** various comp structs have been merged into other places (eg. E_Comp_Zone is now just part of E_Zone where applicable), leading to a large deduplication of attributes
** awful E_Comp_Win is totally dead, having been replaced with e_comp_object smart objects which work just like normal canvas objects
** protocol-specific window management and compositor functionality is now kept exclusively in backend files
** e_pixmap api provides generic client finding and rendering api
** screen/xinerama screens are now provided directly by compositor on startup and re-set on change
** e_comp_render_update finally replaced with eina_tiler
** wayland compositor no longer creates X windows
** compositor e_layout removed entirely
* e_container is gone. this was made unnecessary in E18, but I kept it to avoid having too much code churn in one release. its sole purpose was to catch some events and handle window stacking, both of which are now just done by the compositor infra
* e_manager is just for screensaver and keybind stuff now, possibly remove later?
* e_border is gone along with a lot of its api. e_client has replaced it, and e_client has been rewritten completely; some parts may be similar, but the design now relies upon having a functional compositor
** window configuration/focus functions are all removed. all windows are now managed solely with evas_object_X functions on the "frame" member of a client, just as any other canvas object can be managed.
*** do NOT set interceptors on a client's comp_object. seriously.
* startup order rewritten: compositor now starts much earlier, other things just use attrs and members of the compositor
* ecore_x_pointer_xy_get usage replaced with ecore_evas_pointer_xy_get
* e_popup is totally gone, existing usage replaced by e_comp_object_util_add where applicable, otherwise just placed normally on the canvas
* deskmirror is (more) broken for now
* illume is totally fucked
* Ecore_X_Window replaced with Ecore_Window in most cases
* edge binding XWindows replaced with regular canvas objects
* some E_Win functionality has changed such that delete callbacks are now correctly called in ALL cases. various dialogs have been updated to not crash as a result
comp files and descriptions:
e_comp.c - overall compositor functions, rendering/update loop, shape cutting
e_comp_x.c - X window management and compositor functionality
e_comp_wl.c - Wayland surface management and compositor functionality
e_comp_canvas.c - general compositor canvas functions and utilities
e_comp_object.c - E_Client->frame member for managing clients as Evas_Objects, utility functions for adding objects to the compositor rendering systems
additional authors: ivan.briano@intel.com
feature: new compositor
removal: e_border, e_container, e_popup
2014-01-14 17:19:12 -08:00
|
|
|
cfd = e_config_dialog_new(comp, _("Font Settings"),
|
2012-07-02 01:09:17 -07:00
|
|
|
"E", "appearance/fonts",
|
|
|
|
"preferences-desktop-font", 0, v, NULL);
|
2006-04-01 01:59:40 -08:00
|
|
|
return cfd;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_fill_data(E_Config_Dialog_Data *cfdata)
|
|
|
|
{
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *font_list;
|
|
|
|
Eina_List *next;
|
2006-04-01 01:59:40 -08:00
|
|
|
E_Font_Default *efd;
|
2007-05-03 16:19:40 -07:00
|
|
|
E_Font_Size_Data *size_data;
|
2006-04-01 01:59:40 -08:00
|
|
|
CFText_Class *tc;
|
|
|
|
int i;
|
2009-09-11 14:24:02 -07:00
|
|
|
|
2006-04-04 07:00:19 -07:00
|
|
|
font_list = e_font_default_list();
|
2009-09-11 14:24:02 -07:00
|
|
|
|
2006-04-01 01:59:40 -08:00
|
|
|
/* Fill out the font list */
|
2006-04-23 08:30:47 -07:00
|
|
|
for (i = 0; text_class_predefined_names[i].class_description; i++ )
|
2006-04-01 01:59:40 -08:00
|
|
|
{
|
2012-07-02 01:09:17 -07:00
|
|
|
tc = E_NEW(CFText_Class, 1);
|
|
|
|
tc->class_name = text_class_predefined_names[i].class_name;
|
|
|
|
tc->class_description =
|
2008-03-18 12:59:52 -07:00
|
|
|
_(text_class_predefined_names[i].class_description);
|
2012-07-02 01:09:17 -07:00
|
|
|
tc->font = NULL;
|
|
|
|
tc->size = 0;
|
|
|
|
tc->enabled = 0;
|
|
|
|
|
|
|
|
if (text_class_predefined_names[i].class_name)
|
|
|
|
{
|
|
|
|
/* Search manually because we dont want to fallback */
|
|
|
|
for (next = font_list; next; next = next->next)
|
|
|
|
{
|
|
|
|
efd = next->data;
|
|
|
|
|
|
|
|
if (!strcmp(tc->class_name, efd->text_class))
|
|
|
|
{
|
|
|
|
if (efd->font)
|
|
|
|
{
|
|
|
|
E_Font_Properties *efp;
|
|
|
|
|
|
|
|
efp = e_font_fontconfig_name_parse(efd->font);
|
|
|
|
if (efp->name)
|
|
|
|
tc->font = eina_stringshare_add(efp->name);
|
|
|
|
if (efp->styles)
|
|
|
|
tc->style = eina_stringshare_add(efp->styles->data);
|
|
|
|
e_font_properties_free(efp);
|
|
|
|
}
|
|
|
|
tc->size = efd->size;
|
|
|
|
tc->enabled = 1;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (!tc->enabled)
|
|
|
|
{
|
|
|
|
/* search with default fallbacks */
|
|
|
|
efd = e_font_default_get(tc->class_name);
|
|
|
|
if (efd)
|
|
|
|
{
|
|
|
|
if (efd->font)
|
|
|
|
{
|
|
|
|
E_Font_Properties *efp;
|
|
|
|
|
|
|
|
efp = e_font_fontconfig_name_parse(efd->font);
|
|
|
|
if (efp->name)
|
|
|
|
tc->font = eina_stringshare_add(efp->name);
|
|
|
|
if (efp->styles)
|
|
|
|
tc->style = eina_stringshare_add(efp->styles->data);
|
|
|
|
e_font_properties_free(efp);
|
|
|
|
}
|
|
|
|
tc->size = efd->size;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
/* Append the class */
|
|
|
|
cfdata->text_classes = eina_list_append(cfdata->text_classes, tc);
|
2006-04-01 01:59:40 -08:00
|
|
|
}
|
2008-03-18 12:59:52 -07:00
|
|
|
|
2006-04-01 01:59:40 -08:00
|
|
|
/* Fill Hinting */
|
|
|
|
cfdata->hinting = e_config->font_hinting;
|
2007-05-03 16:19:40 -07:00
|
|
|
|
|
|
|
size_data = E_NEW(E_Font_Size_Data, 1);
|
|
|
|
size_data->cfdata = cfdata;
|
2008-10-15 08:12:56 -07:00
|
|
|
size_data->size_str = eina_stringshare_add(_("Tiny"));
|
2007-05-03 16:19:40 -07:00
|
|
|
size_data->size = -50;
|
2008-10-22 04:49:33 -07:00
|
|
|
cfdata->font_scale_list = eina_list_append(cfdata->font_scale_list, size_data);
|
2007-05-03 16:19:40 -07:00
|
|
|
|
|
|
|
size_data = E_NEW(E_Font_Size_Data, 1);
|
|
|
|
size_data->cfdata = cfdata;
|
2008-10-15 08:12:56 -07:00
|
|
|
size_data->size_str = eina_stringshare_add(_("Small"));
|
2007-05-03 16:19:40 -07:00
|
|
|
size_data->size = -80;
|
2008-10-22 04:49:33 -07:00
|
|
|
cfdata->font_scale_list = eina_list_append(cfdata->font_scale_list, size_data);
|
2007-05-03 16:19:40 -07:00
|
|
|
|
|
|
|
size_data = E_NEW(E_Font_Size_Data, 1);
|
|
|
|
size_data->cfdata = cfdata;
|
2008-10-15 08:12:56 -07:00
|
|
|
size_data->size_str = eina_stringshare_add(_("Normal"));
|
2007-05-03 16:19:40 -07:00
|
|
|
size_data->size = -100;
|
2008-10-22 04:49:33 -07:00
|
|
|
cfdata->font_scale_list = eina_list_append(cfdata->font_scale_list, size_data);
|
2007-05-03 16:19:40 -07:00
|
|
|
|
|
|
|
size_data = E_NEW(E_Font_Size_Data, 1);
|
|
|
|
size_data->cfdata = cfdata;
|
2008-10-15 08:12:56 -07:00
|
|
|
size_data->size_str = eina_stringshare_add(_("Big"));
|
2007-05-03 16:19:40 -07:00
|
|
|
size_data->size = -150;
|
2008-10-22 04:49:33 -07:00
|
|
|
cfdata->font_scale_list = eina_list_append(cfdata->font_scale_list, size_data);
|
2007-05-03 16:19:40 -07:00
|
|
|
|
|
|
|
size_data = E_NEW(E_Font_Size_Data, 1);
|
|
|
|
size_data->cfdata = cfdata;
|
2008-10-15 08:12:56 -07:00
|
|
|
size_data->size_str = eina_stringshare_add(_("Really Big"));
|
2007-05-03 16:19:40 -07:00
|
|
|
size_data->size = -190;
|
2008-10-22 04:49:33 -07:00
|
|
|
cfdata->font_scale_list = eina_list_append(cfdata->font_scale_list, size_data);
|
2007-05-03 16:19:40 -07:00
|
|
|
|
|
|
|
size_data = E_NEW(E_Font_Size_Data, 1);
|
|
|
|
size_data->cfdata = cfdata;
|
2008-10-15 08:12:56 -07:00
|
|
|
size_data->size_str = eina_stringshare_add(_("Huge"));
|
2007-05-03 16:19:40 -07:00
|
|
|
size_data->size = -250;
|
2008-10-22 04:49:33 -07:00
|
|
|
cfdata->font_scale_list = eina_list_append(cfdata->font_scale_list, size_data);
|
2007-05-03 16:19:40 -07:00
|
|
|
|
|
|
|
for (i = 5; i < 21; i++)
|
|
|
|
{
|
2012-12-16 02:15:57 -08:00
|
|
|
char str[256];
|
2007-05-03 16:19:40 -07:00
|
|
|
|
2012-07-02 01:09:17 -07:00
|
|
|
str[0] = 0;
|
2012-07-15 02:28:34 -07:00
|
|
|
snprintf(str, sizeof(str), P_("%d pixel", "%d pixels", i), i);
|
2007-05-03 16:19:40 -07:00
|
|
|
|
2012-07-02 01:09:17 -07:00
|
|
|
size_data = E_NEW(E_Font_Size_Data, 1);
|
|
|
|
size_data->cfdata = cfdata;
|
|
|
|
size_data->size_str = eina_stringshare_add(str);
|
|
|
|
size_data->size = i;
|
|
|
|
cfdata->font_px_list = eina_list_append(cfdata->font_px_list, size_data);
|
2007-05-03 16:19:40 -07:00
|
|
|
}
|
2006-04-01 01:59:40 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void *
|
|
|
|
_create_data(E_Config_Dialog *cfd)
|
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
|
|
|
|
|
|
|
cfdata = E_NEW(E_Config_Dialog_Data, 1);
|
|
|
|
cfdata->cfd = cfd;
|
|
|
|
_fill_data(cfdata);
|
|
|
|
return cfdata;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-08-19 10:16:06 -07:00
|
|
|
_free_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
2006-04-01 01:59:40 -08:00
|
|
|
{
|
2009-03-11 08:13:42 -07:00
|
|
|
E_Font_Size_Data *size_data;
|
|
|
|
CFText_Class *tc;
|
2006-04-01 01:59:40 -08:00
|
|
|
|
2007-04-05 06:25:41 -07:00
|
|
|
e_font_available_hash_free(cfdata->font_hash);
|
2012-07-02 01:09:17 -07:00
|
|
|
cfdata->font_list = eina_list_free(cfdata->font_list);
|
2008-03-18 12:59:52 -07:00
|
|
|
|
2009-03-11 08:13:42 -07:00
|
|
|
EINA_LIST_FREE(cfdata->text_classes, tc)
|
2006-04-01 01:59:40 -08:00
|
|
|
{
|
2009-03-11 08:13:42 -07:00
|
|
|
eina_stringshare_del(tc->font);
|
2012-07-02 01:09:17 -07:00
|
|
|
eina_stringshare_del(tc->style);
|
2006-04-01 01:59:40 -08:00
|
|
|
E_FREE(tc);
|
|
|
|
}
|
2008-03-18 12:59:52 -07:00
|
|
|
|
2009-03-11 08:13:42 -07:00
|
|
|
EINA_LIST_FREE(cfdata->font_scale_list, size_data)
|
2007-05-03 16:19:40 -07:00
|
|
|
{
|
2012-07-02 01:09:17 -07:00
|
|
|
eina_stringshare_del(size_data->size_str);
|
2007-05-03 16:19:40 -07:00
|
|
|
E_FREE(size_data);
|
|
|
|
}
|
|
|
|
|
2009-03-11 08:13:42 -07:00
|
|
|
EINA_LIST_FREE(cfdata->font_px_list, size_data)
|
2007-05-03 16:19:40 -07:00
|
|
|
{
|
2012-07-02 01:09:17 -07:00
|
|
|
eina_stringshare_del(size_data->size_str);
|
2007-05-03 16:19:40 -07:00
|
|
|
E_FREE(size_data);
|
|
|
|
}
|
2008-03-18 12:59:52 -07:00
|
|
|
|
2009-03-11 08:13:42 -07:00
|
|
|
eina_stringshare_del(cfdata->cur_font);
|
|
|
|
eina_stringshare_del(cfdata->cur_style);
|
2007-01-15 09:19:44 -08:00
|
|
|
E_FREE(cfdata);
|
2006-04-01 01:59:40 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2010-08-19 10:16:06 -07:00
|
|
|
_basic_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
2006-10-11 02:02:40 -07:00
|
|
|
{
|
2009-03-11 08:13:42 -07:00
|
|
|
CFText_Class *tc;
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *next;
|
2007-05-03 16:19:40 -07:00
|
|
|
int i;
|
2006-10-11 13:31:10 -07:00
|
|
|
|
2010-08-21 06:52:25 -07:00
|
|
|
if (cfdata->cur_enabled && !cfdata->cur_font)
|
2007-05-03 16:19:40 -07:00
|
|
|
return 0;
|
|
|
|
|
|
|
|
for (i = 0; text_class_predefined_names[i].class_description; i++ )
|
2006-10-11 02:02:40 -07:00
|
|
|
{
|
2012-07-02 01:09:17 -07:00
|
|
|
if (!text_class_predefined_names[i].class_name) continue;
|
2006-10-11 02:02:40 -07:00
|
|
|
|
2012-07-02 01:09:17 -07:00
|
|
|
if (cfdata->cur_enabled)
|
|
|
|
{
|
|
|
|
const char *class_name;
|
|
|
|
const char *font_name;
|
2007-05-03 16:19:40 -07:00
|
|
|
|
2012-07-02 01:09:17 -07:00
|
|
|
class_name = text_class_predefined_names[i].class_name;
|
|
|
|
font_name =
|
2008-03-18 12:59:52 -07:00
|
|
|
e_font_fontconfig_name_get(cfdata->cur_font, cfdata->cur_style);
|
2012-07-02 01:09:17 -07:00
|
|
|
e_font_default_set(class_name, font_name, cfdata->cur_size);
|
|
|
|
|
|
|
|
if (i == 1)
|
|
|
|
e_font_default_set("e_basic_font", font_name, cfdata->cur_size);
|
|
|
|
|
|
|
|
eina_stringshare_del(font_name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
e_font_default_remove(text_class_predefined_names[i].class_name);
|
|
|
|
if (i == 1)
|
|
|
|
e_font_default_remove("e_basic_font");
|
|
|
|
}
|
2006-10-11 02:02:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
e_font_apply();
|
2007-01-23 11:53:05 -08:00
|
|
|
e_config_save_queue();
|
2011-11-01 06:59:44 -07:00
|
|
|
e_xsettings_config_update();
|
2007-05-03 16:19:40 -07:00
|
|
|
|
|
|
|
/* Apply to advanced */
|
2009-03-11 08:13:42 -07:00
|
|
|
EINA_LIST_FOREACH(cfdata->text_classes, next, tc)
|
2007-05-03 16:19:40 -07:00
|
|
|
{
|
2012-07-02 01:09:17 -07:00
|
|
|
tc->size = cfdata->cur_size;
|
2007-05-03 16:19:40 -07:00
|
|
|
|
2012-07-02 01:09:17 -07:00
|
|
|
eina_stringshare_del(tc->font);
|
|
|
|
tc->font = eina_stringshare_ref(cfdata->cur_font);
|
2008-03-18 12:59:52 -07:00
|
|
|
|
2012-07-02 01:09:17 -07:00
|
|
|
eina_stringshare_del(tc->style);
|
|
|
|
tc->style = eina_stringshare_ref(cfdata->cur_style);
|
|
|
|
tc->enabled = cfdata->cur_enabled;
|
2007-05-03 16:19:40 -07:00
|
|
|
}
|
|
|
|
|
2006-10-11 02:02:40 -07:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
2009-06-17 06:46:54 -07:00
|
|
|
static Eina_Bool
|
* estickies,
* etk,
* PROTO/exalt,
* E-MODULES-EXTRA/diskio,
* E-MODULES-EXTRA/drawer,
* E-MODULES-EXTRA/penguins,
* E-MODULES-EXTRA/slideshow,
* E-MODULES-EXTRA/mail,
* E-MODULES-EXTRA/forecasts,
* E-MODULES-EXTRA/iiirk,
* E-MODULES-EXTRA/places,
* e,
* ewl,
* ecore,
* elitaire,
* entrance,
* e_dbus,
* efreet: Here we go, move from Ecore_List to Eina_List.
NOTE: This patch is huge, I did test it a lot, and I hope nothing is
broken. But if you think something change after this commit, please
contact me ASAP.
SVN revision: 39200
2009-02-25 03:03:47 -08:00
|
|
|
_font_hash_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata)
|
2007-04-05 04:59:10 -07:00
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
|
|
|
E_Font_Properties *efp;
|
|
|
|
|
|
|
|
cfdata = fdata;
|
|
|
|
efp = data;
|
2008-10-22 04:49:33 -07:00
|
|
|
cfdata->font_list = eina_list_append(cfdata->font_list, efp->name);
|
2007-04-05 04:59:10 -07:00
|
|
|
|
2009-06-17 06:46:54 -07:00
|
|
|
return EINA_TRUE;
|
2007-04-05 04:59:10 -07:00
|
|
|
}
|
|
|
|
|
2006-10-11 02:02:40 -07:00
|
|
|
static Evas_Object *
|
2014-05-17 09:51:46 -07:00
|
|
|
_basic_create_widgets(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, E_Config_Dialog_Data *cfdata)
|
2006-10-11 02:02:40 -07:00
|
|
|
{
|
2007-05-03 16:19:40 -07:00
|
|
|
Evas_Object *ot, *ob, *of;
|
2008-03-18 12:59:52 -07:00
|
|
|
|
2006-10-11 02:02:40 -07:00
|
|
|
cfdata->evas = evas;
|
2007-05-03 16:19:40 -07:00
|
|
|
|
2007-04-05 20:40:54 -07:00
|
|
|
ot = e_widget_table_add(evas, 0);
|
|
|
|
|
2007-05-03 16:19:40 -07:00
|
|
|
cfdata->gui.class_list = NULL;
|
|
|
|
|
2009-09-11 14:24:02 -07:00
|
|
|
ob = e_widget_check_add(evas, _("Enable Custom Font Classes"),
|
2008-03-18 12:59:52 -07:00
|
|
|
&(cfdata->cur_enabled));
|
2007-05-03 16:19:40 -07:00
|
|
|
cfdata->gui.enabled = ob;
|
|
|
|
e_widget_on_change_hook_set(ob, _basic_enable_cb_change, cfdata);
|
|
|
|
e_widget_table_object_append(ot, ob, 0, 0, 1, 1, 1, 0, 1, 0);
|
2007-04-05 20:40:54 -07:00
|
|
|
|
2007-04-05 04:59:10 -07:00
|
|
|
of = e_widget_framelist_add(evas, _("Fonts"), 1);
|
2007-04-05 20:40:54 -07:00
|
|
|
ob = e_widget_ilist_add(evas, 16, 16, &(cfdata->cur_font));
|
|
|
|
cfdata->gui.font_list = ob;
|
2007-05-03 16:19:40 -07:00
|
|
|
e_widget_on_change_hook_set(ob, _basic_font_cb_change, cfdata);
|
|
|
|
e_widget_ilist_go(ob);
|
|
|
|
e_widget_framelist_object_append(of, ob);
|
|
|
|
e_widget_table_object_append(ot, of, 0, 1, 1, 1, 1, 1, 1, 1);
|
2007-04-05 04:59:10 -07:00
|
|
|
|
2007-05-03 16:19:40 -07:00
|
|
|
of = e_widget_framelist_add(evas, _("Size"), 1);
|
|
|
|
ob = e_widget_ilist_add(evas, 16, 16, NULL);
|
|
|
|
cfdata->gui.size_list = ob;
|
|
|
|
e_widget_ilist_go(ob);
|
2009-09-01 06:34:42 -07:00
|
|
|
e_widget_size_min_set(ob, 100, 200);
|
2007-05-03 16:19:40 -07:00
|
|
|
e_widget_framelist_object_append(of, ob);
|
|
|
|
e_widget_table_object_append(ot, of, 1, 1, 1, 1, 1, 1, 1, 1);
|
2012-11-14 19:49:33 -08:00
|
|
|
ob = e_widget_font_preview_add
|
2012-11-14 20:21:47 -08:00
|
|
|
(evas, _("English 012 #!? 日本語 にほんご ソフト 中文 華語 한국"));
|
2007-05-03 16:19:40 -07:00
|
|
|
cfdata->gui.preview = ob;
|
|
|
|
e_widget_table_object_append(ot, ob, 0, 2, 2, 1, 1, 0, 1, 0);
|
|
|
|
|
|
|
|
_basic_init_data_fill(cfdata);
|
|
|
|
|
2012-11-14 19:49:33 -08:00
|
|
|
e_widget_disabled_set(cfdata->gui.font_list, !cfdata->cur_enabled);
|
|
|
|
e_widget_disabled_set(cfdata->gui.size_list, !cfdata->cur_enabled);
|
|
|
|
|
2007-05-03 16:19:40 -07:00
|
|
|
return ot;
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-08-19 10:16:06 -07:00
|
|
|
_basic_font_cb_change(void *data, Evas_Object *obj __UNUSED__)
|
2007-05-03 16:19:40 -07:00
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
2008-03-18 12:59:52 -07:00
|
|
|
|
2007-05-03 16:19:40 -07:00
|
|
|
cfdata = data;
|
|
|
|
if (!cfdata) return;
|
|
|
|
_font_preview_update(cfdata);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-08-19 10:16:06 -07:00
|
|
|
_basic_enable_cb_change(void *data, Evas_Object *obj __UNUSED__)
|
2007-05-03 16:19:40 -07:00
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
2008-03-18 12:59:52 -07:00
|
|
|
|
2007-05-03 16:19:40 -07:00
|
|
|
cfdata = data;
|
|
|
|
if (!cfdata) return;
|
|
|
|
|
|
|
|
e_widget_disabled_set(cfdata->gui.font_list, !cfdata->cur_enabled);
|
|
|
|
e_widget_disabled_set(cfdata->gui.size_list, !cfdata->cur_enabled);
|
|
|
|
|
|
|
|
if (!cfdata->cur_enabled)
|
2006-10-11 13:31:10 -07:00
|
|
|
{
|
2012-07-02 01:09:17 -07:00
|
|
|
e_widget_ilist_unselect(cfdata->gui.font_list);
|
|
|
|
e_widget_ilist_unselect(cfdata->gui.size_list);
|
2006-10-11 16:33:49 -07:00
|
|
|
}
|
2007-05-03 16:19:40 -07:00
|
|
|
}
|
2007-04-05 04:59:10 -07:00
|
|
|
|
2010-09-08 16:59:07 -07:00
|
|
|
/* fill the basic dialog with initial data and select it */
|
2007-05-03 16:19:40 -07:00
|
|
|
static void
|
2009-09-11 14:24:02 -07:00
|
|
|
_basic_init_data_fill(E_Config_Dialog_Data *cfdata)
|
2007-05-03 16:19:40 -07:00
|
|
|
{
|
|
|
|
Evas_Object *ob;
|
|
|
|
E_Font_Default *efd;
|
|
|
|
const char *init_font;
|
|
|
|
Evas_Font_Size init_size;
|
2007-04-05 06:25:41 -07:00
|
|
|
|
2007-05-03 16:19:40 -07:00
|
|
|
init_font = NULL;
|
|
|
|
init_size = -100;
|
|
|
|
|
2010-09-08 16:59:07 -07:00
|
|
|
/* Get initial basic basic */
|
2009-09-11 14:24:02 -07:00
|
|
|
efd = e_font_default_get("e_basic_font");
|
2007-05-03 16:19:40 -07:00
|
|
|
if (efd)
|
2009-09-11 14:24:02 -07:00
|
|
|
{
|
2012-07-02 01:09:17 -07:00
|
|
|
if (efd->font)
|
|
|
|
{
|
|
|
|
E_Font_Properties *efp;
|
|
|
|
|
|
|
|
efp = e_font_fontconfig_name_parse(efd->font);
|
|
|
|
init_font = eina_stringshare_add(efp->name);
|
|
|
|
e_font_properties_free(efp);
|
|
|
|
}
|
|
|
|
init_size = efd->size;
|
2006-10-11 13:31:10 -07:00
|
|
|
}
|
2007-04-05 04:59:10 -07:00
|
|
|
|
2007-05-03 16:19:40 -07:00
|
|
|
/* Check based on efd */
|
|
|
|
ob = cfdata->gui.enabled;
|
2010-08-21 06:52:25 -07:00
|
|
|
if (!efd)
|
2007-05-03 16:19:40 -07:00
|
|
|
e_widget_check_checked_set(ob, 0);
|
|
|
|
else if (!strcmp(efd->text_class, "default"))
|
|
|
|
e_widget_check_checked_set(ob, 0);
|
2009-09-11 14:24:02 -07:00
|
|
|
else
|
2012-11-14 19:49:33 -08:00
|
|
|
{
|
|
|
|
e_widget_check_checked_set(ob, 1);
|
|
|
|
cfdata->cur_enabled = 1;
|
|
|
|
}
|
2007-05-03 16:19:40 -07:00
|
|
|
|
|
|
|
/* Populate font list (Select current font) */
|
|
|
|
_font_list_load(cfdata, init_font);
|
2008-03-18 12:59:52 -07:00
|
|
|
|
2007-05-03 16:19:40 -07:00
|
|
|
/* Populate size list (Select current font) */
|
|
|
|
_size_list_load(cfdata, cfdata->font_scale_list, init_size, 1);
|
2011-11-01 06:59:44 -07:00
|
|
|
_size_list_load(cfdata, cfdata->font_px_list, init_size, 0);
|
2006-10-11 02:02:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
static int
|
2010-08-19 10:16:06 -07:00
|
|
|
_advanced_apply_data(E_Config_Dialog *cfd __UNUSED__, E_Config_Dialog_Data *cfdata)
|
2006-04-01 01:59:40 -08:00
|
|
|
{
|
2006-04-04 07:00:19 -07:00
|
|
|
int i;
|
2012-09-12 06:03:04 -07:00
|
|
|
const Eina_List *l;
|
2006-04-01 01:59:40 -08:00
|
|
|
CFText_Class *tc;
|
2012-08-08 03:49:07 -07:00
|
|
|
E_Ilist_Item *ili;
|
2008-03-18 12:59:52 -07:00
|
|
|
|
2006-04-01 01:59:40 -08:00
|
|
|
/* Save current data */
|
2012-08-08 03:49:07 -07:00
|
|
|
if (cfdata->cur_class)
|
2006-04-01 01:59:40 -08:00
|
|
|
{
|
2012-08-08 03:49:07 -07:00
|
|
|
tc = cfdata->cur_class;
|
2012-07-02 01:09:17 -07:00
|
|
|
tc->size = cfdata->cur_size;
|
|
|
|
if (cfdata->cur_font)
|
2012-08-08 03:49:07 -07:00
|
|
|
eina_stringshare_replace(&tc->font, cfdata->cur_font);
|
2012-07-02 01:09:17 -07:00
|
|
|
if (cfdata->cur_style)
|
2012-08-08 03:49:07 -07:00
|
|
|
eina_stringshare_replace(&tc->style, cfdata->cur_style);
|
2006-04-01 01:59:40 -08:00
|
|
|
}
|
2007-04-05 06:25:41 -07:00
|
|
|
|
2012-08-08 03:49:07 -07:00
|
|
|
EINA_LIST_FOREACH(cfdata->text_classes, l, tc)
|
2006-04-01 01:59:40 -08:00
|
|
|
{
|
2012-07-02 01:09:17 -07:00
|
|
|
if (!tc->class_name) continue;
|
|
|
|
if (tc->enabled && tc->font)
|
|
|
|
{
|
|
|
|
const char *name;
|
|
|
|
|
|
|
|
name = e_font_fontconfig_name_get(tc->font, tc->style);
|
|
|
|
e_font_default_set(tc->class_name, name, tc->size);
|
|
|
|
eina_stringshare_del(name);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
e_font_default_remove(tc->class_name);
|
2006-04-01 01:59:40 -08:00
|
|
|
}
|
2012-08-08 03:49:07 -07:00
|
|
|
i = 0;
|
|
|
|
EINA_LIST_FOREACH(e_widget_ilist_items_get(cfdata->gui.class_list), l, ili)
|
|
|
|
{
|
|
|
|
Evas_Object *ic;
|
|
|
|
tc = e_widget_ilist_item_data_get(ili);
|
|
|
|
if (!tc)
|
|
|
|
{
|
|
|
|
i++;
|
|
|
|
continue;
|
|
|
|
}
|
|
|
|
if (tc->enabled)
|
|
|
|
{
|
|
|
|
ic = e_icon_add(cfdata->evas);
|
|
|
|
e_util_icon_theme_set(ic, "dialog-ok-apply");
|
|
|
|
e_widget_ilist_nth_icon_set(cfdata->gui.class_list, i, ic);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
e_widget_ilist_nth_icon_set(cfdata->gui.class_list, i, NULL);
|
|
|
|
i++;
|
|
|
|
}
|
2006-04-01 01:59:40 -08:00
|
|
|
|
2006-04-04 07:00:19 -07:00
|
|
|
/* Fallbacks configure */
|
|
|
|
e_font_fallback_clear();
|
2008-03-18 12:59:52 -07:00
|
|
|
|
2006-04-04 07:00:19 -07:00
|
|
|
if (cfdata->cur_fallbacks_enabled)
|
|
|
|
{
|
2012-07-02 01:09:17 -07:00
|
|
|
for (i = 0; i < e_widget_config_list_count(cfdata->gui.fallback_list); i++)
|
|
|
|
{
|
|
|
|
const char *fallback;
|
2007-05-19 12:15:37 -07:00
|
|
|
|
2012-07-02 01:09:17 -07:00
|
|
|
fallback =
|
2008-03-18 12:59:52 -07:00
|
|
|
e_widget_config_list_nth_get(cfdata->gui.fallback_list, i);
|
2012-07-02 01:09:17 -07:00
|
|
|
if ((fallback) && (fallback[0]))
|
|
|
|
e_font_fallback_append(fallback);
|
|
|
|
}
|
2006-04-04 07:00:19 -07:00
|
|
|
}
|
2006-04-01 01:59:40 -08:00
|
|
|
e_font_apply();
|
2008-03-18 12:59:52 -07:00
|
|
|
|
2006-04-01 01:59:40 -08:00
|
|
|
/* Apply Hinting */
|
|
|
|
e_config->font_hinting = cfdata->hinting;
|
|
|
|
e_config_save_queue();
|
|
|
|
e_canvas_rehint();
|
2011-11-01 06:59:44 -07:00
|
|
|
e_xsettings_config_update();
|
2006-04-01 01:59:40 -08:00
|
|
|
return 1;
|
|
|
|
}
|
|
|
|
|
|
|
|
static Evas_Object *
|
2012-12-03 01:24:12 -08:00
|
|
|
_advanced_create_widgets(E_Config_Dialog *cfd EINA_UNUSED, Evas *evas, E_Config_Dialog_Data *cfdata)
|
2006-04-01 01:59:40 -08:00
|
|
|
{
|
2009-09-11 14:07:51 -07:00
|
|
|
Evas_Object *ot, *ob, *of, *otb;
|
2007-04-05 06:25:41 -07:00
|
|
|
E_Radio_Group *rg;
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *next = NULL;
|
2006-04-01 01:59:40 -08:00
|
|
|
int option_enable;
|
2014-04-04 11:10:09 -07:00
|
|
|
E_Font_Fallback *eff;
|
2006-04-01 01:59:40 -08:00
|
|
|
|
2006-04-12 17:01:15 -07:00
|
|
|
cfdata->evas = evas;
|
2008-03-18 12:59:52 -07:00
|
|
|
|
2009-09-11 14:07:51 -07:00
|
|
|
otb = e_widget_toolbook_add(evas, 48 * e_scale, 48 * e_scale);
|
2009-09-11 14:24:02 -07:00
|
|
|
|
2007-05-03 16:19:40 -07:00
|
|
|
ot = e_widget_table_add(evas, 0);
|
2007-12-04 18:08:54 -08:00
|
|
|
of = e_widget_frametable_add(evas, _("Font Classes"), 0);
|
2007-04-10 11:42:50 -07:00
|
|
|
ob = e_widget_ilist_add(evas, 16, 16, NULL);
|
|
|
|
cfdata->gui.class_list = ob;
|
2007-05-03 16:19:40 -07:00
|
|
|
_class_list_load(cfdata);
|
2009-09-11 14:07:51 -07:00
|
|
|
e_widget_size_min_set(ob, 110, 220);
|
2007-05-03 16:19:40 -07:00
|
|
|
e_widget_on_change_hook_set(ob, _adv_class_cb_change, cfdata);
|
2007-12-04 18:08:54 -08:00
|
|
|
e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 1, 1, 1);
|
2012-08-08 03:49:07 -07:00
|
|
|
ob = e_widget_check_add(evas, _("Enable Font Class"), NULL);
|
2007-12-04 18:08:54 -08:00
|
|
|
cfdata->gui.enabled = ob;
|
|
|
|
e_widget_on_change_hook_set(ob, _adv_enabled_font_cb_change, cfdata);
|
|
|
|
e_widget_disabled_set(ob, 1);
|
|
|
|
e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 1, 0, 1, 0);
|
2009-09-11 14:07:51 -07:00
|
|
|
e_widget_table_object_append(ot, of, 0, 0, 1, 2, 1, 1, 1, 1);
|
2007-04-05 06:25:41 -07:00
|
|
|
|
2009-09-11 14:07:51 -07:00
|
|
|
of = e_widget_framelist_add(evas, _("Font"), 1);
|
2007-04-17 01:57:20 -07:00
|
|
|
ob = e_widget_ilist_add(evas, 16, 16, &(cfdata->cur_font));
|
|
|
|
cfdata->gui.font_list = ob;
|
2007-05-03 16:19:40 -07:00
|
|
|
e_widget_on_change_hook_set(ob, _adv_font_cb_change, cfdata);
|
|
|
|
_font_list_load(cfdata, NULL);
|
2009-09-11 14:07:51 -07:00
|
|
|
e_widget_size_min_set(ob, 110, 220);
|
2007-04-17 01:57:20 -07:00
|
|
|
e_widget_framelist_object_append(of, ob);
|
2009-09-11 14:07:51 -07:00
|
|
|
e_widget_table_object_append(ot, of, 1, 0, 1, 2, 1, 1, 1, 1);
|
2007-04-05 06:25:41 -07:00
|
|
|
|
2009-09-11 14:07:51 -07:00
|
|
|
of = e_widget_framelist_add(evas, _("Style"), 1);
|
2007-04-17 01:57:20 -07:00
|
|
|
ob = e_widget_ilist_add(evas, 16, 16, &(cfdata->cur_style));
|
|
|
|
cfdata->gui.style_list = ob;
|
2007-05-03 16:19:40 -07:00
|
|
|
e_widget_on_change_hook_set(ob, _adv_style_cb_change, cfdata);
|
2007-04-17 01:57:20 -07:00
|
|
|
e_widget_ilist_go(ob);
|
2009-09-11 14:07:51 -07:00
|
|
|
e_widget_size_min_set(ob, 110, 50);
|
2007-04-17 01:57:20 -07:00
|
|
|
e_widget_framelist_object_append(of, ob);
|
|
|
|
e_widget_table_object_append(ot, of, 2, 0, 1, 1, 1, 1, 1, 1);
|
2008-03-18 12:59:52 -07:00
|
|
|
|
2007-05-03 16:19:40 -07:00
|
|
|
of = e_widget_framelist_add(evas, _("Size"), 1);
|
|
|
|
ob = e_widget_ilist_add(evas, 16, 16, NULL);
|
|
|
|
cfdata->gui.size_list = ob;
|
|
|
|
e_widget_ilist_go(ob);
|
2009-09-11 14:07:51 -07:00
|
|
|
e_widget_size_min_set(ob, 110, 50);
|
2007-05-03 16:19:40 -07:00
|
|
|
e_widget_framelist_object_append(of, ob);
|
2009-09-11 14:07:51 -07:00
|
|
|
e_widget_table_object_append(ot, of, 2, 1, 1, 1, 1, 1, 1, 1);
|
|
|
|
|
2012-11-14 20:21:47 -08:00
|
|
|
ob = e_widget_font_preview_add
|
|
|
|
(evas, _("English 012 #!? 日本語 にほんご ソフト 中文 華語 한국"));
|
|
|
|
|
2009-09-11 14:07:51 -07:00
|
|
|
cfdata->gui.preview = ob;
|
|
|
|
e_widget_table_object_append(ot, ob, 0, 2, 3, 1, 1, 0, 1, 0);
|
2007-05-03 16:19:40 -07:00
|
|
|
|
2009-09-11 14:07:51 -07:00
|
|
|
e_widget_toolbook_page_append(otb, NULL, _("General Settings"),
|
2012-07-02 01:09:17 -07:00
|
|
|
ot, 1, 1, 1, 1, 0.5, 0.0);
|
2009-09-11 14:07:51 -07:00
|
|
|
|
|
|
|
ot = e_widget_table_add(evas, 0);
|
2007-12-04 18:08:54 -08:00
|
|
|
of = e_widget_frametable_add(evas, _("Hinting"), 0);
|
2006-04-01 01:59:40 -08:00
|
|
|
rg = e_widget_radio_group_new(&(cfdata->hinting));
|
|
|
|
option_enable = evas_font_hinting_can_hint(evas, EVAS_FONT_HINTING_BYTECODE);
|
2006-04-02 00:19:17 -08:00
|
|
|
ob = e_widget_radio_add(evas, _("Bytecode"), 0, rg);
|
2006-04-01 01:59:40 -08:00
|
|
|
e_widget_disabled_set(ob, !option_enable);
|
2007-12-04 18:08:54 -08:00
|
|
|
e_widget_frametable_object_append(of, ob, 0, 0, 1, 1, 1, 0, 1, 0);
|
2006-04-01 01:59:40 -08:00
|
|
|
option_enable = evas_font_hinting_can_hint(evas, EVAS_FONT_HINTING_AUTO);
|
2006-04-02 00:19:17 -08:00
|
|
|
ob = e_widget_radio_add(evas, _("Automatic"), 1, rg);
|
2006-04-01 01:59:40 -08:00
|
|
|
e_widget_disabled_set(ob, !option_enable);
|
2007-12-04 18:08:54 -08:00
|
|
|
e_widget_frametable_object_append(of, ob, 0, 1, 1, 1, 1, 0, 1, 0);
|
2006-04-01 01:59:40 -08:00
|
|
|
option_enable = evas_font_hinting_can_hint(evas, EVAS_FONT_HINTING_NONE);
|
2006-04-02 00:19:17 -08:00
|
|
|
ob = e_widget_radio_add(evas, _("None"), 2, rg);
|
2006-04-01 01:59:40 -08:00
|
|
|
e_widget_disabled_set(ob, !option_enable);
|
2007-12-04 18:08:54 -08:00
|
|
|
e_widget_frametable_object_append(of, ob, 0, 2, 1, 1, 1, 0, 1, 0);
|
2009-09-11 14:07:51 -07:00
|
|
|
e_widget_table_object_append(ot, of, 0, 0, 1, 1, 1, 1, 1, 0);
|
2006-04-04 07:00:19 -07:00
|
|
|
|
2007-04-17 01:57:20 -07:00
|
|
|
of = e_widget_framelist_add(evas, _("Font Fallbacks"), 0);
|
2006-05-30 17:32:26 -07:00
|
|
|
ob = e_widget_config_list_add(evas, e_widget_entry_add, _("Fallback Name"), 2);
|
2006-04-06 05:07:45 -07:00
|
|
|
cfdata->gui.fallback_list = ob;
|
|
|
|
option_enable = 0;
|
2014-04-04 11:10:09 -07:00
|
|
|
EINA_LIST_FOREACH(e_font_fallback_list(), next, eff)
|
2006-04-04 07:00:19 -07:00
|
|
|
{
|
2012-07-02 01:09:17 -07:00
|
|
|
e_widget_config_list_append(ob, eff->name);
|
|
|
|
option_enable = 1;
|
2006-04-04 07:00:19 -07:00
|
|
|
}
|
|
|
|
ob = e_widget_check_add(evas, _("Enable Fallbacks"), &(cfdata->cur_fallbacks_enabled));
|
2009-09-11 14:24:02 -07:00
|
|
|
e_widget_config_list_object_append(cfdata->gui.fallback_list, ob,
|
2012-07-02 01:09:17 -07:00
|
|
|
0, 0, 2, 1, 1, 0, 1, 0);
|
2007-05-03 16:19:40 -07:00
|
|
|
e_widget_on_change_hook_set(ob, _adv_enabled_fallback_cb_change, cfdata);
|
2006-04-04 07:00:19 -07:00
|
|
|
e_widget_check_checked_set(ob, option_enable);
|
2006-04-06 05:07:45 -07:00
|
|
|
e_widget_change(ob);
|
2008-10-17 01:08:31 -07:00
|
|
|
e_widget_framelist_object_append(of, cfdata->gui.fallback_list);
|
2009-09-11 14:07:51 -07:00
|
|
|
e_widget_table_object_append(ot, of, 1, 0, 1, 1, 1, 1, 1, 0);
|
2008-03-18 12:59:52 -07:00
|
|
|
|
2009-09-11 14:07:51 -07:00
|
|
|
e_widget_toolbook_page_append(otb, NULL, _("Hinting / Fallbacks"),
|
2012-07-02 01:09:17 -07:00
|
|
|
ot, 1, 0, 1, 0, 0.5, 0.0);
|
2007-12-04 14:44:55 -08:00
|
|
|
|
2009-09-11 14:07:51 -07:00
|
|
|
e_widget_toolbook_page_show(otb, 0);
|
|
|
|
return otb;
|
2006-04-01 01:59:40 -08:00
|
|
|
}
|
|
|
|
|
2006-04-04 07:00:19 -07:00
|
|
|
/* Private Font Class Functions */
|
2009-09-11 14:24:02 -07:00
|
|
|
static void
|
|
|
|
_class_list_load(E_Config_Dialog_Data *cfdata)
|
2006-10-11 02:08:10 -07:00
|
|
|
{
|
|
|
|
Evas *evas;
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *next;
|
2008-03-18 12:59:52 -07:00
|
|
|
|
2006-10-11 02:08:10 -07:00
|
|
|
if (!cfdata->gui.class_list) return;
|
|
|
|
evas = evas_object_evas_get(cfdata->gui.class_list);
|
2006-11-27 07:39:34 -08:00
|
|
|
evas_event_freeze(evas);
|
|
|
|
edje_freeze();
|
|
|
|
e_widget_ilist_freeze(cfdata->gui.class_list);
|
2006-10-11 02:08:10 -07:00
|
|
|
e_widget_ilist_clear(cfdata->gui.class_list);
|
2008-03-18 12:59:52 -07:00
|
|
|
|
2007-05-03 16:19:40 -07:00
|
|
|
/* Fill in Class Ilist */
|
2006-10-11 02:08:10 -07:00
|
|
|
for (next = cfdata->text_classes; next; next = next->next)
|
|
|
|
{
|
2012-07-02 01:09:17 -07:00
|
|
|
CFText_Class *tc;
|
|
|
|
Evas_Object *ic;
|
|
|
|
|
|
|
|
tc = next->data;
|
|
|
|
if (tc)
|
|
|
|
{
|
|
|
|
if (tc->class_name)
|
|
|
|
{
|
|
|
|
if (tc->enabled)
|
|
|
|
{
|
|
|
|
ic = e_icon_add(evas);
|
|
|
|
e_util_icon_theme_set(ic, "dialog-ok-apply");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
ic = NULL;
|
2012-08-08 03:49:07 -07:00
|
|
|
e_widget_ilist_append(cfdata->gui.class_list, ic, tc->class_description, NULL, tc, NULL);
|
2012-07-02 01:09:17 -07:00
|
|
|
}
|
|
|
|
else
|
|
|
|
e_widget_ilist_header_append(cfdata->gui.class_list, NULL, tc->class_description);
|
|
|
|
}
|
2006-10-11 02:08:10 -07:00
|
|
|
}
|
2006-11-27 07:39:34 -08:00
|
|
|
e_widget_ilist_go(cfdata->gui.class_list);
|
|
|
|
e_widget_ilist_thaw(cfdata->gui.class_list);
|
|
|
|
edje_thaw();
|
|
|
|
evas_event_thaw(evas);
|
2006-10-11 02:08:10 -07:00
|
|
|
}
|
2006-04-04 07:00:19 -07:00
|
|
|
|
2007-05-03 16:19:40 -07:00
|
|
|
/* Called whenever class list selection changes */
|
2006-04-01 01:59:40 -08:00
|
|
|
static void
|
2010-08-19 10:16:06 -07:00
|
|
|
_adv_class_cb_change(void *data, Evas_Object *obj __UNUSED__)
|
2006-04-01 01:59:40 -08:00
|
|
|
{
|
|
|
|
int indx;
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
|
|
|
CFText_Class *tc;
|
2008-03-18 12:59:52 -07:00
|
|
|
|
|
|
|
if (!(cfdata = data)) return;
|
|
|
|
|
2007-04-05 04:59:10 -07:00
|
|
|
/* Save Current */
|
2012-08-08 03:49:07 -07:00
|
|
|
if (cfdata->cur_class)
|
2006-04-01 01:59:40 -08:00
|
|
|
{
|
2012-08-08 03:49:07 -07:00
|
|
|
tc = cfdata->cur_class;
|
2012-07-02 01:09:17 -07:00
|
|
|
tc->size = cfdata->cur_size;
|
2009-03-11 08:13:42 -07:00
|
|
|
|
2012-08-08 03:49:07 -07:00
|
|
|
eina_stringshare_replace(&tc->font, cfdata->cur_font);
|
|
|
|
eina_stringshare_replace(&tc->style, cfdata->cur_style);
|
2009-03-11 08:13:42 -07:00
|
|
|
|
2012-07-02 01:09:17 -07:00
|
|
|
if (cfdata->gui.style_list)
|
|
|
|
e_widget_ilist_unselect(cfdata->gui.style_list);
|
|
|
|
if (cfdata->gui.size_list)
|
|
|
|
e_widget_ilist_unselect(cfdata->gui.size_list);
|
2012-08-08 03:49:07 -07:00
|
|
|
if (cfdata->gui.font_list)
|
|
|
|
e_widget_ilist_unselect(cfdata->gui.font_list);
|
2006-04-01 01:59:40 -08:00
|
|
|
}
|
2008-03-18 12:59:52 -07:00
|
|
|
|
2007-05-03 16:19:40 -07:00
|
|
|
/* If no class is selected unselect all and return */
|
2006-04-01 01:59:40 -08:00
|
|
|
indx = e_widget_ilist_selected_get(cfdata->gui.class_list);
|
2009-09-11 14:24:02 -07:00
|
|
|
if (indx < 0)
|
2007-01-08 18:29:51 -08:00
|
|
|
{
|
2012-07-02 01:09:17 -07:00
|
|
|
e_widget_disabled_set(cfdata->gui.enabled, 1);
|
|
|
|
e_widget_disabled_set(cfdata->gui.font_list, 1);
|
|
|
|
e_widget_disabled_set(cfdata->gui.size_list, 1);
|
|
|
|
e_widget_check_checked_set(cfdata->gui.enabled, 0);
|
|
|
|
if (cfdata->gui.font_list)
|
|
|
|
e_widget_ilist_unselect(cfdata->gui.font_list);
|
|
|
|
return;
|
2007-01-08 18:29:51 -08:00
|
|
|
}
|
2012-08-08 03:49:07 -07:00
|
|
|
tc = e_widget_ilist_selected_data_get(cfdata->gui.class_list);
|
|
|
|
if (!tc) return;
|
|
|
|
e_widget_check_valptr_set(cfdata->gui.enabled, (int*)&tc->enabled);
|
2008-03-18 12:59:52 -07:00
|
|
|
|
2012-08-08 03:49:07 -07:00
|
|
|
cfdata->cur_class = tc;
|
2006-04-01 01:59:40 -08:00
|
|
|
|
|
|
|
e_widget_disabled_set(cfdata->gui.enabled, 0);
|
2007-05-03 16:19:40 -07:00
|
|
|
e_widget_disabled_set(cfdata->gui.font_list, !tc->enabled);
|
|
|
|
e_widget_disabled_set(cfdata->gui.size_list, !tc->enabled);
|
2012-08-08 03:49:07 -07:00
|
|
|
if (!tc->enabled) return;
|
|
|
|
if (!cfdata->gui.font_list) return;
|
2012-07-02 01:09:17 -07:00
|
|
|
|
2012-08-08 03:49:07 -07:00
|
|
|
{
|
|
|
|
E_Ilist_Item *ili;
|
2012-09-12 06:03:04 -07:00
|
|
|
const Eina_List *l;
|
2012-08-08 03:49:07 -07:00
|
|
|
unsigned int sel = 0;
|
|
|
|
|
|
|
|
/* Select the configured font */
|
|
|
|
EINA_LIST_FOREACH(e_widget_ilist_items_get(cfdata->gui.font_list), l, ili)
|
|
|
|
{
|
|
|
|
const char *f;
|
|
|
|
|
|
|
|
f = ili->label;
|
|
|
|
if (tc->font && !strcasecmp(f, tc->font))
|
|
|
|
{
|
|
|
|
e_widget_ilist_selected_set(cfdata->gui.font_list, sel);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
sel++;
|
|
|
|
}
|
|
|
|
}
|
2006-04-01 01:59:40 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2010-08-19 10:16:06 -07:00
|
|
|
_adv_enabled_font_cb_change(void *data, Evas_Object *obj __UNUSED__)
|
2006-04-01 01:59:40 -08:00
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
2012-08-08 03:49:07 -07:00
|
|
|
CFText_Class *tc;
|
2008-03-18 12:59:52 -07:00
|
|
|
|
|
|
|
if (!(cfdata = data)) return;
|
2012-08-08 03:49:07 -07:00
|
|
|
tc = e_widget_ilist_selected_data_get(cfdata->gui.class_list);
|
|
|
|
if ((!tc) || (!tc->enabled))
|
2006-04-01 01:59:40 -08:00
|
|
|
{
|
2012-08-08 03:49:07 -07:00
|
|
|
e_widget_disabled_set(cfdata->gui.font_list, 1);
|
|
|
|
e_widget_ilist_unselect(cfdata->gui.font_list);
|
|
|
|
e_widget_disabled_set(cfdata->gui.style_list, 1);
|
|
|
|
e_widget_ilist_unselect(cfdata->gui.font_list);
|
|
|
|
e_widget_disabled_set(cfdata->gui.size_list, 1);
|
|
|
|
e_widget_ilist_unselect(cfdata->gui.font_list);
|
|
|
|
if (tc)
|
|
|
|
e_widget_ilist_nth_icon_set(cfdata->gui.class_list, e_widget_ilist_selected_get(cfdata->gui.class_list), NULL);
|
|
|
|
return;
|
2006-04-01 01:59:40 -08:00
|
|
|
}
|
2012-08-08 03:49:07 -07:00
|
|
|
|
|
|
|
e_widget_disabled_set(cfdata->gui.font_list, 0);
|
|
|
|
e_widget_disabled_set(cfdata->gui.style_list, 0);
|
|
|
|
e_widget_disabled_set(cfdata->gui.size_list, 0);
|
|
|
|
/* Search class list fot selected and enable Icon */
|
|
|
|
{
|
|
|
|
Evas_Object *icon = NULL;
|
|
|
|
|
|
|
|
tc->size = cfdata->cur_size;
|
|
|
|
eina_stringshare_replace(&tc->font, cfdata->cur_font);
|
|
|
|
if (tc->enabled)
|
|
|
|
{
|
|
|
|
icon = e_icon_add(cfdata->evas);
|
|
|
|
e_util_icon_theme_set(icon, "enlightenment");
|
|
|
|
}
|
|
|
|
|
|
|
|
e_widget_ilist_nth_icon_set(cfdata->gui.class_list, e_widget_ilist_selected_get(cfdata->gui.class_list), icon);
|
|
|
|
}
|
2007-01-08 11:23:21 -08:00
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2007-05-03 16:19:40 -07:00
|
|
|
_size_cb_change(void *data)
|
2007-01-08 11:23:21 -08:00
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
2007-05-03 16:19:40 -07:00
|
|
|
E_Font_Size_Data *size_data;
|
2012-09-12 06:03:04 -07:00
|
|
|
const Eina_List *l;
|
2007-01-08 11:23:21 -08:00
|
|
|
int n;
|
2008-03-18 12:59:52 -07:00
|
|
|
|
2007-05-03 16:19:40 -07:00
|
|
|
size_data = data;
|
2008-03-18 12:59:52 -07:00
|
|
|
if (!(cfdata = size_data->cfdata)) return;
|
2007-05-03 16:19:40 -07:00
|
|
|
|
|
|
|
cfdata->cur_size = size_data->size;
|
|
|
|
|
|
|
|
_font_preview_update(cfdata);
|
|
|
|
|
|
|
|
if (!cfdata->gui.class_list) return;
|
|
|
|
|
2009-09-11 14:24:02 -07:00
|
|
|
for (n = 0, l = e_widget_ilist_items_get(cfdata->gui.class_list); l; l = l->next, n++)
|
2007-01-08 11:23:21 -08:00
|
|
|
{
|
2012-07-02 01:09:17 -07:00
|
|
|
E_Ilist_Item *i;
|
|
|
|
CFText_Class *tc;
|
2007-01-08 11:23:21 -08:00
|
|
|
|
2008-03-18 12:59:52 -07:00
|
|
|
if (!(i = l->data)) continue;
|
2012-07-02 01:09:17 -07:00
|
|
|
if (!i->selected) continue;
|
2007-01-08 11:23:21 -08:00
|
|
|
|
2012-07-02 01:09:17 -07:00
|
|
|
tc = eina_list_nth(cfdata->text_classes, n);
|
|
|
|
tc->size = cfdata->cur_size;
|
2009-09-11 14:24:02 -07:00
|
|
|
}
|
2007-01-08 11:23:21 -08:00
|
|
|
}
|
|
|
|
|
2009-09-11 14:24:02 -07:00
|
|
|
static void
|
2010-08-19 10:16:06 -07:00
|
|
|
_adv_font_cb_change(void *data, Evas_Object *obj __UNUSED__)
|
2007-01-08 11:23:21 -08:00
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
2007-04-05 04:59:10 -07:00
|
|
|
CFText_Class *tc;
|
2007-01-08 11:23:21 -08:00
|
|
|
int n;
|
2008-03-18 12:59:52 -07:00
|
|
|
|
|
|
|
if (!(cfdata = data)) return;
|
|
|
|
|
2007-05-03 16:19:40 -07:00
|
|
|
/* Set up the new font name for each selected class */
|
2012-08-08 03:49:07 -07:00
|
|
|
tc = e_widget_ilist_selected_data_get(cfdata->gui.class_list);
|
|
|
|
if (tc)
|
|
|
|
eina_stringshare_replace(&tc->font, cfdata->cur_font);
|
2007-04-05 04:59:10 -07:00
|
|
|
|
|
|
|
/* Load the style list */
|
|
|
|
if (cfdata->cur_font)
|
|
|
|
{
|
2012-07-02 01:09:17 -07:00
|
|
|
E_Font_Properties *efp;
|
|
|
|
Eina_List *next;
|
2007-04-05 04:59:10 -07:00
|
|
|
|
2012-07-02 01:09:17 -07:00
|
|
|
efp = eina_hash_find(cfdata->font_hash, cfdata->cur_font);
|
|
|
|
evas_event_freeze(evas_object_evas_get(cfdata->gui.style_list));
|
|
|
|
edje_freeze();
|
|
|
|
e_widget_ilist_freeze(cfdata->gui.style_list);
|
|
|
|
e_widget_ilist_clear(cfdata->gui.style_list);
|
2008-03-18 12:59:52 -07:00
|
|
|
|
2012-07-02 01:09:17 -07:00
|
|
|
for (next = efp->styles; next; next = next->next)
|
|
|
|
{
|
|
|
|
const char *style;
|
2007-05-19 12:15:37 -07:00
|
|
|
|
2012-07-02 01:09:17 -07:00
|
|
|
style = next->data;
|
|
|
|
e_widget_ilist_append(cfdata->gui.style_list, NULL, style,
|
2008-03-18 12:59:52 -07:00
|
|
|
NULL, NULL, style);
|
2012-07-02 01:09:17 -07:00
|
|
|
}
|
2007-04-05 04:59:10 -07:00
|
|
|
|
2012-07-02 01:09:17 -07:00
|
|
|
e_widget_ilist_go(cfdata->gui.style_list);
|
|
|
|
e_widget_ilist_thaw(cfdata->gui.style_list);
|
|
|
|
edje_thaw();
|
|
|
|
evas_event_thaw(evas_object_evas_get(cfdata->gui.style_list));
|
2007-04-05 04:59:10 -07:00
|
|
|
}
|
|
|
|
|
2009-09-11 14:24:02 -07:00
|
|
|
/* select configured style from list */
|
2010-09-19 15:27:44 -07:00
|
|
|
if ((tc) && (tc->style))
|
2009-09-11 14:24:02 -07:00
|
|
|
{
|
2012-07-02 01:09:17 -07:00
|
|
|
for (n = 0; n < e_widget_ilist_count(cfdata->gui.style_list); n++)
|
|
|
|
{
|
|
|
|
const char *f;
|
2008-03-18 12:59:52 -07:00
|
|
|
|
2012-07-02 01:09:17 -07:00
|
|
|
f = e_widget_ilist_nth_label_get(cfdata->gui.style_list, n);
|
2010-09-19 15:27:44 -07:00
|
|
|
if ((!f) || (!tc->style)) continue;
|
2012-07-02 01:09:17 -07:00
|
|
|
if (!strcasecmp(f, tc->style))
|
|
|
|
{
|
|
|
|
e_widget_ilist_selected_set(cfdata->gui.style_list, n);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
2007-04-05 04:59:10 -07:00
|
|
|
}
|
2007-05-03 16:19:40 -07:00
|
|
|
|
|
|
|
/* load and select size list */
|
|
|
|
if (tc)
|
|
|
|
{
|
2012-07-02 01:09:17 -07:00
|
|
|
cfdata->cur_size = tc->size;
|
|
|
|
_size_list_load(cfdata, cfdata->font_scale_list, tc->size, 1);
|
|
|
|
_size_list_load(cfdata, cfdata->font_px_list, tc->size, 0);
|
2007-05-03 16:19:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
_font_preview_update(cfdata);
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
2008-10-22 04:49:33 -07:00
|
|
|
_size_list_load(E_Config_Dialog_Data *cfdata, Eina_List *size_list, Evas_Font_Size cur_size, int clear)
|
2007-05-03 16:19:40 -07:00
|
|
|
{
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *next;
|
2007-05-03 16:19:40 -07:00
|
|
|
Evas_Object *ob;
|
|
|
|
Evas *evas;
|
|
|
|
int n;
|
|
|
|
|
|
|
|
ob = cfdata->gui.size_list;
|
|
|
|
evas = evas_object_evas_get(ob);
|
|
|
|
|
2009-09-11 14:24:02 -07:00
|
|
|
evas_event_freeze(evas);
|
|
|
|
edje_freeze();
|
2007-05-03 16:19:40 -07:00
|
|
|
e_widget_ilist_freeze(ob);
|
|
|
|
if (clear) e_widget_ilist_clear(ob);
|
2008-03-18 12:59:52 -07:00
|
|
|
|
2009-09-11 14:24:02 -07:00
|
|
|
for (next = size_list; next; next = next->next)
|
|
|
|
{
|
2012-07-02 01:09:17 -07:00
|
|
|
E_Font_Size_Data *size_data;
|
2007-05-03 16:19:40 -07:00
|
|
|
|
2012-07-02 01:09:17 -07:00
|
|
|
size_data = next->data;
|
|
|
|
e_widget_ilist_append(ob, NULL, size_data->size_str, _size_cb_change,
|
|
|
|
size_data, NULL);
|
2007-05-03 16:19:40 -07:00
|
|
|
}
|
2008-03-18 12:59:52 -07:00
|
|
|
|
2009-09-11 14:24:02 -07:00
|
|
|
e_widget_ilist_go(ob);
|
|
|
|
e_widget_ilist_thaw(ob);
|
2007-05-03 16:19:40 -07:00
|
|
|
edje_thaw();
|
|
|
|
evas_event_thaw(evas);
|
|
|
|
|
2009-09-11 14:24:02 -07:00
|
|
|
for (n = 0; n < e_widget_ilist_count(ob); n++)
|
2007-05-03 16:19:40 -07:00
|
|
|
{
|
2012-07-02 01:09:17 -07:00
|
|
|
E_Font_Size_Data *size_data;
|
|
|
|
|
|
|
|
if (!(size_data = e_widget_ilist_nth_data_get(ob, n))) continue;
|
|
|
|
if (cur_size == size_data->size)
|
|
|
|
{
|
|
|
|
e_widget_ilist_selected_set(ob, n);
|
|
|
|
break;
|
|
|
|
}
|
2007-05-03 16:19:40 -07:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
static void
|
|
|
|
_font_list_load(E_Config_Dialog_Data *cfdata, const char *cur_font)
|
|
|
|
{
|
2012-05-04 02:38:52 -07:00
|
|
|
const char *f;
|
2008-10-22 04:49:33 -07:00
|
|
|
Eina_List *next;
|
2007-05-03 16:19:40 -07:00
|
|
|
Evas_Object *ob;
|
|
|
|
Evas *evas;
|
|
|
|
Evas_Coord w;
|
2012-05-04 02:38:52 -07:00
|
|
|
int n;
|
2007-05-03 16:19:40 -07:00
|
|
|
|
|
|
|
ob = cfdata->gui.font_list;
|
|
|
|
evas = evas_object_evas_get(ob);
|
|
|
|
|
|
|
|
evas_event_freeze(evas);
|
|
|
|
edje_freeze();
|
|
|
|
e_widget_ilist_freeze(ob);
|
|
|
|
|
|
|
|
/* Load Hash a single time */
|
2010-08-21 06:52:25 -07:00
|
|
|
if (!cfdata->font_hash)
|
2007-05-03 16:19:40 -07:00
|
|
|
{
|
2012-07-02 01:09:17 -07:00
|
|
|
Eina_List *fonts;
|
|
|
|
|
|
|
|
fonts = evas_font_available_list(evas);
|
|
|
|
cfdata->font_hash = e_font_available_list_parse(fonts);
|
|
|
|
eina_hash_foreach(cfdata->font_hash, _font_hash_cb, cfdata);
|
|
|
|
if (cfdata->font_list)
|
|
|
|
{
|
|
|
|
cfdata->font_list =
|
2009-09-11 14:24:02 -07:00
|
|
|
eina_list_sort(cfdata->font_list,
|
|
|
|
eina_list_count(cfdata->font_list),
|
2008-03-18 12:59:52 -07:00
|
|
|
_sort_fonts);
|
2012-07-02 01:09:17 -07:00
|
|
|
}
|
|
|
|
evas_font_available_list_free(evas, fonts);
|
2007-05-03 16:19:40 -07:00
|
|
|
}
|
|
|
|
|
|
|
|
/* Load the list */
|
2009-09-11 14:24:02 -07:00
|
|
|
if (cfdata->font_list)
|
2007-05-03 16:19:40 -07:00
|
|
|
{
|
2012-05-04 02:38:52 -07:00
|
|
|
EINA_LIST_FOREACH(cfdata->font_list, next, f)
|
2012-07-02 01:09:17 -07:00
|
|
|
{
|
|
|
|
e_widget_ilist_append(ob, NULL, f, NULL, NULL, f);
|
|
|
|
}
|
2007-05-03 16:19:40 -07:00
|
|
|
}
|
2008-03-18 12:59:52 -07:00
|
|
|
|
2007-05-03 16:19:40 -07:00
|
|
|
e_widget_ilist_go(ob);
|
2009-09-01 06:34:42 -07:00
|
|
|
e_widget_size_min_get(ob, &w, NULL);
|
|
|
|
e_widget_size_min_set(ob, w, 250);
|
2007-05-03 16:19:40 -07:00
|
|
|
e_widget_ilist_thaw(ob);
|
|
|
|
edje_thaw();
|
|
|
|
evas_event_thaw(evas);
|
|
|
|
|
|
|
|
if (!cur_font) return;
|
|
|
|
|
|
|
|
/* Select Current Font */
|
|
|
|
n = 0;
|
2012-05-04 02:38:52 -07:00
|
|
|
EINA_LIST_FOREACH(cfdata->font_list, next, f)
|
2007-05-03 16:19:40 -07:00
|
|
|
{
|
2012-07-02 01:09:17 -07:00
|
|
|
if (!strcasecmp(f, cur_font))
|
|
|
|
{
|
|
|
|
e_widget_ilist_selected_set(ob, n);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
n++;
|
2007-05-03 16:19:40 -07:00
|
|
|
}
|
2007-04-05 04:59:10 -07:00
|
|
|
}
|
|
|
|
|
2009-09-11 14:24:02 -07:00
|
|
|
static void
|
2010-08-19 10:16:06 -07:00
|
|
|
_adv_style_cb_change(void *data, Evas_Object *obj __UNUSED__)
|
2007-04-05 04:59:10 -07:00
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
2012-05-04 02:38:52 -07:00
|
|
|
E_Ilist_Item *i;
|
2012-09-12 06:03:04 -07:00
|
|
|
const Eina_List *l;
|
2012-05-04 02:38:52 -07:00
|
|
|
int n = 0;
|
2008-03-18 12:59:52 -07:00
|
|
|
|
|
|
|
if (!(cfdata = data)) return;
|
|
|
|
|
2007-04-05 04:59:10 -07:00
|
|
|
/* Setup the new style name */
|
2012-05-04 02:38:52 -07:00
|
|
|
EINA_LIST_FOREACH(e_widget_ilist_items_get(cfdata->gui.class_list), l, i)
|
2007-04-05 04:59:10 -07:00
|
|
|
{
|
2012-07-02 01:09:17 -07:00
|
|
|
CFText_Class *tc;
|
2012-05-04 02:38:52 -07:00
|
|
|
const char *tmp;
|
2007-04-05 04:59:10 -07:00
|
|
|
|
2012-07-02 01:09:17 -07:00
|
|
|
if (!i->selected) continue;
|
2007-04-05 04:59:10 -07:00
|
|
|
|
2012-07-02 01:09:17 -07:00
|
|
|
tc = eina_list_nth(cfdata->text_classes, n);
|
2012-05-04 02:38:52 -07:00
|
|
|
tmp = eina_stringshare_ref(cfdata->cur_style);
|
2012-07-02 01:09:17 -07:00
|
|
|
eina_stringshare_del(tc->style);
|
|
|
|
tc->style = tmp;
|
2012-05-04 02:38:52 -07:00
|
|
|
n++;
|
2006-04-01 01:59:40 -08:00
|
|
|
}
|
2007-05-03 16:19:40 -07:00
|
|
|
|
|
|
|
_font_preview_update(cfdata);
|
2006-04-01 01:59:40 -08:00
|
|
|
}
|
2006-04-04 07:00:19 -07:00
|
|
|
|
|
|
|
/* Private Font Fallback Functions */
|
2009-09-11 14:24:02 -07:00
|
|
|
static void
|
2010-08-19 10:16:06 -07:00
|
|
|
_adv_enabled_fallback_cb_change(void *data, Evas_Object *obj __UNUSED__)
|
2006-04-04 07:00:19 -07:00
|
|
|
{
|
|
|
|
E_Config_Dialog_Data *cfdata;
|
2008-03-18 12:59:52 -07:00
|
|
|
|
|
|
|
if (!(cfdata = data)) return;
|
2009-09-11 14:24:02 -07:00
|
|
|
e_widget_disabled_set(cfdata->gui.fallback_list,
|
|
|
|
!cfdata->cur_fallbacks_enabled);
|
2006-04-04 07:00:19 -07:00
|
|
|
}
|
|
|
|
|
2009-09-11 14:24:02 -07:00
|
|
|
static int
|
|
|
|
_sort_fonts(const void *data1, const void *data2)
|
2006-10-11 16:33:49 -07:00
|
|
|
{
|
|
|
|
if (!data1) return 1;
|
|
|
|
if (!data2) return -1;
|
2007-01-12 05:26:40 -08:00
|
|
|
return e_util_strcmp(data1, data2);
|
2006-10-11 16:33:49 -07:00
|
|
|
}
|
2007-05-03 16:19:40 -07:00
|
|
|
|
|
|
|
static void
|
|
|
|
_font_preview_update(E_Config_Dialog_Data *cfdata)
|
|
|
|
{
|
|
|
|
/* update preview */
|
|
|
|
if (cfdata->cur_font)
|
|
|
|
{
|
2012-07-02 01:09:17 -07:00
|
|
|
const char *name;
|
2007-05-19 12:15:37 -07:00
|
|
|
|
2012-07-02 01:09:17 -07:00
|
|
|
name = e_font_fontconfig_name_get(cfdata->cur_font, cfdata->cur_style);
|
|
|
|
e_widget_font_preview_font_set(cfdata->gui.preview, name,
|
2008-03-18 12:59:52 -07:00
|
|
|
cfdata->cur_size);
|
2012-07-02 01:09:17 -07:00
|
|
|
eina_stringshare_del(name);
|
2007-05-03 16:19:40 -07:00
|
|
|
}
|
|
|
|
}
|
2012-07-02 01:09:17 -07:00
|
|
|
|