Enlightenment CVS committal

Author  : rephorm
Project : e17
Module  : proto

Dir     : e17/proto/edje_cc


Modified Files:
        etcher_out.c etcher_parse.c 


Log Message:

output part descriptions also

===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/edje_cc/etcher_out.c,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -3 -r1.1 -r1.2
--- etcher_out.c        9 Sep 2004 13:55:55 -0000       1.1
+++ etcher_out.c        9 Sep 2004 16:03:56 -0000       1.2
@@ -6,7 +6,7 @@
 static void _etcher_output_group(Etcher_Group *group, FILE *out);
 static void _etcher_output_part(Etcher_Part *part, FILE *out);
 static void _etcher_output_program(Etcher_Program *program, FILE *out);
-static void _etcher_output_state(Etcher_Part_State *state, FILE *out);
+static void _etcher_output_state(Etcher_Part *part, Etcher_Part_State *state, FILE 
*out);
 
 
 char *_image_type_string[ETCHER_IMAGE_TYPE_NUM] = {
@@ -141,21 +141,24 @@
   if (group->min.w != 0 || group->min.h != 0)
     fprintf(out, "\t\tmin: %d %d;\n", group->min.w, group->min.h);
 
-  if(group->max.w != 0x7fffffff || group->max.h != 0x7fffffff)
+  if(group->max.w >= 0 || group->max.h >= 0)
     fprintf(out, "\t\tmax: %d %d;\n", group->max.w, group->max.h);
     
   /* data */
-  fprintf(out, "\t\tdata {\n");
-  for (l = group->data; l; l = l->next)
+  if (group->data)
   {
-    Etcher_Data *data = l->data;
-    if (data)
+    fprintf(out, "\t\tdata {\n");
+    for (l = group->data; l; l = l->next)
     {
-        fprintf(out, "\t\t\titem: \"%s\" \"%s\";\n",
-                data->key, data->value);
+      Etcher_Data *data = l->data;
+      if (data)
+      {
+          fprintf(out, "\t\t\titem: \"%s\" \"%s\";\n",
+                  data->key, data->value);
+      }
     }
+    fprintf(out, "\t\t}\n");
   }
-  fprintf(out, "\t\t}\n");
 
   /* script */
   if (group->script)
@@ -189,12 +192,15 @@
   Evas_List *l;
 
   fprintf(out, "\t\t\tpart {\n");
-  fprintf(out, "\t\t\t\tname: \"%s\";\n\t\t\t\ttype: %s;\n\t\t\t\tmouse_events: 
%d;\n\t\t\t\trepeat_events: %d;\n",
-          part->name,
-          _part_type_string[part->type],
-          part->mouse_events,
-          part->repeat_events
-          );
+
+  fprintf(out, "\t\t\t\tname: \"%s\";\n", part->name);
+  fprintf(out, "\t\t\t\ttype: %s;\n", _part_type_string[part->type]); 
+
+  if (!part->mouse_events)
+    fprintf(out, "\t\t\t\tmouse_events: %d;\n", part->mouse_events);
+
+  if (part->repeat_events)
+  fprintf(out, "\t\t\t\trepeat_events: %d;\n", part->repeat_events);
 
   if (part->effect)
     fprintf(out, "\t\t\t\teffect: %s;\n", _text_effect_string[part->effect]);
@@ -203,20 +209,24 @@
     fprintf(out, "\t\t\t\tclip_to: \"%s\";\n", part->clip_to);
 
   if (part->dragable.x || part->dragable.y)
-    fprintf(out, "\t\t\t\tdragable {\n\t\t\t\t\tx: %d %d %d;\n\t\t\t\t\ty: %d %d 
%d;\n\t\t\t\t\tconfine: \"%s\"\n\t\t\t\t}\n",
+  {
+    fprintf(out, "\t\t\t\tdragable {\n");
+    fprintf(out, "\t\t\t\t\tx: %d %d %d;\n\t\t\t\t\ty: %d %d %d;\n",
             part->dragable.x,
             part->dragable.step.x,
             part->dragable.count.x,
             part->dragable.y,
             part->dragable.step.y,
-            part->dragable.count.y,
-            part->dragable.confine ? part->dragable.confine : ""
+            part->dragable.count.y
             );
-
+    if (part->dragable.confine)
+      fprintf(out, "\t\t\t\t\tconfine: \"%s\";\n", part->dragable.confine);
+    fprintf(out, "\t\t\t\t}\n");
+  }
   for (l = part->states; l; l = l->next)
   {
     Etcher_Part_State *state = l->data;
-    if (state) _etcher_output_state(state, out);
+    if (state) _etcher_output_state(part, state, out);
   }
 
 
@@ -258,6 +268,10 @@
             program->state ? program->state : "",
             program->value
             );
+    fprintf(out, "\t\t\t\ttransition: %s %.2f;\n",
+            _transition_string[program->transition],
+            program->duration
+            );
   }
   else if (program->action == ETCHER_ACTION_SIGNAL_EMIT)
   {
@@ -267,35 +281,164 @@
             program->state2
             );
   }
