Mercurial > MadButterfly
changeset 826:94041f085797
Merge from main stream
author | Thinker K.F. Li <thinker@codemud.net> |
---|---|
date | Tue, 14 Sep 2010 05:55:30 +0800 |
parents | e83956ba22d7 (current diff) 586e50f82c1f (diff) |
children | 7eb5421a9864 |
files | src/redraw_man.c |
diffstat | 82 files changed, 708 insertions(+), 549 deletions(-) [+] |
line wrap: on
line diff
--- a/include/Makefile.am Tue Sep 14 05:44:48 2010 +0800 +++ b/include/Makefile.am Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +# -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +# vim: sw=4:ts=8:sts=4 include_HEADERS = \ mb_config.h \ mb_animate.h \
--- a/include/mb.h Tue Sep 14 05:44:48 2010 +0800 +++ b/include/mb.h Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #ifndef __MB_H_ #define __MB_H_
--- a/include/mb_X_supp.h Tue Sep 14 05:44:48 2010 +0800 +++ b/include/mb_X_supp.h Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #ifndef __X_SUPP_H_ #define __X_SUPP_H_
--- a/include/mb_af.h Tue Sep 14 05:44:48 2010 +0800 +++ b/include/mb_af.h Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #ifndef __APP_H #define __APP_H
--- a/include/mb_ani_menu.h Tue Sep 14 05:44:48 2010 +0800 +++ b/include/mb_ani_menu.h Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #ifndef __ANIMATED_MENU_H #define __ANIMATED_MENU_H typedef struct _mb_animated_menu { @@ -19,9 +21,9 @@ X_kb_event_t pending_keys[16]; int pending_pos, pending_last; } mb_animated_menu_t; -/** \brief Create an instace of animated menu. +/** \brief Create an instace of animated menu. * - * The objectnames is used to extract symbols from the SVG file. + * The objectnames is used to extract symbols from the SVG file. * ${objectnames}0 - ${objectnames}8 is the text object. * ${objectnames}_lightbar is the lightbar. *
--- a/include/mb_animate.h Tue Sep 14 05:44:48 2010 +0800 +++ b/include/mb_animate.h Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #ifndef __ANIMATE_H_ #define __ANIMATE_H_
--- a/include/mb_basic_types.h Tue Sep 14 05:44:48 2010 +0800 +++ b/include/mb_basic_types.h Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #ifndef __MB_BASIC_TYPES_H_ #define __MB_BASIC_TYPES_H_
--- a/include/mb_config.h.in Tue Sep 14 05:44:48 2010 +0800 +++ b/include/mb_config.h.in Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #ifndef __MB_CONFIG_H_ #define __MB_CONFIG_H_
--- a/include/mb_graph_engine.h Tue Sep 14 05:44:48 2010 +0800 +++ b/include/mb_graph_engine.h Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #ifndef __MBE_H_ #define __MBE_H_ #include <mb_config.h>
--- a/include/mb_graph_engine_cairo.h Tue Sep 14 05:44:48 2010 +0800 +++ b/include/mb_graph_engine_cairo.h Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #ifndef __MB_GE_CAIRO_H_ #define __MB_GE_CAIRO_H_
--- a/include/mb_graph_engine_skia.h Tue Sep 14 05:44:48 2010 +0800 +++ b/include/mb_graph_engine_skia.h Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #ifndef __MB_GE_SKIA_H_ #define __MB_GE_SKIA_H_
--- a/include/mb_img_ldr.h Tue Sep 14 05:44:48 2010 +0800 +++ b/include/mb_img_ldr.h Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #ifndef __MB_IMG_LDR_H_ #define __MB_IMG_LDR_H_
--- a/include/mb_obj.h Tue Sep 14 05:44:48 2010 +0800 +++ b/include/mb_obj.h Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #ifndef __MBOBJ_H #define __MBOBJ_H #include "mb_shapes.h"
--- a/include/mb_observer.h Tue Sep 14 05:44:48 2010 +0800 +++ b/include/mb_observer.h Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #ifndef __OBSERVER_H_ #define __OBSERVER_H_
--- a/include/mb_paint.h Tue Sep 14 05:44:48 2010 +0800 +++ b/include/mb_paint.h Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #ifndef __PAINT_H_ #define __PAINT_H_
--- a/include/mb_prop.h Tue Sep 14 05:44:48 2010 +0800 +++ b/include/mb_prop.h Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #ifndef __MB_PROP_H_ #define __MB_PROP_H_
--- a/include/mb_redraw_man.h Tue Sep 14 05:44:48 2010 +0800 +++ b/include/mb_redraw_man.h Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #ifndef __REDRAW_MAN_H_ #define __REDRAW_MAN_H_ @@ -78,8 +80,8 @@ * \see addrm_monitor_hdlr() */ mb_obj_t *last_mouse_over; - void *rt; /*!< \brief This is a pointer to the current - * graphic backend. + void *rt; /*!< \brief This is a pointer to the current + * graphic backend. * \see rdman_attach_backend() */ mb_prop_store_t props; @@ -215,8 +217,8 @@ * */ #define rdman_attach_backend(rdman,backend) (((rdman)->rt)=(backend)) -/*! \brief Load sprite dymanicly from the shared object module. - * +/*! \brief Load sprite dymanicly from the shared object module. + * * The search path can be changed by sprite_set_search_path. The name * can have a relative path in the front of it. * This function will search the object in the current working directory @@ -249,7 +251,7 @@ * - render manager(?) */ typedef struct { - + void *(*init)(const char *display,int w,int h); void (*free)(void *be); void (*add_event)(void *be,int type, int fd, mb_eventcb_t f,void *arg);
--- a/include/mb_shapes.h Tue Sep 14 05:44:48 2010 +0800 +++ b/include/mb_shapes.h Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 /*! \file * \brief Declare interfaces of shapes. * @@ -34,7 +36,7 @@ * - *_draw() is responsive to define shape. How the shape is filled * or stroked is defined by paint. * - first member variable of a shape type must be a shape_t. - * + * * Must modify * - event.c::draw_shape_path() * - redraw_man.c::clean_shape() @@ -48,14 +50,14 @@ * update geo_t. * * \section rdman_man_shape Make a redraw manager managing a shape. - * + * * It means managing life cycle of a shape to make a redraw manager * managing a shape. Shapes are referenced by a redraw manager to * update output device. So, a redraw manager must make sure all * shapes are valid when they are needed to update output. To make sure * lifecycle of shapes are synchronized with status of a redraw manager, * lifecycle of shapes are managed by associated redraw manager. - * + * */ /*! \defgroup shapes Shapes @@ -85,12 +87,12 @@ co_aix font_size, mbe_font_face_t *face,PangoAttrList *attrs); /*! \brief Change the content of the text element. - * In the SVG, the content of a text tag can be composed of several tspan inside it. The Madbutterfly parser will collect all content of a + * In the SVG, the content of a text tag can be composed of several tspan inside it. The Madbutterfly parser will collect all content of a * text segement as a single string. The attribute of these characters are saved in a seperate data structure. In the program level, we will - * not keep the SVG text tree. Instead, all attributes will be expanded into a list. + * not keep the SVG text tree. Instead, all attributes will be expanded into a list. * - * When you change the content of a text element, please remember that the attributes will not be removed by the way. You need to change - * them seperately. + * When you change the content of a text element, please remember that the attributes will not be removed by the way. You need to change + * them seperately. * */ extern void sh_text_set_text(shape_t *shape, const char *txt); @@ -142,34 +144,34 @@ /*! \brief Change the style of the text. * - * This function can add a couple of attributes to a segment of text or the whole text field. If the @end is -1, the attributes + * This function can add a couple of attributes to a segment of text or the whole text field. If the @end is -1, the attributes * will be applied to the whole text field. The @style should be initialized by using the mb_textstyle_xxx functions. All attributes * which is not initialized will not be changed. It means that the @style will be added into all existing style instead of reaplcing * it. */ extern void sh_text_set_style(shape_t *shape,int begin,int end,mb_textstyle_t *format); /*! \brief Change the color of the text field - * Change the color of the whole text field. This will removed all existing color attribute. If you want to change part of the text + * Change the color of the whole text field. This will removed all existing color attribute. If you want to change part of the text * field only, please use the sh_text_set_style instead. */ extern void sh_text_set_color(shape_t *shape, unsigned color); /*! \brief Turn on/off the bold attribute. - * Turn on/off the font weight of the whole text field. This will removed all existing bold setting. If you want to change part of the text + * Turn on/off the font weight of the whole text field. This will removed all existing bold setting. If you want to change part of the text * field only, please use the sh_text_set_style instead. */ extern void sh_text_set_bold(shape_t *shape, int bold); /*! \brief Turn on/off the italic attribute. - * Turn on/off the italic of the whole text field. This will removed all existing italic setting. If you want to change part of the text + * Turn on/off the italic of the whole text field. This will removed all existing italic setting. If you want to change part of the text * field only, please use the sh_text_set_style instead. */ extern void sh_text_set_italic(shape_t *shape, int italic); /*! \brief Turn on/off the underline attribute. - * Turn on/off the underline of the whole text field. This will removed all existing underline setting. If you want to change part of the text + * Turn on/off the underline of the whole text field. This will removed all existing underline setting. If you want to change part of the text * field only, please use the sh_text_set_style instead. */ extern void sh_text_set_underline(shape_t *shape, int underline); /*! \brief Change the font of the text field. - * Change the font of the whole text field. This will removed all existing underline setting. If you want to change part of the text + * Change the font of the whole text field. This will removed all existing underline setting. If you want to change part of the text * field only, please use the sh_text_set_style instead. */ extern void sh_text_set_font(shape_t *shape, char *family); @@ -195,7 +197,7 @@ return NULL; } extern void mb_textstyle_set_bold(mb_textstyle_t *style, int bold); -static inline int mb_textstyle_get_bold(mb_textstyle_t *style) +static inline int mb_textstyle_get_bold(mb_textstyle_t *style) { return style->property & TEXTSTYLE_BOLD; }
--- a/include/mb_so.h Tue Sep 14 05:44:48 2010 +0800 +++ b/include/mb_so.h Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 /*! \file * \brief Define types for sprite shared objects. *
--- a/include/mb_timer.h Tue Sep 14 05:44:48 2010 +0800 +++ b/include/mb_timer.h Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #ifndef __MB_TIMER_H_ #define __MB_TIMER_H_
--- a/include/mb_tools.h Tue Sep 14 05:44:48 2010 +0800 +++ b/include/mb_tools.h Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #ifndef __TOOLS_H_ #define __TOOLS_H_
--- a/include/mb_types.h Tue Sep 14 05:44:48 2010 +0800 +++ b/include/mb_types.h Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #ifndef __MB_TYPES_H_ #define __MB_TYPES_H_ @@ -227,7 +229,7 @@ #define COF_DIRTY 0x1 #define COF_HIDDEN 0x2 /*!< A coord is hidden. */ #define COF_OWN_CANVAS 0x4 /*!< A coord owns a canvas or inherit it - * from an ancestor. + * from an ancestor. */ #define COF_SKIP_TRIVAL 0x8 /*!< temporary skip descendants * when trivaling. @@ -251,7 +253,7 @@ */ #define COF_TEMP_MARK 0x400 /*!< \brief Temporary mark a coord. */ #define COF_JUST_ZERO 0x800 /*!< \brief The coord is real peformed zeroing. - * + * * It's canvas is changed by zeroing. */ #define COF_DIRTY_PCACHE_AREA 0x1000 /*!< \brief pcache_area shoud be @@ -437,7 +439,7 @@ /*! \defgroup mb_sprite_lsym Sprite with linear symbol table. * @{ - */ + */ struct _mb_sprite_lsym_entry { const char *sym; const int offset;
--- a/include/mbbutton.h Tue Sep 14 05:44:48 2010 +0800 +++ b/include/mbbutton.h Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #ifndef __MBBUTTON_H #define __MBBUTTON_H typedef struct _mb_button {
--- a/nodejs/Makefile.am Tue Sep 14 05:44:48 2010 +0800 +++ b/nodejs/Makefile.am Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +# -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +# vim: sw=4:ts=8:sts=4 mbfly_node_SRCS = mbfly_njs.cc X_supp_njs.c coord.cc shapes.cc paints.cc \ font.cc
--- a/nodejs/README.h Tue Sep 14 05:44:48 2010 +0800 +++ b/nodejs/README.h Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 /*! \defgroup xnjsmb MadButterfly JS binding for V8 and nodejs * * This implementation of JS binding heavily relies on
--- a/nodejs/X_supp_njs.c Tue Sep 14 05:44:48 2010 +0800 +++ b/nodejs/X_supp_njs.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 /*! \brief Implement X11 backend for nodejs plugin. * * Since nodejs use libev to handle event loops, part of X11 backend @@ -26,7 +28,7 @@ mb_timeval_t now, tmo; ev_tstamp tout; int r; - + tman = X_MB_tman(rt->xrt); get_now(&now); r = mb_tman_next_timeout(tman, &now, &tmo); @@ -50,7 +52,7 @@ rdman = X_MB_rdman(rt->xrt); _X_MB_handle_x_event_for_nodejs(rt->xrt); rdman_redraw_changed(rdman); - + if(rt->enable_timer == 0) /* no installed timeout */ set_next_timeout(rt); } @@ -62,7 +64,7 @@ redraw_man_t *rdman; mb_timeval_t now; extern int _X_MB_flush_x_conn_for_nodejs(void *rt); - + tman = X_MB_tman(rt->xrt); get_now(&now); mb_tman_handle_timeout(tman, &now); @@ -70,7 +72,7 @@ rdman = X_MB_rdman(rt->xrt); rdman_redraw_changed(rdman); _X_MB_flush_x_conn_for_nodejs(rt->xrt); - + set_next_timeout(rt); } @@ -106,7 +108,7 @@ ev_io_stop(&rt->iowatcher); if(rt->enable_timer) ev_timer_stop(&rt->tmwatcher); - + X_MB_free(rt->xrt); free(rt); } @@ -118,7 +120,7 @@ extern int _X_MB_flush_x_conn_for_nodejs(void *rt); _X_MB_flush_x_conn_for_nodejs(xrt); - + return r; } @@ -126,7 +128,7 @@ X_njs_MB_new(char *display_name, int w, int h) { njs_runtime_t *rt; void *xrt; - + rt = (njs_runtime_t *)malloc(sizeof(njs_runtime_t)); ASSERT(rt != NULL); @@ -135,7 +137,7 @@ rt->xrt = xrt; rt->enable_io = 0; rt->enable_timer = 0; /* no timer, now */ - + return rt; }
--- a/nodejs/X_supp_njs.h Tue Sep 14 05:44:48 2010 +0800 +++ b/nodejs/X_supp_njs.h Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #ifndef __X_SUPP_NJS_H_ #define __X_SUPP_NJS_H_
--- a/nodejs/animate.js Tue Sep 14 05:44:48 2010 +0800 +++ b/nodejs/animate.js Tue Sep 14 05:55:30 2010 +0800 @@ -1,5 +1,5 @@ // -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- -// vim: sw=4:ts=8:sts=4:ai +// vim: sw=4:ts=8:sts=4 var sys=require("sys"); /*
--- a/nodejs/canvas.js Tue Sep 14 05:44:48 2010 +0800 +++ b/nodejs/canvas.js Tue Sep 14 05:55:30 2010 +0800 @@ -1,5 +1,5 @@ -// -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- -// vim: sw=4:ts=4:sts=4 +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 var mbfly = require("mbfly"); var sys=require("sys");
--- a/nodejs/coord.cc Tue Sep 14 05:44:48 2010 +0800 +++ b/nodejs/coord.cc Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <stdio.h> #include <v8.h> @@ -83,7 +85,7 @@ WRAP(*child_hdl, NULL); child_hdl->Dispose(); delete child_hdl; - + /* Invalidate members of a coord */ FOR_COORD_SHAPES(child, mem) { mem_hdl = (Persistent<Object> *)mb_prop_get(&mem->obj.props, @@ -107,9 +109,9 @@ coord_t *child, *last_child; shape_t *mem, *last_mem; int r; - + rdman_coord_changed(rdman, coord); - + last_child = NULL; FOR_COORDS_POSTORDER(coord, child) { if(last_child != NULL) { @@ -117,7 +119,7 @@ if(r != OK) THROW_noret("Unknown error"); } - + /* Free members of a coord */ last_mem = NULL; FOR_COORD_SHAPES(child, mem) { @@ -149,7 +151,7 @@ Persistent<Object> *self_hdl; subject_t *subject; Handle<Value> subject_o; - + /* Keep associated js object in property store for retrieving, * later, without create new js object. */ @@ -179,14 +181,14 @@ int idx, float v, const char **err) { Handle<Object> js_rt; redraw_man_t *rdman; - + if(idx < 0 || idx >= 6) { *err = "Invalid index: out of range"; return 0; } coord_get_matrix(coord)[idx] = v; - + js_rt = GET(self, "mbrt")->ToObject(); rdman = xnjsmb_rt_rdman(js_rt); rdman_coord_changed(rdman, coord); @@ -201,7 +203,7 @@ Persistent<Object> *shape_hdl; redraw_man_t *rdman; int r; - + js_rt = GET(self, "mbrt")->ToObject(); rdman = xnjsmb_rt_rdman(js_rt); r = rdman_add_shape(rdman, shape, coord); @@ -219,10 +221,10 @@ xnjsmb_coord_remove(coord_t *coord, Handle<Object> self) { Handle<Object> js_rt; redraw_man_t *rdman; - + if(!GET(self, "valid")->ToBoolean()->Value()) /* Invalidated object */ THROW_noret("Invalid object"); - + js_rt = GET(self, "mbrt")->ToObject(); rdman = xnjsmb_rt_rdman(js_rt); @@ -234,11 +236,11 @@ xnjsmb_coord_show(coord_t *coord, Handle<Object> self) { Handle<Object> js_rt; redraw_man_t *rdman; - + js_rt = GET(self, "mbrt")->ToObject(); ASSERT(js_rt != NULL); rdman = xnjsmb_rt_rdman(js_rt); - + coord_show(coord); rdman_coord_changed(rdman, coord); } @@ -247,11 +249,11 @@ xnjsmb_coord_hide(coord_t *coord, Handle<Object> self) { Handle<Object> js_rt; redraw_man_t *rdman; - + js_rt = GET(self, "mbrt")->ToObject(); ASSERT(js_rt != NULL); rdman = xnjsmb_rt_rdman(js_rt); - + coord_hide(coord); rdman_coord_changed(rdman, coord); } @@ -261,11 +263,11 @@ float opacity) { Handle<Object> js_rt; redraw_man_t *rdman; - + js_rt = GET(self, "mbrt")->ToObject(); ASSERT(js_rt != NULL); rdman = xnjsmb_rt_rdman(js_rt); - + coord_set_opacity(coord, opacity); rdman_coord_changed(rdman, coord); } @@ -296,7 +298,7 @@ xnjsmb_auto_coord_init(); init_flag = 1; } - + rdman = xnjsmb_rt_rdman(js_rt); root = rdman_get_root(rdman); obj = xnjsmb_auto_coord_new(root).As<Object>();
--- a/nodejs/font.cc Tue Sep 14 05:44:48 2010 +0800 +++ b/nodejs/font.cc Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <v8.h> #include "mbfly_njs.h" @@ -62,10 +64,10 @@ temp = FunctionTemplate::New(); temp->SetClassName(String::New("font_face")); - + inst_temp = temp->InstanceTemplate(); inst_temp->SetInternalFieldCount(1); - + xnjsmb_font_face_temp = Persistent<FunctionTemplate>::New(temp); }
--- a/nodejs/image_ldr.cc Tue Sep 14 05:44:48 2010 +0800 +++ b/nodejs/image_ldr.cc Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 /*! \file * This file implements Javascript binding for img_ldr_t of MadButterfly. */ @@ -46,14 +48,14 @@ img_data_obj = img_data_temp->NewInstance(); ASSERT(img_data_obj); - + img_data = MB_IMG_LDR_LOAD(img_ldr, img_id); if(img_data == NULL) THROW("Can not load an image"); WRAP(img_data_obj, img_data); scope.Close(img_data_obj); - + return img_data_obj; } @@ -66,12 +68,12 @@ Handle<Object> self = args.This(); char *path; mb_img_ldr_t *img_ldr; - + if(argc != 1) THROW("Invalid number of arguments (!= 1)"); if(!args[0]->IsString()) THROW("Invalid argument type"); - + String::Utf8Value pathutf8(args[0]->ToString()); path = *pathutf8; @@ -92,7 +94,7 @@ Handle<Value> il_args[1]; Handle<Object> img_ldr; Handle<Function> func; - + if(argc != 1) THROW("Invalid number of arguments (!= 1)"); if(!args[0]->IsString()) @@ -127,7 +129,7 @@ _img_data_temp = ObjectTemplate::New(); _img_data_temp->SetInternalFieldCount(1); img_data_temp = Persistent<ObjectTemplate>::New(_img_data_temp); - + /* Setup img_ldr class */ img_ldr_temp = FunctionTemplate::New(xnjsmb_img_ldr); img_ldr_temp->SetClassName(String::New("img_ldr"));
--- a/nodejs/mbapp.js Tue Sep 14 05:44:48 2010 +0800 +++ b/nodejs/mbapp.js Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 var mbfly = require("mbfly"); var svg = require("./svg"); var sys = require("sys"); @@ -30,6 +32,7 @@ } app.prototype.KeyPress = function(evt) { + sys.puts(evt.sym); if (this.onKeyPress) this.onKeyPress(evt.sym); if (evt.sym in this.keymap) this.keymap[evt.sym](); } @@ -69,8 +72,11 @@ exports.app=app; // Put all key definition here +exports.KEY_LEFT = 0xff51; exports.KEY_UP = 0xff52; +exports.KEY_RIGHT = 0xff53; exports.KEY_DOWN = 0xff54; +exports.KEY_ENTER = 0xff0d; exports.EVT_ANY=0; exports.EVT_MOUSE_OVER=1; exports.EVT_MOUSE_OUT=2;
--- a/nodejs/mbfly_njs.cc Tue Sep 14 05:44:48 2010 +0800 +++ b/nodejs/mbfly_njs.cc Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <stdio.h> #include <string.h> #include <v8.h> @@ -70,7 +72,7 @@ * here. */ X_njs_MB_init_handle_connection(obj); xnjsmb_coord_mkroot(self); - + subject = X_njs_MB_kbevents(obj); subject_o = export_xnjsmb_auto_subject_new(subject); SET(self, "kbevents", subject_o); @@ -112,7 +114,7 @@ rt = (njs_runtime_t *)UNWRAP(mbrt); rdman = X_njs_MB_rdman(rt); - + return rdman; } @@ -145,9 +147,9 @@ xnjsmb_font_init_mb_rt_temp(xnjsmb_auto_mb_rt_temp); xnjsmb_img_ldr_init_mb_rt_temp(target); xnjsmb_observer_init(); - + target->Set(String::New("mb_rt"), - xnjsmb_auto_mb_rt_temp->GetFunction()); + xnjsmb_auto_mb_rt_temp->GetFunction()); } /* @} */
--- a/nodejs/mbfly_njs.h Tue Sep 14 05:44:48 2010 +0800 +++ b/nodejs/mbfly_njs.h Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #ifndef __MBFLY_NJS_H_ #define __MBFLY_NJS_H_
--- a/nodejs/observer.cc Tue Sep 14 05:44:48 2010 +0800 +++ b/nodejs/observer.cc Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <v8.h> #include "mbfly_njs.h" @@ -30,7 +32,7 @@ xnjsmb_event_mod(Handle<Object> self, event_t *evt) { mouse_event_t *mevt; X_kb_event_t *xkbevt; - + switch(evt->type) { case EVT_ANY: case EVT_MOUSE_OVER: @@ -44,14 +46,14 @@ SET(self, "but_state", Integer::New(mevt->but_state)); SET(self, "button", Integer::New(mevt->button)); break; - + case EVT_KB_PRESS: case EVT_KB_RELEASE: xkbevt = (X_kb_event_t *)evt; SET(self, "keycode", Integer::New(xkbevt->keycode)); SET(self, "sym", Integer::New(xkbevt->sym)); break; - + case EVT_PROGM_COMPLETE: case EVT_RDMAN_REDRAW: case EVT_MONITOR_ADD: @@ -70,7 +72,7 @@ observer_t *observer; xnjsmb_observer_data *data; Handle<Context> ctx; - + data = new xnjsmb_observer_data; if(data == NULL) return NULL; @@ -96,7 +98,7 @@ static Handle<Value> xnjsmb_event_tgt_getter(Handle<Object> self, event_t *evt, const char **err) { Persistent<Object> *hdl; - + hdl = (Persistent<Object> *) mb_prop_get(&((mb_obj_t *)evt->tgt->obj)->props, PROP_JSOBJ); @@ -113,7 +115,7 @@ xnjsmb_event_cur_tgt_getter(Handle<Object> self, event_t *evt, const char **err) { Persistent<Object> *hdl; - + hdl = (Persistent<Object> *) mb_prop_get(&((mb_obj_t *)evt->cur_tgt->obj)->props, PROP_JSOBJ); @@ -152,7 +154,7 @@ Handle<Value> export_xnjsmb_auto_subject_new(subject_t *subject) { Handle<Value> val; - + val = xnjsmb_auto_subject_new(subject); return val; }
--- a/nodejs/paints.cc Tue Sep 14 05:44:48 2010 +0800 +++ b/nodejs/paints.cc Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <v8.h> extern "C" { @@ -36,14 +38,14 @@ Handle<Object> rt; redraw_man_t *rdman; int r; - + paint = (paint_t *)UNWRAP(*paint_hdl); rt = GET(*paint_hdl, "mbrt")->ToObject(); rdman = xnjsmb_rt_rdman(rt); - + r = rdman_paint_free(rdman, paint); ASSERT(r == 0); - + paint_hdl->Dispose(); delete paint_hdl; } @@ -51,7 +53,7 @@ static void xnjsmb_paint_mod(Handle<Object> self, void *paint) { Persistent<Object> *paint_hdl; - + paint_hdl = new Persistent<Object>(); *paint_hdl = Persistent<Object>::New(self); @@ -68,9 +70,9 @@ rt_v = GET(self, "mbrt"); rt_o = rt_v->ToObject(); rdman = xnjsmb_rt_rdman(rt_o); - + rdman_paint_fill(rdman, paint, sh); - + if(sh_get_coord(sh)) rdman_shape_changed(rdman, sh); @@ -88,9 +90,9 @@ rt_v = GET(self, "mbrt"); rt_o = rt_v->ToObject(); rdman = xnjsmb_rt_rdman(rt_o); - + rdman_paint_stroke(rdman, paint, sh); - + if(sh_get_coord(sh)) rdman_shape_changed(rdman, sh); @@ -139,7 +141,7 @@ stop_o->Get(3)->ToNumber()->Value(), /* b */ stop_o->Get(4)->ToNumber()->Value()); /* a */ } - + old_grad_stops = paint_linear_stops(paint, nstops, grad_stops); if(old_grad_stops) free(old_grad_stops); /* The stops, here, were allocated for @@ -172,7 +174,7 @@ stop_o->Get(3)->ToNumber()->Value(), /* b */ stop_o->Get(4)->ToNumber()->Value()); /* a */ } - + old_grad_stops = paint_radial_stops(paint, nstops, grad_stops); if(old_grad_stops) free(old_grad_stops); /* The stops, here, were allocated for @@ -265,36 +267,36 @@ Handle<Value> export_xnjsmb_auto_paint_color_new(paint_t *paint) { Handle<Value> ret; - + ret = xnjsmb_auto_paint_color_new(paint); - + return ret; } Handle<Value> export_xnjsmb_auto_paint_image_new(paint_t *paint) { Handle<Value> ret; - + ret = xnjsmb_auto_paint_image_new(paint); - + return ret; } Handle<Value> export_xnjsmb_auto_paint_linear_new(paint_t *paint) { Handle<Value> ret; - + ret = xnjsmb_auto_paint_linear_new(paint); - + return ret; } Handle<Value> export_xnjsmb_auto_paint_radial_new(paint_t *paint) { Handle<Value> ret; - + ret = xnjsmb_auto_paint_radial_new(paint); - + return ret; } /* @} */ @@ -314,7 +316,7 @@ xnjsmb_auto_paint_image_init(); xnjsmb_auto_paint_linear_init(); xnjsmb_auto_paint_radial_init(); - + init_flag = 1; } }
--- a/nodejs/phone.js Tue Sep 14 05:44:48 2010 +0800 +++ b/nodejs/phone.js Tue Sep 14 05:55:30 2010 +0800 @@ -1,5 +1,5 @@ // -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- -// vim: sw=4:ts=8:sts=4:ai +// vim: sw=4:ts=8:sts=4 var mbapp = require("./mbapp"); var sys=require("sys"); var animate=require("./animate");
--- a/nodejs/shapes.cc Tue Sep 14 05:44:48 2010 +0800 +++ b/nodejs/shapes.cc Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <v8.h> #include "mbfly_njs.h" @@ -34,7 +36,7 @@ shape = (shape_t *)UNWRAP(*self_hdl); if(shape == NULL) return; - + WRAP(*self_hdl, NULL); js_rt = GET(*self_hdl, "mbrt")->ToObject(); @@ -50,7 +52,7 @@ xnjsmb_shape_mod(Handle<Object> self, shape_t *sh) { Persistent<Object> *self_hdl; static int count = 0; - + /* Keep associated js object in property store for retrieving, * later, without create new js object. */ @@ -86,7 +88,7 @@ redraw_man_t *rdman; int r; int i; - + blksobj = Array::Cast(*blks); nblks = blksobj->Length(); mb_blks = new mb_style_blk_t[nblks]; @@ -96,23 +98,23 @@ mb_blks[i].face = (mb_font_face_t *)UNWRAP(blkobj->Get(1)->ToObject()); mb_blks[i].font_sz = blkobj->Get(2)->ToNumber()->Value(); } - + r = sh_stext_set_style(sh, mb_blks, nblks); if(r != 0) { *err = "Unknown error"; return; } - + /* * Mark changed. */ rt = GET(self, "mbrt")->ToObject(); ASSERT(rt != NULL); rdman = xnjsmb_rt_rdman(rt); - + if(sh_get_coord(sh)) rdman_shape_changed(rdman, sh); - + delete mb_blks; } @@ -131,17 +133,17 @@ float stroke_width; Handle<Object> rt; redraw_man_t *rdman; - + stroke_width = value->Int32Value(); sh_set_stroke_width(sh, stroke_width); - + /* * Mark changed. */ rt = GET(self, "mbrt")->ToObject(); ASSERT(rt != NULL); rdman = xnjsmb_rt_rdman(rt); - + if(sh_get_coord(sh)) rdman_shape_changed(rdman, sh); } @@ -150,11 +152,11 @@ xnjsmb_shape_show(shape_t *sh, Handle<Object> self) { Handle<Object> js_rt; redraw_man_t *rdman; - + js_rt = GET(self, "mbrt")->ToObject(); ASSERT(js_rt != NULL); rdman = xnjsmb_rt_rdman(js_rt); - + sh_show(sh); rdman_shape_changed(rdman, sh); } @@ -163,11 +165,11 @@ xnjsmb_shape_hide(shape_t *sh, Handle<Object> self) { Handle<Object> js_rt; redraw_man_t *rdman; - + js_rt = GET(self, "mbrt")->ToObject(); ASSERT(js_rt != NULL); rdman = xnjsmb_rt_rdman(js_rt); - + sh_hide(sh); rdman_shape_changed(rdman, sh); } @@ -181,14 +183,14 @@ self_hdl = (Persistent<Object> *)mb_prop_get(&sh->obj.props, PROP_JSOBJ); - + SET(*self_hdl, "valid", Boolean::New(0)); WRAP(*self_hdl, NULL); js_rt = GET(*self_hdl, "mbrt")->ToObject(); ASSERT(js_rt != NULL); rdman = xnjsmb_rt_rdman(js_rt); - + rdman_shape_changed(rdman, sh); r = rdman_shape_free(rdman, sh); if(r != OK) @@ -203,16 +205,16 @@ float w, float h, float rx, float ry) { Handle<Object> rt; redraw_man_t *rdman; - + sh_rect_set(sh, x, y, w, h, rx, ry); - + /* * Mark changed. */ rt = GET(self, "mbrt")->ToObject(); ASSERT(rt != NULL); rdman = xnjsmb_rt_rdman(rt); - + if(sh_get_coord(sh)) rdman_shape_changed(rdman, sh); } @@ -223,7 +225,7 @@ /*! \defgroup xnjsmb_shapes_wraps Exported wrapper makers for shapes * \ingroup xnjsmb_shapes - * + * * These functions are used by methods of mb_rt to wrap shape objects * as Javascript objects. * @@ -260,12 +262,12 @@ xnjsmb_path_new(njs_runtime_t *rt, const char *d) { redraw_man_t *rdman; shape_t *sh; - + rdman = X_njs_MB_rdman(rt); sh = rdman_shape_path_new(rdman, d); /* Code generator supposes that callee should free the memory */ free((void *)d); - + return sh; }
--- a/nodejs/testcanvas.js Tue Sep 14 05:44:48 2010 +0800 +++ b/nodejs/testcanvas.js Tue Sep 14 05:55:30 2010 +0800 @@ -1,4 +1,5 @@ -// vim: ts=4 +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 var mbapp = require("./mbapp"); var sys=require("sys"); var canvas=require("./canvas");
--- a/nodejs/testcase.js Tue Sep 14 05:44:48 2010 +0800 +++ b/nodejs/testcase.js Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 var mbfly = require("mbfly"); var r = mbfly.Hello(" test"); var sys = require("sys");
--- a/nodejs/testdesktop.js Tue Sep 14 05:44:48 2010 +0800 +++ b/nodejs/testdesktop.js Tue Sep 14 05:55:30 2010 +0800 @@ -1,4 +1,5 @@ -// vim: ts=4 +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 var svg = require("./svg"); var mbapp = require("./mbapp"); var sys=require("sys"); @@ -16,8 +17,11 @@ item = 0; an = new animate.scale(app,items[item],1,1.5,0.1); an.start(); +setInterval(function() { + -app.addKeyListener(mbapp.KEY_UP, function() { +}, 300); +app.addKeyListener(mbapp.KEY_LEFT, function() { var old = items[item]; item = item - 1; if (item == -1) { @@ -31,7 +35,7 @@ an.start(); }); -app.addKeyListener(mbapp.KEY_DOWN, function() { +app.addKeyListener(mbapp.KEY_RIGHT, function() { var old = items[item]; item = item + 1; if (item == items.length) {
--- a/nodejs/testleak.js Tue Sep 14 05:44:48 2010 +0800 +++ b/nodejs/testleak.js Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 var mbfly = require("mbfly"); var sys = require("sys"); var cproc = require("child_process");
--- a/nodejs/testsvg.js Tue Sep 14 05:44:48 2010 +0800 +++ b/nodejs/testsvg.js Tue Sep 14 05:55:30 2010 +0800 @@ -1,5 +1,5 @@ -// -*- indent-tabs-mode: nil; tab-width: 4; c-basic-offset: 4; -*- -// vim: sw=4:ts=4:sts=4 +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 var svg = require("./svg"); var mbapp = require("./mbapp"); var sys=require("sys");
--- a/src/Makefile.am Tue Sep 14 05:44:48 2010 +0800 +++ b/src/Makefile.am Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +# -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +# vim: sw=4:ts=8:sts=4 include $(top_srcdir)/config.mk lib_LTLIBRARIES = libmbfly.la
--- a/src/Makefile.pmake Tue Sep 14 05:44:48 2010 +0800 +++ b/src/Makefile.pmake Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +# -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +# vim: sw=4:ts=8:sts=4 SRCS = coord.c geo.c shape_path.c shape_text.c shape_rect.c \ shape_image.c \ redraw_man.c timer.c animate.c paint.c event.c observer.c \
--- a/src/X_main.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/X_main.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <stdio.h> #include <unistd.h> #include <sys/time.h> @@ -191,7 +193,7 @@ rdman_add_shape(&rdman, (shape_t *)path1, coord1); rdman_add_shape(&rdman, (shape_t *)path2, coord2); - + fill3 = rdman_paint_linear_new(&rdman, 50, 50, 150, 150); grad_stop_init(fill3_stops, 0, 1, 0, 0, 0.5); grad_stop_init(fill3_stops + 1, 0.5, 0, 1, 0, 0.5); @@ -209,7 +211,7 @@ if(tman) { /* Prepare an animation program. */ progm = mb_progm_new(10, &rdman); - + MB_TIMEVAL_SET(&start, 0, 0); MB_TIMEVAL_SET(&playing, 1, 0); word = mb_progm_next_word(progm, &start, &playing); @@ -224,7 +226,7 @@ act = mb_shift_new(0, 20, coord1, word); act = mb_shift_new(0, -20, coord2, word); act = mb_visibility_new(VIS_HIDDEN, coord3, word); - + MB_TIMEVAL_SET(&start, 3, 0); MB_TIMEVAL_SET(&playing, 2, 0); word = mb_progm_next_word(progm, &start, &playing); @@ -234,7 +236,7 @@ act = mb_chgcolor_new(0, 0, 1, 0.5, fill1, word); act = mb_chgcolor_new(1, 0, 0, 0.5, fill2, word); act = mb_visibility_new(VIS_VISIBLE, coord3, word); - + /* Start playing the program. */ gettimeofday(&tv, NULL); MB_TIMEVAL_SET(&mbtv, tv.tv_sec, tv.tv_usec);
--- a/src/X_supp.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/X_supp.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -72,7 +74,7 @@ static void XSHM_update(X_MB_runtime_t *xmb_rt) { GC gc; - + gc = DefaultGC(xmb_rt->display, DefaultScreen(xmb_rt->display)); if(xmb_rt->ximage) { /* support XSHM */ XShmPutImage(xmb_rt->display, @@ -166,7 +168,7 @@ but |= MOUSE_BUT2; if(state & Button3Mask) but |= MOUSE_BUT3; - + return but; } @@ -202,12 +204,12 @@ mouse_event.y = y; mouse_event.but_state = state; mouse_event.button = button; - + if(IS_MBO_SHAPES(obj)) subject = sh_get_mouse_event_subject((shape_t *)obj); else subject = coord_get_mouse_event((coord_t *)obj); - + subject_notify(subject, (event_t *)&mouse_event); } @@ -284,7 +286,7 @@ } if(r == -1) break; - + mevt = (XMotionEvent *)&evt; x = mevt->x; y = mevt->y; @@ -400,7 +402,7 @@ else if (rt->monitors[i].type == MONITOR_WRITE) FD_SET(rt->monitors[i].fd, &wfds); } - + get_now(&now); r = mb_tman_next_timeout(tman, &now, &tmo); @@ -474,7 +476,7 @@ disp_buf[cp] = 0; disp_name = disp_buf; } - + display = XOpenDisplay(disp_name); if(display == NULL) return ERR; @@ -519,21 +521,21 @@ XShmSegmentInfo *shminfo; shminfo = &xmb_rt->shminfo; - + if(xmb_rt->shminfo.shmaddr) { XShmDetach(xmb_rt->display, shminfo); } - + if(xmb_rt->ximage) { XDestroyImage(xmb_rt->ximage); xmb_rt->ximage = NULL; } - + if(shminfo->shmaddr) { shmdt(shminfo->shmaddr); shminfo->shmaddr = NULL; } - + if(shminfo->shmid) { shmctl(shminfo->shmid, IPC_RMID, 0); shminfo->shmid = 0; @@ -555,22 +557,22 @@ display = xmb_rt->display; visual = xmb_rt->visual; shminfo = &xmb_rt->shminfo; - + support_shm = XShmQueryExtension(display); if(!support_shm) return; - + screen = DefaultScreen(display); depth = DefaultDepth(display, screen); - + if(depth != 24 && depth != 32) return; - + xmb_rt->ximage = XShmCreateImage(display, visual, depth, ZPixmap, NULL, shminfo, xmb_rt->w, xmb_rt->h); ximage = xmb_rt->ximage; - + mem_sz = ximage->bytes_per_line * ximage->height; shminfo->shmid = shmget(IPC_PRIVATE, mem_sz, IPC_CREAT | 0777); if(shminfo->shmid == -1) { @@ -580,7 +582,7 @@ shminfo->shmaddr = shmat(shminfo->shmid, 0, 0); ximage->data = shminfo->shmaddr; - + shminfo->readOnly = 0; XShmAttach(display, shminfo); @@ -617,7 +619,7 @@ X_MB_init_with_win(X_MB_runtime_t *xmb_rt) { mb_img_ldr_t *img_ldr; int w, h; - + w = xmb_rt->w; h = xmb_rt->h; @@ -630,7 +632,7 @@ xmb_rt->surface_ptn = mbe_pattern_create_for_surface(xmb_rt->surface); - + if(xmb_rt->backend_surface == NULL) /* xshm_init() may create one */ xmb_rt->backend_surface = mbe_xlib_surface_create(xmb_rt->display, @@ -645,7 +647,7 @@ xmb_rt->rdman = (redraw_man_t *)malloc(sizeof(redraw_man_t)); redraw_man_init(xmb_rt->rdman, xmb_rt->cr, xmb_rt->backend_cr); - // FIXME: This is a wired loopback reference. This is inly required when we need + // FIXME: This is a wired loopback reference. This is inly required when we need // to get the xmb_rt->tman for the animation. We should relocate the tman // to the redraw_man_t instead. xmb_rt->rdman->rt = xmb_rt; @@ -656,7 +658,7 @@ xmb_rt->img_ldr = img_ldr; rdman_set_img_ldr(xmb_rt->rdman, img_ldr); memset(xmb_rt->monitors,0,sizeof(xmb_rt->monitors)); - + #ifndef ONLY_MOUSE_MOVE_RAW xmb_rt->last = NULL; #endif @@ -674,7 +676,7 @@ static int X_MB_init(const char *display_name, int w, int h, X_MB_runtime_t *xmb_rt) { int r; - + memset(xmb_rt, 0, sizeof(X_MB_runtime_t)); xmb_rt->w = w; @@ -685,7 +687,7 @@ return ERR; r = X_MB_init_with_win(xmb_rt); - + return r; } @@ -829,7 +831,7 @@ * * These functions are for internal using. * @{ - */ + */ /*! \brief Exported for nodejs plugin to call handle_x_event. */ void _X_MB_handle_x_event_for_nodejs(void *rt) {
--- a/src/animate.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/animate.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 /*! \file * \brief Animation tools. * @@ -41,7 +43,7 @@ * * \code * progm = mb_progm_new(10, &rdman); - * + * * MB_TIMEVAL_SET(&start, 0, 0); * MB_TIMEVAL_SET(&playing, 1, 0); * word = mb_progm_next_word(progm, &start, &playing); @@ -288,7 +290,7 @@ if(MB_TIMEVAL_LATER(&word->abs_start, &next_tmo)) MB_TIMEVAL_CP(&next_tmo, &word->abs_start); timer = mb_tman_timeout(progm->tman, &next_tmo, - mb_progm_step, progm); + mb_progm_step, progm); progm->cur_timer = timer; } else { /* Make program to complete. */ @@ -327,7 +329,7 @@ mb_progm_step(now, now, progm); return; } - + timer = mb_tman_timeout(tman, &progm->words[0].abs_start, mb_progm_step, progm); ASSERT(timer != NULL); @@ -489,7 +491,7 @@ CU_ASSERT(r == 0); CU_ASSERT(MB_TIMEVAL_SEC(&tmo_after) == 0 && MB_TIMEVAL_USEC(&tmo_after) == STEP_INTERVAL); - + /* 1.1s */ MB_TIMEVAL_ADD(&now, &tmo_after); mb_tman_handle_timeout(tman, &now); @@ -499,7 +501,7 @@ CU_ASSERT(r == 0); CU_ASSERT(MB_TIMEVAL_SEC(&tmo_after) == 0 && MB_TIMEVAL_USEC(&tmo_after) == STEP_INTERVAL); - + /* 1.2s */ MB_TIMEVAL_ADD(&now, &tmo_after); mb_tman_handle_timeout(tman, &now); @@ -509,7 +511,7 @@ CU_ASSERT(r == 0); CU_ASSERT(MB_TIMEVAL_SEC(&tmo_after) == 0 && MB_TIMEVAL_USEC(&tmo_after) == STEP_INTERVAL); - + /* 1.3s */ MB_TIMEVAL_ADD(&now, &tmo_after); mb_tman_handle_timeout(tman, &now); @@ -519,7 +521,7 @@ CU_ASSERT(r == 0); CU_ASSERT(MB_TIMEVAL_SEC(&tmo_after) == 0 && MB_TIMEVAL_USEC(&tmo_after) == STEP_INTERVAL); - + /* 1.4s */ MB_TIMEVAL_ADD(&now, &tmo_after); mb_tman_handle_timeout(tman, &now); @@ -529,7 +531,7 @@ CU_ASSERT(r == 0); CU_ASSERT(MB_TIMEVAL_SEC(&tmo_after) == 0 && MB_TIMEVAL_USEC(&tmo_after) == STEP_INTERVAL); - + /* 1.5s */ MB_TIMEVAL_ADD(&now, &tmo_after); mb_tman_handle_timeout(tman, &now); @@ -550,7 +552,7 @@ return NULL; CU_ADD_TEST(suite, test_animate_words); - + return suite; }
--- a/src/chgcolor.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/chgcolor.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <stdio.h> #include <stdlib.h> #include "mb_animate.h"
--- a/src/coord.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/coord.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 /*! \brief Implement coordination tranform mechanism. * \file * This file implements coordination transforming for containers. @@ -28,10 +30,10 @@ void matrix_mul(co_aix *m1, co_aix *m2, co_aix *dst) { co_aix *_dst = dst; co_aix fake_dst[6]; - + if(m1 == dst || m2 == dst) _dst = fake_dst; - + mul_matrix(m1, m2, _dst); if(m1 == dst || m2 == dst) { @@ -60,7 +62,7 @@ /*! \brief Compute aggregated transform matrix. * * Base on parent's aggregated matrix if it is existed, or use transform - * matrix as aggregated matrix. + * matrix as aggregated matrix. */ static void compute_transform_function(coord_t *visit) { if(!coord_is_root(visit)) @@ -82,7 +84,7 @@ co_aix *p_matrix; co_aix cache_p_matrix[6]; co_aix cache_scale_x, cache_scale_y; - + if(!coord_is_root(visit)) { p_matrix = coord_get_aggr_matrix(visit->parent); cache_scale_x = @@ -116,7 +118,7 @@ void compute_reverse(co_aix *orig, co_aix *reverse) { co_aix working[6]; co_aix factor; - + #define VEC_MAC(src, factor, dst) \ do { \ (dst)[0] += (src)[0] * (factor); \ @@ -130,7 +132,7 @@ reverse[3] = 0; reverse[4] = 1; reverse[5] = 0; - + memcpy(working, orig, sizeof(co_aix) * 6); factor = -working[3] / working[0]; @@ -245,7 +247,7 @@ coord_t *next = NULL; ASSERT(last != NULL); - + if((!(last->flags & COF_SKIP_TRIVAL)) && STAILQ_HEAD(last->children)) { next = STAILQ_HEAD(last->children); @@ -272,7 +274,7 @@ if(root == last) return NULL; - + if(last == NULL) { /* Go most left leaf. */ next = root; @@ -325,7 +327,7 @@ update_aggr_matrix(elms); /* | -3 5 0 | - * | 5 1 0 | + * | 5 1 0 | * | 0 0 1 | */ CU_ASSERT(elms[3].aggr_matrix[0] == -3);
--- a/src/event.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/event.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 /*! \file * \brief Convenience functions for event relative work. */ @@ -139,7 +141,7 @@ struct shape { mb_obj_t obj; - + coord_t *coord; area_t area; shape_t *all_next; @@ -148,7 +150,7 @@ void *fill, *stroke; struct shape *sibling; int flags; - + int num_points; co_aix points[32][2]; }; @@ -179,7 +181,7 @@ struct coord { mb_obj_t obj; - + area_t area; int flags; coord_t *parent; @@ -208,7 +210,7 @@ void _areas_merge(area_t *area1, area_t *area2) { co_aix lu_x, lu_y; co_aix rb_x, rb_y; - + lu_x = area2->x; lu_y = area2->y; rb_x = lu_x + area2->w - 1; @@ -225,7 +227,7 @@ area_t *cur_area; area = coord_get_area(coord); - + shape = STAILQ_HEAD(coord->shapes); if(shape != NULL) { cur_area = sh_get_area(shape); @@ -236,7 +238,7 @@ cur_area = coord_get_area(child); } memcpy(area, cur_area, sizeof(area_t)); - + FOR_COORD_SHAPES(coord, shape) { cur_area = sh_get_area(shape); _areas_merge(area, cur_area); @@ -261,9 +263,9 @@ coord_t *preorder_coord_subtree(coord_t *root, coord_t *last) { if(STAILQ_HEAD(last->children) && !(last->flags & COF_SKIP)) return STAILQ_HEAD(last->children); - + last->flags &= ~COF_SKIP; - + if(last == root) return NULL; while(STAILQ_NEXT(coord_t, sibling, last) == NULL) { @@ -282,7 +284,7 @@ static coord_t *postorder_coord_subtree(coord_t *root, coord_t *last) { coord_t *cur; - + if(last != NULL) { if(STAILQ_NEXT(coord_t, sibling, last) == NULL) { if(cur == root) @@ -445,7 +447,7 @@ memset(shape, 0, sizeof(shape_t)); MB_OBJ_INIT(&shape->obj, MBO_PATH); STAILQ_INS(rdman->all_shapes, shape_t, all_next, shape); - + return shape; } @@ -482,7 +484,7 @@ int i, j; cr = surf->cr; - + STAILQ_FOR_EACH(cr->drawed, shape_t, sibling, shape1) { for(i = 0; i < shape1->num_points; i++) { x1 = shape1->points[i][0]; @@ -510,7 +512,7 @@ co_aix x, co_aix y) { shape_t *shape; int r; - + r = rdman_force_clean(rdman); if(r != OK) return ERR; @@ -676,7 +678,7 @@ rdman_surface = mbe_get_target(rdman_get_cr(rdman)); w = mbe_image_surface_get_width(rdman_surface); h = mbe_image_surface_get_height(rdman_surface); - + surface = mbe_image_surface_create(MB_IFMT_A1, w, h); if(surface == NULL) return NULL; @@ -684,7 +686,7 @@ cr = mbe_create(surface); if(cr == NULL) mbe_surface_destroy(surface); - + return cr; } @@ -697,10 +699,10 @@ void _draw_to_mask(shape_t *shape, mbe_t *cr) { if(sh_get_flags(shape, GEF_OV_DRAW)) return; - + draw_shape_path(shape, cr); mbe_clip(cr); - + sh_set_flags(shape, GEF_OV_DRAW); } @@ -745,9 +747,9 @@ shape_t *shape, *candi_shape; int obj_is_shape; int r; - + obj_is_shape = IS_MBO_SHAPES(obj); - + if(obj_is_shape) { shape = (shape_t *)obj; area = sh_get_area(shape); @@ -756,26 +758,26 @@ area = coord_get_area(coord); shape = NULL; } - + if(IS_MBO_SHAPES(others_root)) { candi_shape = (shape_t *)others_root; candi_area = sh_get_area(candi_shape); - + r = areas_are_overlay(area, candi_area); if(!r) return FALSE; - + if(!obj_is_shape) return TRUE; - + _draw_to_mask(candi_shape, cr); r = _fill_and_check(shape, cr); - + return r; } - + ASSERT(IS_MBO_COORD(others_root)); - + root = (coord_t *)others_root; FOR_COORDS_PREORDER(root, candi_coord) { candi_area = coord_get_area(candi_coord); @@ -784,23 +786,23 @@ preorder_coord_skip_subtree(candi_coord); continue; } - + FOR_COORD_SHAPES(candi_coord, candi_shape) { candi_area = sh_get_area(candi_shape); r = areas_are_overlay(area, candi_area); if(!r) continue; - + if(!obj_is_shape) return TRUE; - + _draw_to_mask(candi_shape, cr); r = _fill_and_check(shape, cr); if(r) return TRUE; } } - + return FALSE; } @@ -843,7 +845,7 @@ r = _is_obj_objs_overlay(obj1, obj2, cr); goto out; } - + root = (coord_t *)obj1; FOR_COORDS_PREORDER(root, coord) { area = coord_get_area(coord); @@ -860,7 +862,7 @@ } } r = FALSE; - + out: _clear_ov_draw(obj2); /* marked by _is_obj_objs_overlay() */ _release_mbe_for_testing(cr); @@ -881,7 +883,7 @@ cr = mbe_create(surf); backend = mbe_create(surf); rdman = redraw_man_new(cr, backend); - + return rdman; } @@ -962,7 +964,7 @@ shape_add_point(shape1, 3, 2); shape_add_point(shape2, 5, 5); shape_add_point(shape3, 4, 3); - + surf = mbe_image_surface_create(MB_IFMT_A1, 100, 100); cr = mbe_create(surf); r = _is_obj_objs_overlay((mb_obj_t *)coord1, (mb_obj_t *)coord2, cr); @@ -1010,7 +1012,7 @@ mbe_destroy(cr); mbe_surface_destroy(surf); sh_clear_flags(shape3, GEF_OV_DRAW); - + shape_add_point(shape1, 5, 5); surf = mbe_image_surface_create(MB_IFMT_A1, 100, 100); @@ -1097,39 +1099,39 @@ r = mb_objs_are_overlay(rdman, (mb_obj_t *)coord1, (mb_obj_t *)coord2); CU_ASSERT(!r); - + r = mb_objs_are_overlay(rdman, (mb_obj_t *)shape1, (mb_obj_t *)coord2); CU_ASSERT(!r); - + r = mb_objs_are_overlay(rdman, (mb_obj_t *)shape1, (mb_obj_t *)shape2); CU_ASSERT(!r); - + r = mb_objs_are_overlay(rdman, (mb_obj_t *)coord1, (mb_obj_t *)shape2); CU_ASSERT(!r); - + r = mb_objs_are_overlay(rdman, (mb_obj_t *)shape1, (mb_obj_t *)shape3); CU_ASSERT(!r); - + r = mb_objs_are_overlay(rdman, (mb_obj_t *)coord1, (mb_obj_t *)shape3); CU_ASSERT(!r); shape_add_point(shape1, 5, 5); - + r = mb_objs_are_overlay(rdman, (mb_obj_t *)coord1, (mb_obj_t *)coord2); CU_ASSERT(r); - + r = mb_objs_are_overlay(rdman, (mb_obj_t *)shape1, (mb_obj_t *)coord2); CU_ASSERT(r); - + r = mb_objs_are_overlay(rdman, (mb_obj_t *)shape1, (mb_obj_t *)shape2); CU_ASSERT(r); - + r = mb_objs_are_overlay(rdman, (mb_obj_t *)coord1, (mb_obj_t *)shape2); CU_ASSERT(r); - + r = mb_objs_are_overlay(rdman, (mb_obj_t *)shape1, (mb_obj_t *)shape3); CU_ASSERT(!r); - + r = mb_objs_are_overlay(rdman, (mb_obj_t *)coord1, (mb_obj_t *)shape3); CU_ASSERT(!r);
--- a/src/geo.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/geo.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 /*! \brief Determine who should be re-drawed. * \file * When part of graphic are chagned, not mater size, shape, or position, @@ -23,7 +25,7 @@ if(is_scale_overlay(r1->x, r1->w, r2->x, r2->w) && is_scale_overlay(r1->y, r1->h, r2->y, r2->h)) return 1; - + return 0; } @@ -36,7 +38,7 @@ co_aix min_y, max_y; co_aix x, y; int i; - + /*! \note {x=0, y=0, w=0, h=0} geometry value for a n_pos=0 request * can prevent cursor flasing for Cairo XLib. * (see changeset 21db69d46835) @@ -102,7 +104,7 @@ {33, 25}, {49, 12}, {14, 28}, {39, 56}}; geo_t g; - + geo_init(&g); geo_from_positions(&g, 4, data); CU_ASSERT(g.cur_area->x == 14);
--- a/src/graph_engine_cairo.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/graph_engine_cairo.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <fontconfig/fontconfig.h> #include <cairo-ft.h> #include "mb_graph_engine_cairo.h" @@ -37,11 +39,11 @@ val.type = FcTypeString; val.u.s = family; FcPatternAdd(ptn, "family", val, FcTrue); - + val.type = FcTypeInteger; val.u.i = slant_map[slant]; FcPatternAdd(ptn, "slant", val, FcTrue); - + val.type = FcTypeInteger; val.u.i = weight; FcPatternAdd(ptn, "weight", val, FcTrue); @@ -49,7 +51,7 @@ r = FcConfigSubstituteWithPat(cfg, ptn, NULL, FcMatchPattern); if(!r) goto err; - + r = FcConfigSubstituteWithPat(cfg, p, ptn, FcMatchFont); if(!r) goto err; @@ -72,9 +74,9 @@ FcPatternDestroy(ptn); FcPatternDestroy(p); - + return fn_ptn; - + err: if(ptn) FcPatternDestroy(ptn); @@ -94,11 +96,11 @@ mbe_query_font_face(const char *family, int slant, int weight) { mbe_font_face_t *cface; FcPattern *ptn; - + ptn = query_font_pattern(family, slant, weight); cface = cairo_ft_font_face_create_for_pattern(ptn); FcPatternDestroy(ptn); - + return cface; } @@ -121,7 +123,7 @@ cx1, cy1, radius1); if(ptn == NULL) return NULL; - + stop = stops; for(i = 0; i < stop_cnt; i++) { cairo_pattern_add_color_stop_rgba(ptn, stop->offset,
--- a/src/graph_engine_skia.cpp Tue Sep 14 05:44:48 2010 +0800 +++ b/src/graph_engine_skia.cpp Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 /*! \page ge_layer Graphic Engine Layer * * Graphic Engine Layer is an abstract of graphic engine; likes Cairo @@ -81,7 +83,7 @@ SkPath *path, *subpath; SkPaint *paint; SkRegion *saved_region; - + struct _mbe_states_t *states; }; @@ -135,9 +137,9 @@ SkPath path; co_aix x, y; co_aix reverse[6]; - + *mbe->saved_region = canvas->getTotalClip(); - + compute_reverse(ptn->matrix, reverse); x = 0; y = 0; matrix_trans_pos(reverse, &x, &y); @@ -149,14 +151,14 @@ matrix_trans_pos(reverse, &x, &y); path.moveTo(CO_AIX_2_SKSCALAR(x), CO_AIX_2_SKSCALAR(y)); path.close(); - + canvas->clipPath(path, SkRegion::kIntersect_Op); } static void _finish_sized_pattern(mbe_t *mbe) { SkCanvas *canvas = mbe->canvas; - + canvas->setClipRegion(*mbe->saved_region); } @@ -180,7 +182,7 @@ MB_MATRIX_2_SKMATRIX(canvas_matrix, mbe->states->matrix); path->addPath(*subpath, canvas_matrix); - + subpath->getLastPt(&point); subpath->rewind(); subpath->moveTo(point); @@ -200,7 +202,7 @@ SkMatrix skmatrix; paint->setStyle(style); - + if(ptn != NULL) { /* Local matrix of SkShader is a mapping from source pattern to * user space. Unlikely, for Cairo is a mapping from user space @@ -223,7 +225,7 @@ static void _finish_paint(mbe_t *mbe) { mbe_pattern_t *ptn = mbe->states->ptn; - + mbe->paint->reset(); if(ptn != NULL && ptn->has_size) _finish_sized_pattern(mbe); @@ -241,13 +243,13 @@ free(ptn); return NULL; } - + ptn->has_size = 1; ptn->w = bitmap->width(); ptn->h = bitmap->height(); memcpy(ptn->matrix, id_matrix, sizeof(co_aix) * 6); - + return ptn; } @@ -269,7 +271,7 @@ goto fail; center.set(CO_AIX_2_SKSCALAR(cx1), CO_AIX_2_SKSCALAR(cy1)); - + stop = stops; for(i = 0; i < stop_cnt; i++) { colors[i] = MBSTOP_2_SKCOLOR(stop); @@ -289,11 +291,11 @@ goto fail; memcpy(ptn->matrix, id_matrix, sizeof(co_aix) * 6); - + delete colors; delete poses; return ptn; - + fail: if(ptn) free(ptn); if(colors) delete colors; @@ -320,7 +322,7 @@ points[0].set(CO_AIX_2_SKSCALAR(x0), CO_AIX_2_SKSCALAR(y0)); points[1].set(CO_AIX_2_SKSCALAR(x1), CO_AIX_2_SKSCALAR(y1)); - + stop = stops; for(i = 0; i < stop_cnt; i++) { colors[i] = MBSTOP_2_SKCOLOR(stop); @@ -339,11 +341,11 @@ goto fail; memcpy(ptn->matrix, id_matrix, sizeof(co_aix) * 6); - + delete colors; delete poses; return ptn; - + fail: if(ptn) free(ptn); if(colors) delete colors; @@ -394,25 +396,25 @@ switch(fmt) { case MB_IFMT_ARGB32: cfg = SkBitmap::kARGB_8888_Config; break; - + case MB_IFMT_A8: cfg = SkBitmap::kA8_Config; break; - + case MB_IFMT_A1: cfg = SkBitmap::kA1_Config; break; - + case MB_IFMT_RGB16_565: cfg = SkBitmap::kRGB_565_Config; break; - + case MB_IFMT_RGB24: default: return NULL; } - + bitmap = new SkBitmap(); if(bitmap == NULL) return NULL; - + bitmap->setConfig(cfg, width, height, stride); bitmap->setPixels(data); @@ -423,7 +425,7 @@ SkBitmap *bitmap = (SkBitmap *)surface; mb_img_fmt_t fmt; SkBitmap::Config cfg; - + cfg = bitmap->getConfig(); switch(cfg) { case SkBitmap::kARGB_8888_Config: @@ -453,25 +455,25 @@ switch(fmt) { case MB_IFMT_ARGB32: cfg = SkBitmap::kARGB_8888_Config; break; - + case MB_IFMT_A8: cfg = SkBitmap::kA8_Config; break; - + case MB_IFMT_A1: cfg = SkBitmap::kA1_Config; break; - + case MB_IFMT_RGB16_565: cfg = SkBitmap::kRGB_565_Config; break; - + case MB_IFMT_RGB24: default: return NULL; } - + bitmap = new SkBitmap(); if(bitmap == NULL) return NULL; - + bitmap->setConfig(cfg, width, height); bitmap->allocPixels(); @@ -503,12 +505,12 @@ SkColorFilter::CreatePorterDuffFilter(color, SkPorterDuff::kSrcOver_Mode); mbe_paint(canvas); - + } void mbe_surface_destroy(mbe_surface_t *surface) { SkBitmap *bmap = (SkBitmap *)surface; - + delete bmap; } @@ -544,7 +546,7 @@ if(!canvas->subpath->isEmpty()) _update_path(canvas); - + _prepare_paint(canvas, SkPaint::kFill_Style); canvas->canvas->drawPath(*path, *paint); @@ -576,7 +578,7 @@ void mbe_rectangle(mbe_t *canvas, co_aix x, co_aix y, co_aix width, co_aix height) { SkPath *subpath = canvas->subpath; - + subpath->addRect(CO_AIX_2_SKSCALAR(x), CO_AIX_2_SKSCALAR(y), CO_AIX_2_SKSCALAR(x + width), CO_AIX_2_SKSCALAR(y + height)); @@ -605,7 +607,7 @@ struct _mbe_states_t *states; _update_path(canvas); - + states = canvas->states; ASSERT(states->next); canvas->states = states->next; @@ -628,10 +630,10 @@ if(!canvas->subpath->isEmpty()) _update_path(canvas); - + _canvas_device_region(canvas->canvas, &dev_region); region.setPath(*canvas->path, dev_region); - + in_fill = region.contains(x, y); return in_fill; @@ -670,7 +672,7 @@ mbe = (mbe_t *)malloc(sizeof(mbe_t)); if(mbe == NULL) return NULL; - + mbe->states = (struct _mbe_states_t *) malloc(sizeof(struct _mbe_states_t)); states = mbe->states; @@ -678,7 +680,7 @@ free(mbe); return NULL; } - + canvas->ref(); mbe->canvas = canvas; mbe->path = new SkPath(); @@ -696,7 +698,7 @@ goto fail; memcpy(states->matrix, id_matrix, sizeof(co_aix) * 6); - + return mbe; fail: @@ -707,7 +709,7 @@ if(mbe->saved_region) delete mbe->saved_region; free(states); free(mbe); - + return NULL; } @@ -721,20 +723,20 @@ delete bitmap; return NULL; } - + mbe = skia_mbe_create_by_canvas(canvas); canvas->unref(); - + if(mbe == NULL) { delete bitmap; } - + return mbe; } void mbe_destroy(mbe_t *canvas) { struct _mbe_states_t *states; - + canvas->canvas->unref(); delete canvas->path; delete canvas->subpath; @@ -743,7 +745,7 @@ while(canvas->states) { states = canvas->states; canvas->states = states->next; - + if(states->ptn && states->ptn_owned) mbe_pattern_destroy(states->ptn); free(states); @@ -755,9 +757,9 @@ SkPaint *paint = canvas->paint; ASSERT(paint); - + _prepare_paint(canvas, SkPaint::kFill_Style); - + canvas->canvas->drawPaint(*paint); _finish_paint(canvas); @@ -768,7 +770,7 @@ states = (struct _mbe_states_t *)malloc(sizeof(struct _mbe_states_t)); ASSERT(states); - + memcpy(states, canvas->states, sizeof(struct _mbe_states_t)); states->next = canvas->states; canvas->states = states; @@ -783,7 +785,7 @@ void mbe_clip(mbe_t *canvas) { if(!canvas->subpath->isEmpty()) _update_path(canvas); - + canvas->canvas->clipPath(*canvas->path, SkRegion::kIntersect_Op); canvas->path->rewind(); canvas->subpath->rewind(); @@ -810,7 +812,7 @@ bmap = &src->canvas->getDevice()->accessBitmap(false); dst->canvas->drawBitmap(*bmap, 0, 0, paint); - + paint->reset(); mode->unref(); /* _finish_paint(dst); */ @@ -818,7 +820,7 @@ void mbe_transform(mbe_t *mbe, co_aix matrix[6]) { _update_path(mbe); - + matrix_mul(matrix, mbe->states->matrix, mbe->states->matrix); } @@ -838,7 +840,7 @@ r = CO_AIX_2_SKSCALAR(radius); ang_start = CO_AIX_2_SKSCALAR(angle_start * 180 / PI); ang_stop = CO_AIX_2_SKSCALAR(angle_stop * 180 / PI); - + /* Skia can only draw an arc in clockwise directly. We negative * start and stop point to draw the arc in the mirror along x-axis * in a sub-path. Then, the sub-path are reflected along x-axis, @@ -849,7 +851,7 @@ SkMatrix matrix; co_aix reflect[6] = { 1, 0, 0, 0, -1, 0}; - + rect.set(-r, -r, r, r); sweep = ang_start - ang_stop; tmppath.arcTo(rect, -ang_start, sweep, false);
--- a/src/img_ldr.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/img_ldr.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <stdio.h> #include <string.h> #include "mb_graph_engine.h" @@ -33,12 +35,12 @@ sz = strlen(sldr->repo); sz += strlen(img_id); fname = (char *)malloc(sz + 2); - if (img_id[0] != '/') + if (img_id[0] != '/') strcpy(fname, sldr->repo); else fname[0] = 0; strcat(fname, img_id); - + surf = mbe_image_surface_create_from_png(fname); if(surf == NULL) return NULL; @@ -98,9 +100,9 @@ ((char *)ldr->repo)[sz] = '/'; ((char *)ldr->repo)[sz + 1] = 0; } - + ldr->ldr.load = simple_mb_img_ldr_load; ldr->ldr.free = simple_mb_img_ldr_free; - + return (mb_img_ldr_t *)ldr; }
--- a/src/mbaf/animated_menu.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/mbaf/animated_menu.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <stdio.h> #include <mb.h> #include <string.h> @@ -94,7 +96,7 @@ lightbar = (coord_t *) m->lightbar; mb_shift_new(0,m->menus_y[m->cur]-coord_y(lightbar),lightbar,word); - + MB_TIMEVAL_SET(&start, 0, m->speed); MB_TIMEVAL_SET(&playing, 0, 0); word = mb_progm_next_word(progm, &start, &playing); @@ -197,7 +199,7 @@ mb_animated_menu_fillMenuContentUp(m); mb_animated_menu_update(m); } else { - if (m->cur == 0) + if (m->cur == 0) return; m->cur--; mb_animated_menu_moveLightBar(m); @@ -256,7 +258,7 @@ { mb_animated_menu_t *m = (mb_animated_menu_t *) arg; X_kb_event_t *xkey; - + xkey = &m->pending_keys[m->pending_pos]; m->pending_pos = (m->pending_pos + 1) & 0xf; mb_animated_menu_keyHandler((event_t *) xkey, m); @@ -302,9 +304,9 @@ } } -/** \brief Create an instace of animated menu. +/** \brief Create an instace of animated menu. * - * The objectnames is used to extract symbols from the SVG file. + * The objectnames is used to extract symbols from the SVG file. * ${objectnames}0 - ${objectnames}8 is the text object. * ${objectnames}_lightbar is the lightbar. * @@ -322,7 +324,7 @@ else for(i=0;menus[i];i++); ii=9; - + m = (mb_animated_menu_t *) malloc(sizeof(mb_animated_menu_t)); m->items = (int *) malloc(sizeof(int)*ii*2+sizeof(mb_obj_t *)*ii); m->app = app;
--- a/src/mbaf/mbapp.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/mbaf/mbapp.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <mb.h> #include <mb_af.h> @@ -15,17 +17,17 @@ app->rt = rt; app->rdman = backend.rdman(rt); app->kbevents = backend.kbevents(rt); - + app->rootsprite= sprite_load(module,app->rdman, app->rdman->root_coord); if(app->rootsprite == NULL) { backend.free(rt); free(app); return NULL; } - + rdman_attach_backend(app->rdman, rt); MB_SPRITE_GOTO_SCENE(app->rootsprite, 1); - + return app; }
--- a/src/mbaf/mbbutton.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/mbaf/mbbutton.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <stdio.h> #include <mb.h> @@ -24,16 +26,16 @@ rdman_redraw_changed(btn->rdman); } -static void mb_button_move(event_t *evt, void *arg) +static void mb_button_move(event_t *evt, void *arg) { mb_button_t *btn = (mb_button_t *) arg; - + printf("Mouse move\n"); coord_show(btn->active); mb_button_refresh(btn); } -static void mb_button_out(event_t *evt, void *arg) +static void mb_button_out(event_t *evt, void *arg) { mb_button_t *btn = (mb_button_t *) arg; @@ -61,7 +63,7 @@ mb_button_t *btn = (mb_button_t *) arg; btn->progm = NULL; - + } static void mb_button_pressed(event_t *evt, void *arg)
--- a/src/mbaf/mbobject.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/mbaf/mbobject.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include "mb_types.h" #include "mb_obj.h" @@ -12,7 +14,7 @@ } else { return; } - + } void mb_obj_get_pos(mb_obj_t *obj, co_aix *x, co_aix *y) @@ -25,7 +27,7 @@ } else { return; } - + } void mb_obj_set_text(mb_obj_t *obj, const char *text) @@ -47,7 +49,7 @@ } else { return; } - + }
--- a/src/mouse.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/mouse.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include "mb_types.h" #include "mb_redraw_man.h" @@ -10,20 +12,20 @@ mouse_event_t new_evt; coord_t *coord; shape_t *shape; - + ASSERT(evt->type == EVT_MOUSE_MOVE_RAW); - + obj = (mb_obj_t *)subject_get_object(evt->cur_tgt); if(rdman->last_mouse_over == obj) { evt->type = EVT_MOUSE_MOVE; return; } - + new_evt.x = mevt->x; new_evt.y = mevt->y; new_evt.but_state = mevt->but_state; new_evt.button = mevt->button; - + if(rdman->last_mouse_over != NULL) { new_evt.event.type = EVT_MOUSE_OUT; if(IS_MBO_COORD(rdman->last_mouse_over)) { @@ -33,14 +35,14 @@ shape = (shape_t *)rdman->last_mouse_over; ASSERT(shape->geo != NULL); subject_notify(sh_get_mouse_event_subject(shape), - (event_t *)&new_evt); + (event_t *)&new_evt); } } new_evt.event.type = EVT_MOUSE_OVER; subject_notify(evt->cur_tgt, (event_t *)&new_evt); rdman->last_mouse_over = obj; - + evt->flags |= EVTF_STOP_NOTIFY; } @@ -61,7 +63,7 @@ mb_prop_store_t *props; observer_t *observer; int cnt = 0; - + mevt = (monitor_event_t *)evt; rdman = (redraw_man_t *)arg; obj = (mb_obj_t *)subject_get_object(mevt->subject); @@ -73,7 +75,7 @@ cnt = 0; else cnt = (int)mb_prop_get(props, PROP_MEVT_OB_CNT); - + cnt++; mb_prop_set(props, PROP_MEVT_OB_CNT, (void *)cnt); if(cnt == 1) { @@ -86,7 +88,7 @@ mb_prop_set(props, PROP_MEVT_OBSERVER, observer); } break; - + case EVT_MONITOR_REMOVE: cnt = (int)mb_prop_get(props, PROP_MEVT_OB_CNT); cnt--; @@ -97,7 +99,7 @@ mb_prop_del(props, PROP_MEVT_OBSERVER); } break; - + case EVT_MONITOR_FREE: break; }
--- a/src/observer.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/observer.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <stdio.h> #include "mb_redraw_man.h" #include "mb_observer.h" @@ -41,7 +43,7 @@ subject->flags |= SUBF_FREE; return; } - + if(subject->monitor_sub) { mevt.event.type = EVT_MONITOR_FREE; mevt.subject = subject; @@ -81,7 +83,7 @@ observer = STAILQ_NEXT(observer_t, next, observer)) { if (observer->type == EVT_ANY || observer->type == evt->type) { observer->hdr(evt, observer->arg); - + if(evt->flags & EVTF_STOP_NOTIFY) { stop_propagate = 1; break; @@ -168,7 +170,7 @@ monitor_event_t mevt; STAILQ_REMOVE(subject->observers, observer_t, next, observer); - + if(subject->monitor_sub) { mevt.event.type = EVT_MONITOR_REMOVE; mevt.subject = subject;
--- a/src/paint.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/paint.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <stdio.h> #include <stdlib.h> #include "mb_graph_engine.h" @@ -143,7 +145,7 @@ grad_stop_t *stops) { paint_linear_t *linear = (paint_linear_t *)paint; grad_stop_t *old_stops; - + old_stops = linear->stops; linear->n_stops = n_stops; linear->stops = stops; @@ -226,7 +228,7 @@ grad_stop_t *stops) { paint_radial_t *radial = (paint_radial_t *)paint; grad_stop_t *old_stops; - + old_stops = radial->stops; radial->n_stops = n_stops; radial->stops = stops; @@ -260,7 +262,7 @@ void paint_image_free(redraw_man_t *rdman, paint_t *paint) { paint_image_t *paint_img = (paint_image_t *)paint; mb_img_data_t *img_data; - + mbe_surface_destroy(paint_img->surf); img_data = paint_img->img; MB_IMG_DATA_FREE(img_data); @@ -282,7 +284,7 @@ paint = O_ALLOC(paint_image_t); if(paint == NULL) return NULL; - + paint_init(&paint->paint, MBP_IMAGE, paint_image_prepare, paint_image_free); paint->img = img; @@ -296,7 +298,7 @@ free(paint); return NULL; } - + paint->ptn = mbe_pattern_create_for_surface(paint->surf); if(paint->ptn == NULL) { paint_destroy(&paint->paint); @@ -316,13 +318,13 @@ */ void paint_image_set_matrix(paint_t *paint, co_aix matrix[6]) { paint_image_t *img_paint = (paint_image_t *)paint; - + mbe_pattern_set_matrix(img_paint->ptn, matrix); } void paint_image_get_size(paint_t *paint, int *w, int *h) { paint_image_t *ipaint = (paint_image_t *)paint; - + ASSERT(paint->pnt_type == MBP_IMAGE); *w = ipaint->img->w; *h = ipaint->img->h;
--- a/src/prop.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/prop.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include "mb_prop.h" #define ASSERT(x) @@ -13,7 +15,7 @@ if(entry->id == id) return entry; } - + return NULL; } @@ -79,6 +81,6 @@ entry = _mb_prop_find(prop_store, id); if(entry) return 1; - + return 0; }
--- a/src/redraw_man.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/redraw_man.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -158,7 +160,7 @@ * - areas of descendants of cached coord are in space defined * by aggr_matrix of cached coord. * - descendants are marked with \ref COF_ANCESTOR_CACHE - * + * * Since *_transform of shapes compute area with aggr_matrix that is * derived from aggr_matrix of a cached ancestor, area of * \ref COF_ANCESTOR_CACHE ones should be transformed to device space in @@ -237,7 +239,7 @@ * process of adjusting left-top of bounding box is zeroing. * * Following is rules. - * - zeroing on a cached coord is performed by adjust coord_t::aggr_matrix + * - zeroing on a cached coord is performed by adjust coord_t::aggr_matrix * of the cached coord and descendnats. * - Clean coords works just like before without change. * - in preorder @@ -456,10 +458,10 @@ static int add_dirty_area(redraw_man_t *rdman, coord_t *coord, area_t *area) { int r; - + if(area->w < 0.01 || area->h < 0.01) return OK; - + rdman->n_dirty_areas++; r = areas_add(_coord_get_dirty_areas(coord), area); return r == 0? OK: ERR; @@ -521,7 +523,7 @@ #ifndef UNITTEST mbe_surface_t *surface; mbe_t *cr; - + surface = mbe_image_surface_create(MB_IFMT_ARGB32, w, h); cr = mbe_create(surface); @@ -596,11 +598,11 @@ info = (coord_canvas_info_t *)elmpool_elm_alloc(rdman->coord_canvas_pool); if(info == NULL) return info; - + info->owner = coord; info->canvas = canvas; DARRAY_INIT(&info->dirty_areas); - + bzero(info->pcache_areas, sizeof(area_t) * 2); info->pcache_cur_area = &info->pcache_areas[0]; info->pcache_last_area = &info->pcache_areas[1]; @@ -630,7 +632,7 @@ DARRAY_INIT(&rdman->dirty_geos); DARRAY_INIT(&rdman->gen_geos); DARRAY_INIT(&rdman->zeroing_coords); - + rdman->geo_pool = elmpool_new(sizeof(geo_t), 128); rdman->coord_pool = elmpool_new(sizeof(coord_t), 16); rdman->shnode_pool = elmpool_new(sizeof(shnode_t), 16); @@ -682,7 +684,7 @@ rdman->backend = backend; STAILQ_INIT(rdman->shapes); - + /* \note To make root coord always have at leat one observer. * It triggers mouse interpreter to be installed on root. */ @@ -752,13 +754,13 @@ while((shape = STAILQ_HEAD(rdman->shapes)) != NULL) { rdman_shape_free(rdman, shape); } - + coord_canvas_info_free(rdman, rdman->root_coord->canvas_info); /* XXX: paints are not freed, here. All resources of paints would * be reclaimed by freeing elmpools. */ - + elmpool_free(rdman->coord_pool); elmpool_free(rdman->geo_pool); elmpool_free(rdman->shnode_pool); @@ -806,7 +808,7 @@ geo = elmpool_elm_alloc(rdman->geo_pool); if(geo == NULL) return ERR; - + geo_init(geo); geo->mouse_event = subject_new(&rdman->ob_factory, geo, OBJT_GEO); subject_set_monitor(geo->mouse_event, rdman->addrm_monitor); @@ -858,7 +860,7 @@ rdman_paint_stroke(rdman, (paint_t *)NULL, shape); if(shape->fill != NULL) rdman_paint_fill(rdman, (paint_t *)NULL, shape); - + if(geo != NULL) { subject_free(geo->mouse_event); geo_detach_coord(geo, shape->coord); @@ -873,7 +875,7 @@ if(rdman->last_mouse_over == (mb_obj_t *)shape) rdman->last_mouse_over = NULL; - + return OK; } @@ -905,26 +907,26 @@ FORPAINTMEMBERS(paint, shnode) { if(saved_shnode) { RM_PAINTMEMBER(paint, saved_shnode); - + shape = saved_shnode->shape; if(shape->stroke == paint) rdman_paint_stroke(rdman, (paint_t *)NULL, shape); if(shape->fill == paint) rdman_paint_fill(rdman, (paint_t *)NULL, shape); - + shnode_free(rdman, saved_shnode); } saved_shnode = shnode; } if(saved_shnode) { RM_PAINTMEMBER(paint, saved_shnode); - + shape = saved_shnode->shape; if(shape->stroke == paint) rdman_paint_stroke(rdman, (paint_t *)NULL, shape); if(shape->fill == paint) rdman_paint_fill(rdman, (paint_t *)NULL, shape); - + shnode_free(rdman, saved_shnode); } @@ -992,7 +994,7 @@ if(coord->flags & COF_FREE) return ERR; - + coord->flags |= COF_FREE; coord_hide(coord); if(!(coord->flags & COF_DIRTY)) { @@ -1037,7 +1039,7 @@ if(!(member->flags & GEF_FREE)) return ERR; } - + if(cm_cnt || rdman_is_dirty(rdman)) return rdman_coord_free_postponse(rdman, coord); @@ -1282,7 +1284,7 @@ matrix = coord->matrix; parent = coord->parent; paggr = coord_get_aggr_matrix(parent); - + scale_x = matrix[0] / aggr[0]; scale_y = matrix[4] / aggr[4]; shift_x = matrix[2] - scale_x * aggr[2]; @@ -1308,22 +1310,22 @@ * ancestral cached coord can be retreived by shifting and resizing * canvas box in reverse and transform to coordination system of * ancestral cached coord. - */ + */ static void compute_pcache_area(coord_t *coord) { co_aix cached2pdev[6]; int c_w, c_h; canvas_t *canvas; coord_canvas_info_t *canvas_info; co_aix poses[4][2]; - + canvas_info = coord->canvas_info; SWAP(canvas_info->pcache_cur_area, canvas_info->pcache_last_area, area_t *); compute_cached_2_pdev_matrix(coord, cached2pdev); - + canvas = _coord_get_canvas(coord); canvas_get_size(canvas, &c_w, &c_h); - + poses[0][0] = 0; poses[0][1] = 0; poses[1][0] = c_w; @@ -1336,7 +1338,7 @@ matrix_trans_pos(cached2pdev, &poses[1][0], &poses[1][1]); matrix_trans_pos(cached2pdev, &poses[2][0], &poses[2][1]); matrix_trans_pos(cached2pdev, &poses[3][0], &poses[3][1]); - + area_init(coord_get_pcache_area(coord), 4, poses); coord_set_flags(coord, COF_DIRTY_PCACHE_AREA); @@ -1350,12 +1352,12 @@ static int max_poses = 0; geo_t *geo; int cnt, pos_cnt; - + cnt = 0; FORMEMBERS(coord, geo) { cnt++; } - + if(max_poses < (cnt * 2)) { free(poses); max_poses = cnt * 2; @@ -1379,7 +1381,7 @@ geo_t *geo; int r; /*! \note poses is shared by invokings, it is not support reentrying. */ - + /* Clean member shapes. */ FORMEMBERS(coord, geo) { clean_shape(geo->shape); @@ -1403,7 +1405,7 @@ static int clean_coord(redraw_man_t *rdman, coord_t *coord) { coord_t *child; int r; - + setup_canvas_info(rdman, coord); compute_aggr(coord); @@ -1422,12 +1424,12 @@ coord_clear_flags(coord, COF_DIRTY); coord_set_flags(coord, COF_JUST_CLEAN); - + FORCHILDREN(coord, child) { if(coord_is_cached(child)) add_dirty_pcache_area_coord(rdman, child); } - + return OK; } @@ -1481,7 +1483,7 @@ add_dirty_area(rdman, coord, visit_geo->cur_area); add_dirty_area(rdman, coord, visit_geo->last_area); } - } + } return OK; } @@ -1528,10 +1530,10 @@ min_x = area->x; if(area->y < min_y) min_y = area->y; - + x = area->x + area->w; y = area->y + area->h; - + if(x > max_x) max_x = x; if(y > max_y) @@ -1542,7 +1544,7 @@ w = max_x - min_x; h = max_y - min_y; - + canvas = _coord_get_canvas(coord); if(canvas) canvas_get_size(canvas, &c_w, &c_h); @@ -1564,7 +1566,7 @@ coord_set_flags(coord, COF_SKIP_ZERO); return; } - + /* * Adjust matrics of descendants to align left-top corner of * minimum covering area with origin of space defined by @@ -1583,7 +1585,7 @@ aggr = coord_get_aggr_matrix(cur); aggr[2] -= min_x; aggr[5] -= min_y; - + FOR_COORD_MEMBERS(coord, geo) { /* \see GEO_SWAP() */ if(!geo_get_flags(geo, GEF_SWAP)) @@ -1591,7 +1593,7 @@ } coord_clean_members_n_compute_area(cur); } - + /* * Setup canvas * @@ -1632,7 +1634,7 @@ coord = coord_get_cached(coord_get_parent(coord)); } } - + /* Mark all cached ancestral coords of dirty coords */ n_dirty_coords = rdman->dirty_coords.num; dirty_coords = rdman->dirty_coords.ds; @@ -1645,12 +1647,12 @@ coord = coord_get_cached(coord_get_parent(coord)); } } - + /* Add all marked coords into redraw_man_t::zeroing_coords list */ FOR_COORDS_PREORDER(rdman->root_coord, coord) { if(!coord_is_cached(coord) || coord_is_root(coord)) continue; /* skip coords that is not cached */ - + if(!coord_get_flags(coord, COF_TEMP_MARK)) { if(coord_get_flags(coord, COF_DIRTY_PCACHE_AREA)) add_dirty_pcache_area_coord(rdman, coord); @@ -1658,10 +1660,10 @@ continue; } add_zeroing_coord(rdman, coord); - + coord_clear_flags(coord, COF_TEMP_MARK); } - + return OK; } @@ -1675,7 +1677,7 @@ int i; coords_t *all_zeroing; coord_t *coord; - + all_zeroing = &rdman->zeroing_coords; /*! Zeroing is performed from leaves to root. * @@ -1693,7 +1695,7 @@ zeroing_coord(rdman, coord); compute_pcache_area(coord); } - + return OK; } @@ -1711,7 +1713,7 @@ coords_t *all_coords; coord_t *coord; int i; - + all_coords = &rdman->dirty_pcache_area_coords; for(i = 0; i < all_coords->num; i++) { coord = all_coords->ds[i]; @@ -1741,7 +1743,7 @@ areas = _coord_get_dirty_areas(coord)->ds; if(n_areas == 0) abort(); /* should not happen! */ - + area0 = _coord_get_aggr_dirty_areas(coord); area1 = area0 + 1; @@ -1757,13 +1759,13 @@ if(i >= n_areas) return; - + area = areas[i++]; poses0[0][0] = area->x; poses0[0][1] = area->y; poses0[1][0] = area->x + area->w; poses0[1][1] = area->y + area->h; - + if(i < n_areas) { area = areas[i++]; poses1[0][0] = area->x; @@ -1776,7 +1778,7 @@ poses1[1][0] = 0; poses1[1][1] = 0; } - + for(; i < n_areas - 1;) { /* Even areas */ area = areas[i++]; @@ -1795,7 +1797,7 @@ poses1[1][1] = MB_MAX(poses1[1][1], area->y + area->h); } } - + if(i < n_areas) { area = areas[i]; if(area->w != 0 || area->h != 0) { @@ -1805,10 +1807,10 @@ poses0[1][1] = MB_MAX(poses0[1][1], area->y + area->h); } } - + parent = coord_get_parent(coord); pcached_coord = coord_get_cached(parent); - + compute_cached_2_pdev_matrix(coord, canvas2pdev_matrix); /* Add dirty areas to parent cached coord. */ @@ -1816,7 +1818,7 @@ matrix_trans_pos(canvas2pdev_matrix, poses0[1], poses0[1] + 1); area_init(area0, 2, poses0); add_dirty_area(rdman, pcached_coord, area0); - + matrix_trans_pos(canvas2pdev_matrix, poses1[0], poses1[0] + 1); matrix_trans_pos(canvas2pdev_matrix, poses1[1], poses1[1] + 1); area_init(area1, 2, poses1); @@ -1847,7 +1849,7 @@ coord_t *coord, *pcached_coord; int n_dpca_coords; /* number of dirty pcache area coords */ coord_t **dpca_coords; /* dirty pcache area coords */ - + /* Add aggregated areas to parent cached one for coords in zeroing * list */ @@ -1855,16 +1857,16 @@ zeroings = rdman->zeroing_coords.ds; for(i = 0; i < n_zeroing; i++) { coord = zeroings[i]; - + if(coord_get_flags(coord, COF_TEMP_MARK)) continue; coord_set_flags(coord, COF_TEMP_MARK); - + pcached_coord = coord_get_cached(coord_get_parent(coord)); - + if(coord_is_root(coord) || IS_CACHE_REDRAW_ALL(pcached_coord)) continue; - + if(IS_CACHE_REDRAW_ALL(coord)) { add_dirty_area(rdman, pcached_coord, coord_get_pcache_area(coord)); @@ -1874,7 +1876,7 @@ add_aggr_dirty_areas_to_ancestor(rdman, coord); } } - + /* Add pcache_areas to parent cached one for coord that is * non-zeroing and its parent is changed. */ @@ -1882,16 +1884,16 @@ dpca_coords = rdman->dirty_pcache_area_coords.ds; for(i = 0; i < n_dpca_coords; i++) { coord = dpca_coords[i]; - + if(coord_get_flags(coord, COF_TEMP_MARK)) continue; coord_set_flags(coord, COF_TEMP_MARK); pcached_coord = coord_get_cached(coord_get_parent(coord)); - + if(coord_is_root(coord) || IS_CACHE_REDRAW_ALL(pcached_coord)) continue; - + add_dirty_area(rdman, pcached_coord, coord_get_pcache_area(coord)); add_dirty_area(rdman, pcached_coord, @@ -1985,7 +1987,7 @@ GEO_SWAP(geo); } } - + /* XXX: some geo may swap two times. Should avoid it. */ geos = rdman->dirty_geos.ds; @@ -1993,7 +1995,7 @@ geo = geos[i]; GEO_SWAP(geo); } - + r = clean_rdman_coords(rdman); if(r != OK) return ERR; @@ -2020,7 +2022,7 @@ r = compute_rdman_coords_pcache_area(rdman); if(r != OK) return ERR; - + r = add_rdman_aggr_dirty_areas(rdman); if(r != OK) return ERR; @@ -2045,13 +2047,13 @@ for(i = 0; i < rdman->dirty_pcache_area_coords.num; i++) coord_clear_flags(coords[i], COF_JUST_CLEAN | COF_JUST_ZERO | COF_SKIP_ZERO); - + /* \see GEO_SWAP() */ for(i = 0; i < rdman->dirty_geos.num; i++) { geo = geos[i]; geo_clear_flags(geo, GEF_SWAP); } - + return OK; } @@ -2139,7 +2141,7 @@ set_shape_stroke_param(shape, cr); stroke_path(rdman); } - } + } } #ifndef UNITTEST @@ -2170,7 +2172,7 @@ area_t **dirty_areas) { if(n_dirty_areas) make_clip(rdman->backend, n_dirty_areas, dirty_areas); - + mbe_copy_source(rdman->cr, rdman->backend); } #else /* UNITTEST */ @@ -2203,7 +2205,7 @@ compute_cached_2_pdev_matrix(coord, canvas2pdev_matrix); compute_reverse(canvas2pdev_matrix, reverse); - + canvas = _coord_get_canvas(coord); pcanvas = _coord_get_canvas(coord->parent); surface = mbe_get_target(canvas); @@ -2227,11 +2229,11 @@ if(coord->flags & COF_HIDDEN) return OK; - + areas = _coord_get_dirty_areas(coord)->ds; n_areas = _coord_get_dirty_areas(coord)->num; canvas = _coord_get_canvas(coord); - + member = FIRST_MEMBER(coord); mem_idx = 0; child = FIRST_CHILD(coord); @@ -2273,9 +2275,9 @@ mbe_surface_t *surface; int i; int r; - + canvas = _coord_get_canvas(coord); - + if(IS_CACHE_REDRAW_ALL(coord)) { /* * full_area covers all dirty areas of the cached coord. @@ -2291,7 +2293,7 @@ areas = _coord_get_dirty_areas(coord)->ds; n_areas = _coord_get_dirty_areas(coord)->num; - + for(i = 0; i < n_areas; i++) { area = areas[i]; area->x = floorf(area->x); @@ -2304,7 +2306,7 @@ clear_canvas(canvas); r = draw_coord_shapes_in_dirty_areas(rdman, coord); - + reset_clip(canvas); return OK; @@ -2375,7 +2377,7 @@ coord_t *coord; int n_areas; area_t **areas; - + r = rdman_clean_dirties(rdman); if(r != OK) return ERR; @@ -2401,7 +2403,7 @@ DARRAY_CLEAN(&rdman->dirty_geos); DARRAY_CLEAN(&rdman->zeroing_coords); DARRAY_CLEAN(&rdman->dirty_pcache_area_coords); - + /* Free postponsed removing */ free_free_objs(rdman); @@ -2463,7 +2465,7 @@ geo_t *rdman_geos(redraw_man_t *rdman, geo_t *last) { geo_t *next; coord_t *coord; - + if(last == NULL) { coord = rdman->root_coord; while(coord != NULL && FIRST_MEMBER(coord) == NULL) @@ -2592,15 +2594,15 @@ mb_img_data_t *img_data; paint_t *paint; mb_img_ldr_t *ldr = rdman_img_ldr(rdman); - + img_data = MB_IMG_LDR_LOAD(ldr, img_id); if(img_data == NULL) return NULL; - + paint = rdman_paint_image_new(rdman, img_data); if(paint == NULL) MB_IMG_DATA_FREE(img_data); - + return paint; } @@ -2639,7 +2641,7 @@ dummy->trans_cnt = 0; dummy->draw_cnt = 0; dummy->shape.free = sh_dummy_free; - + rdman_shape_man(rdman, (shape_t *)dummy); return (shape_t *)dummy; @@ -2649,7 +2651,7 @@ sh_dummy_t *dummy = (sh_dummy_t *)shape; co_aix poses[2][2]; co_aix x1, y1, x2, y2; - + if(shape->geo && shape->coord) { x1 = dummy->x; y1 = dummy->y; @@ -2662,7 +2664,7 @@ poses[0][1] = y1; poses[1][0] = x2; poses[1][1] = y2; - + if(shape->geo) geo_from_positions(shape->geo, 2, poses); } @@ -2727,7 +2729,7 @@ CU_ASSERT(dummys[0]->draw_cnt == 1); CU_ASSERT(dummys[1]->draw_cnt == 1); CU_ASSERT(dummys[2]->draw_cnt == 1); - + coords[2]->matrix[2] = 100; coords[2]->matrix[5] = 100; rdman_coord_changed(rdman, coords[0]); @@ -2773,7 +2775,7 @@ redraw_man_init(&_rdman, NULL, NULL); rdman = &_rdman; - + coord = rdman_coord_new(rdman, rdman->root_coord); CU_ASSERT(coord->parent == rdman->root_coord); @@ -2797,7 +2799,7 @@ redraw_man_init(&_rdman, NULL, NULL); rdman = &_rdman; - + coord1 = rdman_coord_new(rdman, rdman->root_coord); CU_ASSERT(coord1->parent == rdman->root_coord); @@ -2831,7 +2833,7 @@ redraw_man_init(&_rdman, NULL, NULL); rdman = &_rdman; - + coord1 = rdman_coord_new(rdman, rdman->root_coord); CU_ASSERT(coord1->parent == rdman->root_coord);
--- a/src/rotate.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/rotate.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <stdio.h> #include <stdlib.h> #include <string.h>
--- a/src/shape_image.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/shape_image.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <stdio.h> #include <string.h> #include "mb_graph_engine.h" @@ -53,11 +55,11 @@ */ typedef struct _sh_image { shape_t shape; - + co_aix x, y; co_aix w, h; co_aix poses[4][2]; - + redraw_man_t *rdman; } sh_image_t; @@ -86,7 +88,7 @@ img->h = h; rdman_shape_man(rdman, (shape_t *)img); - + return (shape_t *)img; } @@ -106,7 +108,7 @@ co_aix x_factor, y_factor; int img_w, img_h; int i; - + poses = img->poses; poses[0][0] = img->x; poses[0][1] = img->y; @@ -118,7 +120,7 @@ poses[3][1] = img->y + img->h; for(i = 0; i < 4; i++) coord_trans_pos(img->shape.coord, &poses[i][0], &poses[i][1]); - + geo_from_positions(sh_get_geo(shape), 4, poses); paint = sh_get_fill(shape); @@ -126,9 +128,9 @@ return; ASSERT(paint.pnt_type == MBP_IMAGE); - + paint_image_get_size(paint, &img_w, &img_h); - + /* Transformation from image space to user space */ img_matrix[0] = (poses[1][0] - poses[0][0]) / img->w; img_matrix[1] = (poses[3][0] - poses[3][0]) / img->h; @@ -156,7 +158,7 @@ */ void sh_image_draw(shape_t *shape, mbe_t *cr) { sh_image_t *img = (sh_image_t *)shape; - + mbe_move_to(cr, img->poses[0][0], img->poses[0][1]); mbe_line_to(cr, img->poses[1][0], img->poses[1][1]); mbe_line_to(cr, img->poses[2][0], img->poses[2][1]);
--- a/src/shape_path.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/shape_path.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <stdio.h> #include <stdlib.h> #include <ctype.h> @@ -108,13 +110,13 @@ float _sin = sinf(x_rotate); float _cos = cosf(x_rotate); int reflect; - + /* Compute center of the ellipse */ nrx = x * _cos + y * _sin; nry = x * -_sin + y * _cos; nrx0 = x0 * _cos + y0 * _sin; nry0 = x0 * -_sin + y0 * _cos; - + udx = (nrx - nrx0) / 2 / rx; /* ux - umx */ udy = (nry - nry0) / 2 / ry; /* uy - umy */ umx = (nrx + nrx0) / 2 / rx; @@ -168,12 +170,12 @@ nrx = (x * _cos + y * _sin) / rx; nry = (-x * _sin + y * _cos) / ry; xy_tan = nry / nrx; - + angle = atan(xy_tan); if(nrx < 0) angle = PI + angle; - + return angle; } @@ -261,7 +263,7 @@ *pnts++ = corners[i][0] + cx; *pnts++ = corners[i][1] + cy; } - + *(pnts++) = x; *(pnts++) = y; @@ -274,7 +276,7 @@ angle_stop += 2 * PI; else if((!sweep) && angle_start < angle_stop) angle_start += 2 * PI; - + *float_args++ = cx; *float_args++ = cy; *float_args++ = rx; @@ -282,7 +284,7 @@ *float_args++ = angle_start; *float_args++ = angle_stop; *float_args++ = x_rotate; - + *cmds++ = toupper(cmd); } @@ -308,7 +310,7 @@ rd2 = distance_pow2(dx, dy); rd = sqrtf(rd2); - + inner = INNER(sx, sy, dx, dy); cross = CROSS(sx, sy, dx, dy); angle = acos(inner / rd); @@ -352,7 +354,7 @@ _sin = sinf(x_rotate); _cos = cosf(x_rotate); - + xyratio = ry / rx; aggr = sh_get_aggr_matrix((shape_t *)path); matrix[0] = _cos; @@ -365,7 +367,7 @@ matrix_mul(aggr, matrix, dev_matrix); mbe_save(cr); mbe_transform(cr, dev_matrix); - mbe_arc(cr, 0, 0, rx, angle_start, angle_stop); + mbe_arc(cr, 0, 0, rx, angle_start, angle_stop); mbe_restore(cr); *pnts_p = pnts; @@ -531,7 +533,7 @@ SKIP_NUM(p); if(p == old) break; - + for(i = 0; i < 6; i++) { SKIP_SPACE(p); old = p; @@ -717,7 +719,7 @@ sy = y; } break; - + case 'l': case 'L': case 't': @@ -863,9 +865,9 @@ memcpy(path->user_data + cmd_cnt + pnt_cnt * sizeof(co_aix), float_args, sizeof(co_aix) * float_arg_cnt); memcpy(path->dev_data, path->user_data, msz); - + path->shape.free = sh_path_free; - + rdman_shape_man(rdman, (shape_t *)path); return (shape_t *)path;
--- a/src/shape_rect.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/shape_rect.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -77,21 +79,21 @@ poses[1][1] = y; poses[2][0] = x + w; poses[2][1] = y + ry; - + poses[3][0] = x + w; poses[3][1] = y + h - ry; poses[4][0] = x + w; poses[4][1] = y + h; poses[5][0] = x + w - rx; poses[5][1] = y + h; - + poses[6][0] = x + rx; poses[6][1] = y + h; poses[7][0] = x; poses[7][1] = y + h; poses[8][0] = x; poses[8][1] = y + h - ry; - + poses[9][0] = x; poses[9][1] = y + ry; poses[10][0] = x;
--- a/src/shape_stext.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/shape_stext.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <stdio.h> #include <string.h> #include "mb_graph_engine.h" @@ -100,7 +102,7 @@ * * Although, mb_text_extents_t is defined as a mbe_scaled_font_t, but * programmers should assume it is opague. - * + * * An extents is the span of showing a fragement of text on the output device. * It includes x and y advance of cursor after showinng the text. * The cursor maybe not really existed. But, the advance is computed as @@ -151,9 +153,9 @@ mbe_scaled_font_t *scaled_font; static co_aix id[6] = { 1, 0, 0, 0, 1, 0 }; - + ASSERT(matrix != NULL); - + scaled_font = mbe_scaled_font_create((mbe_font_face_t *)face, matrix, &id); @@ -198,14 +200,14 @@ buf = strndup(txt, tlen); else buf = txt; - + saved_scaled = mbe_get_scaled_font(cr); mbe_scaled_font_reference(saved_scaled); mbe_set_scaled_font(cr, (mbe_scaled_font_t *)scaled); - + mbe_move_to(cr, x, y); mbe_text_path(cr, buf); - + mbe_set_scaled_font(cr, saved_scaled); mbe_scaled_font_destroy(saved_scaled); @@ -265,12 +267,12 @@ int i; DARRAY_DESTROY(&txt_o->style_blks); - + for(i = 0; i < txt_o->scaled_fonts.num; i++) scaled_font_free(txt_o->scaled_fonts.ds[i]); DARRAY_DESTROY(&txt_o->scaled_fonts); DARRAY_DESTROY(&txt_o->sub_exts); - + if(txt_o->txt) free((void *)txt_o->txt); @@ -282,14 +284,14 @@ sh_stext_t *txt_o; ASSERT(txt != NULL); - + txt_o = (sh_stext_t *)malloc(sizeof(sh_stext_t)); if(txt_o == NULL) return NULL; memset(&txt_o->shape, 0, sizeof(shape_t)); mb_obj_init(txt_o, MBO_STEXT); - + txt_o->txt = strdup(txt); DARRAY_INIT(&txt_o->style_blks); txt_o->x = x; @@ -303,9 +305,9 @@ } txt_o->shape.free = _rdman_shape_stext_free; - + rdman_shape_man(rdman, (shape_t *)txt_o); - + return (shape_t *)txt_o; } @@ -314,7 +316,7 @@ int i; const char *p = txt; const char *v; - + for(i = 0; i < n_chars && *p; i++) { if(!(*p & 0x80)) /* single byte */ p++; @@ -333,7 +335,7 @@ for(v = txt; v != p; v++) if(*v == '\x0') return ERR; - + return p - txt; } @@ -351,7 +353,7 @@ memcpy(noshift_aggr, aggr, sizeof(co_aix) * 6); noshift_aggr[2] = 0; noshift_aggr[5] = 0; - + matrix[0] = font_sz; matrix[1] = 0; matrix[2] = shift_x; @@ -359,7 +361,7 @@ matrix[4] = font_sz; matrix[5] = shift_y; matrix_mul(noshift_aggr, matrix, scaled_matrix); - + scaled = make_scaled_font_face_matrix(face, scaled_matrix); return scaled; @@ -384,13 +386,13 @@ s_ybr = MBE_GET_Y_BEARING(sub) + MBE_GET_Y_ADV(full); s_rbx = s_xbr + MBE_GET_WIDTH(sub); s_rby = s_ybr + MBE_GET_HEIGHT(sub); - + /* set bearing */ if(MBE_GET_X_BEARING(full) > s_xbr) MBE_SET_X_BEARING(full, s_xbr); if(MBE_GET_Y_BEARING(full) > s_ybr) MBE_SET_Y_BEARING(full, s_ybr); - + /* set width/height */ if(f_rbx < s_rbx) MBE_SET_WIDTH(full, s_rbx - MBE_GET_X_BEARING(full)); @@ -435,19 +437,19 @@ mb_text_extents_t *sub; char *txt, saved; int i, nscaled; - + scaled_fonts = &txt_o->scaled_fonts; for(i = 0; i < scaled_fonts->num; i++) scaled_font_free(scaled_fonts->ds[i]); DARRAY_CLEAN(scaled_fonts); - + style_blks = &txt_o->style_blks; blk = style_blks->ds; sub_exts = &txt_o->sub_exts; DARRAY_CLEAN(sub_exts); extents_lst_adv(sub_exts, style_blks->num); - + txt = (char *)txt_o->txt; for(i = 0; i < style_blks->num; i++) { scaled = make_scaled_font_face(txt_o, blk->face, @@ -455,10 +457,10 @@ ASSERT(scaled != NULL); scaled_fonts_lst_add(scaled_fonts, scaled); sub = sub_exts->ds + i; - + blk_txt_len = compute_utf8_chars_sz(txt, blk->n_chars); ASSERT(blk_txt_len != ERR); - + saved = txt[blk_txt_len]; txt[blk_txt_len] = 0; compute_text_extents(scaled, txt, sub); @@ -467,7 +469,7 @@ blk++; txt += blk_txt_len; } - + if(style_blks->num > 0) { sub = sub_exts->ds; memcpy(&txt_o->extents, sub, sizeof(mb_text_extents_t)); @@ -476,7 +478,7 @@ extent_extents(&txt_o->extents, sub); } } else - memset(&txt_o->extents, sizeof(mb_text_extents_t), 0); + memset(&txt_o->extents, sizeof(mb_text_extents_t), 0); } /* @@ -499,14 +501,14 @@ ASSERT(txt_o != NULL); aggr = sh_get_aggr_matrix(shape); - + txt_o->dx = txt_o->x; txt_o->dy = txt_o->y; matrix_trans_pos(aggr, &txt_o->dx, &txt_o->dy); - + compute_styled_extents_n_scaled_font(txt_o); ext = &txt_o->extents; - + area = sh_get_area(shape); area->x = MBE_GET_X_BEARING(ext) + txt_o->dx; area->y = MBE_GET_Y_BEARING(ext) + txt_o->dy; @@ -527,20 +529,20 @@ int i; ASSERT(txt_o != NULL); - + x = txt_o->dx; y = txt_o->dy; txt = txt_o->txt; scaled_fonts = &txt_o->scaled_fonts; style_blks = &txt_o->style_blks; ext = txt_o->sub_exts.ds; - + for(i = 0; i < scaled_fonts->num; i++) { scaled = scaled_fonts->ds[i]; blk = style_blks->ds + i; blk_txt_len = compute_utf8_chars_sz(txt, blk->n_chars); draw_text_scaled(cr, txt, blk_txt_len, scaled, x, y); - + x += MBE_GET_X_ADV(ext); y += MBE_GET_Y_ADV(ext); txt += blk_txt_len; @@ -554,15 +556,15 @@ ASSERT(txt_o != NULL); ASSERT(txt != NULL); - + sz = strlen(txt) + 1; new_txt = (char *)realloc((void *)txt_o->txt, sz); if(new_txt == NULL) return ERR; - + memcpy(new_txt, txt, sz); txt_o->txt = new_txt; - + return OK; } @@ -576,14 +578,14 @@ ASSERT(txt_o != NULL); ASSERT(nblks >= 0); - + style_blks = &txt_o->style_blks; DARRAY_CLEAN(style_blks); style_blks_lst_adv(style_blks, nblks); - + memcpy(style_blks->ds, blks, nblks * sizeof(mb_style_blk_t)); - + return OK; } @@ -597,7 +599,7 @@ face = query_font_face("serif", MB_FONT_SLANT_ROMAN, 100); CU_ASSERT(face != NULL); - + free_font_face(face); } @@ -609,10 +611,10 @@ face = query_font_face("serif", MB_FONT_SLANT_ROMAN, 100); CU_ASSERT(face != NULL); - + scaled = make_scaled_font_face_matrix(face, matrix); CU_ASSERT(scaled != NULL); - + scaled_font_free(scaled); free_font_face(face); } @@ -665,14 +667,14 @@ MBE_SET_Y_BEARING(&ext1, -8); MBE_SET_X_ADV(&ext1, 21); MBE_SET_Y_ADV(&ext1, -3); - + MBE_SET_WIDTH(&ext2, 30); MBE_SET_HEIGHT(&ext2, 11); MBE_SET_X_BEARING(&ext2, 2); MBE_SET_Y_BEARING(&ext2, -11); MBE_SET_X_ADV(&ext2, 32); MBE_SET_Y_ADV(&ext2, -5); - + extent_extents(&ext1, &ext2); CU_ASSERT(MBE_GET_WIDTH(&ext1) == 52); @@ -687,7 +689,7 @@ void test_compute_utf8_chars_sz(void) { const char *str = "\xe4\xb8\xad\xe6\x96\x87test\xe6\xb8\xac\xe8\xa9\xa6"; int sz; - + sz = compute_utf8_chars_sz(str, 4); CU_ASSERT(sz == 8); @@ -718,15 +720,15 @@ face = query_font_face("serif", MB_FONT_SLANT_ROMAN, 100); CU_ASSERT(face != NULL); - + blks[0].n_chars = 5; blks[0].face = face; blks[0].font_sz = 10; - + blks[1].n_chars = 4; blks[1].face = face; blks[1].font_sz = 15.5; - + r = sh_stext_set_style((shape_t *)txt_o, blks, 2); CU_ASSERT(r == OK); @@ -740,7 +742,7 @@ CU_ASSERT(MBE_GET_X_ADV(ext) > 36); CU_ASSERT(MBE_GET_X_ADV(ext) < 72); CU_ASSERT(MBE_GET_Y_ADV(ext) == 0); - + _rdman_shape_stext_free((shape_t *)txt_o); free_font_face(face); } @@ -768,15 +770,15 @@ face = query_font_face("serif", MB_FONT_SLANT_ROMAN, 100); CU_ASSERT(face != NULL); - + blks[0].n_chars = 5; blks[0].face = face; blks[0].font_sz = 10; - + blks[1].n_chars = 4; blks[1].face = face; blks[1].font_sz = 15.5; - + r = sh_stext_set_style((shape_t *)txt_o, blks, 2); CU_ASSERT(r == OK); @@ -791,7 +793,7 @@ CU_ASSERT(MBE_GET_X_ADV(ext) < 72); CU_ASSERT(MBE_GET_Y_ADV(ext) > 36); CU_ASSERT(MBE_GET_Y_ADV(ext) < 72); - + _rdman_shape_stext_free((shape_t *)txt_o); free_font_face(face); } @@ -818,15 +820,15 @@ face = query_font_face("serif", MB_FONT_SLANT_ROMAN, 100); CU_ASSERT(face != NULL); - + blks[0].n_chars = 5; blks[0].face = face; blks[0].font_sz = 10; - + blks[1].n_chars = 4; blks[1].face = face; blks[1].font_sz = 15.5; - + r = sh_stext_set_style((shape_t *)txt_o, blks, 2); CU_ASSERT(r == OK); @@ -837,7 +839,7 @@ CU_ASSERT(area->y >= 40 && area->y < 50); CU_ASSERT(area->w >= 80 && area->w < 120); CU_ASSERT(area->h >= 8 && area->h < 12); - + _rdman_shape_stext_free((shape_t *)txt_o); free_font_face(face); } @@ -853,7 +855,7 @@ txt_o = (sh_stext_t *)rdman_shape_stext_new(NULL, "hello world", 100, 50); CU_ASSERT(txt_o != NULL); - + aggr = txt_o->shape.aggr; aggr[0] = 2; aggr[1] = 0; @@ -864,15 +866,15 @@ face = query_font_face("serif", MB_FONT_SLANT_ROMAN, 100); CU_ASSERT(face != NULL); - + blks[0].n_chars = 5; blks[0].face = face; blks[0].font_sz = 10; - + blks[1].n_chars = 6; blks[1].face = face; blks[1].font_sz = 15.5; - + r = sh_stext_set_style((shape_t *)txt_o, blks, 2); CU_ASSERT(r == OK); @@ -901,7 +903,7 @@ txt_o = (sh_stext_t *)rdman_shape_stext_new(NULL, "hello world", 100, 50); CU_ASSERT(txt_o != NULL); - + aggr = txt_o->shape.aggr; aggr[0] = 2; aggr[1] = 0; @@ -912,15 +914,15 @@ face = query_font_face("serif", MB_FONT_SLANT_ROMAN, 100); CU_ASSERT(face != NULL); - + blks[0].n_chars = 5; blks[0].face = face; blks[0].font_sz = 10; - + blks[1].n_chars = 6; blks[1].face = face; blks[1].font_sz = 15.5; - + r = sh_stext_set_style((shape_t *)txt_o, blks, 2); CU_ASSERT(r == OK);
--- a/src/shape_text.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/shape_text.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -65,7 +67,7 @@ text->attrs = attrs; text->align = TEXTALIGN_START; text->w = text->h = 0; - + rdman_shape_man(rdman, (shape_t *)text); return (shape_t *)text; @@ -222,9 +224,9 @@ int r; text = (sh_text_t *)shape; - + text->d_font_size = coord_trans_size(shape->coord, text->font_size); - + coord = sh_get_coord(shape); canvas = _coord_get_canvas(coord); sh_text_P_generate_layout(text, (mbe_t *)canvas);
--- a/src/shift.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/shift.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -45,7 +47,7 @@ coord_t *coord; float ratio; - + MB_TIMEVAL_CP(&diff, now); MB_TIMEVAL_DIFF(&diff, &shift->start_time); ratio = comp_mb_timeval_ratio(&diff, shift->playing_time);
--- a/src/sprite.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/sprite.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <stdio.h> #include <stdlib.h> #include <string.h> @@ -22,10 +24,10 @@ int fsz; char *fullname; int r; - + if(sprite_search_path == NULL) sprite_search_path = strdup("/usr/share/madbutterffly"); - + fsz = strlen(sprite_search_path) + strlen(name) + 5; fullname = (char *)malloc(fsz); @@ -41,12 +43,12 @@ void sprite_set_search_path(char *path) { int sz; - + if (sprite_search_path) free(sprite_search_path); - + sprite_search_path = strdup(path); - + sz = strlen(sprite_search_path); if(sprite_search_path[sz - 1] == '/') sprite_search_path[sz - 1] = 0; @@ -61,33 +63,31 @@ mb_sprite_t *(*cnstr)(redraw_man_t *, coord_t *); mb_sprite_t *obj; int r; - + so_path = sprite_search_so(name); if(so_path == NULL) return NULL; - + handle = dlopen(so_path, RTLD_LAZY); free(so_path); if (handle == NULL) return NULL; - + bname = strrchr(name, '/'); if(bname != NULL && strlen(bname) > 250) return NULL; - + if(bname == NULL) bname = name; else bname++; - + snprintf(cnstr_name, sizeof(cnstr_name), "%s_new", bname); cnstr = dlsym(handle, cnstr_name); if (cnstr == NULL) return NULL; - + obj = cnstr(rdman, root); - + return obj; } - -/* vim: set ts=4 */
--- a/src/subtree_free.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/subtree_free.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include "mb_redraw_man.h" #include "mb_animate.h"
--- a/src/testcase.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/testcase.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <CUnit/Basic.h> extern CU_pSuite get_tools_suite(void);
--- a/src/timer.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/timer.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <stdio.h> #include <stdint.h> #include <stdlib.h> @@ -23,7 +25,7 @@ mb_tman_t *mb_tman_new(void) { mb_tman_t *tman; - + tman = (mb_tman_t *)malloc(sizeof(mb_tman_t)); if(tman == NULL) return NULL; @@ -76,7 +78,7 @@ return timer; } - + int mb_tman_remove(mb_tman_t *tman, mb_timer_t *timer) { STAILQ_REMOVE(tman->timers, mb_timer_t, next, timer); elmpool_elm_free(tman->timer_pool, timer);
--- a/src/timertool.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/timertool.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <stdio.h> #include <sys/time.h> #ifdef __FreeBSD__
--- a/src/tools.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/tools.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <stdlib.h> #include "mb_tools.h"
--- a/src/visibility.c Tue Sep 14 05:44:48 2010 +0800 +++ b/src/visibility.c Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +// -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +// vim: sw=4:ts=8:sts=4 #include <stdio.h> #include <stdlib.h> #include "mb_animate.h"
--- a/tools/Makefile.am Tue Sep 14 05:44:48 2010 +0800 +++ b/tools/Makefile.am Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +# -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +# vim: sw=4:ts=8:sts=4 m4datadir = $(datadir)/mb dist_m4data_DATA = foreach.m4 mb_c_header.m4 mb_c_source.m4 dist_bin_SCRIPTS = svg2code.py
--- a/tools/Makefile.pmake Tue Sep 14 05:44:48 2010 +0800 +++ b/tools/Makefile.pmake Tue Sep 14 05:55:30 2010 +0800 @@ -1,3 +1,5 @@ +# -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +# vim: sw=4:ts=8:sts=4 BINS= svg2code.py M4SCRIPTS= mb_c_header.m4 mb_c_source.m4 foreach.m4 PREFIX?= /usr/local/
--- a/tools/svg2code.py Tue Sep 14 05:44:48 2010 +0800 +++ b/tools/svg2code.py Tue Sep 14 05:55:30 2010 +0800 @@ -1,4 +1,6 @@ #! /usr/bin/env python +# -*- indent-tabs-mode: t; tab-width: 8; c-basic-offset: 4; -*- +# vim: sw=4:ts=8:sts=4 from xml.dom.minidom import parse import sys import re @@ -131,7 +133,7 @@ style_str = node.getAttribute('style') prop_map = get_style_map(style_str) pass - + if node.hasAttribute('fill-opacity'): opacity = float(node.getAttribute('fill-opacity')) elif node.hasAttribute('opacity'): @@ -234,15 +236,15 @@ # \see calc_center_and_x_aix() def _calc_ellipse_of_arc(x0, y0, rx, ry, x_rotate, large, sweep, x, y): import math - + _sin = math.sin(x_rotate) _cos = math.cos(x_rotate) - + nrx = x * _cos + y * _sin # Not Rotated X nry = x * -_sin + y * _cos nrx0 = x0 * _cos + y0 * _sin nry0 = x0 * -_sin + y0 * _cos - + udx = (nrx - nrx0) / 2 / rx # ux - umx udy = (nry - nry0) / 2 / ry # uy - umy umx = (nrx + nrx0) / 2 / rx @@ -279,10 +281,10 @@ nrcx = rx * (udcx + umx) nrcy = ry * (udcy + umy) - + cx = nrcx * _cos - nrcy * _sin cy = nrcx * _sin + nrcy * _cos - + return cx, cy # M x y : Move to (x,y) @@ -313,20 +315,20 @@ def _angle_rotated_ellipse(x, y, rx, ry, x_rotate): import math - + _cos = math.cos(x_rotate) _sin = math.sin(x_rotate) nrx = (x * _cos + y * _sin) / rx nry = (-x * _sin + y * _cos) / ry - + xy_tan = nry / nrx xy_angle = math.atan(xy_tan) if nrx < 0: xy_angle = math.pi + xy_angle pass - + return xy_angle def rotate(x, y, angle): @@ -340,7 +342,7 @@ def translate_path_data(data, codefo): import string import math - + temp = data.split() fields=[] for f in temp: @@ -385,7 +387,7 @@ pnts.append(pnts[-2]) pnts.append(arg + pnts[-2]) continue - + arg = float(f) if (cmd not in 'am') and (cmd in string.lowercase): # relative and not arc or moveto @@ -424,14 +426,14 @@ c3x, c3y = rotate(-rx, ry, x_rotate) c3x, c3y = c3x + cx, c3y + cy - + pnts[-7:] = [c0x, c0y, c1x, c1y, c2x, c2y, c3x, c3y, abs_x, abs_y] - + start_angle = _angle_rotated_ellipse(x0 - cx, y0 - cy, rx, ry, x_rotate) stop_angle = _angle_rotated_ellipse(x - cx, y - cy, rx, ry, x_rotate) - + # sweep == 1 for positive-angle direction # sweep == 0 for negative-angle direction if start_angle > stop_angle and sweep: @@ -439,7 +441,7 @@ elif start_angle < stop_angle and not sweep: start_angle = math.pi * 2 + start_angle pass - + float_args.extend([cx, cy, rx, ry, start_angle, stop_angle, x_rotate]) pass @@ -548,7 +550,7 @@ pass if tspan.hasAttribute('x'): # Render the tspan as an independent text if the x - # attribute is defined. All elements inside + # attribute is defined. All elements inside # the tspan will be ignore by the outter text or tspan elements. # FIXME: We need to apply the style map recursively. merge_style(tspan, text) @@ -585,7 +587,7 @@ print >> codefo, 'PANGO_SIZE(%d,%d,%d)dnl' % (font_sz*1024,start,end) pass pass - + if style_map.has_key('font-style'): font_style = style_map['font-style'].lower() if font_style == 'normal': @@ -674,10 +676,10 @@ def stext_generate_font_attributes(text, attrs, coord_id, codefo, doc): text_id = _get_id(text) - + for start, end, node in attrs: style_map = node.style_map - + font_sz = 10 if style_map.has_key('font-size'): fsz = style_map['font-size'] @@ -687,13 +689,13 @@ font_sz = float(fsz) pass pass - + if style_map.has_key('font-family'): font_family = style_map['font-family'] else: font_family = 'serif' pass - + font_slant = 0 if style_map.has_key('font-style'): fn_style = style_map['font-style'] @@ -706,7 +708,7 @@ else: raise ValueError, '%s is not a valid font-style' % (fn_style) pass - + font_weight = 80 if style_map.has_key('font-weight'): fn_weight = style_map['font-weight'] @@ -726,7 +728,7 @@ font_weight = int(fn_weight) pass pass - + print >> codefo, 'STYLE_BLOCK([%s], %d, [%s], %f, %d, %d)dnl' % ( text_id, end - start, font_family, font_sz, font_slant, font_weight) @@ -736,7 +738,7 @@ def stext_gen_text(text, coord_id, codefo, doc, txt_strs, attrs): if not txt_strs: return - + text_id = _get_id(text) x = float(text.getAttribute('x')) y = float(text.getAttribute('y')) @@ -757,7 +759,7 @@ coord_id = translate_shape_transform(text, coord_id, codefo) try: map = text.style_map - except: + except: map = translate_font_style(text, codefo) text.style_map = map pass @@ -781,7 +783,7 @@ @check_mbname def translate_image(image, coord_id, codefo, doc): coord_id = translate_shape_transform(image, coord_id, codefo) - + image_id = _get_id(image) if not image.hasAttributeNS(xlinkns, 'href'): raise ValueError, 'image %s must has a href attribute.' % (image_id) @@ -815,7 +817,7 @@ 'ADD_IMAGE([%s], [%s], %f, %f, %f, %f, [%s])dnl' % ( image_id, href, x, y, width, height, coord_id) pass - + reo_func = re.compile('([a-zA-Z]+)\\([^\\)]*\\)') reo_translate = re.compile('translate\\(([-+]?[0-9]+(\\.[0-9]+)?),([-+]?[0-9]+(\\.[0-9]+)?)\\)') @@ -889,7 +891,7 @@ not scene.hasAttribute('ref') or \ not scene.hasAttribute('start'): continue - + start_str = scene.getAttribute('start') start = end = int(start_str) if scene.hasAttribute('end'): @@ -897,11 +899,11 @@ end = int(end_str) pass ref = scene.getAttribute('ref') - + while len(scenes) <= end: scenes.append([]) pass - + for i in range(start, end + 1): scenes[i].append(ref) pass @@ -925,7 +927,7 @@ pass else: raise ValueErr, 'no any svg tag node.' - + svg = node for node in svg.childNodes: if node.localName == 'defs' and node.namespaceURI == svgns: @@ -946,14 +948,14 @@ if __name__ == '__main__': from os import path import optparse - + usage='usage: %prog [options] <SVG file> [<output>]' parser = optparse.OptionParser(usage=usage) parser.add_option('-s', '--stext', dest='stext', action='store_true', default=False, help='Use sh_stext instead of sh_text'); options, args = parser.parse_args() - + if len(args) == 2: svgfn = args[0] codefn = args[1] @@ -964,7 +966,7 @@ parser.print_help() sys.exit(1) pass - + struct_name = path.basename(codefn).split('.')[0] if options.stext: