clouseau: Add some basic code to handle eet dump/load of the obj tree.
SVN revision: 62908
This commit is contained in:
parent
add4f4ec47
commit
b3730d4157
|
@ -17,7 +17,8 @@ pkg_LTLIBRARIES = libclouseau.la
|
|||
|
||||
libclouseau_la_SOURCES = \
|
||||
libclouseau.c \
|
||||
ui/obj_information.c
|
||||
ui/obj_information.c \
|
||||
eet_dump.c
|
||||
|
||||
libclouseau_la_LDFLAGS = -module -avoid-version -rdynamic
|
||||
libclouseau_la_DEPENDENCIES = $(top_builddir)/config.h
|
||||
|
|
|
@ -0,0 +1,95 @@
|
|||
#include <Eina.h>
|
||||
#include <Eet.h>
|
||||
#include <stdio.h>
|
||||
#include <limits.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#include "libclouseau.h"
|
||||
|
||||
static const char EET_ENTRY[] = "obj_tree";
|
||||
|
||||
static Eet_Data_Descriptor * _Tree_Item_descriptor;
|
||||
static Eet_Data_Descriptor * _Obj_Information_descriptor;
|
||||
|
||||
void
|
||||
eet_dump_tree_item_descriptor_init(void)
|
||||
{
|
||||
Eet_Data_Descriptor_Class eddc;
|
||||
|
||||
EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Tree_Item);
|
||||
_Tree_Item_descriptor = eet_data_descriptor_stream_new(&eddc);
|
||||
|
||||
//EET_EINA_STREAM_DATA_DESCRIPTOR_CLASS_SET(&eddc, Obj_Information);
|
||||
// _Obj_Information_descriptor = eet_data_descriptor_stream_new(&eddc);
|
||||
//
|
||||
#define ITEM_TREE_ADD_BASIC(member, eet_type)\
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC\
|
||||
(_Tree_Item_descriptor, Tree_Item, # member, member, eet_type)
|
||||
#define OBJ_INFORMATION_ADD_BASIC(member, eet_type)\
|
||||
EET_DATA_DESCRIPTOR_ADD_BASIC\
|
||||
(_Obj_Information_descriptor, Obj_Information, # member, member, eet_type)
|
||||
|
||||
ITEM_TREE_ADD_BASIC(name, EET_T_STRING);
|
||||
/* FIXME: So fragile, should handle it properly!!! */
|
||||
ITEM_TREE_ADD_BASIC(ptr, EET_T_UINT);
|
||||
ITEM_TREE_ADD_BASIC(is_obj, EET_T_UCHAR);
|
||||
ITEM_TREE_ADD_BASIC(is_clipper, EET_T_UCHAR);
|
||||
ITEM_TREE_ADD_BASIC(is_visible, EET_T_UCHAR);
|
||||
|
||||
EET_DATA_DESCRIPTOR_ADD_LIST
|
||||
(_Tree_Item_descriptor, Tree_Item, "children", children,
|
||||
_Tree_Item_descriptor);
|
||||
|
||||
#undef ITEM_TREE_ADD_BASIC
|
||||
#undef OBJ_INFORMATION_ADD_BASIC
|
||||
}
|
||||
|
||||
void
|
||||
eet_dump_tree_item_descriptor_shutdown(void)
|
||||
{
|
||||
eet_data_descriptor_free(_Obj_Information_descriptor);
|
||||
eet_data_descriptor_free(_Tree_Item_descriptor);
|
||||
}
|
||||
|
||||
Tree_Item *
|
||||
eet_dump_tree_item_load(const char *filename)
|
||||
{
|
||||
Tree_Item *treeit;
|
||||
Eet_File *ef = eet_open(filename, EET_FILE_MODE_READ);
|
||||
if (!ef)
|
||||
{
|
||||
fprintf(stderr, "ERROR: could not open '%s' for reading.\n", filename);
|
||||
return NULL;
|
||||
}
|
||||
|
||||
treeit = eet_data_read(ef, _Tree_Item_descriptor, EET_ENTRY);
|
||||
if (!treeit)
|
||||
goto end;
|
||||
|
||||
end:
|
||||
eet_close(ef);
|
||||
return treeit;
|
||||
}
|
||||
|
||||
Eina_Bool
|
||||
eet_dump_tree_item_save(const Tree_Item *treeit, const char *filename)
|
||||
{
|
||||
Eet_File * ef;
|
||||
Eina_Bool ret;
|
||||
|
||||
ef = eet_open(filename, EET_FILE_MODE_WRITE);
|
||||
if (!ef)
|
||||
{
|
||||
fprintf(stderr, "ERROR: could not open '%s' for writing.\n", filename);
|
||||
return EINA_FALSE;
|
||||
}
|
||||
|
||||
ret = eet_data_write
|
||||
(ef, _Tree_Item_descriptor, EET_ENTRY, treeit, EINA_TRUE);
|
||||
eet_close(ef);
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
|
@ -0,0 +1,10 @@
|
|||
#ifndef _EET_DUMP_H
|
||||
#define _EET_DUMP_H
|
||||
|
||||
void eet_dump_tree_item_descriptor_init(void);
|
||||
void eet_dump_tree_item_descriptor_shutdown(void);
|
||||
Tree_Item *eet_dump_tree_load(const char *filename);
|
||||
|
||||
Eina_Bool eet_dump_tree_save(const Tree_Item *treeit, const char *filename);
|
||||
|
||||
#endif
|
|
@ -274,7 +274,6 @@ _load_list(Evas_Object *gl)
|
|||
glflag, NULL, NULL);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -22,8 +22,8 @@ struct _Tree_Item
|
|||
Eina_List *children;
|
||||
const char *name;
|
||||
void *ptr;
|
||||
Eina_Bool is_obj : 1;
|
||||
Eina_Bool is_clipper : 1;
|
||||
Eina_Bool is_visible : 1;
|
||||
Eina_Bool is_obj;
|
||||
Eina_Bool is_clipper;
|
||||
Eina_Bool is_visible;
|
||||
};
|
||||
#endif
|
||||
|
|
|
@ -15,8 +15,8 @@ struct _Obj_Information
|
|||
double align_x, align_y;
|
||||
double weight_x, weight_y;
|
||||
int r, g, b, a;
|
||||
Eina_Bool is_clipper : 1;
|
||||
Eina_Bool is_visible : 1;
|
||||
Eina_Bool is_clipper;
|
||||
Eina_Bool is_visible;
|
||||
} evas_props;
|
||||
|
||||
enum {
|
||||
|
@ -32,9 +32,9 @@ struct _Obj_Information
|
|||
const char *type;
|
||||
const char *style;
|
||||
double scale;
|
||||
Eina_Bool is_disabled : 1;
|
||||
Eina_Bool is_mirrored : 1;
|
||||
Eina_Bool is_mirrored_automatic : 1;
|
||||
Eina_Bool is_disabled;
|
||||
Eina_Bool is_mirrored;
|
||||
Eina_Bool is_mirrored_automatic;
|
||||
} elm;
|
||||
struct {
|
||||
const char *font;
|
||||
|
|
Loading…
Reference in New Issue