diff --git a/Makefile.am b/Makefile.am index 8993eaf..0cbb5d4 100644 --- a/Makefile.am +++ b/Makefile.am @@ -10,6 +10,7 @@ filesdir = $(datadir) files_DATA = \ module_icon.png \ +module.eap \ net.edj \ net.edc \ VeraMono.ttf @@ -24,9 +25,8 @@ pkgdir = $(datadir)/$(MODULE_ARCH) pkg_LTLIBRARIES = module.la module_la_SOURCES = e_mod_main.c \ e_mod_main.h \ - e_mod_config.c \ - e_mod_config.h - + e_mod_config.c + module_la_LIBADD = @e_libs@ -lm module_la_LDFLAGS = -module -avoid-version module_la_DEPENDENCIES = $(top_builddir)/config.h diff --git a/e_mod_config.c b/e_mod_config.c index 2a45930..47aed14 100644 --- a/e_mod_config.c +++ b/e_mod_config.c @@ -1,14 +1,11 @@ #include +#include #include "e_mod_main.h" -#include "e_mod_config.h" -#include "config.h" struct _E_Config_Dialog_Data { char *device; - int check_interval; - int show_text; - int show_graph; + double poll_time; Ecore_List *devs; int dev_num; @@ -19,15 +16,16 @@ static void *_create_data(E_Config_Dialog *cfd); static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); static Evas_Object *_basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cfdata); static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata); -static void _fill_data(Net_Face *nf, E_Config_Dialog_Data *cfdata); +static void _fill_data(Config_Item *ci, E_Config_Dialog_Data *cfdata); static void _net_config_get_devices(Ecore_List *devs); /* Config Calls */ void -_configure_net_module(Net_Face *nf) +_config_net_module(Config_Item *ci) { E_Config_Dialog *cfd; E_Config_Dialog_View *v; + E_Container *con; v = E_NEW(E_Config_Dialog_View, 1); @@ -36,22 +34,21 @@ _configure_net_module(Net_Face *nf) v->basic.apply_cfdata = _basic_apply_data; v->basic.create_widgets = _basic_create_widgets; - cfd = e_config_dialog_new(nf->con, D_("Net Configuration"), NULL, 0, v, nf); - nf->net->cfd = cfd; + con = e_container_current_get(e_manager_current_get()); + cfd = e_config_dialog_new(con, D_("Net Configuration"), NULL, 0, v, ci); + net_config->config_dialog = cfd; } static void -_fill_data(Net_Face *nf, E_Config_Dialog_Data *cfdata) +_fill_data(Config_Item *ci, E_Config_Dialog_Data *cfdata) { char *tmp; int i; - cfdata->check_interval = nf->conf->check_interval; - cfdata->show_text = nf->conf->show_text; - cfdata->show_graph = nf->conf->show_graph; + cfdata->poll_time = ci->poll_time; - if (nf->conf->device != NULL) - cfdata->device = strdup(nf->conf->device); + if (ci->device != NULL) + cfdata->device = strdup(ci->device); else cfdata->device = NULL; @@ -81,22 +78,20 @@ static void * _create_data(E_Config_Dialog *cfd) { E_Config_Dialog_Data *cfdata; - Net_Face *nf; + Config_Item *ci; - nf = cfd->data; + ci = cfd->data; cfdata = E_NEW(E_Config_Dialog_Data, 1); - - _fill_data(nf, cfdata); + _fill_data(ci, cfdata); return cfdata; } static void _free_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) { - Net_Face *nf; - - nf = cfd->data; - nf->net->cfd = NULL; + if (!net_config) + return; + net_config->config_dialog = NULL; E_FREE(cfdata->device); if (cfdata->devs) ecore_list_destroy(cfdata->devs); @@ -112,13 +107,6 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf int i; o = e_widget_list_add(evas, 0, 0); - of = e_widget_framelist_add(evas, D_("General Settings"), 0); - ob = e_widget_check_add(evas, D_("Show Text"), (&(cfdata->show_text))); - e_widget_framelist_object_append(of, ob); - ob = e_widget_check_add(evas, D_("Show Graph"), (&(cfdata->show_graph))); - e_widget_framelist_object_append(of, ob); - e_widget_list_object_append(o, of, 1, 1, 0.5); - of = e_widget_framelist_add(evas, D_("Device Settings"), 0); ot = e_widget_table_add(evas, 0); rg = e_widget_radio_group_new(&(cfdata->dev_num)); @@ -134,7 +122,7 @@ _basic_create_widgets(E_Config_Dialog *cfd, Evas *evas, E_Config_Dialog_Data *cf ob = e_widget_label_add(evas, D_("Check Interval:")); e_widget_table_object_append(ot, ob, 0, i, 1, 1, 0, 0, 1, 0); i++; - ob = e_widget_slider_add(evas, 1, 0, _("%1.0f seconds"), 1, 60, 1, 0, NULL, &(cfdata->check_interval), 150); + ob = e_widget_slider_add(evas, 1, 0, _("%1.0f seconds"), 1, 60, 1, 0, &(cfdata->poll_time), NULL, 150); e_widget_table_object_append(ot, ob, 0, i, 1, 1, 1, 0, 1, 0); e_widget_framelist_object_append(of, ot); e_widget_list_object_append(o, of, 1, 1, 0.5); @@ -146,27 +134,22 @@ static int _basic_apply_data(E_Config_Dialog *cfd, E_Config_Dialog_Data *cfdata) { char *tmp; - Net_Face *nf; - - nf = cfd->data; + Config_Item *ci; + + ci = cfd->data; tmp = ecore_list_goto_index(cfdata->devs, cfdata->dev_num); if (tmp != NULL) { - if (strcmp(tmp, nf->conf->device)) + if (strcmp(tmp, ci->device)) { - _net_face_graph_clear(nf); - nf->conf->device = (char *)evas_stringshare_add(strdup(tmp)); + evas_stringshare_del(ci->device); + ci->device = evas_stringshare_add(strdup(tmp)); } } - nf->conf->check_interval = cfdata->check_interval; - nf->conf->show_text = cfdata->show_text; - nf->conf->show_graph = cfdata->show_graph; + ci->poll_time = cfdata->poll_time; e_config_save_queue(); - - if (nf->monitor) - ecore_timer_interval_set(nf->monitor, (double)cfdata->check_interval); - + _net_config_updated(ci->id); return 1; } diff --git a/e_mod_config.h b/e_mod_config.h deleted file mode 100644 index 8322341..0000000 --- a/e_mod_config.h +++ /dev/null @@ -1,11 +0,0 @@ -#ifdef E_TYPEDEFS -#else -#ifndef E_MOD_CONFIG_H -#define E_MOD_CONFIG_H - -#include "e_mod_main.h" - -void _configure_net_module(Net_Face *nf); - -#endif -#endif diff --git a/e_mod_main.c b/e_mod_main.c index 0c2d22f..6313684 100644 --- a/e_mod_main.c +++ b/e_mod_main.c @@ -1,492 +1,427 @@ #include #include "e_mod_main.h" -#include "e_mod_config.h" -#include "config.h" -static Net *_net_init(E_Module *m); -static void _net_shutdown(Net *n); -static void _net_config_menu_new(Net *n); +typedef struct _Instance Instance; +typedef struct _Net Net; -static Net_Face *_net_face_init(Net *n, E_Container *con); -static void _net_face_menu_new(Net_Face *nf); -static void _net_face_enable(Net_Face *nf); -static void _net_face_disable(Net_Face *nf); -static void _net_face_free(Net_Face *nf); -static void _net_face_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change); -static void _net_face_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info); -static void _net_face_cb_menu_edit(void *data, E_Menu *mn, E_Menu_Item *mi); -static void _net_face_cb_menu_configure(void *data, E_Menu *mn, E_Menu_Item *mi); -static int _net_face_update_values(void *data); -static void _net_face_graph_values(Net_Face *nf, int tx_val, int rx_val); +struct _Instance +{ + E_Gadcon_Client *gcc; + Evas_Object *net_obj; + Net *net; + Config_Item *ci; + Ecore_Timer *check_timer; +}; -static int net_count; +struct _Net +{ + Instance *inst; + Evas_Object *net_obj; +}; -static E_Config_DD *conf_edd; -static E_Config_DD *conf_face_edd; +/* Func Protos for Gadcon */ +static E_Gadcon_Client *_gc_init(E_Gadcon *gc, char *name, char *id, char *style); +static void _gc_shutdown(E_Gadcon_Client *gcc); +static void _gc_orient(E_Gadcon_Client *gcc); +static char *_gc_label(void); +static Evas_Object *_gc_icon(Evas *evas); -EAPI E_Module_Api e_modapi = { +/* Func Protos for Module */ +static void _net_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _net_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _net_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info); +static void _net_menu_cb_configure(void *data, E_Menu *m, E_Menu_Item *mi); +static void _net_menu_cb_post(void *data, E_Menu *m); +static Config_Item *_net_config_item_get(const char *id); +static Net *_net_new(Evas *evas); +static void _net_free(Net *net); +static void _net_update_rx(Instance *inst, int value); +static void _net_update_tx(Instance *inst, int value); +static int _net_cb_check(void *data); + +static E_Config_DD *conf_edd = NULL; +static E_Config_DD *conf_item_edd = NULL; + +Config *net_config = NULL; + +/* Define the gadcon class and functions provided by this module */ +static const E_Gadcon_Client_Class _gc_class = +{ + GADCON_CLIENT_CLASS_VERSION, + "net", { _gc_init, _gc_shutdown, _gc_orient, _gc_label, _gc_icon } +}; + +static E_Gadcon_Client * +_gc_init(E_Gadcon *gc, char *name, char *id, char *style) +{ + E_Gadcon_Client *gcc; + Evas_Object *o; + Instance *inst; + Config_Item *ci; + Net *net; + char buf[4096]; + + inst = E_NEW(Instance, 1); + ci = _net_config_item_get(id); + if (!ci->id) ci->id = evas_stringshare_add(id); + + net = _net_new(gc->evas); + net->inst = inst; + inst->net = net; + + o = net->net_obj; + gcc = e_gadcon_client_new(gc, name, id, style, o); + gcc->data = inst; + inst->gcc = gcc; + inst->net_obj = o; + + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, + _net_cb_mouse_down, inst); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_IN, + _net_cb_mouse_in, inst); + evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_OUT, + _net_cb_mouse_out, inst); + + inst->check_timer = ecore_timer_add(ci->poll_time, _net_cb_check, inst); + + net_config->instances = evas_list_append(net_config->instances, inst); + + return gcc; +} + +static void +_gc_orient(E_Gadcon_Client *gcc) +{ + e_gadcon_client_aspect_set(gcc, 16, 16); + e_gadcon_client_min_size_set(gcc, 16, 16); +} + +static char * +_gc_label(void) +{ + return D_("Net"); +} + +static Evas_Object * +_gc_icon(Evas *evas) +{ + Evas_Object *o; + char buf[4096]; + + o = edje_object_add(evas); + snprintf(buf, sizeof(buf), "%s/module.eap", e_module_dir_get(net_config->module)); + edje_object_file_set(o, buf, "icon"); + return o; +} + +static void +_gc_shutdown(E_Gadcon_Client *gcc) +{ + Instance *inst; + + inst = gcc->data; + if (inst->check_timer) + ecore_timer_del(inst->check_timer); + net_config->instances = evas_list_remove(net_config->instances, inst); + _net_free(inst->net); + free(inst); +} + +static void +_net_cb_mouse_down(void *data, Evas *e, Evas_Object *obj, void *event_info) +{ + Instance *inst; + Evas_Event_Mouse_Down *ev; + + inst = data; + ev = event_info; + if ((ev->button == 3) && (!net_config->menu)) + { + E_Menu *mn; + E_Menu_Item *mi; + int x, y, w, h; + + mn = e_menu_new(); + e_menu_post_deactivate_callback_set(mn, _net_menu_cb_post, inst); + net_config->menu = mn; + + mi = e_menu_item_new(mn); + e_menu_item_label_set(mi, D_("Configuration")); + e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration"); + e_menu_item_callback_set(mi, _net_menu_cb_configure, inst); + + e_gadcon_client_util_menu_items_append(inst->gcc, mn, 0); + e_gadcon_canvas_zone_geometry_get(inst->gcc->gadcon, &x, &y, &w, &h); + e_menu_activate_mouse(mn, + e_util_zone_current_get(e_manager_current_get()), + x + ev->output.x, y + ev->output.y, 1, 1, E_MENU_POP_DIRECTION_DOWN, ev->timestamp); + evas_event_feed_mouse_up(inst->gcc->gadcon->evas, ev->button, EVAS_BUTTON_NONE, ev->timestamp, NULL); + } +} + +static void +_net_menu_cb_post(void *data, E_Menu *m) +{ + if (!net_config->menu) + return; + e_object_del(E_OBJECT(net_config->menu)); + net_config->menu = NULL; +} + +static void +_net_menu_cb_configure(void *data, E_Menu *m, E_Menu_Item *mi) +{ + Instance *inst; + Config_Item *ci; + + inst = data; + ci = _net_config_item_get(inst->gcc->id); + _config_net_module(ci); +} + +void +_net_config_updated(const char *id) +{ + Evas_List *l; + Config_Item *ci; + + if (!net_config) + return; + + ci = _net_config_item_get(id); + for (l = net_config->instances; l; l = l->next) + { + Instance *inst; + + inst = l->data; + if (!inst->gcc->id) + continue; + + if (!strcmp(inst->gcc->id, ci->id)) + { + _net_cb_check(inst); + if (inst->check_timer) + ecore_timer_interval_set(inst->check_timer, (double)ci->poll_time); + else + inst->check_timer = ecore_timer_add((double)ci->poll_time, _net_cb_check, inst); + break; + } + } +} + +static Config_Item * +_net_config_item_get(const char *id) +{ + Evas_List *l; + Config_Item *ci; + + for (l = net_config->items; l; l = l->next) + { + ci = l->data; + if (!ci->id) + continue; + if (!strcmp(ci->id, id)) + return ci; + } + ci = E_NEW(Config_Item, 1); + ci->id = evas_stringshare_add(id); + ci->device = evas_stringshare_add("eth0"); + ci->poll_time = 1; + ci->max = 1500; + net_config->items = evas_list_append(net_config->items, ci); + return ci; +} + +/* Module routines */ +EAPI E_Module_Api e_modapi = +{ E_MODULE_API_VERSION, - "Net" + "Net" }; EAPI void * -e_modapi_init(E_Module *m) +e_modapi_init(E_Module *m) { - Net *n; - - /* Set up module's message catalogue */ bindtextdomain(PACKAGE, LOCALEDIR); bind_textdomain_codeset(PACKAGE, "UTF-8"); - - n = _net_init(m); - if (!n) - return NULL; - - m->config_menu = n->config_menu; - return n; -} - -EAPI int -e_modapi_shutdown(E_Module *m) -{ - Net *n; - - n = m->data; - if (!n) - return 0; - - if (m->config_menu) + + conf_item_edd = E_CONFIG_DD_NEW("Net_Config_Item", Config_Item); + + #undef T + #undef D + #define T Config_Item + #define D conf_item_edd + E_CONFIG_VAL(D, T, id, STR); + E_CONFIG_VAL(D, T, device, STR); + E_CONFIG_VAL(D, T, max, DOUBLE); + E_CONFIG_VAL(D, T, poll_time, DOUBLE); + + conf_edd = E_CONFIG_DD_NEW("Net_Config", Config); + + #undef T + #undef D + #define T Config + #define D conf_edd + E_CONFIG_LIST(D, T, items, conf_item_edd); + + net_config = e_config_domain_load("module.net", conf_edd); + if (!net_config) { - e_menu_deactivate(m->config_menu); - e_object_del(E_OBJECT(m->config_menu)); - m->config_menu = NULL; + Config_Item *ci; + + net_config = E_NEW(Config, 1); + ci = E_NEW(Config_Item, 1); + ci->id = evas_stringshare_add("0"); + ci->device = evas_stringshare_add("eth0"); + ci->poll_time = 1; + ci->max = 1500; + net_config->items = evas_list_append(net_config->items, ci); } - if (n->cfd) + net_config->module = m; + e_gadcon_provider_register(&_gc_class); + return 1; +} + +EAPI int +e_modapi_shutdown(E_Module *m) +{ + net_config->module = NULL; + e_gadcon_provider_unregister(&_gc_class); + + if (net_config->config_dialog) + e_object_del(E_OBJECT(net_config->config_dialog)); + if (net_config->menu) { - e_object_del(E_OBJECT(n->cfd)); - n->cfd = NULL; + e_menu_post_deactivate_callback_set(net_config->menu, NULL, NULL); + e_object_del(E_OBJECT(net_config->menu)); + net_config->menu = NULL; } - _net_shutdown(n); + while (net_config->items) + { + Config_Item *ci; + + ci = net_config->items->data; + if (ci->id) + evas_stringshare_del(ci->id); + net_config->items = evas_list_remove_list(net_config->items, net_config->items); + free(ci); + } + free(net_config); + net_config = NULL; + E_CONFIG_DD_FREE(conf_item_edd); + E_CONFIG_DD_FREE(conf_edd); return 1; } EAPI int -e_modapi_save(E_Module *m) +e_modapi_info(E_Module *m) { - Net *n; - - n = m->data; - if (!n) - return 0; - e_config_domain_save("module.net", conf_edd, n->conf); + char buf[4096]; + + snprintf(buf, sizeof(buf), "%s/module_icon.png", e_module_dir_get(m)); + m->icon_file = strdup(buf); return 1; } EAPI int -e_modapi_info(E_Module *m) +e_modapi_save(E_Module *m) { - m->icon_file = strdup(PACKAGE_DATA_DIR "/module_icon.png"); - return 1; -} - -EAPI int -e_modapi_about(E_Module *m) -{ - e_module_dialog_show(D_("Enlightenment Network Monitor Module"), D_("This module is used to monitor a network device.")); - return 1; -} - -EAPI int -e_modapi_config(E_Module *m) -{ - Net *n; Evas_List *l; - E_Container *con; - - n = m->data; - if (!n) - return 0; - if (!n->faces) - return 0; - - for (l = n->faces; l; l = l->next) + + for (l = net_config->instances; l; l = l->next) { - Net_Face *nf; - - nf = l->data; - if (!nf) - continue; - - con = e_container_current_get(e_manager_current_get()); - if (nf->con == con) - { - _configure_net_module(nf); - break; - } + Instance *inst; + Config_Item *ci; + + inst = l->data; + ci = _net_config_item_get(inst->gcc->id); + if (ci->id) + evas_stringshare_del(ci->id); + ci->id = evas_stringshare_add(inst->gcc->id); } + e_config_domain_save("module.net", conf_edd, net_config); + return 1; +} + +EAPI int +e_modapi_about(E_Module *m) +{ + e_module_dialog_show(D_("Enlightenment Network Monitor Module"), + D_("This module is used to monitor a network device.")); return 1; } static Net * -_net_init(E_Module *m) +_net_new(Evas *evas) { - Net *n; - E_Menu_Item *mi; - Evas_List *mans, *l, *l2, *fl; - - n = E_NEW(Net, 1); - - if (!n) - return NULL; - - conf_face_edd = E_CONFIG_DD_NEW("Net_Config_Face", Config_Face); -#undef T -#undef D -#define T Config_Face -#define D conf_face_edd - E_CONFIG_VAL(D, T, enabled, UCHAR); - E_CONFIG_VAL(D, T, device, STR); - E_CONFIG_VAL(D, T, check_interval, INT); - E_CONFIG_VAL(D, T, show_text, INT); - E_CONFIG_VAL(D, T, show_graph, INT); - - conf_edd = E_CONFIG_DD_NEW("Net_Config", Config); - -#undef T -#undef D -#define T Config -#define D conf_edd - E_CONFIG_LIST(D, T, faces, conf_face_edd); - - n->conf = e_config_domain_load("module.net", conf_edd); - if (!n->conf) - n->conf = E_NEW(Config, 1); - - _net_config_menu_new(n); - - mans = e_manager_list(); - fl = n->conf->faces; - for (l = mans; l; l = l->next) - { - E_Manager *man; - - man = l->data; - for (l2 = man->containers; l2; l2 = l2->next) - { - E_Container *con; - Net_Face *nf; - - con = l2->data; - nf = _net_face_init(n, con); - if (nf) - { - if (!fl) - { - nf->conf = E_NEW(Config_Face, 1); - - nf->conf->enabled = 1; - nf->conf->device = (char *)evas_stringshare_add("eth0"); - nf->conf->check_interval = 1; - nf->conf->show_text = 1; - nf->conf->show_graph = 1; - n->conf->faces = evas_list_append(n->conf->faces, nf->conf); - } - else - { - nf->conf = fl->data; - fl = fl->next; - } - E_CONFIG_LIMIT(nf->conf->check_interval, 0, 60); - E_CONFIG_LIMIT(nf->conf->show_text, 0, 1); - E_CONFIG_LIMIT(nf->conf->show_graph, 0, 1); - - nf->monitor = ecore_timer_add((double)nf->conf->check_interval, _net_face_update_values, nf); - - _net_face_menu_new(nf); - - mi = e_menu_item_new(n->config_menu); - e_menu_item_label_set(mi, _("Configuration")); - e_menu_item_callback_set(mi, _net_face_cb_menu_configure, nf); - - mi = e_menu_item_new(n->config_menu); - e_menu_item_label_set(mi, con->name); - e_menu_item_submenu_set(mi, nf->menu); - - if (!nf->conf->enabled) - _net_face_disable(nf); - } - } - } - return n; -} - -static void -_net_shutdown(Net *n) -{ - E_CONFIG_DD_FREE(conf_edd); - E_CONFIG_DD_FREE(conf_face_edd); - - while (n->faces) - _net_face_free(n->faces->data); - - e_object_del(E_OBJECT(n->config_menu)); - evas_list_free(n->conf->faces); - - E_FREE(n->conf); - E_FREE(n); -} - -static void -_net_config_menu_new(Net *n) -{ - E_Menu *mn; - - mn = e_menu_new(); - n->config_menu = mn; -} - -static Net_Face * -_net_face_init(Net *n, E_Container *con) -{ - Net_Face *nf; - Evas_Object *o; + Net *net; char buf[4096]; + + net = E_NEW(Net, 1); + net->net_obj = edje_object_add(evas); + + snprintf(buf, sizeof(buf), "%s/net.edj", e_module_dir_get(net_config->module)); + if (!e_theme_edje_object_set(net->net_obj, "base/theme/modules/net", "modules/net/main")) + edje_object_file_set(net->net_obj, buf, "modules/net/main"); + evas_object_show(net->net_obj); - nf = E_NEW(Net_Face, 1); - - if (!nf) - return NULL; - nf->net = n; - n->faces = evas_list_append(n->faces, nf); - - nf->con = con; - e_object_ref(E_OBJECT(con)); - nf->evas = con->bg_evas; - - evas_event_freeze(nf->evas); - - o = edje_object_add(nf->evas); - nf->net_obj = o; - - if (!e_theme_edje_object_set(o, "base/theme/modules/net", "modules/net/main")) - { - snprintf(buf, sizeof(buf), PACKAGE_DATA_DIR "/net.edj"); - edje_object_file_set(o, buf, "modules/net/main"); - } - evas_object_show(o); - - o = edje_object_add(nf->evas); - nf->chart_obj = o; - evas_object_layer_set(o, 1); - evas_object_repeat_events_set(o, 1); - evas_object_color_set(o, 255, 255, 255, 255); - evas_object_show(o); - - o = edje_object_add(nf->evas); - nf->rtxt_obj = o; - if (!e_theme_edje_object_set(o, "base/theme/modules/net", "modules/net/rx_text")) - { - snprintf(buf, sizeof(buf), PACKAGE_DATA_DIR "/net.edj"); - edje_object_file_set(o, buf, "modules/net/rx_text"); - } - evas_object_layer_set(o, 2); - evas_object_repeat_events_set(o, 1); - evas_object_color_set(o, 255, 255, 255, 255); - evas_object_show(o); - - o = edje_object_add(nf->evas); - nf->ttxt_obj = o; - if (!e_theme_edje_object_set(o, "base/theme/modules/net", "modules/net/tx_text")) - { - snprintf(buf, sizeof(buf), PACKAGE_DATA_DIR "/net.edj"); - edje_object_file_set(o, buf, "modules/net/tx_text"); - } - evas_object_layer_set(o, 2); - evas_object_repeat_events_set(o, 1); - evas_object_color_set(o, 255, 255, 255, 255); - evas_object_show(o); - - o = evas_object_rectangle_add(nf->evas); - nf->event_obj = o; - evas_object_layer_set(o, 3); - evas_object_repeat_events_set(o, 1); - evas_object_color_set(o, 0, 0, 0, 0); - evas_object_event_callback_add(o, EVAS_CALLBACK_MOUSE_DOWN, _net_face_cb_mouse_down, nf); - evas_object_show(o); - - nf->gmc = e_gadman_client_new(nf->con->gadman); - e_gadman_client_domain_set(nf->gmc, "module.net", net_count++); - e_gadman_client_policy_set(nf->gmc, - E_GADMAN_POLICY_ANYWHERE | - E_GADMAN_POLICY_HMOVE | E_GADMAN_POLICY_HSIZE | E_GADMAN_POLICY_VMOVE | E_GADMAN_POLICY_VSIZE); - //e_gadman_client_min_size_set(nf->gmc, 40, 40); - //e_gadman_client_max_size_set(nf->gmc, 128, 128); - e_gadman_client_auto_size_set(nf->gmc, 40, 40); - e_gadman_client_align_set(nf->gmc, 1.0, 1.0); - e_gadman_client_resize(nf->gmc, 40, 40); - e_gadman_client_change_func_set(nf->gmc, _net_face_cb_gmc_change, nf); - e_gadman_client_load(nf->gmc); - evas_event_thaw(nf->evas); - - return nf; + return net; } static void -_net_face_menu_new(Net_Face *nf) +_net_free(Net *n) { - E_Menu *mn; - E_Menu_Item *mi; - - mn = e_menu_new(); - nf->menu = mn; - - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Configuration")); - e_util_menu_item_edje_icon_set(mi, "enlightenment/configuration"); - e_menu_item_callback_set(mi, _net_face_cb_menu_configure, nf); - - mi = e_menu_item_new(mn); - e_menu_item_label_set(mi, _("Edit Mode")); - e_util_menu_item_edje_icon_set(mi, "enlightenment/gadgets"); - e_menu_item_callback_set(mi, _net_face_cb_menu_edit, nf); + evas_object_del(n->net_obj); + free(n); } -static void -_net_face_enable(Net_Face *nf) +static void +_net_update_rx(Instance *inst, int value) { - nf->conf->enabled = 1; - e_config_save_queue(); - evas_object_show(nf->net_obj); - evas_object_show(nf->event_obj); - evas_object_show(nf->chart_obj); - evas_object_show(nf->rtxt_obj); - evas_object_show(nf->ttxt_obj); + Edje_Message_Int_Set *val; + + val = malloc(sizeof(Edje_Message_Int_Set) + (1 * sizeof(int))); + val->count = 1; + val->val[0] = value; + edje_object_message_send(inst->net_obj, EDJE_MESSAGE_INT_SET, 1, val); + free(val); } -static void -_net_face_disable(Net_Face *nf) +static void +_net_update_tx(Instance *inst, int value) { - nf->conf->enabled = 0; - e_config_save_queue(); - evas_object_hide(nf->event_obj); - evas_object_hide(nf->net_obj); - evas_object_hide(nf->chart_obj); - evas_object_hide(nf->rtxt_obj); - evas_object_hide(nf->ttxt_obj); + Edje_Message_Int_Set *val; + + val = malloc(sizeof(Edje_Message_Int_Set) + (1 * sizeof(int))); + val->count = 1; + val->val[0] = value; + edje_object_message_send(inst->net_obj, EDJE_MESSAGE_INT_SET, 2, val); + free(val); } -static void -_net_face_free(Net_Face *nf) +static void +_net_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info) { - e_object_unref(E_OBJECT(nf->con)); - e_object_del(E_OBJECT(nf->menu)); - - if (nf->monitor) - ecore_timer_del(nf->monitor); - if (nf->menu) - e_object_del(E_OBJECT(nf->menu)); - if (nf->event_obj) - evas_object_del(nf->event_obj); - if (nf->net_obj) - evas_object_del(nf->net_obj); - if (nf->chart_obj) - evas_object_del(nf->chart_obj); - if (nf->rtxt_obj) - evas_object_del(nf->rtxt_obj); - if (nf->ttxt_obj) - evas_object_del(nf->ttxt_obj); - if (nf->old_rx || nf->old_tx) - _net_face_graph_clear(nf); - - if (nf->gmc) - { - e_gadman_client_save(nf->gmc); - e_object_del(E_OBJECT(nf->gmc)); - } - - nf->net->faces = evas_list_remove(nf->net->faces, nf); - - E_FREE(nf->conf); - E_FREE(nf); - net_count--; + Instance *inst; + + inst = data; + edje_object_signal_emit(inst->net_obj, "label_active", ""); } -static void -_net_face_cb_gmc_change(void *data, E_Gadman_Client *gmc, E_Gadman_Change change) +static void +_net_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void *event_info) { - Net_Face *nf; - Evas_Coord x, y, w, h; - - nf = data; - switch (change) - { - case E_GADMAN_CHANGE_MOVE_RESIZE: - e_gadman_client_geometry_get(nf->gmc, &x, &y, &w, &h); - evas_object_move(nf->net_obj, x, y); - evas_object_move(nf->event_obj, x, y); - evas_object_move(nf->chart_obj, x, y); - evas_object_move(nf->rtxt_obj, x, y); - evas_object_move(nf->ttxt_obj, x, y); - evas_object_resize(nf->net_obj, w, h); - evas_object_resize(nf->event_obj, w, h); - evas_object_resize(nf->chart_obj, w, h); - evas_object_resize(nf->rtxt_obj, w, h); - evas_object_resize(nf->ttxt_obj, w, h); - _net_face_graph_clear(nf); - break; - case E_GADMAN_CHANGE_RAISE: - evas_object_raise(nf->net_obj); - evas_object_raise(nf->event_obj); - evas_object_raise(nf->chart_obj); - evas_object_raise(nf->rtxt_obj); - evas_object_raise(nf->ttxt_obj); - break; - default: - break; - } + Instance *inst; + + inst = data; + edje_object_signal_emit(inst->net_obj, "label_passive", ""); } -static void -_net_face_cb_mouse_down(void *data, Evas *evas, Evas_Object *obj, void *event_info) +static int +_net_cb_check(void *data) { - Net_Face *nf; - Evas_Event_Mouse_Down *ev; - - ev = event_info; - nf = data; - if (ev->button == 3) - { - e_menu_activate_mouse(nf->menu, e_zone_current_get(nf->con), - ev->output.x, ev->output.y, 1, 1, E_MENU_POP_DIRECTION_DOWN, ev->timestamp); - e_util_container_fake_mouse_up_all_later(nf->con); - } -} - -static void -_net_face_cb_menu_edit(void *data, E_Menu *mn, E_Menu_Item *mi) -{ - Net_Face *nf; - - nf = data; - e_gadman_mode_set(nf->gmc->gadman, E_GADMAN_MODE_EDIT); -} - -static void -_net_face_cb_menu_configure(void *data, E_Menu *mn, E_Menu_Item *mi) -{ - Net_Face *nf; - - nf = data; - if (!nf) - return; - - _configure_net_module(nf); -} - -static int -_net_face_update_values(void *data) -{ - Net_Face *nf; + Instance *inst; + Config_Item *ci; FILE *stat; char dev[64]; char buf[256]; @@ -500,12 +435,15 @@ _net_face_update_values(void *data) long max_out = 28672; long bytes_in; long bytes_out; - int in_use = 0; - int out_use = 0; + double in_use = 0.0; + double out_use = 0.0; Edje_Message_Float msg; - - nf = data; - + char in_str[100]; + char out_str[100]; + + inst = data; + ci = _net_config_item_get(inst->gcc->id); + stat = fopen("/proc/net/dev", "r"); if (!stat) return 1; @@ -524,7 +462,7 @@ _net_face_update_values(void *data) "%lu %lu %lu %lu\n", dev, &in, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &out, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy, &dummy) < 17) continue; - if (!strcmp(dev, strdup(nf->conf->device))) + if (!strcmp(dev, strdup(ci->device))) { found = 1; break; @@ -556,20 +494,11 @@ _net_face_update_values(void *data) old_in = in; old_out = out; - - /* Update the modules text */ - char in_str[100]; - char out_str[100]; - - if (!nf->conf->show_text) + + if ((bytes_in < 0) || (bytes_out < 0)) { - edje_object_part_text_set(nf->ttxt_obj, "tx-text", ""); - edje_object_part_text_set(nf->rtxt_obj, "rx-text", ""); - } - else if ((bytes_in < 0) || (bytes_out < 0)) - { - edje_object_part_text_set(nf->ttxt_obj, "tx-text", "Tx: 0 B"); - edje_object_part_text_set(nf->rtxt_obj, "rx-text", "Rx: 0 B"); + edje_object_part_text_set(inst->net_obj, "tx_label", "Tx: 0 B"); + edje_object_part_text_set(inst->net_obj, "rx_label", "Rx: 0 B"); } else { @@ -599,142 +528,27 @@ _net_face_update_values(void *data) else snprintf(out_str, sizeof(out_str), "Tx: %d B", bytes_out); - edje_object_part_text_set(nf->ttxt_obj, "tx-text", out_str); - edje_object_part_text_set(nf->rtxt_obj, "rx-text", in_str); + edje_object_part_text_set(inst->net_obj, "tx_label", out_str); + edje_object_part_text_set(inst->net_obj, "rx_label", in_str); } - msg.val = in_use; - edje_object_message_send(nf->net_obj, EDJE_MESSAGE_FLOAT, 1, &msg); - - msg.val = out_use; - edje_object_message_send(nf->net_obj, EDJE_MESSAGE_FLOAT, 2, &msg); - - if (nf->conf->show_graph) - _net_face_graph_values(nf, out_use, in_use); - else - _net_face_graph_clear(nf); + int x, y, w, h; + double i, o; + evas_object_geometry_get(inst->net_obj, &x, &y, &w, &h); + if (in_use > 100) + in_use = 100; + if (out_use > 100) + out_use = 100; + i = ((double)in_use * ((double)w / (double)100)); + o = ((double)out_use * ((double)w / (double)100)); + if ((i > 0) && (i < 1)) + i = 10.0; + if ((o > 0) && (o < 1)) + o = 10.0; + + _net_update_rx(inst, (i / 10)); + _net_update_tx(inst, (o / 10)); + return 1; } - -static void -_net_face_graph_values(Net_Face *nf, int tx_val, int rx_val) -{ - int x, y, w, h; - Evas_Object *o; - Evas_Object *last = NULL; - Evas_List *l; - int i, j = 0; - - evas_event_freeze(nf->evas); - - evas_object_geometry_get(nf->chart_obj, &x, &y, &w, &h); - - if (rx_val > 100) - rx_val = 100; - if (tx_val > 100) - tx_val = 100; - - rx_val = (int)(((double)rx_val) * (((double)h) / ((double)100))); - tx_val = (int)(((double)tx_val) * (((double)h) / ((double)100))); - - o = evas_object_line_add(nf->evas); - edje_object_part_swallow(nf->chart_obj, "lines", o); - evas_object_layer_set(o, 1); - if (rx_val == 0) - evas_object_hide(o); - else - { - evas_object_line_xy_set(o, (x + w), (y + h), (x + w), (y + h - rx_val)); - evas_object_color_set(o, 255, 0, 0, 100); - evas_object_pass_events_set(o, 1); - evas_object_show(o); - } - - nf->old_rx = evas_list_prepend(nf->old_rx, o); - l = nf->old_rx; - for (i = (x + w); l && ((j - 2) < w); l = l->next, j++) - { - Evas_Coord oy; - Evas_Object *lo; - - lo = (Evas_Object *)evas_list_data(l); - evas_object_geometry_get(lo, NULL, &oy, NULL, NULL); - evas_object_move(lo, i--, oy); - last = lo; - } - if ((j - 2) >= w) - { - nf->old_rx = evas_list_remove(nf->old_rx, last); - edje_object_part_unswallow(nf->chart_obj, last); - evas_object_del(last); - } - - j = 0; - last = NULL; - o = evas_object_line_add(nf->evas); - edje_object_part_swallow(nf->chart_obj, "lines", o); - evas_object_layer_set(o, 1); - if (tx_val == 0) - evas_object_hide(o); - else - { - evas_object_line_xy_set(o, (x + w), y, (x + w), (y + tx_val)); - evas_object_color_set(o, 0, 255, 0, 100); - evas_object_pass_events_set(o, 1); - evas_object_show(o); - } - - nf->old_tx = evas_list_prepend(nf->old_tx, o); - l = nf->old_tx; - for (i = (x + w); l && ((j - 2) < w); l = l->next, j++) - { - Evas_Coord oy; - Evas_Object *lo; - - lo = (Evas_Object *)evas_list_data(l); - evas_object_geometry_get(lo, NULL, &oy, NULL, NULL); - evas_object_move(lo, i--, oy); - last = lo; - } - if ((j - 2) >= w) - { - nf->old_tx = evas_list_remove(nf->old_tx, last); - edje_object_part_unswallow(nf->chart_obj, last); - evas_object_del(last); - } - - evas_event_thaw(nf->evas); -} - -void -_net_face_graph_clear(Net_Face *nf) -{ - Evas_List *l; - - evas_event_freeze(nf->evas); - - for (l = nf->old_rx; l; l = l->next) - { - Evas_Object *o; - - o = evas_list_data(l); - edje_object_part_unswallow(nf->chart_obj, o); - evas_object_del(o); - } - evas_list_free(nf->old_rx); - nf->old_rx = NULL; - - for (l = nf->old_tx; l; l = l->next) - { - Evas_Object *o; - - o = evas_list_data(l); - edje_object_part_unswallow(nf->chart_obj, o); - evas_object_del(o); - } - evas_list_free(nf->old_tx); - nf->old_tx = NULL; - - evas_event_thaw(nf->evas); -} diff --git a/e_mod_main.h b/e_mod_main.h index 31d3365..4439ac2 100644 --- a/e_mod_main.h +++ b/e_mod_main.h @@ -4,61 +4,34 @@ #define E_MOD_MAIN_H typedef struct _Config Config; -typedef struct _Config_Face Config_Face; -typedef struct _Net Net; -typedef struct _Net_Face Net_Face; +typedef struct _Config_Item Config_Item; -struct _Config +struct _Config { - Evas_List *faces; -}; - -struct _Config_Face -{ - unsigned char enabled; - char *device; - int check_interval; - int show_text; - int show_graph; -}; - -struct _Net -{ - E_Menu *config_menu; - Evas_List *faces; - Config *conf; - E_Config_Dialog *cfd; -}; - -struct _Net_Face -{ - Evas *evas; - E_Container *con; + E_Module *module; + E_Config_Dialog *config_dialog; E_Menu *menu; - Net *net; - Evas_List *old_rx, *old_tx; - Config_Face *conf; + Evas_List *instances; + Evas_List *items; +}; - Evas_Object *net_obj; - Evas_Object *event_obj; - Evas_Object *chart_obj; - Evas_Object *rtxt_obj; - Evas_Object *ttxt_obj; - - Ecore_Timer *monitor; - - E_Gadman_Client *gmc; +struct _Config_Item +{ + const char *id; + const char *device; + double poll_time; + double max; }; EAPI extern E_Module_Api e_modapi; - EAPI void *e_modapi_init(E_Module *m); EAPI int e_modapi_shutdown(E_Module *m); EAPI int e_modapi_save(E_Module *m); EAPI int e_modapi_info(E_Module *m); EAPI int e_modapi_about(E_Module *m); -EAPI int e_modapi_config(E_Module *m); -void _net_face_graph_clear(Net_Face *nf); +void _net_config_updated(const char *id); +void _config_net_module(Config_Item *ci); +extern Config *net_config; #endif diff --git a/module.eap b/module.eap new file mode 100644 index 0000000..ad58042 Binary files /dev/null and b/module.eap differ diff --git a/module_icon.png b/module_icon.png index a5f6cc4..01e7d63 100644 Binary files a/module_icon.png and b/module_icon.png differ diff --git a/net.edc b/net.edc index 88dec2a..21d5f21 100644 --- a/net.edc +++ b/net.edc @@ -1,6 +1,28 @@ images { - image: "eth_dev.png" COMP; + image: "module_icon.png" COMP; + image: "rx_00.png" COMP; + image: "rx_01.png" COMP; + image: "rx_02.png" COMP; + image: "rx_03.png" COMP; + image: "rx_04.png" COMP; + image: "rx_05.png" COMP; + image: "rx_06.png" COMP; + image: "rx_07.png" COMP; + image: "rx_08.png" COMP; + image: "rx_09.png" COMP; + image: "rx_10.png" COMP; + image: "tx_00.png" COMP; + image: "tx_01.png" COMP; + image: "tx_02.png" COMP; + image: "tx_03.png" COMP; + image: "tx_04.png" COMP; + image: "tx_05.png" COMP; + image: "tx_06.png" COMP; + image: "tx_07.png" COMP; + image: "tx_08.png" COMP; + image: "tx_09.png" COMP; + image: "tx_10.png" COMP; } fonts @@ -13,190 +35,434 @@ collections group { name: "modules/net/main"; + min: 4 4; + max: 128 128; + script + { + public message(Msg_Type:type, id, ...) + { + if ((type == MSG_INT_SET) && (id == 1)) + { + new f = getarg(2); + new Float:value; + + value = f; + value = (value / 10); + set_state(PART:"rx_meter", "default", value); + } + if ((type == MSG_INT_SET) && (id == 2)) + { + new f = getarg(2); + new Float:value; + + value = f; + value = (value / 10); + set_state(PART:"tx_meter", "default", value); + } + } + } + parts { part { - name: "net_clip"; - type: RECT; - mouse_events: 0; + name: "fade_clip"; + type: RECT; + mouse_events: 1; description { state: "default" 0.0; color: 255 255 255 255; - } - } - part - { - name: "net"; - clip_to: "net_clip"; - mouse_events: 0; - description - { - state: "default" 0.0; - color: 255 255 255 176; - //aspect: 0.5 2.25; rel1 { relative: 0.0 0.0; + offset: 0 0; } rel2 { relative: 1.0 1.0; + offset: -1 -1; + } + } + } + part + { + name: "net"; + type: IMAGE; + mouse_events: 1; + clip_to: "fade_clip"; + description + { + state: "default" 0.0; + aspect: 1.0 1.0; + rel1 + { + relative: 0.0 0.0; + offset: 0 0; + } + rel2 + { + relative: 1.0 1.0; + offset: -1 -1; } image { - normal: "eth_dev.png"; - } - fill - { - smooth: 0; + normal: "module_icon.png"; } + color: 255 255 255 192; } } part { - name, "lines"; - mouse_events, 0; - type, SWALLOW; - clip_to: "net_clip"; - description - { - state, "default" 0.0; - rel1 - { - relative: 0.0 0.0; - } - rel2 - { - relative: 1.0 1.0; - } - color, 0 0 0 0; - } - } - } - } - - group - { - name: "modules/net/tx_text"; - parts - { - part - { - name: "net_clip"; - type: RECT; - mouse_events: 0; + name: "rx_meter"; + type: IMAGE; + clip_to: "fade_clip"; + mouse_events: 1; description { state: "default" 0.0; - color: 255 255 255 255; - rel1 + rel1 { relative: 0.0 0.0; offset: 0 0; } + rel2 + { + relative: 1.0 0.25; + offset: -1 -1; + } + image + { + normal: "rx_00.png"; + } + color: 255 255 255 192; + } + description + { + state: "default" 0.1; + inherit: "default" 0.0; + image + { + normal: "rx_01.png"; + } + } + description + { + state: "default" 0.2; + inherit: "default" 0.0; + image + { + normal: "rx_02.png"; + } + } + description + { + state: "default" 0.3; + inherit: "default" 0.0; + image + { + normal: "rx_03.png"; + } + } + description + { + state: "default" 0.4; + inherit: "default" 0.0; + image + { + normal: "rx_04.png"; + } + } + description + { + state: "default" 0.5; + inherit: "default" 0.0; + image + { + normal: "rx_05.png"; + } + } + description + { + state: "default" 0.6; + inherit: "default" 0.0; + image + { + normal: "rx_06.png"; + } + } + description + { + state: "default" 0.7; + inherit: "default" 0.0; + image + { + normal: "rx_07.png"; + } + } + description + { + state: "default" 0.8; + inherit: "default" 0.0; + image + { + normal: "rx_08.png"; + } + } + description + { + state: "default" 0.9; + inherit: "default" 0.0; + image + { + normal: "rx_09.png"; + } + } + description + { + state: "default" 1.0; + inherit: "default" 0.0; + image + { + normal: "rx_10.png"; + } + } + } + part + { + name: "rx_label"; + type: TEXT; + clip_to: "fade_clip"; + effect: SOFT_SHADOW; + description + { + state: "default" 0.0; + color: 255 255 255 0; + color3: 0 0 0 0; + visible: 0; + rel1 + { + relative: 0.5 0.0; + offset: 0 0; + to: "rx_meter"; + } rel2 + { + relative: 0.5 1.0; + offset: -1 -1; + to: "rx_meter"; + } + text + { + text: "Rx: 10 Kbps"; + font: "VeraMono"; + size: 9; + min: 1 1; + align: 0.5 1.0; + text_class: "module_small"; + } + } + description + { + state: "visible" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 255 255 255 255; + color3: 0 0 0 42; + } + } + part + { + name: "tx_meter"; + type: IMAGE; + clip_to: "fade_clip"; + mouse_events: 1; + description + { + state: "default" 0.0; + rel1 + { + relative: 0.0 0.75; + offset: 0 0; + } + rel2 { relative: 1.0 1.0; offset: -1 -1; } + image + { + normal: "tx_00.png"; + } + color: 255 255 255 192; + } + description + { + state: "default" 0.1; + inherit: "default" 0.0; + image + { + normal: "tx_01.png"; + } + } + description + { + state: "default" 0.2; + inherit: "default" 0.0; + image + { + normal: "tx_02.png"; + } + } + description + { + state: "default" 0.3; + inherit: "default" 0.0; + image + { + normal: "tx_03.png"; + } + } + description + { + state: "default" 0.4; + inherit: "default" 0.0; + image + { + normal: "tx_04.png"; + } + } + description + { + state: "default" 0.5; + inherit: "default" 0.0; + image + { + normal: "tx_05.png"; + } + } + description + { + state: "default" 0.6; + inherit: "default" 0.0; + image + { + normal: "tx_06.png"; + } + } + description + { + state: "default" 0.7; + inherit: "default" 0.0; + image + { + normal: "tx_07.png"; + } + } + description + { + state: "default" 0.8; + inherit: "default" 0.0; + image + { + normal: "tx_08.png"; + } + } + description + { + state: "default" 0.9; + inherit: "default" 0.0; + image + { + normal: "tx_09.png"; + } + } + description + { + state: "default" 1.0; + inherit: "default" 0.0; + image + { + normal: "tx_10.png"; + } + } + } + part + { + name: "tx_label"; + type: TEXT; + clip_to: "fade_clip"; + effect: SOFT_SHADOW; + description + { + state: "default" 0.0; + color: 255 255 255 0; + color3: 0 0 0 0; + visible: 0; + rel1 + { + relative: 0.5 0.0; + offset: 0 0; + to: "tx_meter"; + } + rel2 + { + relative: 0.5 1.0; + offset: -1 -1; + to: "tx_meter"; + } + text + { + text: "Tx: 10 Kbps"; + font: "VeraMono"; + size: 9; + min: 1 1; + align: 0.5 1.0; + text_class: "module_small"; + } + } + description + { + state: "visible" 0.0; + inherit: "default" 0.0; + visible: 1; + color: 255 255 255 255; + color3: 0 0 0 42; } } - part - { - name: "tx-text"; - type: TEXT; - effect: OUTLINE_SOFT_SHADOW; - clip_to: "net_clip"; - mouse_events: 0; - description - { - state: "default" 0.0; - align: 1.0 0.0; - rel1 - { - relative: 0.0 0.0; - } - rel2 - { - relative: 1.0 0.0; - } - color: 128 255 128 255; - color2: 0 0 0 192; - color3: 128 128 128 192; - text - { - text: "Tx"; - font: "VeraMono"; - size: 10; - min: 1 1; - align: 1.0 0.0; - } - } - } } - } - - group - { - name: "modules/net/rx_text"; - parts + programs { - part + program { - name: "net_clip"; - type: RECT; - mouse_events: 0; - description - { - state: "default" 0.0; - color: 255 255 255 255; - rel1 - { - relative: 0.0 0.0; - offset: 0 0; - } - rel2 - { - relative: 1.0 1.0; - offset: -1 -1; - } - } + name: "go_active"; + signal: "label_active"; + source: ""; + action: STATE_SET "visible" 0.0; + transition: SINUSOIDAL 0.5; + target: "rx_label"; + target: "tx_label"; + //after: "go_passive2"; } - part + program { - name: "rx-text"; - type: TEXT; - effect: OUTLINE_SOFT_SHADOW; - clip_to: "net_clip"; - mouse_events: 0; - description - { - state: "default" 0.0; - align: 1.0 1.0; - rel1 - { - relative: 0.0 0.0; - } - rel2 - { - relative: 1.0 1.0; - } - color: 255 192 128 255; - color2: 0 0 0 216; - color3: 128 128 128 192; - text - { - text: "Rx"; - font: "VeraMono"; - size: 10; - min: 1 1; - align: 1.0 1.0; - } - } + name: "go_passive2"; + signal: "label_passive2"; + source: ""; + action: ACTION_STOP; + target: "go_active"; + //after: "go_passive2"; + } + program + { + name: "go_passive"; + signal: "label_passive"; + source: ""; + action: STATE_SET "default" 0.0; + transition: SINUSOIDAL 1.0; + target: "rx_label"; + target: "tx_label"; } } } } - diff --git a/rx_00.png b/rx_00.png new file mode 100644 index 0000000..6847583 Binary files /dev/null and b/rx_00.png differ diff --git a/rx_01.png b/rx_01.png new file mode 100644 index 0000000..8cdfdc4 Binary files /dev/null and b/rx_01.png differ diff --git a/rx_02.png b/rx_02.png new file mode 100644 index 0000000..369e3b5 Binary files /dev/null and b/rx_02.png differ diff --git a/rx_03.png b/rx_03.png new file mode 100644 index 0000000..d2ccb6c Binary files /dev/null and b/rx_03.png differ diff --git a/rx_04.png b/rx_04.png new file mode 100644 index 0000000..fe0161c Binary files /dev/null and b/rx_04.png differ diff --git a/rx_05.png b/rx_05.png new file mode 100644 index 0000000..3a42927 Binary files /dev/null and b/rx_05.png differ diff --git a/rx_06.png b/rx_06.png new file mode 100644 index 0000000..721a187 Binary files /dev/null and b/rx_06.png differ diff --git a/rx_07.png b/rx_07.png new file mode 100644 index 0000000..348018d Binary files /dev/null and b/rx_07.png differ diff --git a/rx_08.png b/rx_08.png new file mode 100644 index 0000000..3dd4751 Binary files /dev/null and b/rx_08.png differ diff --git a/rx_09.png b/rx_09.png new file mode 100644 index 0000000..bf5f020 Binary files /dev/null and b/rx_09.png differ diff --git a/rx_10.png b/rx_10.png new file mode 100644 index 0000000..075f899 Binary files /dev/null and b/rx_10.png differ diff --git a/tx_00.png b/tx_00.png new file mode 100644 index 0000000..6847583 Binary files /dev/null and b/tx_00.png differ diff --git a/tx_01.png b/tx_01.png new file mode 100644 index 0000000..60defe7 Binary files /dev/null and b/tx_01.png differ diff --git a/tx_02.png b/tx_02.png new file mode 100644 index 0000000..e1df5d1 Binary files /dev/null and b/tx_02.png differ diff --git a/tx_03.png b/tx_03.png new file mode 100644 index 0000000..e29a552 Binary files /dev/null and b/tx_03.png differ diff --git a/tx_04.png b/tx_04.png new file mode 100644 index 0000000..46cfa3f Binary files /dev/null and b/tx_04.png differ diff --git a/tx_05.png b/tx_05.png new file mode 100644 index 0000000..a493c45 Binary files /dev/null and b/tx_05.png differ diff --git a/tx_06.png b/tx_06.png new file mode 100644 index 0000000..9359267 Binary files /dev/null and b/tx_06.png differ diff --git a/tx_07.png b/tx_07.png new file mode 100644 index 0000000..a6fa888 Binary files /dev/null and b/tx_07.png differ diff --git a/tx_08.png b/tx_08.png new file mode 100644 index 0000000..2c3d3fa Binary files /dev/null and b/tx_08.png differ diff --git a/tx_09.png b/tx_09.png new file mode 100644 index 0000000..67ef1b8 Binary files /dev/null and b/tx_09.png differ diff --git a/tx_10.png b/tx_10.png new file mode 100644 index 0000000..636e7d5 Binary files /dev/null and b/tx_10.png differ