Enlightenment CVS committal

Author  : rephorm
Project : e17
Module  : apps/elicit

Dir     : e17/apps/elicit/src


Modified Files:
        Elicit.h spectrum.c util.c zoom.c 


Log Message:
if the selected theme does not exist, fall back to the default theme
fix some warnings
get proper number of pixels for shot in all geometries
clip shot (fixes bug where switching themes can cause shot to overflow its 
bounds)
implement missing smart handlers


===================================================================
RCS file: /cvs/e/e17/apps/elicit/src/Elicit.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- Elicit.h    15 Jul 2006 06:47:01 -0000      1.18
+++ Elicit.h    17 Mar 2007 11:04:06 -0000      1.19
@@ -26,6 +26,7 @@
 #endif
 
 #define DATADIR PACKAGE_DATA_DIR
+#define DEFAULT_THEME "winter"
 
 typedef struct _Elicit Elicit;
 typedef struct _Elicit_Swatch Elicit_Swatch;
===================================================================
RCS file: /cvs/e/e17/apps/elicit/src/spectrum.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- spectrum.c  10 Oct 2006 01:05:59 -0000      1.3
+++ spectrum.c  17 Mar 2007 11:04:06 -0000      1.4
@@ -47,7 +47,7 @@
   int i;
   for (i = 0; i < ELICIT_SPECTRUM_COUNT; i++) {
     Evas_Object *o = NULL;
-    if (o = evas_object_name_find(el->evas, spectrum_names[i])) {
+    if ((o = evas_object_name_find(el->evas, spectrum_names[i]))) {
       elicit_spectrum_color_set(o, el->color.r, el->color.g, el->color.b, 
el->color.h, el->color.s, el->color.v);
     }
   }
===================================================================
RCS file: /cvs/e/e17/apps/elicit/src/util.c,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -3 -r1.13 -r1.14
--- util.c      15 Jul 2006 06:47:01 -0000      1.13
+++ util.c      17 Mar 2007 11:04:06 -0000      1.14
@@ -223,6 +223,12 @@
     return eet;
 
   snprintf(eet, sizeof(eet), DATADIR"/themes/%s.edj", name);
+
+  if (!stat(eet, &st))
+    return eet;
+
+  // fallback to default theme
+  snprintf(eet, sizeof(eet), DATADIR"/themes/%s.edj", DEFAULT_THEME);
   return stat(eet, &st) ? NULL : eet;
 }
 
===================================================================
RCS file: /cvs/e/e17/apps/elicit/src/zoom.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- zoom.c      15 Jul 2006 10:52:34 -0000      1.4
+++ zoom.c      17 Mar 2007 11:04:06 -0000      1.5
@@ -8,6 +8,7 @@
 {
   Evas_Object *shot;
   Evas_Object *grid;
+  Evas_Object *clip;
 
   Evas_Coord ow, oh; // current object size
   int iw, ih; // how large of a shot to take
@@ -23,6 +24,9 @@
 static void _smart_resize(Evas_Object *o, Evas_Coord w, Evas_Coord h);
 static void _smart_show(Evas_Object *o);
 static void _smart_hide(Evas_Object *o);
+static void _smart_color_set(Evas_Object *o, int r, int g, int b, int a);
+static void _smart_clip_set(Evas_Object *o, Evas_Object *clip);
+static void _smart_clip_unset(Evas_Object *o);
 
 
 Evas_Object *
@@ -81,6 +85,10 @@
   x = px - .5 * z->iw;
   y = py - .5 * z->ih;
 
+  /* get as many pixels as needed to fill area at current zoom */
+  z->iw = (z->ow / z->zoom) + (z->ow % z->zoom ? 1 : 0);
+  z->ih = (z->oh / z->zoom) + (z->oh % z->zoom ? 1 : 0);
+
   /* keep shot within desktop bounds */
   ecore_x_window_size_get(RootWindow(ecore_x_display_get(),0), &dw, &dh);
   if (x < 0) x = 0;
@@ -140,6 +148,7 @@
 
   /* set it to fill at the current zoom level */
   evas_object_image_fill_set(z->shot, 0, 0, z->iw * z->zoom, z->ih * z->zoom);
+  evas_object_resize(z->shot, z->ow, z->oh);
 
   z->has_data = 1;
 }
@@ -157,9 +166,9 @@
                             _smart_resize,
                             _smart_show,
                             _smart_hide,
-           NULL, // color_set
-           NULL, // clip_set
-           NULL, // clip_unset
+           _smart_color_set,
+           _smart_clip_set,
+           _smart_clip_unset,
                             NULL);
 }
 
@@ -186,6 +195,10 @@
   evas_object_image_file_set(z->grid, buf, "");
   evas_object_smart_member_add(z->grid, o);
 
+  z->clip = evas_object_rectangle_add(evas);
+  evas_object_clip_set(z->shot, z->clip);
+  evas_object_clip_set(z->grid, z->clip);
+
   elicit_zoom_zoom_set(o, 4);
 }
 
@@ -198,6 +211,7 @@
 
   if (z->shot) evas_object_del(z->shot);
   if (z->grid) evas_object_del(z->grid);
+  if (z->clip) evas_object_del(z->clip);
 
   free(z);
   evas_object_smart_data_set(o, NULL);
@@ -212,6 +226,7 @@
 
   evas_object_move(z->grid, x, y);
   evas_object_move(z->shot, x, y);
+  evas_object_move(z->clip, x, y);
 }
 
 static void
@@ -220,14 +235,12 @@
   Elicit_Zoom *z;
 
   z = evas_object_smart_data_get(o);
-  evas_object_resize(z->shot, w, h);
+  evas_object_resize(z->shot, z->iw * z->zoom, z->ih * z->zoom);
   evas_object_resize(z->grid, w, h);
+  evas_object_resize(z->clip, w, h);
 
   z->ow = w;
   z->oh = h;
-
-  z->iw = (w / z->zoom) + (w % z->zoom ? 1 : 0);
-  z->ih = (h / z->zoom) + (h % z->zoom ? 1 : 0);
 }
 
 static void
@@ -238,6 +251,7 @@
   z = evas_object_smart_data_get(o);
 
   evas_object_show(z->shot);
+  evas_object_show(z->clip);
   if (z->has_data && elicit_config_grid_visible_get()) 
evas_object_show(z->grid);
 }
 
@@ -250,8 +264,36 @@
 
   evas_object_hide(z->shot);
   evas_object_hide(z->grid);
+  evas_object_hide(z->clip);
+}
+
+static void
+_smart_color_set(Evas_Object *o, int r, int g, int b, int a)
+{
+  Elicit_Zoom *z;
+
+  z = evas_object_smart_data_get(o);
+
+  evas_object_color_set(z->clip, r, g, b, a);
 }
 
+static void
+_smart_clip_set(Evas_Object *o, Evas_Object *clip)
+{
+  Elicit_Zoom *z;
+  
+  z = evas_object_smart_data_get(o);
+
+  evas_object_clip_set(z->clip, clip);
+}
 
+static void
+_smart_clip_unset(Evas_Object *o)
+{
+  Elicit_Zoom *z;
+  
+  z = evas_object_smart_data_get(o);
 
+  evas_object_clip_unset(z->clip);
+}
 



-------------------------------------------------------------------------
Take Surveys. Earn Cash. Influence the Future of IT
Join SourceForge.net's Techsay panel and you'll get the chance to share your
opinions on IT & business topics through brief surveys-and earn cash
http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV
_______________________________________________
enlightenment-cvs mailing list
enlightenment-cvs@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to