-
-  if(program->action == ETCHER_ACTION_STATE_SET) 
-    fprintf(out, "\t\t\t\ttransition: %s %.2f\n",
-            _transition_string[program->transition],
-            program->duration
-            );
+  else if(program->action == ETCHER_ACTION_SCRIPT) 
+  {
+    if (program->script)
+      fprintf(out, "\t\t\t\tscript {%s\t\t\t\t}\n", program->script);
+  }
 
   if (program->in.from || program->in.range)
-    fprintf(out, "\t\t\t\tin: %.2f %.2f\n",
+    fprintf(out, "\t\t\t\tin: %.2f %.2f;\n",
             program->in.from,
             program->in.range
             );
 
   for (l = program->targets; l; l = l->next)
   {
-    fprintf(out, "\t\t\t\ttarget: \"%s\"\n", (char *)l->data);
+    fprintf(out, "\t\t\t\ttarget: \"%s\";\n", (char *)l->data);
   }
 
   for (l = program->afters; l; l = l->next)
   {
-    fprintf(out, "\t\t\t\tafter: \"%s\"\n", (char *)l->data);
+    fprintf(out, "\t\t\t\tafter: \"%s\";\n", (char *)l->data);
   }
   fprintf(out, "\t\t\t}\n");
 }
 
 
 void
