2011-02-25 Jihoon Kim
* Add edje_object_part_text_cursor_pos_{set,get} API
+
+2011-02-27 Tom Hacohen (TAsn)
+
+ * Added size_range property to TEXT parts in edje files.
+ This lets you limit the size of the font that will be used.
+ Especially useful when using fit.
+
static void st_collections_group_parts_part_description_text_style(void);
static void st_collections_group_parts_part_description_text_repch(void);
static void st_collections_group_parts_part_description_text_size(void);
+static void st_collections_group_parts_part_description_text_size_range(void);
static void st_collections_group_parts_part_description_text_fit(void);
static void st_collections_group_parts_part_description_text_min(void);
static void st_collections_group_parts_part_description_text_max(void);
{"collections.group.parts.part.description.text.style", st_collections_group_parts_part_description_text_style},
{"collections.group.parts.part.description.text.repch", st_collections_group_parts_part_description_text_repch},
{"collections.group.parts.part.description.text.size", st_collections_group_parts_part_description_text_size},
+ {"collections.group.parts.part.description.text.size_range", st_collections_group_parts_part_description_text_size_range},
{"collections.group.parts.part.description.text.fit", st_collections_group_parts_part_description_text_fit},
{"collections.group.parts.part.description.text.min", st_collections_group_parts_part_description_text_min},
{"collections.group.parts.part.description.text.max", st_collections_group_parts_part_description_text_max},
@page edcref
@property
+ size_range
+ @parameters
+ [font min size in points (pt)] [font max size in points (pt)]
+ @effect
+ Sets the allowed font size for the text part. Setting min and max to 0
+ means we won't restrict the sizing (default).
+ @endproperty
+ @since 1.1.0
+*/
+static void
+st_collections_group_parts_part_description_text_size_range(void)
+{
+ Edje_Part_Collection *pc;
+ Edje_Part *ep;
+ Edje_Part_Description_Text *ed;
+
+ check_arg_count(2);
+
+ pc = eina_list_data_get(eina_list_last(edje_collections));
+ ep = pc->parts[pc->parts_count - 1];
+
+ if ((ep->type != EDJE_PART_TYPE_TEXT) &&
+ (ep->type != EDJE_PART_TYPE_TEXTBLOCK))
+ {
+ ERR("%s: Error. parse error %s:%i. "
+ "text attributes in non-TEXT part.",
+ progname, file_in, line - 1);
+ exit(-1);
+ }
+
+ ed = (Edje_Part_Description_Text*) ep->default_desc;
+ if (ep->other.desc_count) ed = (Edje_Part_Description_Text*) ep->other.desc[ep->other.desc_count - 1];
+
+ ed->text.size_range_min = parse_int_range(0, 0, 255);
+ ed->text.size_range_max = parse_int_range(1, 0, 255);
+ if (ed->text.size_range_min > ed->text.size_range_max)
+ {
+ ERR("%s: Error. parse error %s:%i. "
+ "min size is bigger than max size.",
+ progname, file_in, line - 1);
+ exit(-1);
+ }
+}
+
+/**
+ @page edcref
+
+ @property
fit
@parameters
[horizontal] [vertical]
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.text_class", text.text_class, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.style", text.style, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.font", text.font, EET_T_STRING);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.size_range_min", text.size_range_min, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.size_range_max", text.size_range_max, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.repch", text.repch, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.size", text.size, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_text, Edje_Part_Description_Text, "text.fit_x", text.fit_x, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.font", text.font, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.repch", text.repch, EET_T_STRING);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.size", text.size, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.size_range_min", text.size_range_min, EET_T_INT);
+ EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.size_range_max", text.size_range_max, EET_T_INT);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.fit_x", text.fit_x, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.fit_y", text.fit_y, EET_T_UCHAR);
EET_DATA_DESCRIPTOR_ADD_BASIC(_edje_edd_edje_part_description_textblock, Edje_Part_Description_Text, "text.min_x", text.min_x, EET_T_UCHAR);
unsigned char min_y; /* if text size should be part min size */
unsigned char max_x; /* if text size should be part max size */
unsigned char max_y; /* if text size should be part max size */
+ int size_range_min;
+ int size_range_max; /* -1 means, no bound. */
};
struct _Edje_Part_Description_Spec_Box
size = current - 1;
}
}
- if (size < 1) size = 1;
- if (!chosen_desc->text.fit_x)
+ /* Make sure the size is in range */
+ if (size < 1)
+ size = 1;
+ else if ((size > chosen_desc->text.size_range_max) &&
+ (chosen_desc->text.size_range_max > 0))
+ size = chosen_desc->text.size_range_max;
+ else if (size < chosen_desc->text.size_range_min)
+ size = chosen_desc->text.size_range_min;
+
+ /* Handle ellipsis */
{
if (inlined_font) evas_object_text_font_source_set(ep->object, ed->path);
else evas_object_text_font_source_set(ep->object, NULL);