edc_navigator: 3rd patch for base navigation behavior.
|
@ -22,6 +22,15 @@ images {
|
|||
image: "expand.png" COMP;
|
||||
image: "invert.png" COMP;
|
||||
image: "edc_navigator.png" COMP;
|
||||
image: "navi_group.png" COMP;
|
||||
image: "navi_rect.png" COMP;
|
||||
image: "navi_image.png" COMP;
|
||||
image: "navi_swallow.png" COMP;
|
||||
image: "navi_text.png" COMP;
|
||||
image: "navi_textblock.png" COMP;
|
||||
image: "navi_spacer.png" COMP;
|
||||
image: "navi_state.png" COMP;
|
||||
image: "navi_unknown.png" COMP;
|
||||
}
|
||||
|
||||
#define ICON_GROUP(_group_name, _image_path) \
|
||||
|
@ -57,5 +66,14 @@ ICON_GROUP("Text", "live_text.png")
|
|||
ICON_GROUP("Textblock", "live_textblock.png")
|
||||
ICON_GROUP("close", "icon_close.png")
|
||||
ICON_GROUP("edc_navigator", "edc_navigator.png")
|
||||
ICON_GROUP("navi_group", "navi_group.png")
|
||||
ICON_GROUP("navi_image", "navi_image.png")
|
||||
ICON_GROUP("navi_rect", "navi_rect.png")
|
||||
ICON_GROUP("navi_swallow", "navi_swallow.png")
|
||||
ICON_GROUP("navi_text", "navi_text.png")
|
||||
ICON_GROUP("navi_textblock", "navi_textblock.png")
|
||||
ICON_GROUP("navi_spacer", "navi_spacer.png")
|
||||
ICON_GROUP("navi_state", "navi_state.png")
|
||||
ICON_GROUP("navi_unknown", "navi_unknown.png")
|
||||
|
||||
#undef ICON_GROUP
|
||||
|
|
|
@ -71,4 +71,12 @@ EXTRA_DIST = \
|
|||
invert.png \
|
||||
icon_close.png \
|
||||
edc_navigator.png \
|
||||
cursor_arrow.png
|
||||
cursor_arrow.png \
|
||||
navi_group.png \
|
||||
navi_image.png \
|
||||
navi_rect.png \
|
||||
navi_swallow.png \
|
||||
navi_text.png \
|
||||
navi_textblock.png \
|
||||
navi_spacer.png \
|
||||
navi_unknown.png
|
||||
|
|
After Width: | Height: | Size: 514 B |
After Width: | Height: | Size: 268 B |
After Width: | Height: | Size: 207 B |
After Width: | Height: | Size: 324 B |
After Width: | Height: | Size: 205 B |
After Width: | Height: | Size: 677 B |
After Width: | Height: | Size: 412 B |
After Width: | Height: | Size: 475 B |
After Width: | Height: | Size: 375 B |
|
@ -6,6 +6,7 @@ typedef struct base_s
|
|||
Evas_Object *layout;
|
||||
Evas_Object *console;
|
||||
Evas_Object *enventor;
|
||||
Ecore_Timer *edc_navigator_timer;
|
||||
Eina_Bool console_msg : 1;
|
||||
} base_data;
|
||||
|
||||
|
@ -31,6 +32,19 @@ win_resize_cb(void *data EINA_UNUSED, Evas *o EINA_UNUSED, Evas_Object *obj,
|
|||
config_win_size_set(w, h);
|
||||
}
|
||||
|
||||
static Eina_Bool
|
||||
edc_navigator_update_timer_cb(void *data)
|
||||
{
|
||||
base_data *bd = g_bd;
|
||||
|
||||
const char *group_name = data;
|
||||
edc_navigator_group_update(group_name);
|
||||
|
||||
bd->edc_navigator_timer = NULL;
|
||||
|
||||
return ECORE_CALLBACK_CANCEL;
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Externally accessible calls */
|
||||
/*****************************************************************************/
|
||||
|
@ -195,31 +209,38 @@ void
|
|||
base_gui_term(void)
|
||||
{
|
||||
base_data *bd = g_bd;
|
||||
assert(bd);
|
||||
if (!bd) return;
|
||||
|
||||
ecore_timer_del(bd->edc_navigator_timer);
|
||||
edc_navigator_term();
|
||||
panes_term();
|
||||
|
||||
free(bd);
|
||||
g_bd = NULL;
|
||||
}
|
||||
|
||||
void
|
||||
base_edc_navigator_parts_reload(void)
|
||||
base_edc_navigator_group_update(const char *group_name)
|
||||
{
|
||||
edc_navigator_parts_reload();
|
||||
base_data *bd = g_bd;
|
||||
if (!bd) return;
|
||||
|
||||
ecore_timer_del(bd->edc_navigator_timer);
|
||||
bd->edc_navigator_timer = ecore_timer_add(1, edc_navigator_update_timer_cb,
|
||||
group_name);
|
||||
}
|
||||
|
||||
void
|
||||
base_edc_navigator_group_reload(void)
|
||||
base_edc_navigator_reload(void)
|
||||
{
|
||||
edc_navigator_group_reload();
|
||||
edc_navigator_reload();
|
||||
}
|
||||
|
||||
void
|
||||
base_console_reset(void)
|
||||
{
|
||||
base_data *bd = g_bd;
|
||||
assert(bd);
|
||||
if (!bd) return;
|
||||
|
||||
console_text_set(bd->console, "");
|
||||
bd->console_msg = EINA_FALSE;
|
||||
|
|
|
@ -17,6 +17,12 @@ typedef struct edc_navigator_s
|
|||
Elm_Genlist_Item_Class *state_itc;
|
||||
} navi_data;
|
||||
|
||||
typedef struct part_item_data_s
|
||||
{
|
||||
const char *text;
|
||||
Edje_Part_Type type;
|
||||
} part_item_data;
|
||||
|
||||
static navi_data *g_nd = NULL;
|
||||
|
||||
/*****************************************************************************/
|
||||
|
@ -70,24 +76,69 @@ gl_text_get_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
|||
}
|
||||
|
||||
static Evas_Object *
|
||||
gl_content_get_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||
gl_state_content_get_cb(void *data, Evas_Object *obj, const char *part)
|
||||
{
|
||||
if (strcmp("elm.swallow.icon", part)) return NULL;
|
||||
|
||||
//TODO: Add Icon
|
||||
Evas_Object *image = elm_image_add(obj);
|
||||
elm_image_file_set(image, EDJE_PATH, "navi_state");
|
||||
return image;
|
||||
}
|
||||
|
||||
static void
|
||||
gl_part_del_cb(void *data, Evas_Object *obj EINA_UNUSED)
|
||||
{
|
||||
part_item_data *item_data = data;
|
||||
free(item_data);
|
||||
}
|
||||
|
||||
static char *
|
||||
gl_part_text_get_cb(void *data, Evas_Object *obj EINA_UNUSED,
|
||||
const char *part EINA_UNUSED)
|
||||
{
|
||||
return NULL;
|
||||
part_item_data *item_data = data;
|
||||
return strdup(item_data->text);
|
||||
}
|
||||
|
||||
static void
|
||||
gl_del_cb(void *data, Evas_Object *obj EINA_UNUSED)
|
||||
static Evas_Object *
|
||||
gl_part_content_get_cb(void *data, Evas_Object *obj, const char *part)
|
||||
{
|
||||
if (strcmp("elm.swallow.icon", part)) return NULL;
|
||||
part_item_data *item_data = data;
|
||||
|
||||
}
|
||||
//TODO: Add Icon
|
||||
Evas_Object *image = elm_image_add(obj);
|
||||
const char *group;
|
||||
|
||||
static void
|
||||
gl_group_selected_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||
{
|
||||
Elm_Object_Item *it = event_info;
|
||||
switch (item_data->type)
|
||||
{
|
||||
case EDJE_PART_TYPE_RECTANGLE:
|
||||
group = "navi_rect";
|
||||
break;
|
||||
case EDJE_PART_TYPE_TEXT:
|
||||
group = "navi_text";
|
||||
break;
|
||||
case EDJE_PART_TYPE_IMAGE:
|
||||
group = "navi_image";
|
||||
break;
|
||||
case EDJE_PART_TYPE_SWALLOW:
|
||||
group = "navi_swallow";
|
||||
break;
|
||||
case EDJE_PART_TYPE_TEXTBLOCK:
|
||||
group = "navi_textblock";
|
||||
break;
|
||||
case EDJE_PART_TYPE_SPACER:
|
||||
group = "navi_spacer";
|
||||
break;
|
||||
default:
|
||||
group = "navi_unknown";
|
||||
break;
|
||||
}
|
||||
|
||||
//TODO: Search Current Group
|
||||
elm_image_file_set(image, EDJE_PATH, group);
|
||||
|
||||
return image;
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -101,18 +152,44 @@ gl_part_selected_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
|||
states_reload(nd, it);
|
||||
}
|
||||
|
||||
static Evas_Object *
|
||||
gl_group_content_get_cb(void *data, Evas_Object *obj, const char *part)
|
||||
{
|
||||
if (strcmp("elm.swallow.icon", part)) return NULL;
|
||||
|
||||
//TODO: Add Icon
|
||||
Evas_Object *image = elm_image_add(obj);
|
||||
elm_image_file_set(image, EDJE_PATH, "navi_group");
|
||||
return image;
|
||||
}
|
||||
|
||||
static void
|
||||
gl_group_selected_cb(void *data, Evas_Object *obj EINA_UNUSED, void *event_info)
|
||||
{
|
||||
Elm_Object_Item *it = event_info;
|
||||
|
||||
//TODO: Search Current Group
|
||||
}
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Externally accessible calls */
|
||||
/*****************************************************************************/
|
||||
|
||||
void
|
||||
edc_navigator_parts_reload(void)
|
||||
edc_navigator_group_update(const char *cur_group)
|
||||
{
|
||||
if (!config_edc_navigator_get()) return;
|
||||
|
||||
navi_data *nd = g_nd;
|
||||
if (!nd) return;
|
||||
|
||||
if (!config_edc_navigator_get()) return;
|
||||
|
||||
if (!cur_group)
|
||||
{
|
||||
Elm_Object_Item *it = elm_genlist_selected_item_get(nd->genlist);
|
||||
elm_genlist_item_selected_set(it, EINA_FALSE);
|
||||
return;
|
||||
}
|
||||
|
||||
Eina_List *l;
|
||||
Elm_Object_Item *it;
|
||||
|
||||
|
@ -121,20 +198,18 @@ edc_navigator_parts_reload(void)
|
|||
elm_object_item_del(it);
|
||||
|
||||
//Find a current group item
|
||||
const char *cur_group = stats_group_name_get();
|
||||
if (!cur_group) return;
|
||||
|
||||
Elm_Object_Item *group_item = NULL;
|
||||
|
||||
EINA_LIST_FOREACH(nd->group_items, l, it)
|
||||
{
|
||||
group_item = it;
|
||||
const char *group_name = elm_object_item_text_get(it);
|
||||
const char *group_name = elm_object_item_data_get(it);
|
||||
if (!group_name) continue;
|
||||
|
||||
if (!strcmp(group_name, cur_group) &&
|
||||
strlen(group_name) == strlen(cur_group))
|
||||
{
|
||||
elm_genlist_item_selected_set(it, EINA_TRUE);
|
||||
group_item = it;
|
||||
break;
|
||||
}
|
||||
|
@ -147,22 +222,31 @@ edc_navigator_parts_reload(void)
|
|||
edje_edit_string_list_free(nd->part_list);
|
||||
nd->part_list = enventor_object_parts_list_get(enventor);
|
||||
char *name;
|
||||
part_item_data *data;
|
||||
Edje_Part_Type part_type;
|
||||
|
||||
EINA_LIST_FOREACH(nd->part_list, l, name)
|
||||
{
|
||||
part_type = enventor_object_part_type_get(enventor, name);
|
||||
data = malloc(sizeof(part_item_data));
|
||||
data->text = name;
|
||||
data->type = part_type;
|
||||
|
||||
it = elm_genlist_item_append(nd->genlist,
|
||||
nd->part_itc, /* item class */
|
||||
name, /* item data */
|
||||
data,
|
||||
group_item, /* parent */
|
||||
ELM_GENLIST_ITEM_NONE, /* item type */
|
||||
gl_part_selected_cb, /* select cb */
|
||||
nd); /* select cb data */
|
||||
nd->part_items = eina_list_append(nd->part_items, it);
|
||||
}
|
||||
|
||||
//Append Programs
|
||||
}
|
||||
|
||||
void
|
||||
edc_navigator_group_reload(void)
|
||||
edc_navigator_reload(void)
|
||||
{
|
||||
if (!config_edc_navigator_get()) return;
|
||||
|
||||
|
@ -181,7 +265,7 @@ edc_navigator_group_reload(void)
|
|||
const char *cur_group = stats_group_name_get();
|
||||
|
||||
//Update Group
|
||||
EINA_LIST_REVERSE_FOREACH(nd->group_list, l, name)
|
||||
EINA_LIST_FOREACH(nd->group_list, l, name)
|
||||
{
|
||||
it = elm_genlist_item_append(nd->genlist,
|
||||
nd->group_itc, /* item class */
|
||||
|
@ -189,14 +273,14 @@ edc_navigator_group_reload(void)
|
|||
NULL, /* parent */
|
||||
ELM_GENLIST_ITEM_NONE, /* item type */
|
||||
gl_group_selected_cb, /* select cb */
|
||||
nd); /* select cb data */
|
||||
name); /* select cb data */
|
||||
|
||||
nd->group_items = eina_list_append(nd->group_items, it);
|
||||
|
||||
//Update Parts only if current group
|
||||
if (cur_group && !strcmp(name, cur_group) &&
|
||||
(strlen(name) == strlen(cur_group)))
|
||||
edc_navigator_parts_reload();
|
||||
edc_navigator_group_update(cur_group);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -212,6 +296,7 @@ edc_navigator_init(Evas_Object *parent)
|
|||
g_nd = nd;
|
||||
|
||||
Evas_Object *genlist = elm_genlist_add(parent);
|
||||
elm_object_focus_allow_set(genlist, EINA_FALSE);
|
||||
|
||||
//Group Item Class
|
||||
Elm_Genlist_Item_Class *itc;
|
||||
|
@ -219,17 +304,16 @@ edc_navigator_init(Evas_Object *parent)
|
|||
itc = elm_genlist_item_class_new();
|
||||
itc->item_style = "default";
|
||||
itc->func.text_get = gl_text_get_cb;
|
||||
itc->func.content_get = gl_content_get_cb;
|
||||
itc->func.del = gl_del_cb;
|
||||
itc->func.content_get = gl_group_content_get_cb;
|
||||
|
||||
nd->group_itc = itc;
|
||||
|
||||
//Part Item Class
|
||||
itc = elm_genlist_item_class_new();
|
||||
itc->item_style = "default";
|
||||
itc->func.text_get = gl_text_get_cb;
|
||||
itc->func.content_get = gl_content_get_cb;
|
||||
itc->func.del = gl_del_cb;
|
||||
itc->func.text_get = gl_part_text_get_cb;
|
||||
itc->func.content_get = gl_part_content_get_cb;
|
||||
itc->func.del = gl_part_del_cb;
|
||||
|
||||
nd->part_itc = itc;
|
||||
|
||||
|
@ -237,8 +321,7 @@ edc_navigator_init(Evas_Object *parent)
|
|||
itc = elm_genlist_item_class_new();
|
||||
itc->item_style = "default";
|
||||
itc->func.text_get = gl_text_get_cb;
|
||||
itc->func.content_get = gl_content_get_cb;
|
||||
itc->func.del = gl_del_cb;
|
||||
itc->func.content_get = gl_state_content_get_cb;
|
||||
|
||||
nd->state_itc = itc;
|
||||
|
||||
|
|
|
@ -402,7 +402,7 @@ enventor_cursor_group_changed_cb(void *data EINA_UNUSED,
|
|||
{
|
||||
const char *group_name = event_info;
|
||||
stats_edc_group_update(group_name);
|
||||
base_edc_navigator_parts_reload();
|
||||
base_edc_navigator_group_update(group_name);
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -431,7 +431,7 @@ enventor_live_view_loaded_cb(void *data EINA_UNUSED, Evas_Object *obj,
|
|||
Evas_Coord w, h;
|
||||
config_view_size_get(&w, &h);
|
||||
enventor_object_live_view_size_set(obj, w, h);
|
||||
base_edc_navigator_group_reload();
|
||||
base_edc_navigator_reload();
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -487,7 +487,6 @@ enventor_live_view_updated_cb(void *data, Evas_Object *obj,
|
|||
void *event_info EINA_UNUSED)
|
||||
{
|
||||
app_data *ad = data;
|
||||
|
||||
if (ad->lazy_save && enventor_object_modified_get(obj))
|
||||
{
|
||||
enventor_object_save(obj, config_input_path_get());
|
||||
|
@ -498,6 +497,8 @@ enventor_live_view_updated_cb(void *data, Evas_Object *obj,
|
|||
ad->lazy_save = EINA_FALSE;
|
||||
ad->on_saving = EINA_FALSE;
|
||||
}
|
||||
|
||||
base_edc_navigator_group_update(stats_group_name_get());
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -924,7 +925,7 @@ init(app_data *ad, int argc, char **argv)
|
|||
}
|
||||
|
||||
static void
|
||||
term(app_data *ad EINA_UNUSED)
|
||||
term(app_data *ad)
|
||||
{
|
||||
menu_term();
|
||||
live_edit_term();
|
||||
|
|
|
@ -23,5 +23,5 @@ void base_console_reset(void);
|
|||
void base_error_msg_set(const char *msg);
|
||||
void base_console_full_view(void);
|
||||
void base_edc_navigator_toggle(Eina_Bool toggle);
|
||||
void base_edc_navigator_group_reload(void);
|
||||
void base_edc_navigator_parts_reload(void);
|
||||
void base_edc_navigator_reload(void);
|
||||
void base_edc_navigator_group_update(const char *group_name);
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
Evas_Object *edc_navigator_init(Evas_Object *parent);
|
||||
void edc_navigator_term(void);
|
||||
void edc_navigator_group_reload(void);
|
||||
void edc_navigator_parts_reload(void);
|
||||
void edc_navigator_reload(void);
|
||||
void edc_navigator_group_update(const char *cur_group);
|
||||
|
|
|
@ -760,6 +760,12 @@ view_programs_list_get(view_data *vd)
|
|||
return edje_edit_programs_list_get(vd->layout);
|
||||
}
|
||||
|
||||
Edje_Part_Type
|
||||
view_part_type_get(view_data *vd, const char *part)
|
||||
{
|
||||
return edje_edit_part_type_get(vd->layout, part);
|
||||
}
|
||||
|
||||
Eina_List *
|
||||
view_part_states_list_get(view_data *vd, const char *part)
|
||||
{
|
||||
|
|
|
@ -233,6 +233,12 @@ class Enventor.Object (Elm.Widget, Efl.File) {
|
|||
@in h: Evas_Coord *;
|
||||
}
|
||||
}
|
||||
part_type_get {
|
||||
return: Edje_Part_Type;
|
||||
params {
|
||||
@in part_name: const(char) *;
|
||||
}
|
||||
}
|
||||
redo {
|
||||
return: bool;
|
||||
}
|
||||
|
|
|
@ -232,7 +232,7 @@ Eina_List *view_program_targets_get(view_data *vd, const char *prog);
|
|||
void view_string_list_free(Eina_List *list);
|
||||
void view_part_state_set(view_data *vd, const char *part, const char *description, const double state);
|
||||
void view_obj_need_reload_set(view_data *vd);
|
||||
|
||||
Edje_Part_Type view_part_type_get(view_data *vd, const char *part);
|
||||
|
||||
/* template */
|
||||
Eina_Bool template_part_insert(edit_data *ed, Edje_Part_Type part_type, Enventor_Template_Insert_Type insert_type, float rel1_x, float rel1_y, float rel2_x, float rel2_y, const Eina_Stringshare *group_name, char *syntax, size_t n);
|
||||
|
|
|
@ -323,6 +323,14 @@ _enventor_object_part_states_list_get(Eo *obj EINA_UNUSED,
|
|||
return view_part_states_list_get(VIEW_DATA, part);
|
||||
}
|
||||
|
||||
EOLIAN static Edje_Part_Type
|
||||
_enventor_object_part_type_get(Eo *obj EINA_UNUSED,
|
||||
Enventor_Object_Data *pd EINA_UNUSED,
|
||||
const char *part_name)
|
||||
{
|
||||
return view_part_type_get(VIEW_DATA, part_name);
|
||||
}
|
||||
|
||||
EOLIAN static Eina_List *
|
||||
_enventor_object_parts_list_get(Eo *obj EINA_UNUSED,
|
||||
Enventor_Object_Data *pd EINA_UNUSED)
|
||||
|
|