-_etcher_output_state(Etcher_Part_State *state, FILE *out)
+_etcher_output_state(Etcher_Part *part, Etcher_Part_State *state, FILE *out)
 {
-  /* FIXME: fille me in */
+  Evas_List *l;
+  
+  /* NB: many are only written if different from defaults (to save space) */
+
+  fprintf(out, "\t\t\t\tdescription {\n");
+
+  fprintf(out, "\t\t\t\t\tstate: \"%s\" %.2f;\n", state->name, state->value);
+
+  fprintf(out, "\t\t\t\t\tvisible: %d;\n", state->visible);
+
+  if (state->align.x != .5 || state->align.y != .5)
+    fprintf(out, "\t\t\t\t\talign: %.2f %.2f;\n",
+            state->align.x, state->align.y);
+
+  if (state->step.x || state->step.y)
+    fprintf(out, "\t\t\t\t\tstep: %.2f %.2f;\n", state->step.x, state->step.y);
+
+  if (state->min.w > 0 || state->min.h > 0)
+    fprintf(out, "\t\t\t\t\tmin: %d %d;\n", state->min.w, state->min.h);
+
+  if (state->max.w >= 0 || state->max.h >= 0)
+    fprintf(out, "\t\t\t\t\tmax: %d %d;\n", state->max.w, state->max.h);
+
+  if (state->aspect.w || state->aspect.h)
+    fprintf(out, "\t\t\t\t\taspect: %.2f %.2f;\n",
+            state->aspect.w, state->aspect.h);
+
+  if (state->aspect.prefer)
+    fprintf(out, "\t\t\t\t\taspect_preference: %s;\n",
+            _aspect_preference_string[state->aspect.prefer]);
   
+  /* rel 1 */ 
+  fprintf(out, "\t\t\t\t\trel1 {\n");
+  fprintf(out, "\t\t\t\t\t\trelative: %.2f %.2f;\n",
+          state->rel1.relative.x, state->rel1.relative.y);
+  fprintf(out, "\t\t\t\t\t\toffset: %d %d;\n",
+          state->rel1.offset.x, state->rel1.offset.y);
+  if ( state->rel1.to_x || state->rel1.to_y)
+  {
+    if (!strcmp(state->rel1.to_x, state->rel1.to_y))
+    {
+      fprintf(out, "\t\t\t\t\t\tto: \"%s\";\n", state->rel1.to_x);
+    }
+    else
+    {
+      fprintf(out, "\t\t\t\t\t\tto_x: \"%s\";\n", state->rel1.to_x);
+      fprintf(out, "\t\t\t\t\t\tto_y: \"%s\";\n", state->rel1.to_y);
+    }
+  }
+  fprintf(out, "\t\t\t\t\t}\n");
+
+  /* rel 2 */ 
+  fprintf(out, "\t\t\t\t\trel2 {\n");
+  fprintf(out, "\t\t\t\t\t\trelative: %.2f %.2f;\n",
+          state->rel2.relative.x, state->rel2.relative.y);
+  fprintf(out, "\t\t\t\t\t\toffset: %d %d;\n",
+          state->rel2.offset.x, state->rel2.offset.y);
+  if ( state->rel2.to_x || state->rel2.to_y)
+  {
+    if (!strcmp(state->rel2.to_x, state->rel2.to_y))
+    {
+      fprintf(out, "\t\t\t\t\t\tto: \"%s\";\n", state->rel2.to_x);
+    }
+    else
+    {
+      fprintf(out, "\t\t\t\t\t\tto_x: \"%s\";\n", state->rel2.to_x);
+      fprintf(out, "\t\t\t\t\t\tto_y: \"%s\";\n", state->rel2.to_y);
+    }
+  }
+  fprintf(out, "\t\t\t\t\t}\n");
+
+  if (state->color_class)
+    fprintf(out, "\t\t\t\t\tcolor_class: \"%s\";\n", state->color_class);
+
+  if (state->border.l || state->border.r || state->border.t || state->border.b)
+    fprintf(out, "\t\t\t\t\tborder: %d %d %d %d;\n",
+            state->border.l, state->border.r, state->border.t, state->border.b);
+
+  if (state->color.r != 255 && state->color.g != 255 &&
+      state->color.b != 255 && state->color.a != 255)
+    fprintf(out, "\t\t\t\t\tcolor: %d %d %d %d;\n",
+            state->color.r, state->color.g, state->color.b, state->color.a);
+
+  if (state->color2.r != 0 && state->color2.g != 0 &&
+      state->color2.b != 0 && state->color2.a != 255)
+    fprintf(out, "\t\t\t\t\tcolor2: %d %d %d %d;\n",
+            state->color2.r, state->color2.g, state->color2.b, state->color2.a);
+
+  if (state->color3.r != 0 && state->color3.g != 0 &&
+      state->color3.b != 0 && state->color3.a != 128)
+    fprintf(out, "\t\t\t\t\tcolor3: %d %d %d %d;\n",
+            state->color3.r, state->color3.g, state->color3.b, state->color3.a);
+
+  if (part->type == ETCHER_PART_TYPE_IMAGE)
+  {
+    fprintf(out, "\t\t\t\t\timage {\n");
+    fprintf(out, "\t\t\t\t\t\tnormal: \"%s\";\n", state->image.normal->name);
+    for (l = state->image.tween; l; l = l->next)
+    {
+      Etcher_Image *tw = l->data;
+      fprintf(out, "\t\t\t\t\t\ttween: \"%s\";\n", tw->name);
+    }
+    fprintf(out, "\t\t\t\t\t}\n");
+  }
+  else if (part->type == ETCHER_PART_TYPE_TEXT)
+  {
+    fprintf(out, "\t\t\t\t\ttext {\n");
+    if (state->text.text)
+      fprintf(out, "\t\t\t\t\t\ttext: \"%s\";\n", state->text.text);
+    
+    if (state->text.text_class)
+      fprintf(out, "\t\t\t\t\t\ttext_class: \"%s\";\n", state->text.text_class);
+
+    if (state->text.font)
+      fprintf(out, "\t\t\t\t\t\tfont: \"%s\";\n", state->text.font);
+    
+    if (state->text.fit.x || state->text.fit.y)
+      fprintf(out, "\t\t\t\t\t\tfit: %d %d;\n",
+              state->text.fit.x, state->text.fit.y);
+  
+    if (state->text.min.x || state->text.min.y)
+      fprintf(out, "\t\t\t\t\t\tmin: %d %d;\n",
+              state->text.min.x, state->text.min.y);
+
+    if (state->text.align.x || state->text.align.y)
+      fprintf(out, "\t\t\t\t\t\talign: %.2f %.2f;\n",
+              state->text.align.x, state->text.align.y);
+
+    fprintf(out, "\t\t\t\t\t}\n");
+  }
+
+  fprintf(out, "\t\t\t\t}\n");
 }
===================================================================
RCS file: /cvsroot/enlightenment/e17/proto/edje_cc/etcher_parse.c,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -3 -r1.4 -r1.5
--- etcher_parse.c      9 Sep 2004 13:55:55 -0000       1.4
+++ etcher_parse.c      9 Sep 2004 16:03:56 -0000       1.5
@@ -57,8 +57,8 @@
   group = (Etcher_Group *)calloc(1, sizeof(Etcher_Group));
 
   /* defaults */
-  group->max.w = 0x7fffffff;
-  group->max.h = 0x7fffffff;
+  group->max.w = -1;
+  group->max.h = -1;
   
   etcher_file->groups = evas_list_append(etcher_file->groups, group);
   return;
@@ -929,6 +929,7 @@
 
   if(program->script) free(program->script);
   program->script = (char *)strdup(script);
+  program->action = ETCHER_ACTION_SCRIPT;
 }
 
 void




-------------------------------------------------------
This SF.Net email is sponsored by: YOU BE THE JUDGE. Be one of 170
Project Admins to receive an Apple iPod Mini FREE for your judgement on
who ports your project to Linux PPC the best. Sponsored by IBM. 
Deadline: Sept. 13. Go here: http://sf.net/ppc_contest.php
_______________________________________________
enlightenment-cvs mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs

Reply via email to