Enlightenment CVS committal

Author  : davemds
Project : e17
Module  : proto

Dir     : e17/proto/edje_editor/src/bin


Modified Files:
        callbacks.c evas.c interface.c interface.h main.c main.h 


Log Message:
 * All new loading and saving routines of edj file
 * Reflect etk_combobox api change
 * Reflect etk_dialog api change
 * Re-enable image/font insert/manage
 * I have to test and review all this :)


===================================================================
RCS file: /cvs/e/e17/proto/edje_editor/src/bin/callbacks.c,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -3 -r1.15 -r1.16
--- callbacks.c 5 Feb 2007 07:44:18 -0000       1.15
+++ callbacks.c 13 Mar 2007 04:10:33 -0000      1.16
@@ -38,23 +38,20 @@
    {
       case TOOLBAR_NEW:
          printf("Clicked signal on Toolbar Button 'New' EMITTED\n");
-         //ShowFilechooser(FILECHOOSER_NEW);
-         ShowAlert("Not yet implemented");
+         system("edje_editor &");
          break;
       case TOOLBAR_OPEN:
          printf("Clicked signal on Toolbar Button 'Open' EMITTED\n");
          //ShowAlert("Not yet implemented");
          ShowFilechooser(FILECHOOSER_OPEN);
          break;
-      case TOOLBAR_SAVE:
+      case TOOLBAR_SAVE_EDC:
          printf("Clicked signal on Toolbar Button 'Save' EMITTED\n");
-         //SaveEDC(NULL);
-         ShowAlert("Not yet implemented");
+         ShowFilechooser(FILECHOOSER_SAVE_EDC);
          break;
-      case TOOLBAR_SAVE_AS:
-         printf("Clicked signal on Toolbar Button 'Save as' EMITTED\n");
-         //ShowFilechooser(FILECHOOSER_SAVE_AS);
-         ShowAlert("Not yet implemented");
+      case TOOLBAR_SAVE_EDJ:
+         printf("Clicked signal on Toolbar Button 'Save edj' EMITTED\n");
+         ShowFilechooser(FILECHOOSER_SAVE_EDJ);
          break;
       case TOOLBAR_ADD:
          printf("Clicked signal on Toolbar Button 'Add' EMITTED\n");
@@ -108,16 +105,12 @@
          //printf("ZOOM: %d %d - %d %d\n",x,y,w,h);
          break;
       case TOOLBAR_IMAGE_FILE_ADD:
-         ShowAlert("Not yet implemented =)");
-         //printf("INSERT IMAGE\n");
-         //if (EDCFile->len > 0) ShowFilechooser(FILECHOOSER_IMAGE);
-         //e   lse ShowAlert("You have to save the file once for insert 
image.");
-            break;
+         if (engrave_file_image_dir_get(Cur.ef)) 
ShowFilechooser(FILECHOOSER_IMAGE);
+         else ShowAlert("You have to save the file once for insert image.");
+         break;
       case TOOLBAR_FONT_FILE_ADD:
-         ShowAlert("Not yet implemented =)");
-         //printf("INSERT FONT\n");
-         //i   f (EDCFile->len > 0) ShowFilechooser(FILECHOOSER_FONT);
-         //else ShowAlert("You have to save the file once for insert font.");
+         if (engrave_file_font_dir_get(Cur.ef)) 
ShowFilechooser(FILECHOOSER_FONT);
+         else ShowAlert("You have to save the file once for insert font.");
          break;
    }
 }
@@ -240,7 +233,7 @@
       ev_resize_fake(w,h);
       edje_object_part_text_set (EV_fakewin, "title", Cur.eg->name);
 
-      engrave_canvas_current_group_set (ecanvas, Cur.eg);
+      engrave_canvas_current_group_set (engrave_canvas, Cur.eg);
    }
    ev_redraw();
 }
@@ -580,22 +573,20 @@
 }
 
 /* Text Frame Callbacks */
