В вт, 2007-12-25 в 20:18 -0500, Enlightenment CVS написа:
> Enlightenment CVS committal
>
> Author : devilhorns
> Project : e_modules
> Module : tclock
>
> Dir : e_modules/tclock
>
>
> Modified Files:
> e_mod_main.h e_mod_main.c e_mod_config.c
> Added Files:
> tip_bg.png tip_bd.png
>
>
> Log Message:
> Added a tooltip for tclock so you can see a more full date/time string on
> mouse over.
Wouldn't it be better to use the gadcon popup? With the current
implementation, and depending the the shelf and gadget position, the
popup will be positioned so that it is out of the screen boundary, and
most of the time, it will cover up the gadget's content (which will most
likely not be desirable).
>
> ===================================================================
> RCS file: /cvs/e/e_modules/tclock/e_mod_main.h,v
> retrieving revision 1.23
> retrieving revision 1.24
> diff -u -3 -r1.23 -r1.24
> --- e_mod_main.h 2 Dec 2007 16:37:00 -0000 1.23
> +++ e_mod_main.h 26 Dec 2007 01:18:56 -0000 1.24
> @@ -25,8 +25,10 @@
> double poll_time;
> int show_time;
> int show_date;
> + int show_tip;
> const char *time_format;
> const char *date_format;
> + const char *tip_format;
> };
>
> EAPI extern E_Module_Api e_modapi;
> ===================================================================
> RCS file: /cvs/e/e_modules/tclock/e_mod_main.c,v
> retrieving revision 1.55
> retrieving revision 1.56
> diff -u -3 -r1.55 -r1.56
> --- e_mod_main.c 2 Dec 2007 16:53:52 -0000 1.55
> +++ e_mod_main.c 26 Dec 2007 01:18:56 -0000 1.56
> @@ -21,6 +21,8 @@
>
> /* Module Protos */
> static void _tclock_cb_mouse_down (void *data, Evas *e,
> Evas_Object *obj, void *event_info);
> +static void _tclock_cb_mouse_in (void *data, Evas *e,
> Evas_Object *obj, void *event_info);
> +static void _tclock_cb_mouse_out (void *data, Evas *e,
> Evas_Object *obj, void *event_info);
> static void _tclock_menu_cb_configure (void *data, E_Menu *m,
> E_Menu_Item *mi);
> static void _tclock_menu_cb_post (void *data, E_Menu *m);
> static int _tclock_cb_check (void *data);
> @@ -43,8 +45,9 @@
> struct _Instance
> {
> E_Gadcon_Client *gcc;
> - Evas_Object *tclock;
> + Evas_Object *tclock, *o_tip;
> Config_Item *ci;
> + E_Popup *tip;
> };
>
> static E_Gadcon_Client *
> @@ -76,6 +79,10 @@
>
> evas_object_event_callback_add (o, EVAS_CALLBACK_MOUSE_DOWN,
> _tclock_cb_mouse_down, inst);
> + evas_object_event_callback_add (o, EVAS_CALLBACK_MOUSE_IN,
> + _tclock_cb_mouse_in, inst);
> + evas_object_event_callback_add (o, EVAS_CALLBACK_MOUSE_OUT,
> + _tclock_cb_mouse_out, inst);
>
> tclock_config->instances =
> evas_list_append (tclock_config->instances, inst);
> @@ -95,11 +102,15 @@
>
> evas_object_event_callback_del (inst->tclock, EVAS_CALLBACK_MOUSE_DOWN,
> _tclock_cb_mouse_down);
> + evas_object_event_callback_del (inst->tclock, EVAS_CALLBACK_MOUSE_IN,
> + _tclock_cb_mouse_in);
> + evas_object_event_callback_del (inst->tclock, EVAS_CALLBACK_MOUSE_OUT,
> + _tclock_cb_mouse_out);
>
> evas_object_del (inst->tclock);
>
> tclock_config->instances =
> - evas_list_remove (tclock_config->instances, inst);
> + evas_list_remove (tclock_config->instances, inst);
>
> if (evas_list_count (tclock_config->instances) <= 0)
> {
> @@ -188,6 +199,58 @@
> }
> }
>
> +static void
> +_tclock_cb_mouse_in(void *data, Evas *e, Evas_Object *obj, void *event_info)
> +{
> + Instance *inst = NULL;
> + E_Zone *zone = NULL;
> + char buf[4096];
> + int x, y, w, h;
> + time_t current_time;
> + struct tm *local_time;
> +
> + if (!(inst = data)) return;
> + if (!inst->ci->show_tip) return;
> + if (inst->tip) return;
> + snprintf(buf, sizeof(buf), "%s/tclock.edj", tclock_config->module->dir);
> +
> + zone = e_util_zone_current_get(e_manager_current_get());
> + inst->tip = e_popup_new(zone, 0, 0, 0, 0);
> + e_popup_layer_set(inst->tip, 255);
> +
> + inst->o_tip = edje_object_add(inst->tip->evas);
> + edje_object_file_set(inst->o_tip, buf, "modules/tclock/tip");
> + evas_object_show(inst->o_tip);
> +
> + current_time = time (NULL);
> + local_time = localtime (¤t_time);
> + memset (buf, 0, sizeof (buf));
> + strftime (buf, 1024, inst->ci->tip_format, local_time);
> + edje_object_part_text_set (inst->o_tip, "e.text.tip", buf);
> +
> + evas_object_move(inst->o_tip, 0, 0);
> + edje_object_size_min_calc(inst->o_tip, &w, &h);
> + evas_object_resize(inst->o_tip, w, h);
> +
> + e_popup_edje_bg_object_set(inst->tip, inst->o_tip);
> + ecore_x_pointer_xy_get(zone->container->win, &x, &y);
> + e_popup_move_resize(inst->tip, x, y, w, h);
> + e_popup_show(inst->tip);
> +}
> +
> +static void
> +_tclock_cb_mouse_out(void *data, Evas *e, Evas_Object *obj, void
> *event_info)
> +{
> + Instance *inst = NULL;
> +
> + if (!(inst = data)) return;
> + if (!inst->tip) return;
> + evas_object_del(inst->o_tip);
> + e_object_del(E_OBJECT(inst->tip));
> + inst->tip = NULL;
> + inst->o_tip = NULL;
> +}
> +
> static void
> _tclock_menu_cb_post (void *data, E_Menu * m)
> {
> @@ -261,19 +324,26 @@
> else
> edje_object_signal_emit (inst->tclock, "date_visible", "");
> edje_object_message_signal_process (inst->tclock);
> -
> +
> memset (buf, 0, sizeof (buf));
>
> if (inst->ci->time_format)
> {
> strftime (buf, 1024, inst->ci->time_format, local_time);
> edje_object_part_text_set (inst->tclock, "tclock_time", buf);
> + if (inst->tip)
> + edje_object_part_text_set(inst->o_tip, "e.text.tip", buf);
> }
> if (inst->ci->date_format)
> {
> strftime (buf, 1024, inst->ci->date_format, local_time);
> edje_object_part_text_set (inst->tclock, "tclock_date", buf);
> }
> + if ((inst->ci->tip_format) && (inst->o_tip))
> + {
> + strftime (buf, 1024, inst->ci->tip_format, local_time);
> + edje_object_part_text_set (inst->o_tip, "e.text.tip", buf);
> + }
> }
>
> return 1;
> @@ -317,8 +387,10 @@
> ci->id = evas_stringshare_add (id);
> ci->show_date = 1;
> ci->show_time = 1;
> + ci->show_tip = 1;
> ci->time_format = evas_stringshare_add ("%T");
> ci->date_format = evas_stringshare_add ("%d/%m/%y");
> + ci->tip_format = evas_stringshare_add("%A, %B %d, %Y");
>
> tclock_config->items = evas_list_append (tclock_config->items, ci);
> return ci;
> @@ -346,8 +418,10 @@
> E_CONFIG_VAL (D, T, id, STR);
> E_CONFIG_VAL (D, T, show_date, INT);
> E_CONFIG_VAL (D, T, show_time, INT);
> + E_CONFIG_VAL (D, T, show_tip, INT);
> E_CONFIG_VAL (D, T, date_format, STR);
> E_CONFIG_VAL (D, T, time_format, STR);
> + E_CONFIG_VAL (D, T, tip_format, STR);
>
> conf_edd = E_CONFIG_DD_NEW ("TClock_Config", Config);
> #undef T
> @@ -367,8 +441,10 @@
> ci->id = evas_stringshare_add ("0");
> ci->show_date = 1;
> ci->show_time = 1;
> + ci->show_tip = 1;
> ci->time_format = evas_stringshare_add ("%T");
> ci->date_format = evas_stringshare_add ("%d/%m/%y");
> + ci->tip_format = evas_stringshare_add("%d");
>
> tclock_config->items = evas_list_append (tclock_config->items, ci);
> }
> @@ -406,6 +482,8 @@
> evas_stringshare_del (ci->time_format);
> if (ci->date_format)
> evas_stringshare_del (ci->date_format);
> + if (ci->tip_format)
> + evas_stringshare_del(ci->tip_format);
> E_FREE (ci);
> }
>
> @@ -421,4 +499,3 @@
> e_config_domain_save ("module.tclock", conf_edd, tclock_config);
> return 1;
> }
> -
> ===================================================================
> RCS file: /cvs/e/e_modules/tclock/e_mod_config.c,v
> retrieving revision 1.35
> retrieving revision 1.36
> diff -u -3 -r1.35 -r1.36
> --- e_mod_config.c 31 Oct 2007 14:41:53 -0000 1.35
> +++ e_mod_config.c 26 Dec 2007 01:18:56 -0000 1.36
> @@ -5,8 +5,10 @@
> {
> int show_date;
> int show_time;
> + int show_tip;
> char *time_format;
> char *date_format;
> + char *tip_format;
> };
>
> /* Protos */
> @@ -49,10 +51,13 @@
> {
> cfdata->show_time = ci->show_time;
> cfdata->show_date = ci->show_date;
> + cfdata->show_tip = ci->show_tip;
> if (ci->time_format)
> cfdata->time_format = strdup (ci->time_format);
> if (ci->date_format)
> cfdata->date_format = strdup (ci->date_format);
> + if (ci->tip_format)
> + cfdata->tip_format = strdup(ci->tip_format);
> }
>
> static void *
> @@ -82,7 +87,7 @@
> Evas_Object *time_entry, *time_check, *date_entry, *date_check;
>
> o = e_widget_list_add (evas, 0, 0);
> -
> +
> of = e_widget_frametable_add (evas, D_ ("Top"), 1);
> time_check =
> e_widget_check_add (evas, D_ ("Show Top Line"), &(cfdata->show_time));
> @@ -111,6 +116,16 @@
> e_widget_frametable_object_append (of, ob, 0, 2, 1, 1, 1, 0, 1, 0);
> e_widget_list_object_append (o, of, 1, 1, 0.5);
>
> + of = e_widget_frametable_add (evas, D_ ("Tool Tip"), 1);
> + ob = e_widget_check_add (evas, D_ ("Show Tooltip"), &(cfdata->show_tip));
> + e_widget_frametable_object_append (of, ob, 0, 0, 1, 1, 1, 0, 1, 0);
> + ob = e_widget_entry_add (evas, &cfdata->tip_format, NULL, NULL, NULL);
> + e_widget_min_size_set (ob, 150, 1);
> + e_widget_frametable_object_append (of, ob, 0, 1, 1, 1, 1, 0, 1, 0);
> + ob =
> + e_widget_label_add (evas, D_ ("Consult strftime(3) for format syntax"));
> + e_widget_frametable_object_append (of, ob, 0, 2, 1, 1, 1, 0, 1, 0);
> + e_widget_list_object_append (o, of, 1, 1, 0.5);
>
> return o;
> }
> @@ -123,12 +138,16 @@
> ci = cfd->data;
> ci->show_date = cfdata->show_date;
> ci->show_time = cfdata->show_time;
> + ci->show_tip = cfdata->show_tip;
> if (ci->time_format)
> evas_stringshare_del (ci->time_format);
> ci->time_format = evas_stringshare_add (cfdata->time_format);
> if (ci->date_format)
> evas_stringshare_del (ci->date_format);
> ci->date_format = evas_stringshare_add (cfdata->date_format);
> + if (ci->tip_format)
> + evas_stringshare_del (ci->tip_format);
> + ci->tip_format = evas_stringshare_add (cfdata->tip_format);
>
> e_config_save_queue ();
>
>
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> _______________________________________________
> enlightenment-cvs mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs
--
Виктор Кожухаров /Viktor Kojouharov/
signature.asc
Description: Това е цифрово подписана част от писмото
------------------------------------------------------------------------- This SF.net email is sponsored by: Microsoft Defy all challenges. Microsoft(R) Visual Studio 2005. http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________ enlightenment-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/enlightenment-devel
