Enlightenment CVS committal
Author : davemds
Project : e17
Module : proto/edje_editor
Dir : e17/proto/edje_editor/src/bin
Modified Files:
callbacks.c callbacks.h interface.c interface.h main.c main.h
Log Message:
Direct-edje version: (need edje patch 7 on #294)
* Catch all the signal from the editing edje object and show in console
* open, save and save as now works well (using a temp file while editing)
* Reimplemented add images
* mouse events/repeat done
* manage well single-group files
===================================================================
RCS file: /cvs/e/e17/proto/edje_editor/src/bin/callbacks.c,v
retrieving revision 1.43
retrieving revision 1.44
diff -u -3 -r1.43 -r1.44
--- callbacks.c 18 Dec 2007 06:20:49 -0000 1.43
+++ callbacks.c 28 Dec 2007 23:01:41 -0000 1.44
@@ -30,6 +30,13 @@
etk_main_quit();
}
+/* Catch all the signal from the editing edje object */
+void
+signal_cb(void *data, Evas_Object *o, const char *sig, const char *src)
+{
+ printf("CALLBACK for \"%s\" \"%s\"\n", sig, src);
+}
+
/* All the buttons Callback */
Etk_Bool
on_AllButton_click(Etk_Button *button, void *data)
@@ -50,7 +57,11 @@
break;
#if TEST_DIRECT_EDJE
case TOOLBAR_SAVE:
- ShowAlert("Not yet reimplemented ;)");
+ edje_edit_save(edje_o);
+ if (!ecore_file_cp(Cur.edj_temp_name->string,
Cur.edj_file_name->string))
+ {
+ ShowAlert("<b>ERROR:<\b><br>Can't write file");
+ }
break;
case TOOLBAR_SAVE_EDC:
ShowAlert("Not yet reimplemented ;)");
@@ -71,7 +82,7 @@
ShowAlert("Not yet reimplemented ;)");
break;
case TOOLBAR_IMAGE_FILE_ADD:
- ShowAlert("Not yet reimplemented ;)");
+ ShowFilechooser(FILECHOOSER_IMAGE);
break;
case TOOLBAR_FONT_FILE_ADD:
ShowAlert("Not yet reimplemented ;)");
@@ -296,6 +307,8 @@
edje_object_signal_emit(edje_ui,"program_frame_hide","edje_editor");
edje_object_signal_emit(edje_ui,"part_frame_show","edje_editor");
edje_object_signal_emit(edje_ui,"script_frame_hide","edje_editor");
+
+ UpdatePartFrame();
break;
case ROW_DESC:
@@ -352,7 +365,7 @@
edje_object_signal_emit(edje_ui,"program_frame_show","edje_editor");
edje_object_signal_emit(edje_ui,"script_frame_show_small","edje_editor");
- // UpdateScriptFrame();
+ UpdateScriptFrame();
UpdateProgFrame();
// PopulateSourceComboBox();
break;
@@ -571,9 +584,59 @@
on_PartNameEntry_text_changed(Etk_Object *object, void *data)
{
Etk_Tree_Col *col1=NULL;
-
+ Etk_Tree_Row *row;
+ char *text;
//printf("Text Changed Signal on PartNameEntry EMITTED (text:
%s)\n",etk_entry_text_get(ETK_ENTRY(object)));
-
+#if TEST_DIRECT_EDJE
+ if (etk_string_length_get(Cur.part->string))
+ {
+ //Update PartTree
+ row = etk_tree_selected_row_get(ETK_TREE(UI_PartsTree));
+ text = etk_entry_text_get(ETK_ENTRY(object));
+
+ printf("** TYPE: %d\n", edje_edit_part_type_get(edje_o,
Cur.part->string));
+ switch (edje_edit_part_type_get(edje_o, Cur.part->string))
+ {
+ case EDJE_PART_TYPE_IMAGE:
+ etk_tree_row_fields_set(row,TRUE,
+ COL_NAME, EdjeFile, "IMAGE.PNG", text,
+ NULL);
+ break;
+ case EDJE_PART_TYPE_RECTANGLE:
+ etk_tree_row_fields_set(row,TRUE,
+ COL_NAME, EdjeFile, "RECT.PNG", text,
+ NULL);
+ break;
+ case EDJE_PART_TYPE_TEXT:
+ etk_tree_row_fields_set(row,TRUE,
+ COL_NAME, EdjeFile, "TEXT.PNG", text,
+ NULL);
+ break;
+ default:
+ etk_tree_row_fields_set(row,TRUE,
+ COL_NAME, EdjeFile, "NONE.PNG", text,
+ NULL);
+ break;
+ }
+
+ /* Update hidden colon on every child */
+ Etk_Tree_Row *child;
+ child = etk_tree_row_first_child_get(row);
+ etk_tree_row_fields_set(child, TRUE, COL_PARENT, text, NULL);
+ while (child = etk_tree_row_next_get(child))
+ etk_tree_row_fields_set(child, TRUE, COL_PARENT, text, NULL);
+
+
+ /* change the name in edje */
+ edje_edit_part_name_set(edje_o, Cur.part->string, text);
+
+ /* Set new Current name */
+ Cur.part = etk_string_set(Cur.part, text);
+
+ /* Recreate rel combobox */
+ PopulateRelComboBoxes(); //TODO do a focus-out callback for this (don't
need to do on every key!!)
+ }
+#else
if (Cur.ep)
{
engrave_part_name_set(Cur.ep,etk_entry_text_get(ETK_ENTRY(object)));
@@ -605,6 +668,7 @@
break;
}
}
+#endif
return ETK_TRUE;
}
@@ -612,11 +676,33 @@
on_PartEventsCheck_toggled(Etk_Object *object, void *data)
{
printf("Toggled Signal on EventsCheck EMITTED\n");
+#if TEST_DIRECT_EDJE
+ if (etk_string_length_get(Cur.part))
+ {
+ edje_edit_part_mouse_events_set(edje_o, Cur.part->string,
+ etk_toggle_button_active_get(ETK_TOGGLE_BUTTON(object)));
+ }
+#else
if (Cur.ep)
{
engrave_part_mouse_events_set(Cur.ep,
etk_toggle_button_active_get(ETK_TOGGLE_BUTTON(object)));
}
+#endif
+ return ETK_TRUE;
+}
+
+Etk_Bool
+on_PartEventsRepeatCheck_toggled(Etk_Object *object, void *data)
+{
+ printf("Toggled Signal on EventsRepeatCheck EMITTED\n");
+#if TEST_DIRECT_EDJE
+ if (etk_string_length_get(Cur.part))
+ {
+ edje_edit_part_repeat_events_set(edje_o, Cur.part->string,
+ etk_toggle_button_active_get(ETK_TOGGLE_BUTTON(object)));
+ }
+#endif
return ETK_TRUE;
}
@@ -1357,14 +1443,11 @@
#if TEST_DIRECT_EDJE
Etk_Bool
-on_GroupsComboBox_changed(Etk_Combobox *combobox, void *data)
+on_GroupsComboBox_activated(Etk_Combobox *combobox, Etk_Combobox_Item *item,
void *data)
{
- Etk_Combobox_Item *item;
char *gr;
-
- item = etk_combobox_active_item_get(combobox);
gr = etk_combobox_item_field_get(item,0);
- printf("Group combo changed: %s\n",gr);
+ printf("Group combo activated: %s\n",gr);
ChangeGroup(gr);
}
#endif
@@ -1817,10 +1900,17 @@
switch(FileChooserOperation){
case FILECHOOSER_OPEN:
+#if TEST_DIRECT_EDJE
+ snprintf(cmd,4096,"%s/%s",
+
etk_filechooser_widget_current_folder_get(ETK_FILECHOOSER_WIDGET(UI_FileChooser)),
+
etk_filechooser_widget_selected_file_get(ETK_FILECHOOSER_WIDGET(UI_FileChooser)));
+ LoadEDJ2(cmd);
+#else
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);
+#endif
break;
case FILECHOOSER_SAVE_EDJ:
printf("SAVE EDJ\n");
@@ -1828,7 +1918,11 @@
etk_filechooser_widget_current_folder_get
(ETK_FILECHOOSER_WIDGET(UI_FileChooser)),
etk_filechooser_widget_selected_file_get
(ETK_FILECHOOSER_WIDGET(UI_FileChooser)));
#if TEST_DIRECT_EDJE
- edje_edit_save(edje_o,cmd);
+ edje_edit_save(edje_o);
+ if(!ecore_file_cp(Cur.edj_temp_name->string, cmd))
+ {
+ ShowAlert("<b>ERROR:<\b><br>Can't write file");
+ }
#else
SaveEDJ(cmd);
#endif
@@ -1842,6 +1936,13 @@
ShowAlert("Error saving file.");
break;
case FILECHOOSER_IMAGE:
+#if TEST_DIRECT_EDJE
+ snprintf(cmd, 4096, "%s/%s",
+ etk_filechooser_widget_current_folder_get
(ETK_FILECHOOSER_WIDGET(UI_FileChooser)),
+ etk_filechooser_widget_selected_file_get
(ETK_FILECHOOSER_WIDGET(UI_FileChooser)));
+ edje_edit_image_add(edje_o, cmd);
+ PopulateImagesComboBox();
+#else
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)),engrave_file_image_dir_get(Cur.ef))){
@@ -1870,6 +1971,7 @@
UpdateImageFrame();
ev_redraw();
}
+#endif
break;
case FILECHOOSER_FONT:
if (Cur.eps){
@@ -1917,6 +2019,7 @@
on_FileChooserDialog_response(ETK_DIALOG(UI_FileChooserDialog),
ETK_RESPONSE_OK, NULL);
return ETK_TRUE;
}
+
Etk_Bool
on_AlertDialog_response(Etk_Dialog *dialog, int response_id, void *data)
{
===================================================================
RCS file: /cvs/e/e17/proto/edje_editor/src/bin/callbacks.h,v
retrieving revision 1.18
retrieving revision 1.19
diff -u -3 -r1.18 -r1.19
--- callbacks.h 28 Nov 2007 07:10:52 -0000 1.18
+++ callbacks.h 28 Dec 2007 23:01:41 -0000 1.19
@@ -8,10 +8,11 @@
Etk_Bool on_GroupSpinner_value_changed (Etk_Range *range, double value,
void *data);
Etk_Bool on_canvas_geometry_changed (Etk_Object *canvas, const char
*property_name, void *data);
Etk_Bool on_PartsTree_row_selected (Etk_Object *object, Etk_Tree_Row
*row, void *data);
-void on_ColorCanvas_click (void *data, Evas *e, Evas_Object
*obj, void *event_info);
+void on_ColorCanvas_click (void *data, Evas *e, Evas_Object
*obj, void *event_info);
Etk_Bool on_ColorDialog_change (Etk_Object *object, void *data);
Etk_Bool on_PartNameEntry_text_changed (Etk_Object *object, void *data);
Etk_Bool on_PartEventsCheck_toggled (Etk_Object *object, void *data);
+Etk_Bool on_PartEventsRepeatCheck_toggled (Etk_Object *object, void *data);
Etk_Bool on_StateEntry_text_changed (Etk_Object *object, void *data);
Etk_Bool on_AllButton_click (Etk_Button *button, void *data);
Etk_Bool on_AddMenu_item_activated (Etk_Object *object, void *data);
@@ -54,5 +55,6 @@
Etk_Bool on_AfterEntry_text_changed (Etk_Object *object, void *data);
#if TEST_DIRECT_EDJE
-Etk_Bool on_GroupsComboBox_changed(Etk_Combobox *combobox, void *data);
+Etk_Bool on_GroupsComboBox_activated(Etk_Combobox *combobox, Etk_Combobox_Item
*item, void *data);
+void signal_cb(void *data, Evas_Object *o, const char *sig, const char *src);
#endif
===================================================================
RCS file: /cvs/e/e17/proto/edje_editor/src/bin/interface.c,v
retrieving revision 1.50
retrieving revision 1.51
diff -u -3 -r1.50 -r1.51
--- interface.c 18 Dec 2007 06:20:49 -0000 1.50
+++ interface.c 28 Dec 2007 23:01:41 -0000 1.51
@@ -24,8 +24,6 @@
/* functions to update interface*/
#if TEST_DIRECT_EDJE
-
-
void
AddPartToTree2(char *part_name)//, char *group_name)//, int place_after,
Engrave_Part* after)
{
@@ -219,18 +217,24 @@
void
PopulateGroupsComboBox()
{
- Evas_List *groups;
- Etk_Combobox_Item *ComboItem;
+ Evas_List *groups, *l;
- groups = edje_file_collection_list(Cur.edj_file_name->string);
- while(groups)
- {
- ComboItem = etk_combobox_item_append(ETK_COMBOBOX(UI_GroupsComboBox),
(char*)groups->data);
- groups = groups->next;
- }
- edje_file_collection_list_free (groups);
+ //Stop signal propagation
+ // etk_signal_disconnect("item-activated", ETK_OBJECT(UI_GroupsComboBox),
+ // ETK_CALLBACK(on_GroupsComboBox_activated), NULL);
+ etk_combobox_clear(ETK_COMBOBOX(UI_GroupsComboBox));
+
+ groups = edje_file_collection_list(Cur.edj_temp_name->string);
+ for(l = groups; l; l = l->next)
+ etk_combobox_item_append(ETK_COMBOBOX(UI_GroupsComboBox),
(char*)l->data);
+ edje_file_collection_list_free(groups);
+
+ //Renable signal propagation
+ // etk_signal_connect("item-activated", ETK_OBJECT(UI_GroupsComboBox),
+ // ETK_CALLBACK(on_GroupsComboBox_activated), NULL);
+
etk_combobox_active_item_set(ETK_COMBOBOX(UI_GroupsComboBox),
- etk_combobox_last_item_get (ETK_COMBOBOX(UI_GroupsComboBox)));
+ etk_combobox_first_item_get (ETK_COMBOBOX(UI_GroupsComboBox)));
}
#else
void
@@ -329,7 +333,7 @@
{
snprintf(buf,4095,"images/%d",edje_edit_image_id_get(edje_o,
(char*)l->data));
ComboItem = etk_combobox_item_append(ETK_COMBOBOX(UI_ImageComboBox),
- etk_image_new_from_file (Cur.edj_file_name->string, buf),
+ etk_image_new_from_file (Cur.edj_temp_name->string, buf),
(char*)l->data);
l = l->next;
}
@@ -587,26 +591,42 @@
void
UpdatePartFrame(void)
{
- if (Cur.ep){
- //printf("Update Part Frame: %s\n",Cur.ep->name);
-
- //Stop signal propagation
+ //Stop signal propagation
etk_signal_block("text-changed",ETK_OBJECT(UI_PartNameEntry),
on_PartNameEntry_text_changed, NULL);
etk_signal_block("toggled",ETK_OBJECT(UI_PartEventsCheck),
on_PartEventsCheck_toggled, NULL);
+ etk_signal_block("toggled",ETK_OBJECT(UI_PartEventsRepeatCheck),
+ on_PartEventsRepeatCheck_toggled, NULL);
+
+#if TEST_DIRECT_EDJE
+ if (etk_string_length_get(Cur.part))
+ {
+ etk_entry_text_set(ETK_ENTRY(UI_PartNameEntry), Cur.part->string);
+ etk_toggle_button_active_set(ETK_TOGGLE_BUTTON(UI_PartEventsCheck),
+ edje_edit_part_mouse_events_get(edje_o,
Cur.part->string));
+ etk_toggle_button_active_set(ETK_TOGGLE_BUTTON(UI_PartEventsRepeatCheck),
+ edje_edit_part_repeat_events_get(edje_o,
Cur.part->string));
+ }
+#else
+ if (Cur.ep){
+ //printf("Update Part Frame: %s\n",Cur.ep->name);
//Update Part
etk_entry_text_set(ETK_ENTRY(UI_PartNameEntry),Cur.ep->name);
etk_toggle_button_active_set(ETK_TOGGLE_BUTTON(UI_PartEventsCheck),
- Cur.ep->mouse_events);
-
- //ReEnable Signal Propagation
- etk_signal_unblock("text-changed",ETK_OBJECT(UI_PartNameEntry),
- on_PartNameEntry_text_changed, NULL);
- etk_signal_unblock("toggled",ETK_OBJECT(UI_PartEventsCheck),
- on_PartEventsCheck_toggled, NULL);
+ Cur.ep->mouse_events);
}
+#endif
+
+ //ReEnable Signal Propagation
+ etk_signal_unblock("text-changed",ETK_OBJECT(UI_PartNameEntry),
+ on_PartNameEntry_text_changed, NULL);
+ etk_signal_unblock("toggled",ETK_OBJECT(UI_PartEventsCheck),
+ on_PartEventsCheck_toggled, NULL);
+ etk_signal_unblock("toggled",ETK_OBJECT(UI_PartEventsRepeatCheck),
+ on_PartEventsRepeatCheck_toggled, NULL);
+
}
void
@@ -1479,6 +1499,14 @@
void
UpdateScriptFrame(void)
{
+#if TEST_DIRECT_EDJE
+ if (etk_string_length_get(Cur.group))
+ {
+ edje_edit_script_get(edje_o);
+ //printf("Update group script: %s\n",edje_edit_script_get(edje_o));
+
+ }
+#else
//Update ScriptBox
if (Cur.epr){
printf("Update prog script: %s\n",Cur.epr->script);
@@ -1493,6 +1521,7 @@
return;
}
etk_textblock_clear(ETK_TEXT_VIEW(UI_ScriptBox)->textblock);
+#endif
}
void
@@ -1859,8 +1888,10 @@
etk_combobox_items_height_set (ETK_COMBOBOX(UI_GroupsComboBox), 16);
etk_toolbar_append(ETK_TOOLBAR(UI_Toolbar), UI_GroupsComboBox,
ETK_BOX_START);
- etk_signal_connect("active-item-changed", ETK_OBJECT(UI_GroupsComboBox),
- ETK_CALLBACK(on_GroupsComboBox_changed), NULL);
+ //etk_signal_connect("active-item-changed", ETK_OBJECT(UI_GroupsComboBox),
+ // ETK_CALLBACK(on_GroupsComboBox_changed), NULL);
+ etk_signal_connect("item-activated", ETK_OBJECT(UI_GroupsComboBox),
+ ETK_CALLBACK(on_GroupsComboBox_activated), NULL);
#else
//Test Button
button = etk_tool_button_new_from_stock( ETK_STOCK_MEDIA_PLAYBACK_START);
@@ -2663,6 +2694,8 @@
Etk_Widget *table;
Etk_Widget *label;
Etk_Widget *combo;
+ Etk_Widget *frame;
+ Etk_Widget *hbox;
//table
table = etk_table_new (2, 3, ETK_TABLE_NOT_HOMOGENEOUS);
@@ -2672,14 +2705,10 @@
etk_table_attach (ETK_TABLE(table), label, 0, 0, 0, 0,ETK_TABLE_NONE,0,0);
UI_PartNameEntry = etk_entry_new();
etk_table_attach_default (ETK_TABLE(table),UI_PartNameEntry, 1, 1, 0, 0);
-
- //PartEventsCheck
- UI_PartEventsCheck = etk_check_button_new_with_label ("<b>Accept mouse
events</b>");
- etk_table_attach_default (ETK_TABLE(table),UI_PartEventsCheck, 0, 1, 1, 1);
-
+
//PartClipToComboBox
label = etk_label_new("<b>Clip_to</b>");
- etk_table_attach (ETK_TABLE(table), label, 0, 0, 2, 2,ETK_TABLE_NONE,0,0);
+ etk_table_attach (ETK_TABLE(table), label, 0, 0, 1, 1,ETK_TABLE_NONE,0,0);
combo = etk_combobox_new();
etk_combobox_column_add(ETK_COMBOBOX(combo),
@@ -2689,13 +2718,34 @@
etk_combobox_build(ETK_COMBOBOX(combo));
etk_combobox_item_append(ETK_COMBOBOX(combo),
etk_image_new_from_edje (EdjeFile,"NONE.PNG"), "Not yet implemented");
-
- etk_table_attach_default (ETK_TABLE(table), combo, 1, 1, 2, 2);
-
+ etk_table_attach_default (ETK_TABLE(table), combo, 1, 1, 1, 1);
+
+ //events frame
+ frame = etk_frame_new("Mouse events");
+ etk_table_attach(ETK_TABLE(table), frame, 0, 1, 2, 2,
+ ETK_TABLE_EXPAND_FILL, 0, 0);
+ //events hbox
+ hbox = etk_hbox_new(ETK_FALSE, 0);
+ etk_widget_padding_set(hbox, 10, 0, 0, 0);
+ etk_container_add(ETK_CONTAINER(frame), hbox);
+
+ //PartEventsCheck
+ UI_PartEventsCheck = etk_check_button_new_with_label ("Accept</b>");
+ etk_box_append(ETK_BOX(hbox), UI_PartEventsCheck,
+ ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);
+
+ //PartEventRepeatCheck
+ UI_PartEventsRepeatCheck = etk_check_button_new_with_label ("Repeat</b>");
+ etk_box_append(ETK_BOX(hbox), UI_PartEventsRepeatCheck,
+ ETK_BOX_START, ETK_BOX_EXPAND_FILL, 0);
+
+
etk_signal_connect("text-changed", ETK_OBJECT(UI_PartNameEntry),
ETK_CALLBACK(on_PartNameEntry_text_changed), NULL);
etk_signal_connect("toggled", ETK_OBJECT(UI_PartEventsCheck),
ETK_CALLBACK(on_PartEventsCheck_toggled), NULL);
+ etk_signal_connect("toggled", ETK_OBJECT(UI_PartEventsRepeatCheck),
+ ETK_CALLBACK(on_PartEventsRepeatCheck_toggled), NULL);
return table;
}
@@ -3060,6 +3110,13 @@
etk_signal_connect("color-changed", ETK_OBJECT(UI_ColorPicker),
ETK_CALLBACK(on_ColorDialog_change), NULL);
+#if TEST_DIRECT_EDJE
+ //Create the main edje object to edit
+ edje_o = edje_object_add(UI_evas);
+#if ECHO_EDJE_SIGNAL
+ edje_object_signal_callback_add(edje_o, "*", "*", signal_cb, NULL);
+#endif
+#endif
/*edje_object_signal_emit(edje_ui,"group_frame_show","edje_editor");
edje_object_signal_emit(edje_ui,"part_frame_show","edje_editor");
edje_object_signal_emit(edje_ui,"description_frame_show","edje_editor");
===================================================================
RCS file: /cvs/e/e17/proto/edje_editor/src/bin/interface.h,v
retrieving revision 1.23
retrieving revision 1.24
diff -u -3 -r1.23 -r1.24
--- interface.h 6 Dec 2007 03:34:45 -0000 1.23
+++ interface.h 28 Dec 2007 23:01:41 -0000 1.24
@@ -107,6 +107,7 @@
Etk_Widget *UI_DelayRangeSpinner;
Etk_Widget *UI_CurrentGroupSizeLabel;
Etk_Widget *UI_PartEventsCheck;
+Etk_Widget *UI_PartEventsRepeatCheck;
Etk_Widget *UI_PartsTreeEmbed;
Etk_Widget *UI_GroupEmbed;
===================================================================
RCS file: /cvs/e/e17/proto/edje_editor/src/bin/main.c,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -3 -r1.24 -r1.25
--- main.c 18 Dec 2007 06:20:49 -0000 1.24
+++ main.c 28 Dec 2007 23:01:41 -0000 1.25
@@ -1,5 +1,6 @@
#include "config.h"
#include <string.h>
+#include <errno.h>
#include <Edje.h>
#if TEST_DIRECT_EDJE
#include <Edje_Edit.h>
@@ -250,6 +251,7 @@
printf("\n\n ********************* D E B U G
***************************\n");
printf(" ** open file name: %s\n",Cur.edj_file_name->string);
+ printf(" ** temp file name: %s\n",Cur.edj_temp_name->string);
printf(" ** edje_editor.edj: %s\n",EdjeFile);
if (etk_string_length_get(Cur.group))
printf(" ** Cur group: %s\n",Cur.group->string);
@@ -402,9 +404,12 @@
ChangeGroup(char *group)
{
if (!group) return;
- printf("Selected group: %s\n", group);
+
+ if (Cur.group->string && !strcmp(group, Cur.group->string)) return;
+ printf("Change group: %s\n", group);
+ edje_edit_save(edje_o);
evas_object_hide(edje_o);
- edje_object_file_set(edje_o, Cur.edj_file_name->string, group);
+ edje_object_file_set(edje_o, Cur.edj_temp_name->string, group);
evas_object_show(edje_o);
Parts_Hash = NULL; //TODO FREE
@@ -416,12 +421,85 @@
PopulateTree2();
PopulateRelComboBoxes();
}
-#endif
-static void signal_cb(void *data, Evas_Object *o, const char *sig, const char
*src)
+int
+LoadEDJ2(char *file)
{
- printf("CALLBACK for \"%s\" \"%s\"\n", sig, src);
+ char *realp = NULL;
+ char *old_temp;
+ if (!file) return 0;
+
+ printf("** Load EDJ: '%s'\n",file);
+
+ realp = ecore_file_realpath(file);
+ if (!ecore_file_exists(realp))
+ {
+ ShowAlert("<b>ERROR:</b><br>File not exists.");
+ return 0;
+ }
+ if (!ecore_file_can_read(realp))
+ {
+ ShowAlert("<b>ERROR</b>:<br>Can't read file.");
+ return 0;
+ }
+ if (!ecore_str_has_suffix(realp, ".edj")) //TODO: better check
+ {
+ ShowAlert("<b>ERROR</b>:<br>File is not an edje file.");
+ return 0;
+ }
+
+
+ //Create temp file
+ if (etk_string_length_get(Cur.edj_temp_name) > 0)
+ old_temp = strdup(Cur.edj_temp_name->string);
+ else
+ old_temp = NULL;
+
+ char tmpn[1024];
+ int fd = 0;
+ strcpy(tmpn, "/tmp/edje_editor_tmp.edj-XXXXXX");
+ fd = mkstemp(tmpn);
+ if (fd < 0)
+ {
+ printf("Can't create temp file '%s'\nError: %s\n", tmpn,
strerror(errno));
+ return 0;
+ }
+ Cur.edj_temp_name = etk_string_set(Cur.edj_temp_name, tmpn);
+
+
+ if (!ecore_file_cp(realp, Cur.edj_temp_name->string))
+ {
+ ShowAlert("<b>ERROR</b>:<br>Can't copy to temp file.");
+ return 0;
+ }
+
+
+ Cur.edj_file_name = etk_string_set(Cur.edj_file_name, realp);
+
+ ecore_evas_title_set(UI_ecore_MainWin, Cur.edj_file_name->string);
+
+ Cur.group = etk_string_clear(Cur.group);
+ Cur.part = etk_string_clear(Cur.part);
+ Cur.state = etk_string_clear(Cur.state);
+ Cur.prog = etk_string_clear(Cur.prog);
+ Parts_Hash = NULL;
+
+ PopulateGroupsComboBox();
+ PopulateFontsComboBox();
+ PopulateImagesComboBox();
+
+
+
+ //Delete old temp file
+ if (old_temp && !ecore_file_unlink(old_temp))
+ {
+ ShowAlert("<b>ERROR</b>:<br>Can't remove temp file.");
+ return 0;
+ }
+ if (old_temp) free(old_temp);
+ return 1;
}
+#endif
/* main */
@@ -484,13 +562,14 @@
return 1;
}
- //Create the etk window with all his widget
+ //Create the etk window and all the widgets
create_main_window();
+
#if TEST_DIRECT_EDJE
printf("*********************************\n");
printf("Testing edje direct access!!...\n");
printf("*********************************\n");
- char *file;
+
double val = 1.2;
printf("TEST:\n");
@@ -498,57 +577,32 @@
sscanf("3.2","%lf", &val);
printf("%f\n", val);
-
-
- if (argc > 1)
- {
- file = ecore_file_realpath(argv[1]);
- if (!ecore_file_exists(file))
- {
- printf("File not exists: '%s'\nExiting...\n",argv[1]);
- return 1;
- }
- if (!ecore_str_has_suffix(file, ".edj")) //TODO: better check
- {
- printf("File is not an edje file: '%s'\nExiting...\n",argv[1]);
- return 1;
- }
- }
- else
- {
- printf("You must specify an edje file to open.\nExiting...\n");
- return 1;
- }
-
- Cur.edj_file_name = etk_string_new(file);
- ecore_evas_title_set(UI_ecore_MainWin, Cur.edj_file_name->string);
-
+ Cur.edj_file_name = etk_string_new("");
+ Cur.edj_temp_name = etk_string_new("");
Cur.group = etk_string_new("");
Cur.part = etk_string_new("");
Cur.state = etk_string_new("");
Cur.prog = etk_string_new("");
- Parts_Hash = NULL;
-
- //Create the main edje object to edit
- edje_o = edje_object_add(UI_evas);
- edje_object_signal_callback_add(edje_o, "*", "*", signal_cb, NULL);
- edje_object_file_set(edje_o, Cur.edj_file_name->string, "icon");
- evas_object_resize(edje_o, 100, 100);
- evas_object_move(edje_o, 100, 100);
- evas_object_show(edje_o);
- /* Evas_Object *o2;
- o2 = edje_object_add(UI_evas);
- edje_object_file_set(o2,"/home/dave/test/globe2.edj","icon");
- evas_object_show(o2);
- evas_object_resize(o2, 100, 100);
- */
+ //~ //Create temp file
+ //~ char tmpn[1024];
+ //~ int fd = 0;
+ //~ strcpy(tmpn, "/tmp/edje_editor_tmp.edj-XXXXXX");
+ //~ fd = mkstemp(tmpn);
+ //~ if (fd < 0)
+ //~ {
+ //~ printf("Can't create temp file '%s'\nError: %s\n", tmpn,
strerror(errno));
+ //~ return 1;
+ //~ }
+ //~ Cur.edj_temp_name = etk_string_set(Cur.edj_temp_name, tmpn);
- PopulateGroupsComboBox();
- PopulateFontsComboBox();
- PopulateImagesComboBox();
-
+ //Open a file from command line
+ if (argc == 2)
+ {
+ printf("Opening edje file: '%s'\n",argv[1]);
+ LoadEDJ2(argv[1]);
+ }
#else
//Open a file
@@ -589,9 +643,13 @@
//Start main loop
etk_main();
+
+#if TEST_DIRECT_EDJE
+ //Remove temp file
+ ecore_file_unlink(Cur.edj_temp_name->string); //TODO move this line down
(when don't use etk_string anymore)
+#endif
etk_shutdown();
-
-
+
return 0;
}
===================================================================
RCS file: /cvs/e/e17/proto/edje_editor/src/bin/main.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -3 -r1.21 -r1.22
--- main.h 18 Dec 2007 06:20:49 -0000 1.21
+++ main.h 28 Dec 2007 23:01:41 -0000 1.22
@@ -14,8 +14,9 @@
#define FAKEWIN_BORDER_BOTTOM 4
#define TEST_DIRECT_EDJE 0
-
+#define ECHO_EDJE_SIGNAL 0
#define DEBUG_TREE 0
+
#if DEBUG_TREE
#define TREE_WIDTH 365
#else
@@ -128,7 +129,8 @@
Etk_String *prog;
Etk_String *edj_file_name;
-
+ Etk_String *edj_temp_name;
+
#endif
}Cur;
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
enlightenment-cvs mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/enlightenment-cvs