changeset 108:565b55508c8d

More dox
author Thinker K.F. Li <thinker@branda.to>
date Fri, 12 Sep 2008 13:58:30 +0800
parents 069868161f63
children 703ab76aa8a5
files Doxyfile README.h dox/first_program.h dox/footer.html dox/install.h examples/calculator/Makefile examples/calculator/main.c examples/svg2code_ex/Makefile examples/svg2code_ex/main.c src/Makefile src/shapes.h tools/mb_c_source.m4
diffstat 12 files changed, 87 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- 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 
--- 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
+ *
  */
--- 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().
  */
--- /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 @@
+<a href="http://sourceforge.net"><img src="http://sflogo.sourceforge.net/sflogo.php?group_id=235115&amp;type=2" width="125" height="37" border="0" alt="SourceForge.net Logo" /></a>
--- /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
+ */
--- 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
 
--- 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 <stdio.h>
-#include <mb_types.h>
-#include <X_supp.h>
-#include <shapes.h>
-#include <tools.h>
+#include <mb/mb.h>
 #include "calculator_scr.h"
 
 typedef struct _calc_data calc_data_t;
--- 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
 
--- 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 <stdio.h>
-#include <mb_types.h>
-#include <X_supp.h>
+#include <mb/mb.h>
 #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);
 
--- 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
 
--- 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()
--- 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 <stdio.h>
 #include <stdlib.h>
 #include <string.h>
-#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) {