Enlightenment CVS committal

Author  : rephorm
Project : e17
Module  : apps/elicit

Dir     : e17/apps/elicit/src


Modified Files:
        Elicit.h callbacks.c callbacks.h conf.c elicit.c 


Log Message:

add a signal to allow resizing. (needs to be a bit more robust)


===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/Elicit.h,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- Elicit.h    7 Feb 2004 20:27:27 -0000       1.4
+++ Elicit.h    8 Feb 2004 09:25:59 -0000       1.5
@@ -53,7 +53,7 @@
 };
 
 void elicit_ui_update_text(Elicit *el);
-void elicit_ui_theme_set(Elicit *el, char *name);
+void elicit_ui_theme_set(Elicit *el, char *name, char *group);
 
 #endif
 
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/callbacks.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- callbacks.c 8 Feb 2004 04:02:09 -0000       1.4
+++ callbacks.c 8 Feb 2004 09:25:59 -0000       1.5
@@ -99,6 +99,77 @@
 }
 
 void
+elicit_cb_switch(void *data, Evas_Object *o, const char *sig, const char *src)
+{
+  Elicit *el = data;
+  /* FIXME: i may need to free something here... */
+  char *theme = elicit_config_theme_get();
+  char *file = elicit_theme_find(theme);
+  char group[PATH_MAX];
+  Evas_List *groups = edje_file_collection_list(file);
+  Evas_List *l;
+
+  sscanf(sig, "elicit,switch,%s", group);
+
+  printf("switch group to: %s\n", group);
+
+  for (l = groups; l; l = l->next)
+  {
+    char *gp = l->data;
+    if (!strcmp(gp, group))
+    {
+      elicit_ui_theme_set(el, theme, group); 
+      return;
+    }
+  }
+  printf("Error: group %s does not exist in file %s\n", group, file);
+}
+
+void
+elicit_cb_resize_sig(void *data, Evas_Object *o, const char *sig, const char *src)
+{
+  Elicit *el = data;
+  int ow = 0, oh = 0;
+  int w = 0, h = 0;
+  int dw = 0, dh = 0;
+  char arg[PATH_MAX];
+  char *wstr, *hstr, *sub;
+  int ret;
+  int woff = 0, hoff = 0;
+
+  ecore_evas_geometry_get(el->ee, NULL, NULL, &ow, &oh);
+
+  /* if we have an arg */
+  if (sscanf(sig, "elicit,resize,%s,%s", arg))
+  {
+    wstr = arg;
+    sub = strstr(arg, ",");
+    printf("arg: %s :: sub: %s\n", arg, sub);
+    sub[0] = '\0';
+    hstr = sub + 1;
+
+    if (wstr[0] == '+') woff = 1;
+    else if (wstr[0] == '-') woff = -1;
+    if (hstr[0] == '+') hoff = 1;
+    else if (hstr[0] == '-') hoff = -1;
+
+    printf("h: %s, w: %s off:(%d,%d)\n", hstr, wstr, hoff, woff);
+    if (woff != 0) wstr = wstr + 1;
+    if (hoff != 0) hstr = hstr + 1;
+    printf("h: %s, w: %s off:(%d,%d)\n", hstr, wstr, hoff, woff);
+    w = atoi(wstr);
+    h = atoi(hstr);
+
+    printf("resize: (%d, %d) (%d, %d)\n", w, h, woff, hoff);
+    ecore_evas_resize(el->ee,
+                      woff ? ow + w * woff : w,
+                      hoff ? oh + h * hoff : h);
+  }
+
+  
+}
+
+void
 elicit_cb_copy(void *data, Evas_Object *o, const char *sig, const char *src)
 {
   Elicit *el = data;
@@ -118,7 +189,7 @@
   /* we're done */
   if (!el->flags.changing)
   {
-    if (0 && el->change_timer)
+    if (el->change_timer)
     {
       ecore_timer_del(el->change_timer);
       el->change_timer = NULL;
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/callbacks.h,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- callbacks.h 8 Feb 2004 04:02:09 -0000       1.2
+++ callbacks.h 8 Feb 2004 09:25:59 -0000       1.3
@@ -8,6 +8,8 @@
 void elicit_cb_pick(void *data, Evas_Object *o, const char *sig, const char *src);
 void elicit_cb_shoot(void *data, Evas_Object *o, const char *sig, const char *src);
 void elicit_cb_colors(void *data, Evas_Object *o, const char *sig, const char *src);
+void elicit_cb_switch(void *data, Evas_Object *o, const char *sig, const char *src);
 void elicit_cb_copy(void *data, Evas_Object *o, const char *sig, const char *src);
+void elicit_cb_resize_sig(void *data, Evas_Object *o, const char *sig, const char 
*src);
 
 #endif
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/conf.c,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -3 -r1.3 -r1.4
--- conf.c      8 Feb 2004 04:02:09 -0000       1.3
+++ conf.c      8 Feb 2004 09:25:59 -0000       1.4
@@ -57,8 +57,7 @@
 elicit_config_theme_get()
 {
   char *theme = ecore_config_get_string("/settings/theme");
-
-  return theme ? theme : "winter";
+  return theme;
 }
 
 void
@@ -104,7 +103,7 @@
     case ELICIT_CONF_TAG_THEME:
       if (el->gui)
       {
-        elicit_ui_theme_set(el, ecore_config_get_string(key));
+        elicit_ui_theme_set(el, ecore_config_get_string(key), "elicit");
       }
       break;
   }
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/elicit/src/elicit.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- elicit.c    8 Feb 2004 04:02:09 -0000       1.7
+++ elicit.c    8 Feb 2004 09:25:59 -0000       1.8
@@ -112,28 +112,31 @@
   evas_object_name_set(el->swatch, "swatch");
   evas_object_show(el->swatch);
 
-  elicit_ui_theme_set(el, elicit_config_theme_get(el));
+  elicit_ui_theme_set(el, elicit_config_theme_get(el), "elicit");
   elicit_ui_update_text(el);
   return 0;
 }
 
 void
-elicit_ui_theme_set(Elicit *el, char *theme)
+elicit_ui_theme_set(Elicit *el, char *theme, char *group)
 {
   double mw, mh;
 
   /* set the theme */
-  if (!edje_object_file_set(el->gui, elicit_theme_find(theme), "elicit"))
+  if (!edje_object_file_set(el->gui, elicit_theme_find(theme), group))
   {
     printf("Error: can't set theme to %s\n", theme);
     return;
   }
 
+  printf("theme set\n");
+
   /* set the default window size */
   edje_object_size_min_get(el->gui, &mw, &mh);
   ecore_evas_size_min_set(el->ee, mw, mh);
   if (mw != 0 && mh != 0)
   {
+    printf("resize to: %.2f x %.2f\n", mw, mh);
     evas_object_resize(el->gui, mw, mh);
     ecore_evas_resize(el->ee, mw, mh);
   }
@@ -157,8 +160,12 @@
   edje_object_signal_callback_add(el->gui, "elicit,quit", "*", elicit_cb_exit, el);
   edje_object_signal_callback_add(el->gui, "elicit,color,*", "*", elicit_cb_colors, 
el);
   edje_object_signal_callback_add(el->gui, "elicit,zoom,*", "*", elicit_cb_colors, 
el);
+  edje_object_signal_callback_add(el->gui, "elicit,switch,*", "*", elicit_cb_switch, 
el);
   edje_object_signal_callback_add(el->gui, "elicit,copy,*", "*", elicit_cb_copy, el);
+  edje_object_signal_callback_add(el->gui, "elicit,resize,*", "*", 
elicit_cb_resize_sig, el);
 
+  evas_object_hide(el->gui);
+  evas_object_show(el->gui);
 }
 
 void




-------------------------------------------------------
The SF.Net email is sponsored by EclipseCon 2004
Premiere Conference on Open Tools Development and Integration
See the breadth of Eclipse activity. February 3-5 in Anaheim, CA.
http://www.eclipsecon.org/osdn
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to