-void on_FontComboBox_changed(Etk_Combobox *combobox, void *data){
+void 
+on_FontComboBox_changed(Etk_Combobox *combobox, void *data)
+{
    printf("Changed Signal on FontComboBox EMITTED \n");
-/*    char* font;
-   if ((font = etk_combobox_item_data_get(etk_combobox_active_item_get 
(combobox)))){
+   Engrave_Font *ef;
+   if ((ef = 
etk_combobox_item_data_get(etk_combobox_active_item_get(combobox)))){
       //Set an existing font
-      if (selected_desc){
-   g_string_printf(selected_desc->text_font,"%s",font);
-   ev_draw_part(selected_part);
-
+      if (Cur.eps){
+         printf("selected font: %s\n", engrave_font_name_get (ef));
+         engrave_part_state_text_font_set(Cur.eps,engrave_font_name_get(ef));
+         printf("changed font: %s\n", 
engrave_part_state_text_font_get(Cur.eps));
+         ev_redraw();
       }
    }
-   else{
-      //Insert a new font in EDC
-      printf("INSERT FONT\n");
-      ShowFilechooser(FILECHOOSER_FONT);
-   } */
 }
 
 void 
@@ -618,9 +609,7 @@
 on_FontSizeSpinner_value_changed(Etk_Range *range, double value, void *data)
 {
    printf("Value Changed Signal on FontSizeSpinner EMITTED (value: 
%d)\n",(int)etk_range_value_get(range));
-
    engrave_part_state_text_size_set(Cur.eps,(int)etk_range_value_get(range));
-
    ev_redraw();
 }
 
@@ -628,10 +617,7 @@
 on_TextEntry_text_changed(Etk_Object *object, void *data)
 {
    printf("Text Changed Signal on TextEntry EMITTED (value 
%s)\n",etk_entry_text_get(ETK_ENTRY(object)));
-
    
engrave_part_state_text_text_set(Cur.eps,etk_entry_text_get(ETK_ENTRY(object)));
-
-
    ev_redraw();
 }
 
@@ -671,7 +657,7 @@
       etk_widget_hide(UI_DurationLabel);
       etk_widget_show(UI_Param1Entry);
       etk_widget_show(UI_Param1Label);
-      etk_label_set(UI_Param1Label, "<b>Signal</b>");
+      etk_label_set(ETK_LABEL(UI_Param1Label), "<b>Signal</b>");
       etk_widget_hide(UI_Param1Spinner);
       etk_widget_show(UI_Param2Label);
       etk_widget_show(UI_Param2Entry);
@@ -686,7 +672,7 @@
       etk_widget_show(UI_DurationLabel);
       etk_widget_show(UI_Param1Entry);
       etk_widget_show(UI_Param1Label);
-      etk_label_set(UI_Param1Label, "<b>State</b>");
+      etk_label_set(ETK_LABEL(UI_Param1Label), "<b>State</b>");
       etk_widget_show(UI_Param1Spinner);
       etk_widget_hide(UI_Param2Label);
       etk_widget_hide(UI_Param2Entry);
@@ -1198,7 +1184,8 @@
 void
 on_FileChooser_response(Etk_Dialog *dialog, int response_id, void *data)
 {
-   Etk_String *cmd = etk_string_new("");
+   char cmd[4096];
+   int ret = 0;
 
    printf("Response Signal on Filechooser EMITTED\n");
 
@@ -1206,75 +1193,86 @@
 
       switch(FileChooserOperation){
          case FILECHOOSER_OPEN:
-            etk_string_append_printf(cmd,"edje_editor %s/%s &",
+            snprintf(cmd,4096,"edje_editor %s/%s &",
                etk_filechooser_widget_current_folder_get 
(ETK_FILECHOOSER_WIDGET(UI_FileChooser)),
                etk_filechooser_widget_selected_file_get 
(ETK_FILECHOOSER_WIDGET(UI_FileChooser)));
-            system(cmd->string);
-
-
+            system(cmd);
          break;
-       /*   case FILECHOOSER_NEW:
-            //printf("new: 
%s\n",etk_entry_text_get(UI_FilechooserFileNameEntry));
-            ClearAll();
-            CreateBlankEDC();
-            
g_string_printf(EDCFile,"%s",etk_entry_text_get(ETK_ENTRY(UI_FilechooserFileNameEntry)));
-            g_string_printf(EDCFileDir,"%s",g_path_get_dirname(EDCFile->str));
-            UpdateWindowTitle();
+         case FILECHOOSER_SAVE_EDJ:
+            printf("SAVE EDJ\n");
+            engrave_edj_output(Cur.ef,
+            (char*)etk_entry_text_get(ETK_ENTRY(UI_FilechooserFileNameEntry)));
+         break;
+         case FILECHOOSER_SAVE_EDC:
+            printf("SAVE EDC\n");
+            engrave_edc_output(Cur.ef,
+            (char*)etk_entry_text_get(ETK_ENTRY(UI_FilechooserFileNameEntry)));
          break;
          case FILECHOOSER_IMAGE:
             printf("new image: 
%s\n",etk_entry_text_get(ETK_ENTRY(UI_FilechooserFileNameEntry)));
-            if (selected_desc){
+            if (Cur.eps){
                //If the new image is not in the edc dir
-               if (strcmp(etk_filechooser_widget_current_folder_get 
(ETK_FILECHOOSER_WIDGET(UI_FileChooser)),EDCFileDir->str)){
-                  //TODO check if image already exist in the EDCFileDir
-                  //Copy the image to the EDCDir
-                  
FileCopy((char*)etk_entry_text_get(ETK_ENTRY(UI_FilechooserFileNameEntry)),EDCFileDir->str);
+               if (strcmp(etk_filechooser_widget_current_folder_get 
(ETK_FILECHOOSER_WIDGET(UI_FileChooser)),engrave_file_image_dir_get(Cur.ef))){
+                  //TODO check if image already exist
+                  //Copy the image to the image_dir
+                  snprintf(cmd, 4096, "cp %s %s", 
etk_entry_text_get(ETK_ENTRY(UI_FilechooserFileNameEntry)), 
engrave_file_image_dir_get(Cur.ef));
+                  ret = system(cmd);
+                  if (ret < 0) {
+                     ShowAlert("Error: unable to copy image!");
+                     return;
+                  }
                }
-               //Set the image name
-               
g_string_printf(selected_desc->image_normal,"%s",etk_filechooser_widget_selected_file_get
 (ETK_FILECHOOSER_WIDGET(UI_FileChooser)));
-               UpdateImageFrame();
-               ev_draw_part(selected_part);
-
-               UpdateImageComboBox();
+               //Set the new image
+               Engrave_Image* eimg;
+               eimg = 
engrave_image_new(etk_filechooser_widget_selected_file_get(ETK_FILECHOOSER_WIDGET(UI_FileChooser)),ENGRAVE_IMAGE_TYPE_LOSSY,95);
  
+               engrave_file_image_add(Cur.ef,eimg);     
+               engrave_part_state_image_normal_set(Cur.eps,eimg);
+               
+               PopulateImagesComboBox();
                UpdateImageFrame();
+               ev_redraw();
             }
          break;
          case FILECHOOSER_FONT:
             printf("new font: 
%s\n",etk_entry_text_get(ETK_ENTRY(UI_FilechooserFileNameEntry)));
-            if (selected_desc){
+            if (Cur.eps){
                //If the new font is not in the edc dir
-               if (strcmp(etk_filechooser_widget_current_folder_get 
(ETK_FILECHOOSER_WIDGET(UI_FileChooser)),EDCFileDir->str)){
+               if (strcmp(etk_filechooser_widget_current_folder_get 
(ETK_FILECHOOSER_WIDGET(UI_FileChooser)),engrave_file_font_dir_get(Cur.ef))){
                   //TODO check if font already exist in the EDCFileDir
                   //Copy the font to the EDCDir
-                  
FileCopy((char*)etk_entry_text_get(ETK_ENTRY(UI_FilechooserFileNameEntry)),EDCFileDir->str);
+                  snprintf(cmd, 4096, "cp %s %s", 
etk_entry_text_get(ETK_ENTRY(UI_FilechooserFileNameEntry)), 
engrave_file_font_dir_get(Cur.ef));
+                  ret = system(cmd);
+                  if (ret < 0) {
+                     ShowAlert("Error: unable to copy font!");
+                     return;
+                  }
                }
-               //Set the font name
-               
g_string_printf(selected_desc->text_font,"%s",etk_filechooser_widget_selected_file_get
 (ETK_FILECHOOSER_WIDGET(UI_FileChooser)));
-
-               UpdateFontComboBox();
+               //Set the new font
+               Engrave_Font *efont;
+               efont = engrave_font_new(
+                  
etk_filechooser_widget_selected_file_get(ETK_FILECHOOSER_WIDGET(UI_FileChooser)),
+                  
etk_filechooser_widget_selected_file_get(ETK_FILECHOOSER_WIDGET(UI_FileChooser)));
+               engrave_file_font_add(Cur.ef,efont);     
+               
engrave_part_state_text_font_set(Cur.eps,etk_filechooser_widget_selected_file_get(ETK_FILECHOOSER_WIDGET(UI_FileChooser)));
 
+               PopulateFontsComboBox();
                UpdateTextFrame();
-               ev_draw_part(selected_part);
+               ev_redraw();
             }
          break;
-         case FILECHOOSER_SAVE_AS:
-            
SaveEDC((char*)etk_entry_text_get(ETK_ENTRY(UI_FilechooserFileNameEntry)));
-         break; */
       }
       etk_widget_hide(ETK_WIDGET(dialog));
    }
    else{
       etk_widget_hide(ETK_WIDGET(dialog));
    }
-   etk_object_destroy(ETK_OBJECT(cmd));
 }
 
 void 
 on_FileChooser_row_selected(Etk_Object *object, Etk_Tree_Row *row, void *data)
 {
    Etk_String *str=etk_string_new("");
-
-
+   
    if (etk_filechooser_widget_current_folder_get 
(ETK_FILECHOOSER_WIDGET(UI_FileChooser)))
      
etk_string_append_printf(str,"%s/",etk_filechooser_widget_current_folder_get(ETK_FILECHOOSER_WIDGET(UI_FileChooser)));
 
@@ -1283,6 +1281,7 @@
 
 
    etk_entry_text_set(ETK_ENTRY(UI_FilechooserFileNameEntry),str->string);
+   
    etk_object_destroy(ETK_OBJECT(str));
 }
 
===================================================================
RCS file: /cvs/e/e17/proto/edje_editor/src/bin/evas.c,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -3 -r1.11 -r1.12
--- evas.c      5 Feb 2007 07:44:18 -0000       1.11
+++ evas.c      13 Mar 2007 04:10:34 -0000      1.12
@@ -162,8 +162,8 @@
    edje_object_file_set(rel2Y_parent_handler, EdjeFile, "Rel2Y_ParentH");
 
    //Create engrave canvas
-   ecanvas = engrave_canvas_new (etk_widget_toplevel_evas_get(ETK_canvas));
-   etk_canvas_object_add (ETK_CANVAS(ETK_canvas), ecanvas);
+   engrave_canvas = engrave_canvas_new 
(etk_widget_toplevel_evas_get(ETK_canvas));
+   etk_canvas_object_add (ETK_CANVAS(ETK_canvas), engrave_canvas);
 
    // Create Fake win
    EV_fakewin = edje_object_add(etk_widget_toplevel_evas_get(ETK_canvas));
@@ -378,10 +378,10 @@
       evas_object_geometry_get(EV_fakewin,&x,&y,&w,&h);
 
       //place engrave canvas
-      evas_object_move(ecanvas, x, y);
-      evas_object_resize(ecanvas,w+1,h);  //This make engrave_canvas redraw
+      evas_object_move(engrave_canvas, x, y);
+      evas_object_resize(engrave_canvas,w+1,h);  //This make engrave_canvas 
redraw
 
-      evas_object_show(ecanvas);
+      evas_object_show(engrave_canvas);
       evas_object_show(EV_fakewin);
       evas_object_show(EV_movebox);
       evas_object_raise(EV_fakewin);
@@ -391,7 +391,7 @@
 
    }else
    {
-      evas_object_hide(ecanvas);
+      evas_object_hide(engrave_canvas);
       evas_object_hide(EV_fakewin);
       evas_object_hide(EV_movebox);
       evas_object_hide(rel1X_parent_handler);
===================================================================
RCS file: /cvs/e/e17/proto/edje_editor/src/bin/interface.c,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- interface.c 5 Feb 2007 07:44:18 -0000       1.18
+++ interface.c 13 Mar 2007 04:10:34 -0000      1.19
@@ -449,11 +449,12 @@
 UpdateTextFrame(void)
 {
    int eff_num = 0;
-   //int i;
+   int i;
    //int alpha;
    int r, g, b;
-   //Etk_Combobox_Item *item = NULL;
-   //char* font;
+   Etk_Combobox_Item *item = NULL;
+   char* font;
+   Engrave_Font *ef;
 
    if (Cur.eps){
       printf("Update Text Frame: %s\n",Cur.eps->name);
@@ -467,20 +468,21 @@
          engrave_part_state_text_text_get(Cur.eps));
 
 
-      /*//Set the font combobox
-      if (selected_desc->text_font->len > 0){
-      i=0;
-      while ((item = 
etk_combobox_nth_item_get(ETK_COMBOBOX(UI_FontComboBox),i))){
-       //Loop for all the item in the Combobox
-       if ((font = etk_combobox_item_data_get(item))){
-          //Get the data for the item (should be an char* with the name of the 
font file)
-          if (strcmp(font ,selected_desc->text_font->str) == 0)
-       etk_combobox_active_item_set (ETK_COMBOBOX(UI_FontComboBox),item);      
//If we found the item set active
-       }
-       i++;
-    }
+      //Set the font combobox
+      if (Cur.eps->text.font){//selected_desc->text_font->len > 0){
+         i=0;
+         //Loop for all the item in the Combobox
+         while ((item = 
etk_combobox_nth_item_get(ETK_COMBOBOX(UI_FontComboBox),i))){
+            //Get the data for the item (should be an Engrave_font*)         
+            if ((ef = etk_combobox_item_data_get(item))){
+               printf("ITEM: %s - 
%s\n",engrave_font_name_get(ef),engrave_part_state_text_font_get(Cur.eps));
+               if (strcmp(engrave_font_name_get(ef), Cur.eps->text.font) == 0)
+                  etk_combobox_active_item_set 
(ETK_COMBOBOX(UI_FontComboBox),item);   //If we found the item set active
+            }
+            i++;
+         }
       }else{etk_combobox_active_item_set (ETK_COMBOBOX(UI_FontComboBox), 
etk_combobox_nth_item_get(ETK_COMBOBOX(UI_FontComboBox),0));}
-*/
+
       //Set the font size spinner
       etk_range_value_set (ETK_RANGE(UI_FontSizeSpinner), 
          (float)engrave_part_state_text_size_get(Cur.eps));
@@ -667,7 +669,7 @@
    if (!Cur.epr)
       return;
    
-   printf("Update Program: '%s' params: %s %s %d 
%d\n",Cur.epr->name,Cur.epr->state,Cur.epr->state2,Cur.epr->value,Cur.epr->value2);
+   printf("Update Program: '%s\n",Cur.epr->name);
    
    //Stop signal propagation
    etk_signal_block("text_changed", ETK_OBJECT(UI_ProgramEntry),
@@ -804,14 +806,30 @@
 void
 ShowFilechooser(int FileChooserType)
 {
-   FileChooserOperation = FileChooserType;
-   if (FileChooserType == FILECHOOSER_OPEN) 
etk_window_title_set(ETK_WINDOW(UI_FileChooserDialog), "Choose an EDC file to 
open");
-   if (FileChooserType == FILECHOOSER_NEW) 
etk_window_title_set(ETK_WINDOW(UI_FileChooserDialog), "Choose a name for the 
new EDC");
-   if (FileChooserType == FILECHOOSER_IMAGE) 
etk_window_title_set(ETK_WINDOW(UI_FileChooserDialog), "Choose an image to 
import");
-   if (FileChooserType == FILECHOOSER_FONT) 
etk_window_title_set(ETK_WINDOW(UI_FileChooserDialog), "Choose an font to 
import");
-   if (FileChooserType == FILECHOOSER_SAVE_AS) 
etk_window_title_set(ETK_WINDOW(UI_FileChooserDialog), "Choose a new name");
-
    etk_widget_show_all(UI_FileChooserDialog);
+   
+   FileChooserOperation = FileChooserType;
+   switch(FileChooserType){
+      case FILECHOOSER_OPEN:
+         etk_window_title_set(ETK_WINDOW(UI_FileChooserDialog), "Choose an EDJ 
or EDC file to open");
+         etk_widget_hide(UI_FilechooserFileNameLabel);
+         etk_widget_hide(UI_FilechooserFileNameEntry);
+      break;
+      case FILECHOOSER_IMAGE:
+         etk_window_title_set(ETK_WINDOW(UI_FileChooserDialog), "Choose an 
image to import");
+      break;
+      case FILECHOOSER_FONT:
+         etk_window_title_set(ETK_WINDOW(UI_FileChooserDialog), "Choose an 
font to import");
+      break;
+      case FILECHOOSER_SAVE_EDJ:
+          etk_window_title_set(ETK_WINDOW(UI_FileChooserDialog), "Choose the 
new edje name");
+      break;
+      case FILECHOOSER_SAVE_EDC:
+          etk_window_title_set(ETK_WINDOW(UI_FileChooserDialog), "Choose the 
new edc name");
+      break;
+      default:
+      break;
+   }
 }
 
 /* functions to create interface*/
@@ -831,7 +849,8 @@
    etk_widget_size_request_set(dialog, 400, 300);
 
    vbox = etk_vbox_new(ETK_FALSE, 10);
-   etk_dialog_pack_in_main_area(ETK_DIALOG(dialog), vbox, ETK_TRUE, ETK_TRUE, 
0, ETK_FALSE);
+   etk_dialog_pack_in_main_area(ETK_DIALOG(dialog), vbox,
+      ETK_BOX_START, ETK_BOX_EXPAND_FILL,0);
 
    label = etk_label_new("<b>Executing_edje_cc</>");
    etk_object_properties_set (ETK_OBJECT(label), "xalign",0.5,NULL);
@@ -856,46 +875,46 @@
 create_filechooser_dialog(void)
 {
    Etk_Widget *dialog = NULL;
-   Etk_Widget *label = NULL;
    Etk_Widget *file_tree = NULL;
    Etk_Widget *places_tree = NULL;
    Etk_Widget *fav_tree = NULL;
 
    //Dialog
    dialog = etk_dialog_new();
+   etk_object_properties_set (ETK_OBJECT(dialog), 
"action_area_homogeneous",ETK_FALSE,NULL);
    etk_signal_connect("delete_event", ETK_OBJECT(dialog), 
ETK_CALLBACK(etk_window_hide_on_delete), NULL);
    etk_signal_connect("response", ETK_OBJECT(dialog), 
ETK_CALLBACK(on_FileChooser_response), NULL);
 
    //Filechooser
    UI_FileChooser = etk_filechooser_widget_new();
-   etk_dialog_pack_in_main_area(ETK_DIALOG(dialog), UI_FileChooser, ETK_TRUE, 
ETK_TRUE, 0, ETK_FALSE);
+   etk_dialog_pack_in_main_area(ETK_DIALOG(dialog), UI_FileChooser,
+      ETK_BOX_START, ETK_BOX_EXPAND_FILL,0);
 
    file_tree = ETK_FILECHOOSER_WIDGET(UI_FileChooser)->files_tree;
    etk_signal_connect("row_clicked", ETK_OBJECT(file_tree), 
ETK_CALLBACK(on_FileChooser_row_selected), NULL);
-   etk_signal_connect("row_selected", ETK_OBJECT(file_tree), 
ETK_CALLBACK(on_FileChooser_row_selected), NULL);
+   //etk_signal_connect("row_selected", ETK_OBJECT(file_tree), 
ETK_CALLBACK(on_FileChooser_row_selected), NULL);
    places_tree = ETK_FILECHOOSER_WIDGET(UI_FileChooser)->places_tree;
    etk_signal_connect("row_clicked", ETK_OBJECT(places_tree), 
ETK_CALLBACK(on_FileChooser_row_selected), NULL);
-   etk_signal_connect("row_selected", ETK_OBJECT(places_tree), 
ETK_CALLBACK(on_FileChooser_row_selected), NULL);
+   //etk_signal_connect("row_selected", ETK_OBJECT(places_tree), 
ETK_CALLBACK(on_FileChooser_row_selected), NULL);
    fav_tree = ETK_FILECHOOSER_WIDGET(UI_FileChooser)->fav_tree;
    etk_signal_connect("row_clicked", ETK_OBJECT(fav_tree), 
ETK_CALLBACK(on_FileChooser_row_selected), NULL);
-   etk_signal_connect("row_selected", ETK_OBJECT(fav_tree), 
ETK_CALLBACK(on_FileChooser_row_selected), NULL);
+   //etk_signal_connect("row_selected", ETK_OBJECT(fav_tree), 
ETK_CALLBACK(on_FileChooser_row_selected), NULL);
 
    //label
-   label = etk_label_new("<b>File</b>");
-   etk_object_properties_set (ETK_OBJECT(label), "xalign",1.0,NULL);
-   
etk_dialog_pack_widget_in_action_area(ETK_DIALOG(dialog),label,FALSE,TRUE,10,FALSE);
+   UI_FilechooserFileNameLabel = etk_label_new("<b>File</b>");
+   etk_object_properties_set (ETK_OBJECT(UI_FilechooserFileNameLabel), 
"xalign",1.0,NULL);
+   
etk_dialog_pack_widget_in_action_area(ETK_DIALOG(dialog),UI_FilechooserFileNameLabel,
+      ETK_BOX_START, ETK_BOX_NONE,0);
 
    //FileNameEntry
    UI_FilechooserFileNameEntry = etk_entry_new();
+   etk_dialog_pack_widget_in_action_area(ETK_DIALOG(dialog),
+      UI_FilechooserFileNameEntry, ETK_BOX_START, ETK_BOX_EXPAND_FILL,0);
 
-   
etk_dialog_pack_widget_in_action_area(ETK_DIALOG(dialog),UI_FilechooserFileNameEntry,TRUE,TRUE,0,FALSE);
-   /*    Etk_Bool  expand,
-      Etk_Bool  fill,
-      int      padding,
-      Etk_Bool pack_at_end
-    */
-   etk_dialog_button_add_from_stock(ETK_DIALOG(dialog),ETK_STOCK_DOCUMENT_OPEN 
,ETK_RESPONSE_OK );
-   etk_dialog_button_add_from_stock(ETK_DIALOG(dialog),ETK_STOCK_DIALOG_CANCEL 
,ETK_RESPONSE_CANCEL );
+   etk_dialog_button_add_from_stock(ETK_DIALOG(dialog),
+      ETK_STOCK_DOCUMENT_OPEN ,ETK_RESPONSE_OK );
+   etk_dialog_button_add_from_stock(ETK_DIALOG(dialog),
+      ETK_STOCK_DIALOG_CANCEL, ETK_RESPONSE_CANCEL );
 
    return dialog;
 }
@@ -958,15 +977,17 @@
    etk_toolbar_append(ETK_TOOLBAR(ToolBar), button);
    etk_signal_connect("clicked", ETK_OBJECT(button), 
ETK_CALLBACK(on_AllButton_click), (void*)TOOLBAR_OPEN);
 
-   //SaveButton
+   //SaveEDJButton
    button = etk_tool_button_new_from_stock(ETK_STOCK_DOCUMENT_SAVE);
+   etk_object_properties_set(ETK_OBJECT(button),"label","Save edc",NULL);
    etk_toolbar_append(ETK_TOOLBAR(ToolBar), button);
-   etk_signal_connect("clicked", ETK_OBJECT(button), 
ETK_CALLBACK(on_AllButton_click), (void*)TOOLBAR_SAVE);
+   etk_signal_connect("clicked", ETK_OBJECT(button), 
ETK_CALLBACK(on_AllButton_click), (void*)TOOLBAR_SAVE_EDC);
 
-   //SaveAsButton
+   //SaveEDJButton
    button = etk_tool_button_new_from_stock(ETK_STOCK_DOCUMENT_SAVE_AS);
+   etk_object_properties_set(ETK_OBJECT(button),"label","Save edj",NULL);
    etk_toolbar_append(ETK_TOOLBAR(ToolBar), button);
-   etk_signal_connect("clicked", ETK_OBJECT(button), 
ETK_CALLBACK(on_AllButton_click), (void*)TOOLBAR_SAVE_AS);
+   etk_signal_connect("clicked", ETK_OBJECT(button), 
ETK_CALLBACK(on_AllButton_click), (void*)TOOLBAR_SAVE_EDJ);
 
    sep = etk_hseparator_new();
    etk_toolbar_append(ETK_TOOLBAR(ToolBar), sep);
@@ -1240,7 +1261,7 @@
 
    //UI_AspectCombo
    UI_AspectComboBox = etk_combobox_new();
-   etk_combobox_column_add(ETK_COMBOBOX(UI_AspectComboBox), 
ETK_COMBOBOX_LABEL, 30, ETK_TRUE, ETK_FALSE, ETK_FALSE, 0.0, 0.5);
+   etk_combobox_column_add(ETK_COMBOBOX(UI_AspectComboBox), 
ETK_COMBOBOX_LABEL, 30, ETK_COMBOBOX_NONE, 0.0);
    etk_combobox_build(ETK_COMBOBOX(UI_AspectComboBox));
    etk_box_append(ETK_BOX(hbox),UI_AspectComboBox, ETK_BOX_START, 
ETK_BOX_NONE, 0);
 
@@ -1342,8 +1363,8 @@
 
    //imageComboBox
    UI_ImageComboBox = etk_combobox_new();
-   etk_combobox_column_add(ETK_COMBOBOX(UI_ImageComboBox), ETK_COMBOBOX_IMAGE, 
24, ETK_FALSE, ETK_TRUE, ETK_TRUE, 0.0, 0.5);
-   etk_combobox_column_add(ETK_COMBOBOX(UI_ImageComboBox), ETK_COMBOBOX_LABEL, 
75, ETK_TRUE, ETK_FALSE, ETK_FALSE, 0.0, 0.5);
+   etk_combobox_column_add(ETK_COMBOBOX(UI_ImageComboBox), ETK_COMBOBOX_IMAGE, 
24, ETK_COMBOBOX_NONE, 0.0);
+   etk_combobox_column_add(ETK_COMBOBOX(UI_ImageComboBox), ETK_COMBOBOX_LABEL, 
75, ETK_COMBOBOX_NONE, 0.0);
    etk_combobox_build(ETK_COMBOBOX(UI_ImageComboBox));
    etk_table_attach_default (ETK_TABLE(table),UI_ImageComboBox, 1, 3, 0, 0);
 
@@ -1447,8 +1468,8 @@
 
    //FontComboBox
    UI_FontComboBox = etk_combobox_new();
-   etk_combobox_column_add(ETK_COMBOBOX(UI_FontComboBox), ETK_COMBOBOX_IMAGE, 
24, ETK_FALSE, ETK_TRUE, ETK_TRUE, 0.0, 0.5);
-   etk_combobox_column_add(ETK_COMBOBOX(UI_FontComboBox), ETK_COMBOBOX_LABEL, 
75, ETK_TRUE, ETK_FALSE, ETK_FALSE, 0.0, 0.5);
+   etk_combobox_column_add(ETK_COMBOBOX(UI_FontComboBox), ETK_COMBOBOX_IMAGE, 
24, ETK_COMBOBOX_NONE, 0.0);
+   etk_combobox_column_add(ETK_COMBOBOX(UI_FontComboBox), ETK_COMBOBOX_LABEL, 
75, ETK_COMBOBOX_NONE, 0.0);
    etk_combobox_build(ETK_COMBOBOX(UI_FontComboBox));
    etk_table_attach_default (ETK_TABLE(table),UI_FontComboBox, 1, 1, 1,1);
 
@@ -1473,9 +1494,9 @@
    //PartEffectComboBox
    UI_EffectComboBox = etk_combobox_new();
    etk_combobox_column_add(ETK_COMBOBOX(UI_EffectComboBox), 
-      ETK_COMBOBOX_IMAGE, 24, ETK_FALSE, ETK_TRUE, ETK_TRUE, 0.0, 0.5);
+      ETK_COMBOBOX_IMAGE, 24, ETK_COMBOBOX_NONE, 0.0);
    etk_combobox_column_add(ETK_COMBOBOX(UI_EffectComboBox),
-      ETK_COMBOBOX_LABEL, 75, ETK_TRUE, ETK_FALSE, ETK_FALSE, 0.0, 0.5);
+      ETK_COMBOBOX_LABEL, 75, ETK_COMBOBOX_NONE, 0.0);
    etk_combobox_build(ETK_COMBOBOX(UI_EffectComboBox));
    ComboItem = etk_combobox_item_append(ETK_COMBOBOX(UI_EffectComboBox),
       etk_image_new_from_edje (EdjeFile,"NONE.PNG"), "Plain");
@@ -1590,8 +1611,10 @@
 
    //Rel1ToXCombobox
    UI_Rel1ToXComboBox = etk_combobox_new();
-   etk_combobox_column_add(ETK_COMBOBOX(UI_Rel1ToXComboBox), 
ETK_COMBOBOX_IMAGE, 24, ETK_FALSE, ETK_TRUE, ETK_TRUE, 0.0, 0.5);
-   etk_combobox_column_add(ETK_COMBOBOX(UI_Rel1ToXComboBox), 
ETK_COMBOBOX_LABEL, 75, ETK_TRUE, ETK_FALSE, ETK_FALSE, 0.0, 0.5);
+   etk_combobox_column_add(ETK_COMBOBOX(UI_Rel1ToXComboBox),
+      ETK_COMBOBOX_IMAGE, 24, ETK_COMBOBOX_NONE, 0.0);
+   etk_combobox_column_add(ETK_COMBOBOX(UI_Rel1ToXComboBox),
+      ETK_COMBOBOX_LABEL, 75, ETK_COMBOBOX_NONE, 0.0);
    etk_combobox_build(ETK_COMBOBOX(UI_Rel1ToXComboBox));
    etk_box_append(ETK_BOX(hbox), UI_Rel1ToXComboBox, ETK_BOX_START, 
ETK_BOX_EXPAND_FILL, 0);
 
@@ -1622,8 +1645,10 @@
 
    //Rel1ToYCombobox
    UI_Rel1ToYComboBox = etk_combobox_new();
-   etk_combobox_column_add(ETK_COMBOBOX(UI_Rel1ToYComboBox), 
ETK_COMBOBOX_IMAGE, 24, ETK_FALSE, ETK_TRUE, ETK_TRUE, 0.0, 0.5);
-   etk_combobox_column_add(ETK_COMBOBOX(UI_Rel1ToYComboBox), 
ETK_COMBOBOX_LABEL, 75, ETK_TRUE, ETK_FALSE, ETK_FALSE, 0.0, 0.5);
+   etk_combobox_column_add(ETK_COMBOBOX(UI_Rel1ToYComboBox),
+      ETK_COMBOBOX_IMAGE, 24, ETK_COMBOBOX_NONE, 0.0);
+   etk_combobox_column_add(ETK_COMBOBOX(UI_Rel1ToYComboBox),
+      ETK_COMBOBOX_LABEL, 75, ETK_COMBOBOX_NONE, 0.0);
    etk_combobox_build(ETK_COMBOBOX(UI_Rel1ToYComboBox));
    etk_box_append(ETK_BOX(hbox), UI_Rel1ToYComboBox, ETK_BOX_START, 
ETK_BOX_EXPAND_FILL, 0);
 
@@ -1658,8 +1683,10 @@
 
    //Rel2ToXCombobox
    UI_Rel2ToXComboBox = etk_combobox_new();
-   etk_combobox_column_add(ETK_COMBOBOX(UI_Rel2ToXComboBox), 
ETK_COMBOBOX_IMAGE, 24, ETK_FALSE, ETK_TRUE, ETK_TRUE, 0.0, 0.5);
-   etk_combobox_column_add(ETK_COMBOBOX(UI_Rel2ToXComboBox), 
ETK_COMBOBOX_LABEL, 75, ETK_TRUE, ETK_FALSE, ETK_FALSE, 0.0, 0.5);
+   etk_combobox_column_add(ETK_COMBOBOX(UI_Rel2ToXComboBox),
+      ETK_COMBOBOX_IMAGE, 24, ETK_COMBOBOX_NONE, 0.0);
+   etk_combobox_column_add(ETK_COMBOBOX(UI_Rel2ToXComboBox),
+      ETK_COMBOBOX_LABEL, 75, ETK_COMBOBOX_NONE, 0.0);
    etk_combobox_build(ETK_COMBOBOX(UI_Rel2ToXComboBox));
    etk_box_append(ETK_BOX(hbox), UI_Rel2ToXComboBox, ETK_BOX_START, 
ETK_BOX_EXPAND_FILL, 0);
 
@@ -1690,8 +1717,10 @@
 
    //Rel1ToYCombobox
    UI_Rel2ToYComboBox = etk_combobox_new();
-   etk_combobox_column_add(ETK_COMBOBOX(UI_Rel2ToYComboBox), 
ETK_COMBOBOX_IMAGE, 24, ETK_FALSE, ETK_TRUE, ETK_TRUE, 0.0, 0.5);
-   etk_combobox_column_add(ETK_COMBOBOX(UI_Rel2ToYComboBox), 
ETK_COMBOBOX_LABEL, 75, ETK_TRUE, ETK_FALSE, ETK_FALSE, 0.0, 0.5);
+   etk_combobox_column_add(ETK_COMBOBOX(UI_Rel2ToYComboBox),
+      ETK_COMBOBOX_IMAGE, 24, ETK_COMBOBOX_NONE, 0.0);
+   etk_combobox_column_add(ETK_COMBOBOX(UI_Rel2ToYComboBox),
+      ETK_COMBOBOX_LABEL, 75, ETK_COMBOBOX_NONE, 0.0);
    etk_combobox_build(ETK_COMBOBOX(UI_Rel2ToYComboBox));
    etk_box_append(ETK_BOX(hbox), UI_Rel2ToYComboBox, ETK_BOX_START, 
ETK_BOX_EXPAND_FILL, 0);
 
@@ -1738,8 +1767,10 @@
    etk_table_attach (ETK_TABLE(table), label, 0, 0, 2, 2,0,0,ETK_TABLE_NONE);
 
    combo = etk_combobox_new();
-   etk_combobox_column_add(ETK_COMBOBOX(combo), ETK_COMBOBOX_IMAGE, 24, 
ETK_FALSE, ETK_TRUE, ETK_TRUE, 0.0, 0.5);
-   etk_combobox_column_add(ETK_COMBOBOX(combo), ETK_COMBOBOX_LABEL, 75, 
ETK_TRUE, ETK_FALSE, ETK_FALSE, 0.0, 0.5);
+   etk_combobox_column_add(ETK_COMBOBOX(combo),
+      ETK_COMBOBOX_IMAGE, 24, ETK_COMBOBOX_NONE, 0.0);
+   etk_combobox_column_add(ETK_COMBOBOX(combo),
+      ETK_COMBOBOX_LABEL, 75, ETK_COMBOBOX_NONE, 0.0);
    etk_combobox_build(ETK_COMBOBOX(combo));
    etk_combobox_item_append(ETK_COMBOBOX(combo), etk_image_new_from_edje 
(EdjeFile,"NONE.PNG"), "Not yet implemented");
 
@@ -1814,8 +1845,10 @@
    etk_table_attach (ETK_TABLE(table), label, 0, 0, 5, 5,0,0,ETK_TABLE_NONE);
    UI_ActionComboBox = etk_combobox_new();
    //etk_tooltips_tip_set(UI_ActionComboBox, "<b>Action</b> to be performed by 
the program.<br>STATE_SET is used to change the state of one or more targets 
parts<br>, ACTION_STOP and SIGNAL_EMIT.<br>");
-   etk_combobox_column_add(ETK_COMBOBOX(UI_ActionComboBox), 
ETK_COMBOBOX_IMAGE, 24, ETK_FALSE, ETK_TRUE, ETK_TRUE, 0.0, 0.5);
-   etk_combobox_column_add(ETK_COMBOBOX(UI_ActionComboBox), 
ETK_COMBOBOX_LABEL, 75, ETK_TRUE, ETK_FALSE, ETK_FALSE, 0.0, 0.5);
+   etk_combobox_column_add(ETK_COMBOBOX(UI_ActionComboBox),
+      ETK_COMBOBOX_IMAGE, 24, ETK_COMBOBOX_NONE, 0.0);
+   etk_combobox_column_add(ETK_COMBOBOX(UI_ActionComboBox),
+      ETK_COMBOBOX_LABEL, 75, ETK_COMBOBOX_NONE, 0.0);
    etk_combobox_build(ETK_COMBOBOX(UI_ActionComboBox));
    item = etk_combobox_item_append(ETK_COMBOBOX(UI_ActionComboBox), 
etk_image_new_from_edje (EdjeFile,"DESC.PNG"), "State Set");
    etk_combobox_item_data_set (item, ENGRAVE_ACTION_STATE_SET);
@@ -1851,8 +1884,10 @@
    UI_TransiLabel = etk_label_new("<b>Transition</b>");
    etk_table_attach(ETK_TABLE(table), UI_TransiLabel, 0, 0, 8, 
8,0,0,ETK_TABLE_NONE);
    UI_TransiComboBox = etk_combobox_new();
-   etk_combobox_column_add(ETK_COMBOBOX(UI_TransiComboBox), 
ETK_COMBOBOX_IMAGE, 24, ETK_FALSE, ETK_TRUE, ETK_TRUE, 0.0, 0.5);
-   etk_combobox_column_add(ETK_COMBOBOX(UI_TransiComboBox), 
ETK_COMBOBOX_LABEL, 75, ETK_TRUE, ETK_FALSE, ETK_FALSE, 0.0, 0.5);
+   etk_combobox_column_add(ETK_COMBOBOX(UI_TransiComboBox),
+      ETK_COMBOBOX_IMAGE, 24, ETK_COMBOBOX_NONE, 0.0);
+   etk_combobox_column_add(ETK_COMBOBOX(UI_TransiComboBox),
+      ETK_COMBOBOX_LABEL, 75, ETK_COMBOBOX_NONE, 0.0);
    etk_combobox_build(ETK_COMBOBOX(UI_TransiComboBox));
    item = etk_combobox_item_append(ETK_COMBOBOX(UI_TransiComboBox), 
etk_image_new_from_edje (EdjeFile,"DESC.PNG"), "Linear");
    etk_combobox_item_data_set (item, ENGRAVE_TRANSITION_LINEAR);
===================================================================
RCS file: /cvs/e/e17/proto/edje_editor/src/bin/interface.h,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -3 -r1.9 -r1.10
--- interface.h 5 Feb 2007 07:44:18 -0000       1.9
+++ interface.h 13 Mar 2007 04:10:34 -0000      1.10
@@ -53,6 +53,7 @@
 Etk_Widget *UI_PlayDialog;
 Etk_Widget *UI_PlayTextView;
 Etk_Widget *UI_FilechooserFileNameEntry;
+Etk_Widget *UI_FilechooserFileNameLabel;
 Etk_Widget *UI_tree_vbox;
 Etk_Widget *UI_AlertDialog;
 Etk_Widget *UI_GroupMinWSpinner;
===================================================================
RCS file: /cvs/e/e17/proto/edje_editor/src/bin/main.c,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -3 -r1.7 -r1.8
--- main.c      18 Jan 2007 02:07:38 -0000      1.7
+++ main.c      13 Mar 2007 04:10:34 -0000      1.8
@@ -1,5 +1,6 @@
 #include "config.h"
-
+#include <errno.h>
+#include <unistd.h>
 #include <stdlib.h>
 #include <string.h>
 #include <Edje.h>
@@ -10,6 +11,8 @@
 #include "interface.h"
 #include "main.h"
 
+#define MAIN_EDC_NAME "edje_editor_link.edc"
+
 /**
  * engrave_part_state_remove - remove the state from the part.
  * @param ep: The Engrave_Part to remove the state to.
@@ -124,8 +127,8 @@
    ef->groups = evas_list_remove(ef->groups, eg);
    engrave_group_parent_set(eg, NULL);
 }
-void
-DebugInfo(int full)
+
+void DebugInfo(int full)
 {
    Engrave_Group *gro;
    Engrave_Part *par;
@@ -133,16 +136,23 @@
    Evas_List *gp,*pp,*sp;
 
    printf("\n\n ********************* D E B U G 
***************************\n");
+   printf(" ** open file name: %s\n",Cur.open_file_name);
+   printf(" ** main source file: %s\n",Cur.main_source_file);
+   printf(" ** sources directory: %s\n",Cur.source_dir);
+   printf(" ** images directory: %s\n",engrave_file_image_dir_get(Cur.ef));
+   printf(" ** fonts directory: %s\n",engrave_file_font_dir_get(Cur.ef));
+   printf(" **\n");
    printf(" ** edje_editor.edj: %s\n",EdjeFile);
   /* printf("Current engrave file: %s\n",Cur.ef->);
    printf("Current EDCFileDir: %s\n",EDCFileDir->str);
    */
-   printf(" ** Tot groups in EDC: %d\n",engrave_file_groups_count (Cur.ef));
-   printf(" ** Tot images in EDC: %d\n",engrave_file_images_count (Cur.ef));
-   printf(" ** Tot fonts in EDC: %d\n",engrave_file_fonts_count (Cur.ef));
-   printf(" ** Tot spectra in EDC: %d\n",engrave_file_spectra_count (Cur.ef));
-   printf(" ** Tot styles in EDC: %d\n",engrave_file_styles_count (Cur.ef));
-   printf(" ** Tot data in EDC: %d\n",engrave_file_data_count (Cur.ef));
+   printf(" ** Tot groups: %d\n",engrave_file_groups_count (Cur.ef));
+   printf(" ** Tot images: %d\n",engrave_file_images_count (Cur.ef));
+   printf(" ** Tot fonts: %d\n",engrave_file_fonts_count (Cur.ef));
+   printf(" ** Tot spectra: %d\n",engrave_file_spectra_count (Cur.ef));
+   printf(" ** Tot styles: %d\n",engrave_file_styles_count (Cur.ef));
+   printf(" ** Tot data: %d\n",engrave_file_data_count (Cur.ef));
+   printf(" **\n");
    if (Cur.eg)
       printf(" ** Cur group: %s\n",Cur.eg->name);
    else
@@ -179,6 +189,252 @@
    printf(" *********************** E N D *****************************\n\n");
 }
 
+
+
+
+//Etk_Widget *LABEL;
+Etk_Widget *UI_LoadTextView;
+Etk_Widget *UI_LoadPBar;
+Ecore_Timer *progress_bar_timer;
+
+
+void 
+etk_textview_append(Etk_Widget *tv, char *str)
+{
+   Etk_Textblock_Iter *iter;
+   iter = etk_text_view_cursor_get (ETK_TEXT_VIEW(tv));
+       etk_textblock_insert_markup(ETK_TEXT_VIEW(tv)->textblock, iter, 
+                              str, strlen(str));
+}
+
+int 
+exe_data(void *data, int ev_type, void *ev)
+{
+   Ecore_Exe_Event_Data *e;
+   e = (Ecore_Exe_Event_Data *)ev;
+   
+   if (e->lines)
+   {
+      int i;
+      for (i = 0; e->lines[i].line != NULL; i++)
+      {
+         //printf("++ %d %s\n", e->lines[i].size, e->lines[i].line);
+         etk_textview_append(UI_LoadTextView,e->lines[i].line);
+         etk_textview_append(UI_LoadTextView,"\n");
+      }
+      
//etk_textblock_object_yoffset_set(ETK_TEXT_VIEW(UI_LoadTextView)->textblock, 
-200 );
+   }
+   
+   return 1;
+}
+
+void
+stop_bar(void)
+{
+   ecore_timer_del(progress_bar_timer);
+   etk_progress_bar_text_set (ETK_PROGRESS_BAR(UI_LoadPBar), "Done!");
+   etk_progress_bar_fraction_set (ETK_PROGRESS_BAR(UI_LoadPBar), 1.0);
+}
+
+int 
+exe_exit(void *data, int ev_type, void *ev)
+{
+   char buf[1024];
+   Ecore_Exe_Event_Del *e = (Ecore_Exe_Event_Del *)ev;
+  
+   stop_bar();
+   if (e->exit_code){
+      snprintf(buf,1024,"<b>Error in edje_decc, exit code: </b> 
%d\n",e->exit_code);
+      etk_textview_append(UI_LoadTextView,buf);
+      return 1;
+   }
+   
+   etk_textview_append(UI_LoadTextView,"<b>Decompile complete.</b>\n");
+   
+   
+   Cur.ef = engrave_load_edc(Cur.main_source_file, Cur.source_dir, 
Cur.source_dir);
+   
+   snprintf(buf,1024,"<b>Main source file:</b> %s\n",Cur.main_source_file);
+   etk_textview_append(UI_LoadTextView, buf);
+   
+   snprintf(buf,1024,"<b>Source dir:</b> %s\n",Cur.source_dir);
+   etk_textview_append(UI_LoadTextView, buf);
+   
+   snprintf(buf,1024,"<b>Image dir:</b> 
%s\n",engrave_file_image_dir_get(Cur.ef));
+   etk_textview_append(UI_LoadTextView, buf);
+   
+   snprintf(buf,1024,"<b>Font dir:</b> 
%s\n",engrave_file_font_dir_get(Cur.ef));
+   etk_textview_append(UI_LoadTextView, buf);
+   
+   
+   
+   //TODO Check engrave load success
+   etk_main_quit();
+   return 0;
+}
+
+
+int Decompile(void *data) //data is the name of the file to open
+{
+   char buf[4096];
+   char tmpn[4096];
+   char cmd[4096];
+   char *file = (char*)data;
+   char *old_fname;
+   char *ptr;
+   char *work_dir = NULL;
+
+   
+   progress_bar_timer = 
+      ecore_timer_add(0.025, etk_progress_bar_pulse, UI_LoadPBar);
+
+   //TODO Check source integrity (is an edje file?
+   Cur.open_file_name = strdup(file);
+   
+   //Create working dir
+   memset(tmpn, '\0', sizeof(tmpn));
+   strcpy(tmpn, "/tmp/edje_editor-tmp-XXXXXX");
+#if defined (__SVR4) && defined (__sun)
+  if (mkdir(tmpn, S_IRWXU | S_IRWXG) == NULL) {
+#else 
+  if (mkdtemp(tmpn) == NULL) {
+#endif
+      snprintf(buf,4096,"<font color=#FF0000><b>Can't create working dir:</b> 
%s\n<b>Error:</b> %s</font>\n",tmpn,strerror(errno));
+      etk_textview_append(UI_LoadTextView,buf);
+      stop_bar();
+      return 0;
+   }
+   work_dir = strdup(tmpn);
+   
+   //Change to the working dir
+   snprintf(buf,4096,"<b>Change to working dir:</b> %s\n",work_dir);
+   etk_textview_append(UI_LoadTextView,buf);
+   getcwd(tmpn, sizeof(tmpn));
+   if (chdir(work_dir) == -1) {
+      snprintf(buf,4096,"<font color=#FF0000><b>Can't change to dir:</b> 
%s\n<b>Error: </b> %s</font>\n",work_dir,strerror(errno));
+      etk_textview_append(UI_LoadTextView, buf);
+      stop_bar();
+      return 0;
+   }
+   
+   //Calculate Cur.source_dir, image_dir, font_dir, main_source_file
+   old_fname = strdup(file);
+   ptr = strstr(old_fname, ".edj");
+   *ptr = '\0';
+   ptr = strrchr(old_fname, '/');
+   if (ptr == NULL) ptr = old_fname;
+   snprintf(buf,4096,"%s%s",work_dir,ptr);
+   Cur.source_dir = strdup(buf);
+   snprintf(buf,4096,"%s/"MAIN_EDC_NAME,Cur.source_dir);
+   Cur.main_source_file = strdup(buf);
+   
+   //Execute edje_decc through a pipe
+   snprintf(cmd, 4096, "edje_decc %s -main-out "MAIN_EDC_NAME, file);
+   snprintf(buf,4096,"<b>Executing: </b>%s\n",cmd);
+   etk_textview_append(UI_LoadTextView, buf);
+   
+   Ecore_Exe* exe;
+   Ecore_Event_Handler *handler1 = NULL;
+   Ecore_Event_Handler *handler2 = NULL;
+   handler1 = ecore_event_handler_add(ECORE_EXE_EVENT_DATA, exe_data, NULL);
+   handler2 = ecore_event_handler_add(ECORE_EXE_EVENT_DEL, exe_exit, NULL);
+   exe = ecore_exe_pipe_run(cmd,ECORE_EXE_PIPE_READ | 
ECORE_EXE_PIPE_READ_LINE_BUFFERED,"test"); 
+   
+   /* if (!(pipe = popen(cmd, "r"))){
+      etk_textview_append(UI_LoadTextView,"<font color=#FF0000>Error executing 
edje_decc</font>\n");
+               return 0;
+       }
+       while (fgets(pbuf, 4096, pipe) != NULL){
+       etk_textview_append(UI_LoadTextView, pbuf);
+       }
+       pclose(pipe);
+    */
+
+   /* we need the info on the work dir to pass the cpp so it can
+   * include files correctly 
+   */
+/*    ptr = strstr(old_fname, ".edj");
+   *ptr = '\0';
+    
+   ptr = strrchr(old_fname, '/');
+   if (ptr == NULL)
+      ptr = old_fname;
+   
+   
+   len = strlen(ptr) + strlen(work_dir) + 2;
+   out_dir = (char *)calloc(len, sizeof(char));
+   snprintf(out_dir, len, "%s/%s", work_dir, ptr);
+   etk_textview_append(UI_LoadTextView, "<b>Out dir:</b> ");
+   etk_textview_append(UI_LoadTextView, out_dir);
+   etk_textview_append(UI_LoadTextView, "\n");
+
+   len = strlen(out_dir) + strlen(MAIN_EDC_NAME) + 2;
+   new_fname = (char *)calloc(len, sizeof(char));
+   snprintf(new_fname, len, "%s/%s", out_dir, MAIN_EDC_NAME);
+   //FREE(old_fname);
+   etk_textview_append(UI_LoadTextView, "<b>Main edc:</b> ");
+   etk_textview_append(UI_LoadTextView, new_fname);
+   etk_textview_append(UI_LoadTextView, "\n");
+
+   
+   Cur.ef = engrave_load_edc(new_fname, out_dir, out_dir);
+   
+ */
+   //ecore_timer_add(0,cb,NULL);
+   return 0;
+}
+void
+LoadEDJ(char *file)
+{
+   Etk_Widget *win;
+   Etk_Widget *vbox;
+   Etk_Widget *scrolled_view;
+   Etk_Widget *button;
+   Etk_Widget *label;
+   
+   
+   //Load Win
+   win = etk_window_new();
+   etk_widget_size_request_set(win, 400, 300);
+   etk_window_title_set(ETK_WINDOW(win), "Loading...");
+   etk_signal_connect("destroyed", ETK_OBJECT(win), 
ETK_CALLBACK(etk_main_quit), NULL);
+  // etk_signal_connect("show", ETK_OBJECT(win), 
ETK_CALLBACK(on_LoadWin_realize), NULL);
+ 
+   vbox = etk_vbox_new(ETK_FALSE, 0);
+   etk_container_add(ETK_CONTAINER(win), vbox);
+   
+   label = etk_label_new("<font_size=20><b>Loading</b></>");
+   etk_object_properties_set (ETK_OBJECT(label), "xalign",0.5,NULL);
+   etk_box_append(ETK_BOX(vbox), label, ETK_BOX_START, ETK_BOX_NONE, 5);
+   
+   UI_LoadPBar = etk_progress_bar_new_with_text("Loading...");
+   etk_progress_bar_pulse_step_set(ETK_PROGRESS_BAR(UI_LoadPBar), 0.03);
+   
+   etk_box_append(ETK_BOX(vbox), UI_LoadPBar, ETK_BOX_START, ETK_BOX_NONE, 5);
+ 
+   //Text_view
+   UI_LoadTextView = etk_text_view_new ();
+   
etk_textblock_object_cursor_visible_set(ETK_TEXT_VIEW(UI_LoadTextView)->textblock,
 ETK_FALSE); //TODO questa riga non funziona
+   scrolled_view = etk_scrolled_view_new();
+   etk_scrolled_view_policy_set(ETK_SCROLLED_VIEW(scrolled_view), 
ETK_POLICY_HIDE, ETK_POLICY_SHOW);
+   etk_bin_child_set( ETK_BIN(scrolled_view), UI_LoadTextView);
+   etk_box_append(ETK_BOX(vbox), scrolled_view, ETK_BOX_START, 
ETK_BOX_EXPAND_FILL, 5);
+ 
+   //buttons
+   button = etk_button_new_from_stock(ETK_STOCK_DIALOG_CLOSE);
+   etk_box_append(ETK_BOX(vbox), button, ETK_BOX_START, ETK_BOX_NONE, 5);
+   etk_signal_connect("clicked", ETK_OBJECT(button), 
ETK_CALLBACK(etk_main_quit), NULL);
+   
+   
+   etk_widget_show_all(win);
+   
+   ecore_timer_add(0.1,Decompile,file);
+   printf("MAIN\n");
+   //etk_progress_bar_pulse(ETK_PROGRESS_BAR(UI_LoadPBar));
+   etk_main();
+   etk_widget_hide(win);
+}
+
 /* main */
 int
 main(int argc, char **argv)
@@ -189,8 +445,10 @@
    Cur.ep = NULL;
    Cur.eps = NULL;
    Cur.ef = NULL;
-
-
+   Cur.open_file_name = NULL;
+   Cur.source_dir = NULL;
+   Cur.main_source_file = NULL;
+   
    //Setting Globals
    EdjeFile = PACKAGE_DATA_DIR"/edje_editor.edj";
 
@@ -202,15 +460,15 @@
            (0 == strcmp(argv[1],"--help")) ||
            (0 == strcmp(argv[1],"--usage")) )
       {
-         printf("Usage:\n");
-         printf("edje_editor [EDC | EDJ] [IMAGE_DIR] [FONT_DIR]\n");
-         printf("Example:\n");
+         printf("\nUsage:\n");
+         printf(" edje_editor [EDC | EDJ] [IMAGE_DIR] [FONT_DIR]\n");
+         printf("\nExample:\n");
          printf(" edje_editor                #Open an empty file\n");
          printf(" edje_editor default.edj    #Open the given EDJ\n");
          printf(" edje_editor default.edc    #Open the given EDC\n");
-         printf("Note on open an EDC:\n");
+         printf("\nNote on open an EDC:\n");
          printf(" To open an EDC file you must pass the IMAGE_DIR and 
FONT_DIR\n");
-         printf(" parameters. If not given the EDC directory is assumed.\n");
+         printf(" parameters. If not given the EDC directory is assumed.\n\n");
          return 0;
       }
    }
@@ -250,7 +508,8 @@
          return 1;
       }
       if (strstr(file, ".edj"))
-         Cur.ef = engrave_load_edj(file);
+         //Cur.ef = engrave_load_edj(file);
+         LoadEDJ(file);
       if (strstr(file, ".edc"))
       {
          char *edc_dir =  ecore_file_get_dir(file);
@@ -261,13 +520,14 @@
          if (argc == 4)
             Cur.ef = engrave_load_edc(file, argv[2], argv[3]);
       }
+      etk_window_title_set(ETK_WINDOW(UI_MainWin),file);
    }
 
    if (!Cur.ef)
       Cur.ef = engrave_file_new();
 
 
-   engrave_canvas_file_set (ecanvas, Cur.ef);
+   engrave_canvas_file_set (engrave_canvas, Cur.ef);
 
 
    //Populate Interface
@@ -276,7 +536,7 @@
    PopulateFontsComboBox();
 
 
-   DebugInfo(FALSE);
+   //DebugInfo(FALSE);
 
    //Start main loop
    etk_main();
===================================================================
RCS file: /cvs/e/e17/proto/edje_editor/src/bin/main.h,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -3 -r1.6 -r1.7
--- main.h      31 Jan 2007 06:02:21 -0000      1.6
+++ main.h      13 Mar 2007 04:10:34 -0000      1.7
@@ -31,17 +31,17 @@
 enum various
 {
    FILECHOOSER_OPEN,
-   FILECHOOSER_NEW,
    FILECHOOSER_IMAGE,
    FILECHOOSER_FONT,
-   FILECHOOSER_SAVE_AS,
+   FILECHOOSER_SAVE_EDC,
+   FILECHOOSER_SAVE_EDJ,
    TOOLBAR_NEW,
    TOOLBAR_OPEN,
    TOOLBAR_ADD,
    TOOLBAR_REMOVE,
    TOOLBAR_DEBUG,
-   TOOLBAR_SAVE,
-   TOOLBAR_SAVE_AS,
+   TOOLBAR_SAVE_EDC,
+   TOOLBAR_SAVE_EDJ,
    TOOLBAR_PLAY,
    TOOLBAR_MOVE_UP,
    TOOLBAR_MOVE_DOWN,
@@ -89,13 +89,16 @@
    Engrave_Part  *ep;
    Engrave_Program *epr;
    Engrave_Part_State *eps;
+   char *open_file_name;      //Full path to the open edje file
+   char *source_dir;          //Full path to sources
+   char *main_source_file;    //Full path to the main edc file
 }Cur;
 
 /* GLOBALS */
 int            FileChooserOperation;   //The current file chooser operation 
(FILECHOOSER_OPEN,FILECHOOSER_NEW etc)
 char           *EdjeFile;              //The filename of the edje_editor.edj 
file (witch contain all the graphics used by the program)
 
-Evas_Object    *ecanvas;               //The engrave canvas
+Evas_Object    *engrave_canvas;        //The engrave canvas
 Etk_Widget     *ETK_canvas;             //Designer canvas
 Evas_Object    *EV_canvas_bg;          //
 Evas_Object    *EV_canvas_shadow;      //



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