/* callbacks */ static void _enscribi_input_frame_cb_matches(void *data, Evas_Object *obj, const char *emission, const char *source) { Match *match; Eina_List *matches, *l; int i; Edje_Message_String_Set *msg; Edje_Message_Int_Set *msg2; Smart_Data *sd; sd = data; matches = enscribi_canvas_matches_get(sd->canvas); if (!matches) return; msg = calloc(1, sizeof(Edje_Message_String_Set) + ((9-1) * sizeof(char *))); msg->count = 9; msg2 = calloc(1, sizeof(Edje_Message_String_Set) + ((9-1) * sizeof(int))); msg2->count = 9; for (i = 0; i < 8; i++) { l = eina_list_nth_list(matches, i); match = l->data; msg->str[i] = match->str; // Get and send the unicode value of the glyph as well int glyph; evas_string_char_next_get(match->str, 0, &(glyph)); msg2->val[i] = glyph; printf("%s\t(%d)\n", msg->str[i], msg2->val[i]); } msg->str[8] = ""; // Why do we have to set a 9th element to not get scrap in 8th? msg2->val[8] = 0; edje_object_message_send(obj, EDJE_MESSAGE_STRING_SET, 1, msg); edje_object_message_send(obj, EDJE_MESSAGE_INT_SET, 1, msg2); free(msg); free(msg2); }
static void _update_animation_time(Evas_Object *prefs, Evas_Object *layout) { Eina_Value value; float animation_time; Edje_Message_Float msg; elm_prefs_item_value_get(prefs, "main:config:options:animation_time", &value); eina_value_get(&value, &animation_time); if (animation_time < 0.01) animation_time = 0.01; msg.val = animation_time; edje_object_message_send(elm_layout_edje_get(layout), EDJE_MESSAGE_FLOAT, MSG_ID_VEL, &msg); }
/* set progress position 0.0 -> 1.0 */ void theme_progress_set(double val) { if (edje_object_part_exists(o_bg, "exquisite.progress")) { edje_object_part_drag_value_set(o_bg, "exquisite.progress", val, val); edje_object_signal_emit(o_bg, "exquisite", "progress"); } else { Edje_Message_Float m; m.val = val; edje_object_message_send(o_bg, EDJE_MESSAGE_FLOAT, 2, &m); } }
/* set theme title text */ void theme_message_set(const char *txt) { if (edje_object_part_exists(o_bg, "exquisite.message")) { edje_object_part_text_set(o_bg, "exquisite.message", txt); edje_object_signal_emit(o_bg, "exquisite", "message"); } else { Edje_Message_String m; m.str = (char *)txt; edje_object_message_send(o_bg, EDJE_MESSAGE_STRING, 1, &m); } }
EAPI void edje_object_message_send(Evas_Object *obj, Edje_Message_Type type, int id, void *msg) { Edje *ed; unsigned int i; ed = _edje_fetch(obj); if (!ed) return; _edje_message_send(ed, EDJE_QUEUE_SCRIPT, type, id, msg); for (i = 0; i < ed->table_parts_size; i++) { Edje_Real_Part *rp = ed->table_parts[i]; if ((rp->part->type == EDJE_PART_TYPE_GROUP) && (rp->swallowed_object)) edje_object_message_send(rp->swallowed_object, type, id, msg); } }
static void _enscribi_input_frame_cb_finished(void *data, Evas_Object *obj, const char *emission, const char *source) { Smart_Data *sd; Edje_Message_String msg; char *str; sd = data; msg.str = edje_object_part_text_get(obj, "result"); if (msg.str && strlen(msg.str) > 0) { printf("Result: %s\n", msg.str); if (sd->parent) edje_object_message_send(sd->parent, EDJE_MESSAGE_STRING, 188, &msg); evas_object_smart_callback_call(sd->obj, "input,selected", edje_object_part_text_get(obj, "result")); } edje_object_part_text_set(obj, "result", ""); }
static void _win_play_eval(Win *w) { Edje_Message_Float_Set *mf; w->play.position = emotion_object_position_get(w->emotion); w->play.length = emotion_object_play_length_get(w->emotion); if ((w->song) && (w->song->length != (int)w->play.length)) db_song_length_set(w->db, w->song, w->play.length); mf = alloca(sizeof(Edje_Message_Float_Set) + sizeof(double)); mf->count = 2; mf->val[0] = w->play.position; mf->val[1] = w->play.length; edje_object_message_send(elm_layout_edje_get(w->nowplaying), EDJE_MESSAGE_FLOAT_SET, MSG_POSITION, mf); if (w->play.playing_last == w->play.playing) return; w->play.playing_last = !w->play.playing; _win_play_pause_toggle(w); ecore_event_add(ENJOY_EVENT_PLAYER_CAPS_CHANGE, NULL, NULL, NULL); }
static void _opinfo_op_registry_listener(void *data, const E_Fm2_Op_Registry_Entry *ere) { Evas_Object *o = data; char *total, buf[4096]; Edje_Message_Float msg; int mw, mh; if (!o || !ere) return; // Don't show if the operation keep less than 1 second if (!ere->needs_attention && (ere->start_time + 1.0 > ecore_loop_time_get())) return; // Update icon switch (ere->op) { case E_FM_OP_COPY: edje_object_signal_emit(o, "e,action,icon,copy", "e"); break; case E_FM_OP_MOVE: edje_object_signal_emit(o, "e,action,icon,move", "e"); break; case E_FM_OP_REMOVE: edje_object_signal_emit(o, "e,action,icon,delete", "e"); break; case E_FM_OP_SECURE_REMOVE: edje_object_signal_emit(o, "e,action,icon,secure_delete", "e"); break; default: edje_object_signal_emit(o, "e,action,icon,unknown", "e"); } // Update information text switch (ere->status) { case E_FM2_OP_STATUS_ABORTED: switch (ere->op) { case E_FM_OP_COPY: snprintf(buf, sizeof(buf), _("Copying is aborted")); break; case E_FM_OP_MOVE: snprintf(buf, sizeof(buf), _("Moving is aborted")); break; case E_FM_OP_REMOVE: snprintf(buf, sizeof(buf), _("Deleting is aborted")); break; case E_FM_OP_SECURE_REMOVE: snprintf(buf, sizeof(buf), _("Secure deletion is aborted")); break; default: snprintf(buf, sizeof(buf), _("Unknown operation from slave is aborted")); } break; default: total = e_util_size_string_get(ere->total); switch (ere->op) { case E_FM_OP_COPY: if (ere->finished) snprintf(buf, sizeof(buf), _("Copy of %s done"), total); else snprintf(buf, sizeof(buf), _("Copying %s (eta: %s)"), total, e_util_time_str_get(ere->eta)); break; case E_FM_OP_MOVE: if (ere->finished) snprintf(buf, sizeof(buf), _("Move of %s done"), total); else snprintf(buf, sizeof(buf), _("Moving %s (eta: %s)"), total, e_util_time_str_get(ere->eta)); break; case E_FM_OP_REMOVE: if (ere->finished) snprintf(buf, sizeof(buf), _("Delete done")); else snprintf(buf, sizeof(buf), _("Deleting files...")); break; case E_FM_OP_SECURE_REMOVE: if (ere->finished) snprintf(buf, sizeof(buf), _("Secure delete done")); else snprintf(buf, sizeof(buf), _("Securely deleting files...")); break; default: snprintf(buf, sizeof(buf), _("Unknown operation from slave %d"), ere->id); } E_FREE(total); } edje_object_part_text_set(o, "e.text.info", buf); // Update spinner wheel if ((ere->finished) || (ere->status == E_FM2_OP_STATUS_ABORTED)) { if (!evas_object_data_get(o, "stopped")) { evas_object_data_set(o, "stopped", o); edje_object_signal_emit(o, "e,state,busy,stop", "e"); } } if (ere->percent > 0) { if (!evas_object_data_get(o, "started")) { evas_object_data_set(o, "started", o); edje_object_signal_emit(o, "e,state,busy,start", "e"); } } // Show/hide the red attention led if (ere->needs_attention) { if (!evas_object_data_get(o, "attention_started")) { evas_object_data_set(o, "attention_started", o); edje_object_signal_emit(o, "e,state,attention,start", "e"); if (evas_object_data_get(o, "attention_stopped")) evas_object_data_del(o, "attention_stopped"); } } else { if (!evas_object_data_get(o, "attention_stopped")) { evas_object_data_set(o, "attention_stopped", o); edje_object_signal_emit(o, "e,state,attention,stop", "e"); if (evas_object_data_get(o, "attention_started")) evas_object_data_del(o, "attention_started"); } } // Update gauge edje_object_part_drag_size_set(o, "e.gauge.bar", ((double)(ere->percent)) / 100.0, 1.0); msg.val = ((double)(ere->percent)) / 100.0; edje_object_message_send(o, EDJE_MESSAGE_FLOAT, 1, &msg); // resize element to fit the box edje_object_size_min_calc(o, &mw, &mh); e_box_pack_options_set(o, 1, 0, 1, 0, 0.0, 0.0, mw, mh, 9999, mh); evas_object_show(o); }
void eyelight_edit_image_properties_set(Eyelight_Viewer *pres, Eyelight_Edit *edit, char *file, int border, int shadow, int keep_aspect) { Eyelight_Node *node; char buf[EYELIGHT_BUFLEN]; EYELIGHT_ASSERT_RETURN_VOID(!!edit); EYELIGHT_ASSERT_RETURN_VOID(edit->node->name == EYELIGHT_NAME_IMAGE); if(edit->node->type == EYELIGHT_NODE_TYPE_PROP) { //change the prop into a block char *_file = strdup(eyelight_retrieve_value_of_prop(edit->node, 0)); edit->node->type = EYELIGHT_NODE_TYPE_BLOCK; Eyelight_Node *node_image_value = eina_list_nth(edit->node->l, 0); edit->node->l = eina_list_remove(edit->node->l, node_image_value); eyelight_node_free( &node_image_value, NULL ); Eyelight_Node *node_image = eyelight_node_new(EYELIGHT_NODE_TYPE_PROP, EYELIGHT_NAME_IMAGE, edit->node); Eyelight_Node *node_value = eyelight_node_new(EYELIGHT_NODE_TYPE_VALUE, EYELIGHT_NAME_NAME, node_image); node_value->value = _file; } if(file) { node = eyelight_retrieve_node_prop(edit->node, EYELIGHT_NAME_IMAGE); if(node) { node = eina_list_nth(node->l, 0); EYELIGHT_FREE(node->value); node->value = strdup(file); } else { node = eyelight_node_new(EYELIGHT_NODE_TYPE_PROP, EYELIGHT_NAME_IMAGE, edit->node); node = eyelight_node_new(EYELIGHT_NODE_TYPE_VALUE, EYELIGHT_NAME_NONE, node); node->value = strdup(file); } const Evas_Object *part_image = edje_object_part_object_get(edit->obj, "object.image"); char *image_path = eyelight_compile_image_path_new(pres,file); evas_object_image_file_set((Evas_Object*)part_image, image_path, NULL); EYELIGHT_FREE(image_path); } if(border > -1) { snprintf(buf, EYELIGHT_BUFLEN, "%d",border); node = eyelight_retrieve_node_prop(edit->node, EYELIGHT_NAME_BORDER); if(node) { node = eina_list_nth(node->l, 0); EYELIGHT_FREE(node->value); node->value = strdup(buf); } else { node = eyelight_node_new(EYELIGHT_NODE_TYPE_PROP, EYELIGHT_NAME_BORDER, edit->node); node = eyelight_node_new(EYELIGHT_NODE_TYPE_VALUE, EYELIGHT_NAME_NONE, node); node->value = strdup(buf); } if(border) edje_object_signal_emit(edit->obj, "border,show","eyelight"); else edje_object_signal_emit(edit->obj, "border,hide","eyelight"); } if(shadow > -1) { snprintf(buf, EYELIGHT_BUFLEN, "%d",shadow); node = eyelight_retrieve_node_prop(edit->node, EYELIGHT_NAME_SHADOW); if(node) { node = eina_list_nth(node->l, 0); EYELIGHT_FREE(node->value); node->value = strdup(buf); } else { node = eyelight_node_new(EYELIGHT_NODE_TYPE_PROP, EYELIGHT_NAME_SHADOW, edit->node); node = eyelight_node_new(EYELIGHT_NODE_TYPE_VALUE, EYELIGHT_NAME_NONE, node); node->value = strdup(buf); } if(shadow) edje_object_signal_emit(edit->obj, "shadow,show","eyelight"); else edje_object_signal_emit(edit->obj, "shadow,hide","eyelight"); } if(keep_aspect > -1) { double aspect_x = 0; double aspect_y = 0; snprintf(buf, EYELIGHT_BUFLEN, "%d", keep_aspect); node = eyelight_retrieve_node_prop(edit->node, EYELIGHT_NAME_KEEP_ASPECT); if(node) { node = eina_list_nth(node->l, 0); EYELIGHT_FREE(node->value); node->value = strdup(buf); } else { node = eyelight_node_new(EYELIGHT_NODE_TYPE_PROP, EYELIGHT_NAME_KEEP_ASPECT, edit->node); node = eyelight_node_new(EYELIGHT_NODE_TYPE_VALUE, EYELIGHT_NAME_NONE, node); node->value = strdup(buf); } if(keep_aspect) { Eyelight_Node *node_name = eyelight_retrieve_node_prop(edit->node, EYELIGHT_NAME_IMAGE); const char *file = eyelight_retrieve_value_of_prop(node_name, 0); Evas_Coord w, h; Evas_Object *o = evas_object_image_add(evas_object_evas_get(edit->obj)); char *image_path = eyelight_compile_image_path_new(pres,file); evas_object_image_file_set(o, image_path, NULL); evas_object_image_size_get(o, &w, &h); evas_object_del(o); aspect_x = w/(float)h; aspect_y = 1; EYELIGHT_FREE(image_path); } Edje_Message_Float_Set *msg = alloca(sizeof(Edje_Message_Float_Set) + (1 * sizeof(float))); msg->count = 2; msg->val[0] = aspect_x; msg->val[1] = aspect_y; edje_object_message_send(edit->obj,EDJE_MESSAGE_FLOAT_SET , 0, msg); } }