# HG changeset patch # User Thinker K.F. Li # Date 1221199110 -28800 # Node ID 565b55508c8d608a1c414491a3da3db369199d2f # Parent 069868161f63bca505dc3894da1d3cc52f1d39bb More dox diff -r 069868161f63 -r 565b55508c8d Doxyfile --- a/Doxyfile Fri Sep 12 12:55:13 2008 +0800 +++ b/Doxyfile Fri Sep 12 13:58:30 2008 +0800 @@ -747,7 +747,7 @@ # each generated HTML page. If it is left blank doxygen will generate a # standard footer. -HTML_FOOTER = +HTML_FOOTER = dox/footer.html # The HTML_STYLESHEET tag can be used to specify a user-defined cascading # style sheet that is used by each HTML page. It can be used to diff -r 069868161f63 -r 565b55508c8d README.h --- a/README.h Fri Sep 12 12:55:13 2008 +0800 +++ b/README.h Fri Sep 12 13:58:30 2008 +0800 @@ -24,4 +24,14 @@ * Inkscape is an open source project to provide a vector graphics editor. * Inkscape saves graphics in SVG format. You can use it to design your * graphics that can be used with MadBufferfly. + * + * \section more More + * - \ref install + * - \ref first_program + * - \ref mb_clutter + * - More information in "Related Pages" tab. + * + * \section repos Repository + * - http://hg.assembla.com/MadButterfly + * */ diff -r 069868161f63 -r 565b55508c8d dox/first_program.h --- a/dox/first_program.h Fri Sep 12 12:55:13 2008 +0800 +++ b/dox/first_program.h Fri Sep 12 13:58:30 2008 +0800 @@ -1,4 +1,4 @@ -/*! /page first_program Your First MadButterfly Program. +/*! \page first_program Your First MadButterfly Program. * * MadButterfly use SVG as a media to adapt gap between GUI designers * and application programmmers. Designers export their works with SVG @@ -24,6 +24,6 @@ * foo_new() and foo_free(). An instance of 'foo' holds all objects for * foo.svg. One object, with specified ID as name, for each tag. If you * don't assign one, a random one is picked. foo_new() is invoked to create - * and initialize a 'foo' instance. A instance is released by calling + * and initialize a 'foo' instance. An instance is released by calling * foo_free(). */ diff -r 069868161f63 -r 565b55508c8d dox/footer.html --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dox/footer.html Fri Sep 12 13:58:30 2008 +0800 @@ -0,0 +1,1 @@ +SourceForge.net Logo diff -r 069868161f63 -r 565b55508c8d dox/install.h --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/dox/install.h Fri Sep 12 13:58:30 2008 +0800 @@ -0,0 +1,20 @@ +/*! \page install How to Build and Install MadButterfly? + * + * Prerequisite + * - install pmake (pmake is make of FreeBSD) + * - install Cairo + * + * Build and Install + * - cd src + * - make + * - make install + * + * Examples + * - cd examples/calculator + * - make + * - ./calc + * or + * - cd examples/svg2code_ex + * - make + * - ./ex1 + */ diff -r 069868161f63 -r 565b55508c8d examples/calculator/Makefile --- a/examples/calculator/Makefile Fri Sep 12 12:55:13 2008 +0800 +++ b/examples/calculator/Makefile Fri Sep 12 13:58:30 2008 +0800 @@ -1,8 +1,8 @@ SVG=calculator_scr.svg TOOLSDIR=../../tools -INCS=-I../../src +INCS=-I/usr/local/include CFLAGS+=`pkg-config --cflags cairo` $(INCS) -Wall -LDFLAGS=-L../../src/ `pkg-config --libs cairo` +LDFLAGS=-L/usr/local/lib `pkg-config --libs cairo` LIBS=-lmbfly BINS= calc diff -r 069868161f63 -r 565b55508c8d examples/calculator/main.c --- a/examples/calculator/main.c Fri Sep 12 12:55:13 2008 +0800 +++ b/examples/calculator/main.c Fri Sep 12 13:58:30 2008 +0800 @@ -1,8 +1,5 @@ #include -#include -#include -#include -#include +#include #include "calculator_scr.h" typedef struct _calc_data calc_data_t; diff -r 069868161f63 -r 565b55508c8d examples/svg2code_ex/Makefile --- a/examples/svg2code_ex/Makefile Fri Sep 12 12:55:13 2008 +0800 +++ b/examples/svg2code_ex/Makefile Fri Sep 12 13:58:30 2008 +0800 @@ -1,8 +1,8 @@ SVG=svg2code_ex.svg TOOLSDIR=../../tools -INCS=-I../../src +INCS=-I/usr/local/include CFLAGS+=`pkg-config --cflags cairo` $(INCS) -Wall -LDFLAGS=-L../../src/ `pkg-config --libs cairo` +LDFLAGS=-L/usr/local/lib `pkg-config --libs cairo` LIBS=-lmbfly BINS= ex1 diff -r 069868161f63 -r 565b55508c8d examples/svg2code_ex/main.c --- a/examples/svg2code_ex/main.c Fri Sep 12 12:55:13 2008 +0800 +++ b/examples/svg2code_ex/main.c Fri Sep 12 13:58:30 2008 +0800 @@ -1,6 +1,5 @@ #include -#include -#include +#include #include "svg2code_ex.h" typedef struct _ex_rt ex_rt_t; @@ -15,7 +14,9 @@ switch(evt->type) { case EVT_MOUSE_BUT_PRESS: coord_show(ex_rt->code->file_menu); + /* Tell redraw manager that a coord (group) is chagned. */ rdman_coord_changed(ex_rt->rt->rdman, ex_rt->code->file_menu); + /* Update changed part to UI. */ rdman_redraw_changed(ex_rt->rt->rdman); break; } @@ -27,7 +28,9 @@ switch(evt->type) { case EVT_MOUSE_BUT_PRESS: coord_hide(ex_rt->code->file_menu); + /* Tell redraw manager that a coord (group) is chagned. */ rdman_coord_changed(ex_rt->rt->rdman, ex_rt->code->file_menu); + /* Update changed part to UI. */ rdman_redraw_changed(ex_rt->rt->rdman); break; } @@ -41,11 +44,23 @@ ex_rt_t ex_rt; int r; + /* + * Initialize a runtime with XLib as backend. + */ r = X_MB_init(":0.0", 800, 600, &rt); + /* + * Instantiate objects from a SVG file. + */ svg2code = svg2code_ex_new(rt.rdman); + /* + * Get observer factory + */ factory = rdman_get_ob_factory(rt.rdman); + /* + * Register observers to subjects of events for objects. + */ subject = coord_get_mouse_event(svg2code->file_button); ex_rt.rt = &rt; ex_rt.code = svg2code; @@ -53,8 +68,15 @@ subject = coord_get_mouse_event(svg2code->file_menu); subject_add_observer(factory, subject, file_menu_handler, &ex_rt); + /* + * Start handle connections, includes one to X server. + * User start to interact with the application. + */ X_MB_handle_connection(&rt); + /* + * Clean + */ svg2code_ex_free(svg2code); X_MB_destroy(&rt); diff -r 069868161f63 -r 565b55508c8d src/Makefile --- a/src/Makefile Fri Sep 12 12:55:13 2008 +0800 +++ b/src/Makefile Fri Sep 12 13:58:30 2008 +0800 @@ -5,10 +5,28 @@ TESTCASE_OBJS = ${SRCS:C/(.*)\.c/testcase-\1.o/g} CFLAGS+= -Wall -I/usr/local/include `pkg-config --cflags cairo` LDFLAGS = `pkg-config --libs cairo` -BINS = testcase libmbfly.a X_main +BINS = libmbfly.a X_main +PREFIX?=/usr/local/ +HEADERS= X_supp.h animate.h mb.h mb_timer.h mb_types.h \ + observer.h paint.h redraw_man.h shapes.h tools.h +MKDIR?= mkdir -p all: $(BINS) +install: $(BINS) + $(INSTALL) -d ${PREFIX}include/mb +.for i in $(HEADERS) + $(INSTALL) -o root -m 0644 ${i} ${PREFIX}include/mb/ +.endfor + $(INSTALL) -o root libmbfly.a ${PREFIX}lib/ + +uninstall: +.for i in $(HEADERS) + rm -f ${PREFIX}include/mb/${i} +.endfor + rm -f ${PREFIX}lib/libmbfly.a + rmdir ${PREFIX}include/mb/ + testcase: testcase.o $(TESTCASE_OBJS) $(CC) $(LDFLAGS) -o $@ $(.ALLSRC) -L/usr/local/lib -lcunit diff -r 069868161f63 -r 565b55508c8d src/shapes.h --- a/src/shapes.h Fri Sep 12 12:55:13 2008 +0800 +++ b/src/shapes.h Fri Sep 12 13:58:30 2008 +0800 @@ -17,7 +17,7 @@ * - clear memory for shape_t member. * - *_transform() * - *_draw() - * - struct of shape must include an shape_t as type of first member. + * - first member variable of a shape type must be a shape_t. * * Must modify * - event.c::draw_shape_path() diff -r 069868161f63 -r 565b55508c8d tools/mb_c_source.m4 --- a/tools/mb_c_source.m4 Fri Sep 12 12:55:13 2008 +0800 +++ b/tools/mb_c_source.m4 Fri Sep 12 13:58:30 2008 +0800 @@ -261,10 +261,10 @@ [#include #include #include -#include "mb_types.h" -#include "redraw_man.h" -#include "shapes.h" -#include "paint.h" +#include "mb/mb_types.h" +#include "mb/redraw_man.h" +#include "mb/shapes.h" +#include "mb/paint.h" #include "$1.h" $1_t *$1_new(redraw_man_t *rdman) {