Enlightenment CVS committal

Author  : handyande
Project : e17
Module  : apps/examine

Dir     : e17/apps/examine/src


Modified Files:
        examine.c 


Log Message:
Examine now parses and takes heed of bounded and stepped number properties
===================================================================
RCS file: /cvsroot/enlightenment/e17/apps/examine/src/examine.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -3 -r1.2 -r1.3
--- examine.c   13 Jan 2004 19:51:50 -0000      1.2
+++ examine.c   4 Feb 2004 00:44:09 -0000       1.3
@@ -109,6 +109,9 @@
   char           *prop_list;
   int             tmpi;
   double          tmpd;
+  char            type[20], range[10], step[5];
+  int             mini, maxi;
+  double          mind, maxd; 
 
   prop_list = examine_client_list_props();
   if (prop_list && (strlen(prop_list) > 0)) {
@@ -161,24 +164,54 @@
         cell[1] = ewl_cell_new();
         text[0] = ewl_text_new(label);
 
-        if (!strcmp(typename, "string"))
+        type[0]='\0';
+        range[0]='\0';
+        step[0]='\0';
+        sscanf(typename, "%s%*s%s%*s%s", &type, &range, &step);
+        
+        if(type[strlen(type)-1]==',')
+          type[strlen(type)-1]='\0';
+        if(*range)
+          if(range[strlen(range)-1]==',')
+            range[strlen(range)-1]='\0';
+                    
+        if (!strcmp(type, "string"))
           text[1] = ewl_entry_new(examine_client_get_val(label));
-        else if (!strcmp(typename, "integer")) {
+        else if (!strcmp(type, "integer")) {
           text[1] = ewl_spinner_new();
           ewl_spinner_set_digits(EWL_SPINNER(text[1]), 0);
           ewl_spinner_set_step(EWL_SPINNER(text[1]), 1);
           sscanf(examine_client_get_val(label), "%d", &tmpi);
           ewl_spinner_set_value(EWL_SPINNER(text[1]), tmpi);
-        } else if (!strcmp(typename, "float")) {
+          if (*range) {
+            sscanf(range, "%d..%d", &mini, &maxi);
+            ewl_spinner_set_min_val(EWL_SPINNER(text[1]), mini);
+            ewl_spinner_set_max_val(EWL_SPINNER(text[1]), maxi);
+          }
+          if (*step) {
+            sscanf(step, "%d", &tmpi);
+            ewl_spinner_set_step(EWL_SPINNER(text[1]), tmpi);
+          }                                            
+        } else if (!strcmp(type, "float")) {
           text[1] = ewl_spinner_new();
 //          ewl_spinner_set_digits(EWL_SPINNER(text[1]), 0);
 //          ewl_spinner_set_step(EWL_SPINNER(text[1]), 1);
           sscanf(examine_client_get_val(label), "%lf", &tmpd);
           ewl_spinner_set_value(EWL_SPINNER(text[1]), tmpd);
-        } else if (!strcmp(typename, "colour"))
+          if (*range) {
+            sscanf(range, "%lf..%lf", &mind, &maxd);
+            ewl_spinner_set_min_val(EWL_SPINNER(text[1]), mind);
+            ewl_spinner_set_max_val(EWL_SPINNER(text[1]), maxd);
+          }
+          if (*step) {
+            sscanf(step, "%lf", &tmpd);
+            ewl_spinner_set_step(EWL_SPINNER(text[1]), tmpd);
+          }
+        } else if (!strcmp(type, "colour"))
           text[1] = ewl_entry_new(examine_client_get_val(label));
         else
           text[1] = ewl_text_new(typename);
+        
 
         ewl_container_append_child(EWL_CONTAINER(cell[0]), text[0]);
         ewl_container_append_child(EWL_CONTAINER(cell[1]), text[1]);




-------------------------------------------------------
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