formatting

SVN revision: 74416
This commit is contained in:
Mike Blumenkrantz 2012-07-26 06:49:35 +00:00
parent 325aaa82ad
commit 7fd07d8712
1 changed files with 99 additions and 100 deletions

View File

@ -2,8 +2,8 @@
#define E_TOK_STYLE ":style=" #define E_TOK_STYLE ":style="
static Eina_Bool _font_hash_free_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__); static Eina_Bool _font_hash_free_cb(const Eina_Hash *hash __UNUSED__, const void *key __UNUSED__, void *data, void *fdata __UNUSED__);
static Eina_Hash *_e_font_available_hash_add(Eina_Hash *font_hash, const char *full_name); static Eina_Hash *_e_font_available_hash_add(Eina_Hash *font_hash, const char *full_name);
static E_Font_Properties *_e_font_fontconfig_name_parse(Eina_Hash **font_hash, E_Font_Properties *efp, const char *font); static E_Font_Properties *_e_font_fontconfig_name_parse(Eina_Hash **font_hash, E_Font_Properties *efp, const char *font);
static char _fn_buf[1024]; static char _fn_buf[1024];
@ -38,29 +38,29 @@ e_font_apply(void)
l = e_config->font_fallbacks; l = e_config->font_fallbacks;
if (l) if (l)
{ {
eff = eina_list_data_get(l); eff = eina_list_data_get(l);
len = strlen(eff->name); len = strlen(eff->name);
if (len < blen) if (len < blen)
{ {
strcpy(buf, eff->name); strcpy(buf, eff->name);
blen -= len; blen -= len;
} }
EINA_LIST_FOREACH(eina_list_next(l), l, eff) EINA_LIST_FOREACH(eina_list_next(l), l, eff)
{ {
len = 1; len = 1;
if (len < blen) if (len < blen)
{ {
strcat(buf, ","); strcat(buf, ",");
blen -= len; blen -= len;
} }
len = strlen(eff->name); len = strlen(eff->name);
if (len < blen) if (len < blen)
{ {
strcat(buf, eff->name); strcat(buf, eff->name);
blen -= len; blen -= len;
} }
} }
edje_fontset_append_set(buf); edje_fontset_append_set(buf);
} }
else else
edje_fontset_append_set(NULL); edje_fontset_append_set(NULL);
@ -68,13 +68,13 @@ e_font_apply(void)
/* setup edje text classes */ /* setup edje text classes */
EINA_LIST_FOREACH(e_config->font_defaults, l, efd) EINA_LIST_FOREACH(e_config->font_defaults, l, efd)
{ {
edje_text_class_set(efd->text_class, efd->font, efd->size); edje_text_class_set(efd->text_class, efd->font, efd->size);
} }
/* Update borders */ /* Update borders */
EINA_LIST_FOREACH(e_border_client_list(), l, bd) EINA_LIST_FOREACH(e_border_client_list(), l, bd)
{ {
e_border_frame_recalc(bd); e_border_frame_recalc(bd);
} }
} }
@ -99,11 +99,11 @@ e_font_available_list(void)
e_fonts = NULL; e_fonts = NULL;
EINA_LIST_FOREACH(evas_fonts, l, evas_font) EINA_LIST_FOREACH(evas_fonts, l, evas_font)
{ {
E_Font_Available *efa; E_Font_Available *efa;
efa = E_NEW(E_Font_Available, 1); efa = E_NEW(E_Font_Available, 1);
efa->name = eina_stringshare_add(evas_font); efa->name = eina_stringshare_add(evas_font);
e_fonts = eina_list_append(e_fonts, efa); e_fonts = eina_list_append(e_fonts, efa);
} }
evas_font_available_list_free(con->bg_evas, evas_fonts); evas_font_available_list_free(con->bg_evas, evas_fonts);
@ -118,9 +118,9 @@ e_font_available_list_free(Eina_List *available)
EINA_LIST_FREE(available, efa) EINA_LIST_FREE(available, efa)
{ {
if (efa->name) eina_stringshare_del(efa->name); if (efa->name) eina_stringshare_del(efa->name);
E_FREE(efa); E_FREE(efa);
} }
} }
EAPI void EAPI void
@ -195,10 +195,10 @@ _e_font_fontconfig_name_parse(Eina_Hash **font_hash, E_Font_Properties *efp, con
efp = calloc(1, sizeof(E_Font_Properties)); efp = calloc(1, sizeof(E_Font_Properties));
efp->name = eina_stringshare_add(name); efp->name = eina_stringshare_add(name);
if (font_hash) if (font_hash)
{ {
if (!*font_hash) *font_hash = eina_hash_string_superfast_new(NULL); if (!*font_hash) *font_hash = eina_hash_string_superfast_new(NULL);
eina_hash_add(*font_hash, name, efp); eina_hash_add(*font_hash, name, efp);
} }
} }
s2 = strchr(style, ','); s2 = strchr(style, ',');
if (s2) if (s2)
@ -225,16 +225,15 @@ _e_font_fontconfig_name_parse(Eina_Hash **font_hash, E_Font_Properties *efp, con
efp = calloc(1, sizeof(E_Font_Properties)); efp = calloc(1, sizeof(E_Font_Properties));
efp->name = eina_stringshare_add(font); efp->name = eina_stringshare_add(font);
if (font_hash) if (font_hash)
{ {
if (!*font_hash) *font_hash = eina_hash_string_superfast_new(NULL); if (!*font_hash) *font_hash = eina_hash_string_superfast_new(NULL);
eina_hash_add(*font_hash, font, efp); eina_hash_add(*font_hash, font, efp);
} }
} }
} }
return efp; return efp;
} }
static Eina_Hash * static Eina_Hash *
_e_font_available_hash_add(Eina_Hash *font_hash, const char *full_name) _e_font_available_hash_add(Eina_Hash *font_hash, const char *full_name)
{ {
@ -273,7 +272,6 @@ e_font_available_list_parse(Eina_List *list)
return font_hash; return font_hash;
} }
EAPI const char * EAPI const char *
e_font_fontconfig_name_get(const char *name, const char *style) e_font_fontconfig_name_get(const char *name, const char *style)
{ {
@ -281,7 +279,7 @@ e_font_fontconfig_name_get(const char *name, const char *style)
if (!name) return NULL; if (!name) return NULL;
if (!style || style[0] == 0) return eina_stringshare_add(name); if (!style || style[0] == 0) return eina_stringshare_add(name);
snprintf(buf, 256, "%s"E_TOK_STYLE"%s", name, style); snprintf(buf, 256, "%s"E_TOK_STYLE "%s", name, style);
return eina_stringshare_add(buf); return eina_stringshare_add(buf);
} }
@ -292,9 +290,9 @@ e_font_fallback_clear(void)
EINA_LIST_FREE(e_config->font_fallbacks, eff) EINA_LIST_FREE(e_config->font_fallbacks, eff)
{ {
if (eff->name) eina_stringshare_del(eff->name); if (eff->name) eina_stringshare_del(eff->name);
E_FREE(eff); E_FREE(eff);
} }
} }
EAPI void EAPI void
@ -329,14 +327,14 @@ e_font_fallback_remove(const char *font)
EINA_LIST_FOREACH(e_config->font_fallbacks, next, eff) EINA_LIST_FOREACH(e_config->font_fallbacks, next, eff)
{ {
if (!strcmp(eff->name, font)) if (!strcmp(eff->name, font))
{ {
e_config->font_fallbacks = e_config->font_fallbacks =
eina_list_remove_list(e_config->font_fallbacks, next); eina_list_remove_list(e_config->font_fallbacks, next);
if (eff->name) eina_stringshare_del(eff->name); if (eff->name) eina_stringshare_del(eff->name);
E_FREE(eff); E_FREE(eff);
break; break;
} }
} }
} }
@ -355,18 +353,18 @@ e_font_default_set(const char *text_class, const char *font, Evas_Font_Size size
/* search for the text class */ /* search for the text class */
EINA_LIST_FOREACH(e_config->font_defaults, next, efd) EINA_LIST_FOREACH(e_config->font_defaults, next, efd)
{ {
if (!strcmp(efd->text_class, text_class)) if (!strcmp(efd->text_class, text_class))
{ {
if (efd->font) eina_stringshare_del(efd->font); if (efd->font) eina_stringshare_del(efd->font);
efd->font = eina_stringshare_add(font); efd->font = eina_stringshare_add(font);
efd->size = size; efd->size = size;
/* move to the front of the list */ /* move to the front of the list */
e_config->font_defaults = e_config->font_defaults =
eina_list_remove_list(e_config->font_defaults, next); eina_list_remove_list(e_config->font_defaults, next);
e_config->font_defaults = e_config->font_defaults =
eina_list_prepend(e_config->font_defaults, efd); eina_list_prepend(e_config->font_defaults, efd);
return; return;
} }
} }
/* the text class doesn't exist */ /* the text class doesn't exist */
@ -390,18 +388,18 @@ e_font_default_get(const char *text_class)
/* search for the text class */ /* search for the text class */
EINA_LIST_FOREACH(e_config->font_defaults, next, efd) EINA_LIST_FOREACH(e_config->font_defaults, next, efd)
{ {
if (!strcmp(efd->text_class, text_class)) if (!strcmp(efd->text_class, text_class))
{ {
/* move to the front of the list */ /* move to the front of the list */
e_config->font_defaults = e_config->font_defaults =
eina_list_remove_list(e_config->font_defaults, next); eina_list_remove_list(e_config->font_defaults, next);
e_config->font_defaults = e_config->font_defaults =
eina_list_prepend(e_config->font_defaults, efd); eina_list_prepend(e_config->font_defaults, efd);
return efd; return efd;
} }
if (!strcmp(efd->text_class, "default")) defd = efd; if (!strcmp(efd->text_class, "default")) defd = efd;
} }
if (!defd) defd = efd; if (!defd) defd = efd;
return defd; return defd;
} }
@ -414,17 +412,17 @@ e_font_default_remove(const char *text_class)
/* search for the text class */ /* search for the text class */
EINA_LIST_FOREACH(e_config->font_defaults, next, efd) EINA_LIST_FOREACH(e_config->font_defaults, next, efd)
{ {
if (!strcmp(efd->text_class, text_class)) if (!strcmp(efd->text_class, text_class))
{ {
e_config->font_defaults = e_config->font_defaults =
eina_list_remove_list(e_config->font_defaults, next); eina_list_remove_list(e_config->font_defaults, next);
if (efd->text_class) eina_stringshare_del(efd->text_class); if (efd->text_class) eina_stringshare_del(efd->text_class);
if (efd->font) eina_stringshare_del(efd->font); if (efd->font) eina_stringshare_del(efd->font);
E_FREE(efd); E_FREE(efd);
edje_text_class_del(text_class); edje_text_class_del(text_class);
return; return;
} }
} }
} }
EAPI Eina_List * EAPI Eina_List *
@ -449,34 +447,35 @@ e_font_default_string_get(const char *text_class, Evas_Font_Size *size_ret)
efd = e_font_default_get(text_class); efd = e_font_default_get(text_class);
if (!efd) if (!efd)
{ {
if (size_ret) *size_ret = 0; if (size_ret) *size_ret = 0;
return ""; return "";
} }
blen = sizeof(_fn_buf) - 1; blen = sizeof(_fn_buf) - 1;
len = strlen(efd->font); len = strlen(efd->font);
if (len < blen) if (len < blen)
{ {
strcpy(_fn_buf, efd->font); strcpy(_fn_buf, efd->font);
blen -= len; blen -= len;
} }
EINA_LIST_FOREACH(e_config->font_fallbacks, next, eff) EINA_LIST_FOREACH(e_config->font_fallbacks, next, eff)
{ {
len = 1; len = 1;
if (len < blen) if (len < blen)
{ {
strcat(_fn_buf, ","); strcat(_fn_buf, ",");
blen -= len; blen -= len;
} }
len = strlen(eff->name); len = strlen(eff->name);
if (len < blen) if (len < blen)
{ {
strcat(_fn_buf, eff->name); strcat(_fn_buf, eff->name);
blen -= len; blen -= len;
} }
} }
if (size_ret) *size_ret = efd->size; if (size_ret) *size_ret = efd->size;
return _fn_buf; return _fn_buf;
} }