On Sat, 2 Jul 2011, Enlightenment SVN wrote:

> Log:
> automatically scale down huge images, clean up some repeated code, and also 
> scroll the list on new image. this officially completes my ev TODO...for now
>
>
> Author:       discomfitor
> Date:         2011-07-02 22:44:57 -0700 (Sat, 02 Jul 2011)
> New Revision: 60944
> Trac:         http://trac.enlightenment.org/e/changeset/60944
>
> Modified:
>  trunk/PROTO/ev/build.sh trunk/PROTO/ev/ev.c
>
> Modified: trunk/PROTO/ev/build.sh
> ===================================================================
> --- trunk/PROTO/ev/build.sh   2011-07-03 05:24:57 UTC (rev 60943)
> +++ trunk/PROTO/ev/build.sh   2011-07-03 05:44:57 UTC (rev 60944)
> @@ -2,12 +2,12 @@
>
> CF="-DHAVE_LIMITS_H -DSTDC_HEADERS -DHAVE_MEMCPY=1 -D_GNU_SOURCE=1 -O0 -pipe 
> -Wall -Wextra -g"
>
> -DEPS=($(pkg-config --print-requires-private elementary))
> +DEPS=($(pkg-config --print-requires-private elementary ecore-x))
> echo "DEPENDENCIES: ${DEPS[@]}"
> -CFLAGS="$(pkg-config --static --cflags ${DEPS[@]} elementary)"
> +CFLAGS="$(pkg-config --static --cflags ${DEPS[@]} elementary ecore-x)"
> echo "DEPENDENCY CFLAGS: $CFLAGS"
>
> -LIBS="$(pkg-config --static --libs ${DEPS[@]} elementary)"
> +LIBS="$(pkg-config --static --libs ${DEPS[@]} elementary ecore-x)"
> echo "DEPENDENCY LIBS: $LIBS"
> echo
>
>
> Modified: trunk/PROTO/ev/ev.c
> ===================================================================
> --- trunk/PROTO/ev/ev.c       2011-07-03 05:24:57 UTC (rev 60943)
> +++ trunk/PROTO/ev/ev.c       2011-07-03 05:44:57 UTC (rev 60944)
> @@ -16,6 +16,7 @@
>  */
>
> #include <Elementary.h>
> +#include <Ecore_X.h>
> #include <sys/stat.h>
> #include <sys/types.h>
>
> @@ -32,6 +33,7 @@
> static int _ev_log_dom = -1;
> static Elm_Genlist_Item_Class itc;;
> static Evas_Object *img, *list = NULL;
> +static int root_x = -1, root_y = -1;
>
> static void
> _close(void *data __UNUSED__, Evas_Object *obj __UNUSED__, void *event_info 
> __UNUSED__)
> @@ -53,6 +55,7 @@
>         DBG("next: %p", it);
>         elm_image_file_set(img, elm_genlist_item_data_get(it), NULL);
>         elm_genlist_item_selected_set(it, EINA_TRUE);
> +        elm_genlist_item_bring_in(it);
>      }
>    else if ((!strcmp(key->keyname, "Return")) || (!strcmp(key->keyname, 
> "KP_Enter")))
>      {
> @@ -60,6 +63,7 @@
>         it = elm_genlist_selected_item_get(list);
>         if (!it) return;
>         elm_image_file_set(img, elm_genlist_item_data_get(it), NULL);
> +        elm_genlist_item_bring_in(it);
>      }
>    else if (key->keyname[0] == 'q')
>      ecore_main_loop_quit();
> @@ -82,15 +86,40 @@
> {
>    const char *file, *f, *p;
>    Evas_Object *win;
> +   int x, y;
>
>    DBG("pick");
>    elm_image_file_get(img, &f, &p);
>    file = elm_genlist_item_data_get(ev);
> -   if (!strcmp(file, f)) return;
> +   if (f && (!strcmp(file, f))) return;
>
>    elm_image_file_set(img, file, NULL);
> +   elm_image_object_size_get(img, &x, &y);
> +   if ((x >= root_x) || (y >= root_y))
> +     {
> +        double dx, dy;
> +
> +        dx = (double)root_x / (double) x;
> +        dy = (double)root_y / (double) y;
> +        if (dx > dy)
> +          {
> +             evas_object_resize(img, (int)(dy * x), root_y);
> +             evas_object_resize(elm_object_parent_widget_get(img), (int)(dy 
> * x), root_y);
> +          }
> +        else
> +          {
> +             evas_object_resize(img, root_x, (int)(dx * y));
> +             evas_object_resize(elm_object_parent_widget_get(img), root_x, 
> (int)(dx * y));
> +          }
> +     }
> +   else
> +     {
> +        evas_object_resize(img, x, y);
> +        evas_object_resize(elm_object_parent_widget_get(img), x, y);
> +     }
>    win = elm_object_parent_widget_get(img);
>    elm_win_title_set(win, file);
> +   INF("x=%i, y=%i", x, y);
> }
>
> static void
> @@ -144,7 +173,8 @@
> main(int argc, char *argv[])
> {
>    Evas_Object *listwin, *win, *box, *obj;
> -   int x, y;
> +   int num_wins, nw;
> +   Ecore_X_Window zw, zwr, *roots;
>
>    itc.item_style     = "default";
>    itc.func.label_get = _label;
> @@ -165,7 +195,26 @@
>    evas_object_size_hint_align_set(img, EVAS_HINT_FILL, EVAS_HINT_FILL);
>    evas_object_show(img);
>    evas_object_show(win);
> -
> +
> +   zw = elm_win_xwindow_get(win);
> +   zwr = ecore_x_window_root_get(zw);

why don't you call here

ecore_x_window_size_get(zwr, &root_x, &root_y);

?

Vincent

> +   roots = ecore_x_window_root_list(&num_wins);
> +   if ((!roots) || (num_wins <= 0))
> +     ERR("Could not determine screen size; autoscaling disabled");
> +   else
> +     {
> +        for (nw = 0; nw < num_wins; nw++)
> +          {
> +             if (roots[nw] != zwr) continue;
> +
> +             ecore_x_window_size_get(zwr, &root_x, &root_y);
> +             break;
> +          }
> +        free(roots);
> +     }
> +
> +
> +
>    listwin = elm_win_add(NULL, "ev", ELM_WIN_BASIC);
>    elm_win_autodel_set(listwin, EINA_TRUE);
>
> @@ -192,12 +241,7 @@
>
>    load_stuff(argc, argv, list);
>
> -   elm_image_file_set(img, 
> elm_genlist_item_data_get(elm_genlist_selected_item_get(list)), NULL);
> -   elm_win_title_set(win, 
> elm_genlist_item_data_get(elm_genlist_selected_item_get(list)));
> -   elm_image_object_size_get(img, &x, &y);
> -   evas_object_resize(img, x, y);
> -   evas_object_resize(win, x, y);
> -   INF("x=%i, y=%i", x, y);
> +   _pick(NULL, NULL, elm_genlist_selected_item_get(list));
>
>    evas_object_resize(listwin, 450, 350);
>
>
>
> ------------------------------------------------------------------------------
> All of the data generated in your IT infrastructure is seriously valuable.
> Why? It contains a definitive record of application performance, security
> threats, fraudulent activity, and more. Splunk takes this data and makes
> sense of it. IT sense. And common sense.
> http://p.sf.net/sfu/splunk-d2d-c2
> _______________________________________________
> enlightenment-svn mailing list
> enlightenment-...@lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/enlightenment-svn
>
>

------------------------------------------------------------------------------
All of the data generated in your IT infrastructure is seriously valuable.
Why? It contains a definitive record of application performance, security 
threats, fraudulent activity, and more. Splunk takes this data and makes 
sense of it. IT sense. And common sense.
http://p.sf.net/sfu/splunk-d2d-c2
_______________________________________________
enlightenment-devel mailing list
enlightenment-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-devel

Reply via email to