Enlightenment CVS committal

Author  : moom
Project : e17
Module  : proto

Dir     : e17/proto/etk/src/bin


Modified Files:
        etk_canvas_test.c 


Log Message:
* Improve canvas test app


===================================================================
RCS file: /cvs/e/e17/proto/etk/src/bin/etk_canvas_test.c,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -3 -r1.10 -r1.11
--- etk_canvas_test.c   16 Aug 2006 15:36:56 -0000      1.10
+++ etk_canvas_test.c   16 Aug 2006 16:38:49 -0000      1.11
@@ -21,6 +21,7 @@
 
    win = etk_window_new();
    etk_window_title_set(ETK_WINDOW(win), "Etk Canvas Test");
+   etk_container_border_width_set(ETK_CONTAINER(win), 5);
    etk_signal_connect("delete_event", ETK_OBJECT(win), 
ETK_CALLBACK(etk_window_hide_on_delete), NULL); 
 
    vbox = etk_vbox_new(ETK_FALSE, 5);
@@ -43,44 +44,46 @@
    Etk_Canvas *canvas;
    Evas *evas;
    Evas_Object *object;
-   int x, y, w, h;
-   int r, g, b, a;
+   int x, y;
    int cw, ch;
-   Etk_Bool is_image;
 
    if (!(canvas = ETK_CANVAS(data)) || !(evas = 
etk_widget_toplevel_evas_get(ETK_WIDGET(canvas))))
       return;
-
+   
+   etk_widget_geometry_get(ETK_WIDGET(canvas), NULL, NULL, &cw, &ch);
+   x = rand() % cw;
+   y = rand() % ch;
+   
+   /* Add a rectangle */
    if (rand() % 4 != 0)
    {
+      int w, h;
+      int r, g, b, a;
+      
       object = evas_object_rectangle_add(evas);
-      is_image = ETK_FALSE;
+      etk_canvas_object_add(canvas, object);
+      
+      w = ETK_MAX(abs(rand() % (cw - x)), 10);
+      h = ETK_MAX(abs(rand() % (ch - y)), 10);
+      evas_object_resize(object, w, h);
+      
+      r = rand() % 255;
+      g = rand() % 255;
+      b = rand() % 255;
+      a = ETK_MAX(rand() % 255, 40);
+      evas_object_color_set(object, r, g, b, a);
    }
+   /* Or add an image */
    else
    {
       object = evas_object_image_add(evas);
+      etk_canvas_object_add(canvas, object);
+      
       evas_object_image_file_set(object, PACKAGE_DATA_DIR "/images/test.png", 
NULL);
-      is_image = ETK_TRUE;
+      evas_object_image_fill_set(object, 0, 0, 48, 48);
+      evas_object_resize(object, 48, 48);
    }
    
-   evas_object_show(object);
-   etk_canvas_object_add(canvas, object);
-
-   etk_widget_geometry_get(ETK_WIDGET(canvas), NULL, NULL, &cw, &ch);
-   
-   x = rand() % cw;
-   y = rand() % ch;
    etk_canvas_object_move(canvas, object, x, y);
-
-   w = ETK_MAX(abs(rand() % (cw - x)), 10);
-   h = ETK_MAX(abs(rand() % (ch - y)), 10);
-   evas_object_resize(object, w, h);
-   if (is_image)
-      evas_object_image_fill_set(object, 0, 0, w, h);
-
-   r = rand() % 255;
-   g = rand() % 255;
-   b = rand() % 255;
-   a = ETK_MAX(rand() % 255, 40);
-   evas_object_color_set(object, r, g, b, a);
+   evas_object_show(object);
 }



-------------------------------------------------------------------------
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to