diff options
-rw-r--r-- | ChangeLog | 11 | ||||
-rw-r--r-- | configure.in | 188 | ||||
-rw-r--r-- | csslint/Makefile.am | 21 | ||||
-rw-r--r-- | libcroco.pc.in | 7 | ||||
-rw-r--r-- | src/Makefile.am | 87 | ||||
-rw-r--r-- | src/cr-additional-sel.c (renamed from src/parser/cr-additional-sel.c) | 0 | ||||
-rw-r--r-- | src/cr-additional-sel.h (renamed from src/parser/cr-additional-sel.h) | 0 | ||||
-rw-r--r-- | src/cr-attr-sel.c (renamed from src/parser/cr-attr-sel.c) | 0 | ||||
-rw-r--r-- | src/cr-attr-sel.h (renamed from src/parser/cr-attr-sel.h) | 0 | ||||
-rw-r--r-- | src/cr-cascade.c (renamed from src/parser/cr-cascade.c) | 0 | ||||
-rw-r--r-- | src/cr-cascade.h (renamed from src/parser/cr-cascade.h) | 0 | ||||
-rw-r--r-- | src/cr-declaration.c (renamed from src/parser/cr-declaration.c) | 0 | ||||
-rw-r--r-- | src/cr-declaration.h (renamed from src/parser/cr-declaration.h) | 0 | ||||
-rw-r--r-- | src/cr-doc-handler.c (renamed from src/parser/cr-doc-handler.c) | 0 | ||||
-rw-r--r-- | src/cr-doc-handler.h (renamed from src/parser/cr-doc-handler.h) | 0 | ||||
-rw-r--r-- | src/cr-enc-handler.c (renamed from src/parser/cr-enc-handler.c) | 0 | ||||
-rw-r--r-- | src/cr-enc-handler.h (renamed from src/parser/cr-enc-handler.h) | 0 | ||||
-rw-r--r-- | src/cr-fonts.c (renamed from src/seleng/cr-fonts.c) | 0 | ||||
-rw-r--r-- | src/cr-fonts.h (renamed from src/seleng/cr-fonts.h) | 0 | ||||
-rw-r--r-- | src/cr-input.c (renamed from src/parser/cr-input.c) | 0 | ||||
-rw-r--r-- | src/cr-input.h (renamed from src/parser/cr-input.h) | 0 | ||||
-rw-r--r-- | src/cr-num.c (renamed from src/parser/cr-num.c) | 0 | ||||
-rw-r--r-- | src/cr-num.h (renamed from src/parser/cr-num.h) | 0 | ||||
-rw-r--r-- | src/cr-om-parser.c (renamed from src/parser/cr-om-parser.c) | 0 | ||||
-rw-r--r-- | src/cr-om-parser.h (renamed from src/parser/cr-om-parser.h) | 0 | ||||
-rw-r--r-- | src/cr-parser.c (renamed from src/parser/cr-parser.c) | 0 | ||||
-rw-r--r-- | src/cr-parser.h (renamed from src/parser/cr-parser.h) | 0 | ||||
-rw-r--r-- | src/cr-pseudo.c (renamed from src/parser/cr-pseudo.c) | 0 | ||||
-rw-r--r-- | src/cr-pseudo.h (renamed from src/parser/cr-pseudo.h) | 0 | ||||
-rw-r--r-- | src/cr-rgb.c (renamed from src/parser/cr-rgb.c) | 0 | ||||
-rw-r--r-- | src/cr-rgb.h (renamed from src/parser/cr-rgb.h) | 0 | ||||
-rw-r--r-- | src/cr-sel-eng.c (renamed from src/seleng/cr-sel-eng.c) | 0 | ||||
-rw-r--r-- | src/cr-sel-eng.h (renamed from src/seleng/cr-sel-eng.h) | 4 | ||||
-rw-r--r-- | src/cr-selector.c (renamed from src/parser/cr-selector.c) | 0 | ||||
-rw-r--r-- | src/cr-selector.h (renamed from src/parser/cr-selector.h) | 0 | ||||
-rw-r--r-- | src/cr-simple-sel.c (renamed from src/parser/cr-simple-sel.c) | 0 | ||||
-rw-r--r-- | src/cr-simple-sel.h (renamed from src/parser/cr-simple-sel.h) | 0 | ||||
-rw-r--r-- | src/cr-statement.c (renamed from src/parser/cr-statement.c) | 0 | ||||
-rw-r--r-- | src/cr-statement.h (renamed from src/parser/cr-statement.h) | 0 | ||||
-rw-r--r-- | src/cr-style.c (renamed from src/seleng/cr-style.c) | 0 | ||||
-rw-r--r-- | src/cr-style.h (renamed from src/seleng/cr-style.h) | 0 | ||||
-rw-r--r-- | src/cr-stylesheet.c (renamed from src/parser/cr-stylesheet.c) | 0 | ||||
-rw-r--r-- | src/cr-stylesheet.h (renamed from src/parser/cr-stylesheet.h) | 0 | ||||
-rw-r--r-- | src/cr-term.c (renamed from src/parser/cr-term.c) | 0 | ||||
-rw-r--r-- | src/cr-term.h (renamed from src/parser/cr-term.h) | 0 | ||||
-rw-r--r-- | src/cr-tknzr.c (renamed from src/parser/cr-tknzr.c) | 0 | ||||
-rw-r--r-- | src/cr-tknzr.h (renamed from src/parser/cr-tknzr.h) | 0 | ||||
-rw-r--r-- | src/cr-token.c (renamed from src/parser/cr-token.c) | 0 | ||||
-rw-r--r-- | src/cr-token.h (renamed from src/parser/cr-token.h) | 0 | ||||
-rw-r--r-- | src/cr-utils.c (renamed from src/parser/cr-utils.c) | 0 | ||||
-rw-r--r-- | src/cr-utils.h (renamed from src/parser/cr-utils.h) | 0 | ||||
-rw-r--r-- | src/layeng/Makefile.am | 22 | ||||
-rw-r--r-- | src/layeng/cr-box-view.c | 778 | ||||
-rw-r--r-- | src/layeng/cr-box-view.h | 83 | ||||
-rw-r--r-- | src/layeng/cr-box.c | 739 | ||||
-rw-r--r-- | src/layeng/cr-box.h | 293 | ||||
-rw-r--r-- | src/layeng/cr-lay-eng.c | 1844 | ||||
-rw-r--r-- | src/layeng/cr-lay-eng.h | 78 | ||||
-rw-r--r-- | src/libcroco-config.h | 18 | ||||
-rw-r--r-- | src/libcroco-config.h.in (renamed from src/parser/libcroco-config.h.in) | 16 | ||||
-rw-r--r-- | src/libcroco.h | 41 | ||||
-rw-r--r-- | src/parser/Makefile.am | 74 | ||||
-rw-r--r-- | src/seleng/Makefile.am | 18 | ||||
-rw-r--r-- | tests/Makefile.am | 35 |
64 files changed, 149 insertions, 4208 deletions
@@ -1,7 +1,16 @@ +2004-01-24 Dodji Seketeli <dodji@gnome.org> + + * all: separated the library into two projects. Libcroco + is now the combination of the parser and the selection engine. + A new project is born: sewfox. It is basically the + xml rendering/layout engine. + Libcroco now needs libxml2 and glib only. + Sewfox need libgnomecanvas2. + 2004-01-16 Dodji Seketeli <dodji@gnome.org> * src/seleng/cr-sel-eng.c: applied a patch from - Rob BUIS to fix the rwlbuis@xs4all.nl class selector + Rob BUIS<rwlbuis@xs4all.nl> for a better class selector evaluation. 2004-01-04 Dodji Seketeli <dodji@gnome.org> diff --git a/configure.in b/configure.in index ca5a336..7f3089e 100644 --- a/configure.in +++ b/configure.in @@ -1,6 +1,6 @@ dnl Process this file with autoconf to produce a configure script. AC_PREREQ(2.5) -AC_INIT(src/parser/cr-input.c) +AC_INIT(src/cr-input.c) PACKAGE=libcroco LIBCROCO_MAJOR_VERSION=0 @@ -11,22 +11,12 @@ LIBCROCO_CURRENT=1 LIBCROCO_REVISION=1 LIBCROCO_AGE=0 -LIBCRSELENG_CURRENT=2 -LIBCRSELENG_REVISION=0 -LIBCRSELENG_AGE=0 - -LIBCRLAYENG_CURRENT=2 -LIBCRLAYENG_REVISION=0 -LIBCRLAYENG_AGE=1 - #LIBCROCO_VERSION_INFO=`expr $LIBCROCO_MAJOR_VERSION + $LIBCROCO_MINOR_VERSION`:$LIBCROCO_MICRO_VERSION:$LIBCROCO_MINOR_VERSION LIBCROCO_VERSION_INFO="$LIBCROCO_CURRENT:$LIBCROCO_REVISION:$LIBCROCO_AGE" LIBCROCO_VERSION=$LIBCROCO_MAJOR_VERSION.$LIBCROCO_MINOR_VERSION.$LIBCROCO_MICRO_VERSION LIBCROCO_VERSION_NUMBER=`expr $LIBCROCO_MAJOR_VERSION \* 10000 + $LIBCROCO_MINOR_VERSION \* 100 + $LIBCROCO_MICRO_VERSION` VERSION=$LIBCROCO_VERSION -LIBCRSELENG_VERSION_INFO="$LIBCRSELENG_CURRENT:$LIBCRSELENG_REVISION:$LIBCRSELENG_AGE" -LIBCRLAYENG_VERSION_INFO="$LIBCRLAYENG_CURRENT:$LIBCRLAYENG_REVISION:$LIBCRLAYENG_AGE" AC_SUBST(LIBCROCO_MAJOR_VERSION) AC_SUBST(LIBCROCO_MINOR_VERSION) @@ -35,8 +25,6 @@ AC_SUBST(LIBCROCO_VERSION) AC_SUBST(LIBCROCO_VERSION_INFO) AC_SUBST(LIBCROCO_VERSION_NUMBER) AC_SUBST(VERSION) -AC_SUBST(LIBCRLAYENG_VERSION_INFO) -AC_SUBST(LIBCRSELENG_VERSION_INFO) AM_INIT_AUTOMAKE($PACKAGE, $LIBCROCO_VERSION) AM_CONFIG_HEADER(config.h) @@ -107,7 +95,6 @@ AC_SUBST(GLIB2_VERSION) AC_SUBST(CROCO_HAVE_GLIB2) dnl check libxml2 version - have_libxml2=no CROCO_HAVE_LIBXML2=0 PKG_CHECK_MODULES(LIBXML2, [libxml-2.0 >= $LIBXML2_VERSION], @@ -117,155 +104,10 @@ PKG_CHECK_MODULES(LIBXML2, [libxml-2.0 >= $LIBXML2_VERSION], AC_SUBST(LIBXML2_VERSION) AC_SUBST(CROCO_HAVE_LIBXML2) -CROCO_PARSER_LIB=libcroco.la -AC_SUBST(CROCO_PARSER_LIB) - -dnl -dnl check glib-2.0 version -dnl -have_pango=no -PKG_CHECK_MODULES(PANGO, - [pango >= $PANGO_VERSION], - [have_pango=yes - CROCO_HAVE_PANGO=1], - have_pango=no) -if test "$have_pango" = no ; then - AC_MSG_ERROR([*** pango not found. See http://www.pango.org]) -fi - -AC_SUBST(PANGO_VERSION) -AC_SUBST(CROCO_HAVE_PANGO) - -dnl --enable-tests -dnl this option enables compilation of the unit tests built in to .c files -dnl and also some stuff in the test/ subdir -CROCO_TESTS_ENABLED=0 -AC_ARG_ENABLE(tests, - AC_HELP_STRING([--enable-tests=yes|no], - [Enables unit test code, Default=no]), - WITH_TESTS=$enableval, - WITH_TESTS=no) - -if test "$WITH_TESTS" = "yes" ; then - CROCO_TESTS_ENABLED=1 -else - WITH_TESTS="no" -fi +CROCO_LIB=libcroco.la +AC_SUBST(CROCO_LIB) -AC_SUBST(WITH_TESTS) -AC_SUBST(CROCO_TESTS_ENABLED) -AM_CONDITIONAL(HAVE_TESTS, test "$WITH_TESTS" = "yes") - -dnl --enable-seleng -dnl this option enables compilation of the selection engine -CROCO_SELENG_ENABLED=0 -AC_ARG_ENABLE(seleng, - AC_HELP_STRING([--enable-seleng=yes|no|auto], - [Enables the css2 selector engine based on libxml2. Default=no]), - WITH_SELENG=$enableval, - WITH_SELENG="no") - -if test "$WITH_SELENG" = "auto" ; then - if test "x$have_libxml2" != "xno" -a "x$have_pango" != "xno" ; then - CROCO_SELENG_ENABLED=1 - WITH_SELENG="yes" - else - WITH_SELENG="no" - fi - - if test "x$WITH_SELENG" = "yes" ; then - if test "x$have_libxml2" != "yes" ; then - AC_MSG_ERROR([*** libxml2 is not present, so you cannot have seleng enabled. Go to http://xmlsoft.org to get libxml2 version $LIBXML2_VERSION ***]) - fi - - if test "x$have_pango" != "yes" ; then - AC_MSG_ERROR([*** pango is not present, so you cannot have seleng enabled. Go to http://www.pango.org to get pango version $PANGO_VERSION ***]) - fi - fi - -elif test "$WITH_SELENG" = "yes" ; then - CROCO_SELENG_ENABLED=1 -else - WITH_SELENG="no" -fi -if test "$WITH_SELENG" = "yes" ; then - CROCO_SELENG_LIB_NAME=crseleng - CROCO_SELENG_LIB="lib${CROCO_SELENG_LIB_NAME}.la" -fi -AC_SUBST(CROCO_SELENG_ENABLED) -AC_SUBST(WITH_SELENG) -AC_SUBST(CROCO_SELENG_LIB) -AM_CONDITIONAL(HAVE_SELENG, test "$WITH_SELENG" = "yes") - -dnl --enable-layeng -dnl this option enable the layout engine/box model/style stuffs. -CROCO_LAYENG_ENABLED=0 -AC_ARG_ENABLE(layeng, - AC_HELP_STRING([--enable-layeng=yes|no|auto], - [Enables the layout engine. Default=no]), - WITH_LAYENG=$enableval, - WITH_LAYENG="no") - -if test "$WITH_LAYENG" = "auto" ; then - if test "$WITH_SELENG" = "yes" ; then - CROCO_LAYENG_ENABLED=1 - WITH_LAYENG="yes" - else - WITH_LAYENG="no" - fi - -elif test "$WITH_LAYENG" = "yes" ; then - CROCO_LAYENG_ENABLED=1 -else - WITH_LAYENG="no" -fi - -if test "$WITH_LAYENG" = "yes" ; then - CROCO_LAYENG_LIB_NAME=crlayeng - CROCO_LAYENG_LIB="lib${CROCO_LAYENG_LIB_NAME}.la" -fi - -AC_SUBST(WITH_LAYENG) -AC_SUBST(CROCO_LAYENG_ENABLED) -AC_SUBST(CROCO_LAYENG_LIB) -AM_CONDITIONAL(HAVE_LAYENG, test "$WITH_LAYENG" = "yes") - -dnl choose which tests to launch and in which condition -dnl okay, this should not go here but it seems like -dnl AM_CONDITIONAL() and it peer if/endif construction -dnl is bugged and does not properly support a serie -dnl of several non nested if/endif. So, I will handle this -dnl this way until I find a better way. -CORE_TESTS= -SELENG_TESTS= -LAYENG_TESTS= - -if test "$WITH_TESTS" = "yes" ; then - CORE_TESTS="test0 test1 test2 test3 test4 test6" - if test "$WITH_SELENG" = yes ; then - SELENG_TESTS="test5" - fi - if test "$WITH_LAYENG" = "yes" ; then - LAYENG_TESTS="test7" ; - fi -fi - -AC_SUBST(CORE_TESTS) -AC_SUBST(SELENG_TESTS) -AC_SUBST(LAYENG_TESTS) - -CROCO_HAVE_LIBGNOMEUI2=0 -if test "$WITH_LAYENG" = "yes" ; then - PKG_CHECK_MODULES(LIBGNOMEUI2, - [libgnomeui-2.0 >= $LIBGNOMEUI_VERSION], - [have_libgnomeui2=yes CROCO_HAVE_LIBGNOMEUI2=1], - have_libgnomeui2=no) - if test "$have_libgnomeui2" = "no" ; then - AC_MSG_ERROR([*** libgnomeui2 not found. See http://www.gnome.org]) - fi -fi -AC_SUBST(CROCO_HAVE_LIBGNOMEUI2) dnl ********************************** dnl *By default compile in debug mode dnl ********************************** @@ -288,16 +130,13 @@ if test "x$LOGNAME" = "xdodji" -a "x$GCC" = "xyes" ; then fi -#-pedantic -0 -Wshadow -Wuninitialized - dnl dnl Define the CROCO_LIBS and CROCO_CFLAGS variables. These will be used dnl by client application to know where to find croco include files and libs. dnl -CROCO_LIBS=" $GLIB2_LIBS $LIBXML2_LIBS -L${libdir} -lcroco" +CROCO_LIBS="$GLIB2_LIBS $LIBXML2_LIBS -L${libdir} -lcroco" -CROCO_CFLAGS="-I${includedir}/libcroco -I${includedir}/libcroco/parser \ --I${includedir}/libcroco/seleng -I${includedir}/libcroco/layeng \ +CROCO_CFLAGS="-I${includedir}/libcroco -I${includedir}/libcroco \ $GLIB2_CFLAGS $LIBXML2_CFLAGS" if test "$USE_LIBXML2" = "yes" ; then @@ -310,14 +149,6 @@ else REQUIRE_LIBXML2= fi -if test "$WITH_SELENG" = "yes" ; then - CROCO_LIBS="$CROCO_LIBS -l$CROCO_SELENG_LIB_NAME" -fi - -if test "$WITH_LAYENG" = "yes" ; then - CROCO_LIBS="$CROCO_LIBS $LIBGNOMEUI2_LIBS -l$CROCO_LAYENG_LIB_NAME" - CROCO_CFLAGS="$CROCO_CFLAGS $LIBGNOMEUI2_CFLAGS" -fi AC_SUBST(LIBXML2_LIBS) AC_SUBST(LIBXML2_CFLAGS) @@ -340,10 +171,7 @@ tests/Makefile tests/test-inputs/Makefile tests/test-output-refs/Makefile src/Makefile -src/parser/Makefile -src/parser/libcroco-config.h -src/seleng/Makefile -src/layeng/Makefile +src/libcroco-config.h csslint/Makefile ]) @@ -360,8 +188,4 @@ echo " cflags: : ${CFLAGS} Maintainer mode: : ${USE_MAINTAINER_MODE} - Building unit tests: : ${WITH_TESTS} - Building with selection engine: : ${WITH_SELENG} - Building with layout engine: : ${WITH_LAYENG} - "
\ No newline at end of file diff --git a/csslint/Makefile.am b/csslint/Makefile.am index 7efc024..da0b081 100644 --- a/csslint/Makefile.am +++ b/csslint/Makefile.am @@ -3,29 +3,16 @@ man_MANS = csslint.1 csslint_SOURCES = csslint.c -croco_parser_lib=$(top_builddir)/src/parser/@CROCO_PARSER_LIB@ - -if HAVE_SELENG -croco_seleng_lib=$(top_builddir)/src/seleng/@CROCO_SELENG_LIB@ -croco_seleng_cflags=-I$(top_srcdir)/src/seleng @LIBXML2_CFLAGS@ -endif - -if HAVE_LAYENG -croco_layeng_lib=$(top_builddir)/src/layeng/@CROCO_LAYENG_LIB@ -croco_layeng_cflags=-I$(top_srcdir)/src/layeng @LIBGNOMEUI2_CFLAGS@ -endif - -LDADD=$(croco_layeng_lib) $(croco_seleng_lib) $(croco_parser_lib) +croco_lib=$(top_builddir)/src/@CROCO_LIB@ +LDADD=$(croco_lib) INCLUDES=-I$(top_srcdir)/intl \ -I$(top_srcdir)/src \ - -I$(top_srcdir)/src/parser \ @GLIB2_CFLAGS@ \ - $(croco_seleng_cflags) \ - $(croco_layeng_cflags) + @LIBXML2_CFLAGS@ AM_CFLAGS=$(INCLUDES) -LDFLAGS=@GLIB2_LIBS@ +LDFLAGS=@GLIB2_LIBS@ @LIBXML2_LIBS@ EXTRA_DIST = $(man_MANS) diff --git a/libcroco.pc.in b/libcroco.pc.in index e161ed7..8a94fba 100644 --- a/libcroco.pc.in +++ b/libcroco.pc.in @@ -5,7 +5,8 @@ includedir=@includedir@ Name: libcroco Version: @VERSION@ -Description: a CSS2 Parsing Library in C. -Requires: glib-2.0 @REQUIRE_LIBXML2@ +Description: a CSS2 Parsing and manipulation Library in C. +Requires: glib-2.0 libxml-2.0 Libs: @CROCO_LIBS@ -Cflags: @CROCO_CFLAGS@
\ No newline at end of file +Cflags: @CROCO_CFLAGS@ + diff --git a/src/Makefile.am b/src/Makefile.am index c4bce35..076a020 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -1,4 +1,85 @@ -SUBDIRS=parser seleng layeng - +#Headers files to be distributed crocoincdir=$(includedir)/@PACKAGE@ -crocoinc_HEADERS= libcroco.h +crocoinc_HEADERS= libcroco.h \ +cr-additional-sel.h \ +cr-attr-sel.h \ +cr-cascade.h \ +cr-declaration.h \ +cr-doc-handler.h \ +cr-enc-handler.h \ +cr-input.h \ +cr-num.h \ +cr-om-parser.h \ +cr-parser.h \ +cr-pseudo.h \ +cr-rgb.h \ +cr-selector.h \ +cr-simple-sel.h \ +cr-statement.h \ +cr-stylesheet.h \ +cr-term.h \ +cr-tknzr.h \ +cr-token.h \ +cr-utils.h \ +cr-fonts.h \ +cr-sel-eng.h \ +cr-style.h \ +libcroco-config.h + + +#the files to be compiled +SRCS=\ +cr-utils.c \ +cr-utils.h \ +cr-input.c \ +cr-input.h \ +cr-enc-handler.c \ +cr-enc-handler.h \ +cr-num.c \ +cr-num.h \ +cr-rgb.c \ +cr-rgb.h \ +cr-token.c \ +cr-token.h \ +cr-tknzr.c \ +cr-tknzr.h \ +cr-term.c \ +cr-term.h \ +cr-attr-sel.c \ +cr-attr-sel.h \ +cr-pseudo.c \ +cr-pseudo.h \ +cr-additional-sel.c \ +cr-additional-sel.h \ +cr-simple-sel.c \ +cr-simple-sel.h \ +cr-selector.c \ +cr-selector.h \ +cr-doc-handler.c \ +cr-doc-handler.h \ +cr-parser.c \ +cr-parser.h \ +cr-declaration.c \ +cr-declaration.h \ +cr-statement.c \ +cr-statement.h \ +cr-stylesheet.c \ +cr-stylesheet.h \ +cr-cascade.c \ +cr-cascade.h \ +cr-om-parser.c \ +cr-om-parser.h \ +cr-style.c \ +cr-style.h \ +cr-sel-eng.c \ +cr-sel-eng.h \ +cr-fonts.c \ +cr-fonts.h + +lib_LTLIBRARIES=libcroco.la +libcroco_la_SOURCES= $(SRCS) + +INCLUDES=-I$(top_srcdir) -I$(top_srcdir)/intl \ +@GLIB2_CFLAGS@ @LIBXML2_CFLAGS@ +libcroco_la_LDFLAGS=-version-info @LIBCROCO_VERSION_INFO@ \ +@GLIB2_CFLAGS@ diff --git a/src/parser/cr-additional-sel.c b/src/cr-additional-sel.c index 53e0f8f..53e0f8f 100644 --- a/src/parser/cr-additional-sel.c +++ b/src/cr-additional-sel.c diff --git a/src/parser/cr-additional-sel.h b/src/cr-additional-sel.h index 04992c3..04992c3 100644 --- a/src/parser/cr-additional-sel.h +++ b/src/cr-additional-sel.h diff --git a/src/parser/cr-attr-sel.c b/src/cr-attr-sel.c index 9c1f2e6..9c1f2e6 100644 --- a/src/parser/cr-attr-sel.c +++ b/src/cr-attr-sel.c diff --git a/src/parser/cr-attr-sel.h b/src/cr-attr-sel.h index fd18635..fd18635 100644 --- a/src/parser/cr-attr-sel.h +++ b/src/cr-attr-sel.h diff --git a/src/parser/cr-cascade.c b/src/cr-cascade.c index 14e9264..14e9264 100644 --- a/src/parser/cr-cascade.c +++ b/src/cr-cascade.c diff --git a/src/parser/cr-cascade.h b/src/cr-cascade.h index f139721..f139721 100644 --- a/src/parser/cr-cascade.h +++ b/src/cr-cascade.h diff --git a/src/parser/cr-declaration.c b/src/cr-declaration.c index 096759c..096759c 100644 --- a/src/parser/cr-declaration.c +++ b/src/cr-declaration.c diff --git a/src/parser/cr-declaration.h b/src/cr-declaration.h index acc7c8a..acc7c8a 100644 --- a/src/parser/cr-declaration.h +++ b/src/cr-declaration.h diff --git a/src/parser/cr-doc-handler.c b/src/cr-doc-handler.c index 165e5da..165e5da 100644 --- a/src/parser/cr-doc-handler.c +++ b/src/cr-doc-handler.c diff --git a/src/parser/cr-doc-handler.h b/src/cr-doc-handler.h index 9fda7bc..9fda7bc 100644 --- a/src/parser/cr-doc-handler.h +++ b/src/cr-doc-handler.h diff --git a/src/parser/cr-enc-handler.c b/src/cr-enc-handler.c index 85ad1c5..85ad1c5 100644 --- a/src/parser/cr-enc-handler.c +++ b/src/cr-enc-handler.c diff --git a/src/parser/cr-enc-handler.h b/src/cr-enc-handler.h index 8155833..8155833 100644 --- a/src/parser/cr-enc-handler.h +++ b/src/cr-enc-handler.h diff --git a/src/seleng/cr-fonts.c b/src/cr-fonts.c index 2a5f908..2a5f908 100644 --- a/src/seleng/cr-fonts.c +++ b/src/cr-fonts.c diff --git a/src/seleng/cr-fonts.h b/src/cr-fonts.h index 758778f..758778f 100644 --- a/src/seleng/cr-fonts.h +++ b/src/cr-fonts.h diff --git a/src/parser/cr-input.c b/src/cr-input.c index d094492..d094492 100644 --- a/src/parser/cr-input.c +++ b/src/cr-input.c diff --git a/src/parser/cr-input.h b/src/cr-input.h index 3c450a5..3c450a5 100644 --- a/src/parser/cr-input.h +++ b/src/cr-input.h diff --git a/src/parser/cr-num.c b/src/cr-num.c index 36c29b7..36c29b7 100644 --- a/src/parser/cr-num.c +++ b/src/cr-num.c diff --git a/src/parser/cr-num.h b/src/cr-num.h index f50cfb2..f50cfb2 100644 --- a/src/parser/cr-num.h +++ b/src/cr-num.h diff --git a/src/parser/cr-om-parser.c b/src/cr-om-parser.c index da9cf01..da9cf01 100644 --- a/src/parser/cr-om-parser.c +++ b/src/cr-om-parser.c diff --git a/src/parser/cr-om-parser.h b/src/cr-om-parser.h index 475016c..475016c 100644 --- a/src/parser/cr-om-parser.h +++ b/src/cr-om-parser.h diff --git a/src/parser/cr-parser.c b/src/cr-parser.c index c580799..c580799 100644 --- a/src/parser/cr-parser.c +++ b/src/cr-parser.c diff --git a/src/parser/cr-parser.h b/src/cr-parser.h index 4dc80cb..4dc80cb 100644 --- a/src/parser/cr-parser.h +++ b/src/cr-parser.h diff --git a/src/parser/cr-pseudo.c b/src/cr-pseudo.c index 0323e44..0323e44 100644 --- a/src/parser/cr-pseudo.c +++ b/src/cr-pseudo.c diff --git a/src/parser/cr-pseudo.h b/src/cr-pseudo.h index 1949612..1949612 100644 --- a/src/parser/cr-pseudo.h +++ b/src/cr-pseudo.h diff --git a/src/parser/cr-rgb.c b/src/cr-rgb.c index 5999d23..5999d23 100644 --- a/src/parser/cr-rgb.c +++ b/src/cr-rgb.c diff --git a/src/parser/cr-rgb.h b/src/cr-rgb.h index 8c8e4b8..8c8e4b8 100644 --- a/src/parser/cr-rgb.h +++ b/src/cr-rgb.h diff --git a/src/seleng/cr-sel-eng.c b/src/cr-sel-eng.c index edec6b3..edec6b3 100644 --- a/src/seleng/cr-sel-eng.c +++ b/src/cr-sel-eng.c diff --git a/src/seleng/cr-sel-eng.h b/src/cr-sel-eng.h index 44de096..b650df0 100644 --- a/src/seleng/cr-sel-eng.h +++ b/src/cr-sel-eng.h @@ -32,9 +32,6 @@ #include <libxml/tree.h> #endif -#ifdef CROCO_SELENG_ENABLED - - /** *@file: *The declaration of the #CRSelEng class. @@ -106,6 +103,5 @@ void cr_sel_eng_destroy (CRSelEng *a_this) ; G_END_DECLS -#endif /*CROCO_SELENG_ENABLED*/ #endif/*__CR_SEL_ENG_H__*/ diff --git a/src/parser/cr-selector.c b/src/cr-selector.c index be1a069..be1a069 100644 --- a/src/parser/cr-selector.c +++ b/src/cr-selector.c diff --git a/src/parser/cr-selector.h b/src/cr-selector.h index 7c4a983..7c4a983 100644 --- a/src/parser/cr-selector.h +++ b/src/cr-selector.h diff --git a/src/parser/cr-simple-sel.c b/src/cr-simple-sel.c index bd960c1..bd960c1 100644 --- a/src/parser/cr-simple-sel.c +++ b/src/cr-simple-sel.c diff --git a/src/parser/cr-simple-sel.h b/src/cr-simple-sel.h index b54ee5e..b54ee5e 100644 --- a/src/parser/cr-simple-sel.h +++ b/src/cr-simple-sel.h diff --git a/src/parser/cr-statement.c b/src/cr-statement.c index a857680..a857680 100644 --- a/src/parser/cr-statement.c +++ b/src/cr-statement.c diff --git a/src/parser/cr-statement.h b/src/cr-statement.h index 9f893be..9f893be 100644 --- a/src/parser/cr-statement.h +++ b/src/cr-statement.h diff --git a/src/seleng/cr-style.c b/src/cr-style.c index 8059bcd..8059bcd 100644 --- a/src/seleng/cr-style.c +++ b/src/cr-style.c diff --git a/src/seleng/cr-style.h b/src/cr-style.h index 2348c76..2348c76 100644 --- a/src/seleng/cr-style.h +++ b/src/cr-style.h diff --git a/src/parser/cr-stylesheet.c b/src/cr-stylesheet.c index 06b1c5f..06b1c5f 100644 --- a/src/parser/cr-stylesheet.c +++ b/src/cr-stylesheet.c diff --git a/src/parser/cr-stylesheet.h b/src/cr-stylesheet.h index c850e6e..c850e6e 100644 --- a/src/parser/cr-stylesheet.h +++ b/src/cr-stylesheet.h diff --git a/src/parser/cr-term.c b/src/cr-term.c index 6f5ae9f..6f5ae9f 100644 --- a/src/parser/cr-term.c +++ b/src/cr-term.c diff --git a/src/parser/cr-term.h b/src/cr-term.h index 94a9d14..94a9d14 100644 --- a/src/parser/cr-term.h +++ b/src/cr-term.h diff --git a/src/parser/cr-tknzr.c b/src/cr-tknzr.c index 4315460..4315460 100644 --- a/src/parser/cr-tknzr.c +++ b/src/cr-tknzr.c diff --git a/src/parser/cr-tknzr.h b/src/cr-tknzr.h index 3a7765c..3a7765c 100644 --- a/src/parser/cr-tknzr.h +++ b/src/cr-tknzr.h diff --git a/src/parser/cr-token.c b/src/cr-token.c index 8ade6be..8ade6be 100644 --- a/src/parser/cr-token.c +++ b/src/cr-token.c diff --git a/src/parser/cr-token.h b/src/cr-token.h index 23aac22..23aac22 100644 --- a/src/parser/cr-token.h +++ b/src/cr-token.h diff --git a/src/parser/cr-utils.c b/src/cr-utils.c index 4c7c00a..4c7c00a 100644 --- a/src/parser/cr-utils.c +++ b/src/cr-utils.c diff --git a/src/parser/cr-utils.h b/src/cr-utils.h index 07d3a94..07d3a94 100644 --- a/src/parser/cr-utils.h +++ b/src/cr-utils.h diff --git a/src/layeng/Makefile.am b/src/layeng/Makefile.am deleted file mode 100644 index 5a87d59..0000000 --- a/src/layeng/Makefile.am +++ /dev/null @@ -1,22 +0,0 @@ -LAYENG_SRCS=cr-box.c cr-box.h cr-box-view.c cr-box-view.h cr-lay-eng.c cr-lay-eng.h -EXTRA_DIST=$(LAYENG_SRCS) - -if HAVE_LAYENG -lib_LTLIBRARIES=libcrlayeng.la -crlayengincdir=$(includedir)/@PACKAGE@/layeng -crlayenginc_HEADERS= cr-box.h cr-box-view.h cr-lay-eng.h -libcrlayeng_la_SOURCES=$(LAYENG_SRCS) - - -INCLUDES=-I$(top_srcdir) -I$(top_srcdir)/src/parser \ --I$(top_srcdir)/src/seleng -I$(top_srcdir)/intl \ -@GLIB2_CFLAGS@ @LIBXML2_CFLAGS@ @LIBGNOMEUI2_CFLAGS@ - -LDADD=$(top_srcdir)/src/parser/@CROCO_PARSER_LIB@ -endif -#libcrlayeng_la_LDFLAGS=-version-info @LIBCRLAYENG_VERSION_INFO@ \ -#$(top_srcdir)/src/seleng/@CROCO_SELENG_LIB@ @LIBXML2_LIBS@ \ -#@LIBGNOMEUI2_LIBS@ - -libcrlayeng_la_LDFLAGS=-version-info @LIBCRLAYENG_VERSION_INFO@ \ -@LIBXML2_LIBS@ @LIBGNOMEUI2_LIBS@ diff --git a/src/layeng/cr-box-view.c b/src/layeng/cr-box-view.c deleted file mode 100644 index 2755be4..0000000 --- a/src/layeng/cr-box-view.c +++ /dev/null @@ -1,778 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */ - -/* - * This file is part of The Croco Library - * - * Copyright (C) 2002-2003 Dodji Seketeli <dodji@seketeli.org> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2.1 of - * the GNU Lesser General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the - * GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -/* - *$Id$ - */ - -#include "cr-box-view.h" -#include "cr-lay-eng.h" -#include "cr-om-parser.h" -#include <libxml/tree.h> - -#define PRIVATE(a_this) ((a_this)->priv) - -struct _CRBoxViewPriv -{ - CRBoxModel *box_model ; - /* - *The default graphical context - *Function willing to modify this gc - *should save it firts, then modify it, - *draw what they have to draw and then restore it !! - */ - GdkGC *gc ; - - CRLayEng *layeng ; - - /** - * a boolean used by some drawing functions. - *greping PRIVATE (a_this)->draw should tell you who uses it :) - */ - gboolean draw ; -} ; - - -static GtkLayoutClass *gv_parent_class = NULL ; - - -static void -cr_box_view_class_init (CRBoxViewClass *a_klass) ; - - -static void -cr_box_view_init (CRBoxView *a_this) ; - - -static gboolean -expose_event_cb (GtkWidget *a_this, - GdkEventExpose *a_event, - gpointer a_user_data) ; - -static enum CRStatus -draw_box (CRBoxView *a_this, - CRBox *a_box, - GdkRectangle *a_region_to_draw) ; - -static enum CRStatus -draw_borders (CRBoxView *a_bv, - CRBox *a_box) ; - -static enum CRStatus -draw_paddings (CRBoxView *a_bv, - CRBox *a_box) ; - -static enum CRStatus -draw_inner_box (CRBoxView *a_bv, - CRBox *a_box) ; - -static enum CRStatus -set_border_line_attrs (CRBoxView *a_this, - CRBox *a_box, - enum CRBorderStyleProp a_style_prop) ; - -static enum CRStatus -set_color (CRBoxView *a_this, CRRgb *a_rgb_color, - gboolean a_foreground) ; - -static void -cr_box_view_class_init (CRBoxViewClass *a_klass) -{ - GtkObjectClass *gtk_object_class = GTK_OBJECT_CLASS (a_klass) ; - - gv_parent_class = - g_type_class_peek_parent (a_klass) ; - - g_return_if_fail (gv_parent_class) ; - g_return_if_fail (gtk_object_class) ; - gtk_object_class->destroy = cr_box_view_destroy ; -} - -static void -cr_box_view_init (CRBoxView *a_this) -{ - g_return_if_fail (a_this) ; - - PRIVATE (a_this) = g_try_malloc (sizeof (CRBoxView)) ; - if (!PRIVATE (a_this)) - { - cr_utils_trace_info ("Out of memory") ; - return ; - } - memset (PRIVATE (a_this), 0, sizeof (CRBoxView)) ; -} - - -static gboolean -expose_event_cb (GtkWidget *a_this, - GdkEventExpose *a_event, - gpointer a_user_data) -{ - g_return_val_if_fail (a_event - && a_this - && GTK_IS_LAYOUT (a_this) - && CR_IS_BOX_VIEW (a_this), - CR_BAD_PARAM_ERROR) ; - - switch (a_event->type) - { - case GDK_EXPOSE: - g_return_val_if_fail - (PRIVATE (CR_BOX_VIEW (a_this))->box_model - && ((CRBox*)PRIVATE (CR_BOX_VIEW (a_this))-> - box_model)->children, - FALSE) ; - - cr_box_view_layout (CR_BOX_VIEW (a_this)) ; - - draw_box (CR_BOX_VIEW (a_this), - ((CRBox*)PRIVATE (CR_BOX_VIEW (a_this))->box_model)-> - children, - &a_event->area) ; - break ; - - default: - cr_utils_trace_info ("Unexpected event received, " - "Only GDK_EXPOSE was expected.") ; - return FALSE ; - break ; - } - - return FALSE ; - -} - -static enum CRStatus -set_border_line_attrs (CRBoxView *a_this, - CRBox *a_box, - enum CRBorderStyleProp a_style_prop) -{ - enum CRNumProp border_width_dir ; - GdkGCValues gc_values ; - - g_return_val_if_fail (a_this && PRIVATE (a_this) - && a_box - && a_style_prop < NB_BORDER_STYLE_PROPS, - CR_BAD_PARAM_ERROR) ; - - memset (&gc_values, 0, sizeof (GdkGCValues)) ; - - gdk_gc_get_values (PRIVATE (a_this)->gc, &gc_values) ; - - switch (a_style_prop) - { - case BORDER_STYLE_PROP_TOP: - border_width_dir = NUM_PROP_BORDER_TOP ; - set_color - (a_this, - &a_box->style->rgb_props[RGB_PROP_BORDER_TOP_COLOR].cv, - TRUE /*foreground*/) ; - break ; - - case BORDER_STYLE_PROP_RIGHT: - border_width_dir = NUM_PROP_BORDER_RIGHT ; - set_color (a_this, - &a_box->style-> - rgb_props[RGB_PROP_BORDER_RIGHT_COLOR].cv, - TRUE /*foreground*/) ; - break ; - - case BORDER_STYLE_PROP_BOTTOM: - border_width_dir = NUM_PROP_BORDER_BOTTOM ; - set_color (a_this, - &a_box->style-> - rgb_props[RGB_PROP_BORDER_BOTTOM_COLOR].cv, - TRUE /*foreground*/) ; - break ; - - case BORDER_STYLE_PROP_LEFT: - border_width_dir = NUM_PROP_BORDER_LEFT ; - set_color (a_this, - &a_box->style-> - rgb_props[RGB_PROP_BORDER_LEFT_COLOR].cv, - TRUE /*foreground*/) ; - break ; - - default: - cr_utils_trace_info ("Bad value of enum CRBorderStyleProp " - "given in parameter") ; - return CR_BAD_PARAM_ERROR ; - - } - - switch (a_box->style->border_style_props[a_style_prop]) - { - case BORDER_STYLE_NONE : - case BORDER_STYLE_HIDDEN: - PRIVATE (a_this)->draw = FALSE ; - break ; - - case BORDER_STYLE_DOTTED: - gdk_gc_set_line_attributes - (PRIVATE (a_this)->gc, - a_box->style->num_props[border_width_dir].cv.val, - GDK_LINE_ON_OFF_DASH, - gc_values.cap_style, - gc_values.join_style) ; - PRIVATE (a_this)->draw = TRUE ; - break ; - - case BORDER_STYLE_DASHED: - gdk_gc_set_line_attributes - (PRIVATE (a_this)->gc, - a_box->style->num_props[border_width_dir].cv.val, - GDK_LINE_ON_OFF_DASH, - gc_values.cap_style, - gc_values.join_style) ; - PRIVATE (a_this)->draw = TRUE ; - break ; - - case BORDER_STYLE_SOLID: - case BORDER_STYLE_DOUBLE: - case BORDER_STYLE_GROOVE: - case BORDER_STYLE_RIDGE: - case BORDER_STYLE_INSET: - case BORDER_STYLE_OUTSET: - gdk_gc_set_line_attributes - (PRIVATE (a_this)->gc, - a_box->style->num_props[border_width_dir].cv.val, - GDK_LINE_SOLID, - gc_values.cap_style, - gc_values.join_style) ; - PRIVATE (a_this)->draw = TRUE ; - break ; - } - - return CR_OK ; -} - -static enum CRStatus -set_color (CRBoxView *a_this, CRRgb *a_rgb_color, - gboolean a_foreground) -{ - GdkColor gdk_color = {0} ; - g_return_val_if_fail (a_this && a_rgb_color, - CR_BAD_PARAM_ERROR) ; - - gdk_color.red = (a_rgb_color->red << 8) | a_rgb_color->red ; - gdk_color.green = (a_rgb_color->green << 8) | a_rgb_color->green; - gdk_color.blue = (a_rgb_color->blue << 8) | a_rgb_color->blue ; - - gdk_rgb_find_color - (gdk_drawable_get_colormap - (GDK_DRAWABLE (GTK_LAYOUT (a_this)->bin_window)), - &gdk_color) ; - - if (a_foreground == FALSE) - { - gdk_gc_set_background (PRIVATE (a_this)->gc, - &gdk_color) ; - } - else - { - gdk_gc_set_foreground (PRIVATE (a_this)->gc, - &gdk_color) ; - } - - - return CR_OK ; -} - -static enum CRStatus -draw_borders (CRBoxView *a_this, - CRBox *a_box) -{ - GdkWindow * window = NULL ; - GtkWidget *widget = NULL ; - CRBox *box = NULL ; - - gulong x0=0, y0=0, x1=0, y1=0 ; - enum CRStatus status = CR_OK ; - - g_return_val_if_fail (a_this - && CR_IS_BOX_VIEW (a_this) - && a_box, - CR_BAD_PARAM_ERROR) ; - - widget = GTK_WIDGET (a_this) ; - window = GTK_LAYOUT (a_this)->bin_window ; - g_return_val_if_fail (window, CR_ERROR) ; - - box = a_box ; - g_return_val_if_fail (box, CR_ERROR) ; - - /* - *Draw left border. - */ - x0 = box->border_edge.x + (box->padding_edge.x - box->border_edge.x)/2 ; - /*x0 = box->border_edge.x ;*/ - y0 = box->border_edge.y ; - x1 = x0; - y1 = y0 + box->border_edge.height ; - status = set_border_line_attrs (a_this, a_box, - BORDER_STYLE_PROP_LEFT) ; - g_return_val_if_fail (status == CR_OK, status) ; - - if (PRIVATE (a_this)->draw == TRUE) - gdk_draw_line - (window, - PRIVATE (a_this)->gc, - x0, y0, x1, y1); - - /* - *draw right border - */ - x0 = box->padding_edge.x + box->padding_edge.width + - (box->border_edge.x + box->border_edge.width - - box->padding_edge.x - box->padding_edge.width)/2 ; - y0 = box->border_edge.y ; - x1 = x0 ; - /*y1 remains the same as y0*/ - status = set_border_line_attrs (a_this, a_box, - BORDER_STYLE_PROP_RIGHT) ; - g_return_val_if_fail (status == CR_OK, status) ; - - if (PRIVATE (a_this)->draw == TRUE) - gdk_draw_line (window, PRIVATE (a_this)->gc, - x0, y0, x1, y1) ; - - /* - *draw top border. - */ - x0 = box->border_edge.x ; - y0 = box->border_edge.y + (box->padding_edge.y - box->border_edge.y)/2 ; - /*y0 = box->border_edge.y ;*/ - x1 = x0 + box->border_edge.width ; - y1 = y0 ; - status = set_border_line_attrs (a_this, a_box, - BORDER_STYLE_PROP_TOP) ; - g_return_val_if_fail (status == CR_OK, status) ; - - if (PRIVATE (a_this)->draw == TRUE) - gdk_draw_line (window, PRIVATE (a_this)->gc, - x0, y0, x1, y1) ; - - /* - *draw bottom border - */ - /*x0 remains the same as previous x0 ;*/ - - y0 = box->padding_edge.y + box->padding_edge.height + - (box->border_edge.y + box->border_edge.height - - box->padding_edge.y - box->padding_edge.height)/2 ; - - /*y0 = box->padding_edge.y + box->padding_edge.height ;*/ - x1 = x0 + box->border_edge.width ; - y1 = y0 ; - status = set_border_line_attrs (a_this, a_box, - BORDER_STYLE_PROP_BOTTOM) ; - g_return_val_if_fail (status == CR_OK, status) ; - - if (PRIVATE (a_this)->draw == TRUE) - gdk_draw_line (window, PRIVATE (a_this)->gc, - x0, y0, x1, y1) ; - - PRIVATE (a_this)->draw = TRUE ; - - return CR_OK ; -} - - -static enum CRStatus -draw_paddings (CRBoxView *a_this, - CRBox *a_box) -{ - GdkWindow * window = NULL ; - GtkWidget *widget = NULL ; - CRBox *box = NULL ; - - g_return_val_if_fail (a_this - && CR_IS_BOX_VIEW (a_this) - && a_box, - CR_BAD_PARAM_ERROR) ; - - widget = GTK_WIDGET (a_this) ; - window = GTK_LAYOUT (a_this)->bin_window ; - g_return_val_if_fail (window, CR_ERROR) ; - - box = a_box ; - g_return_val_if_fail (box, CR_ERROR) ; - - set_color (a_this, - &a_box->style->rgb_props[RGB_PROP_BACKGROUND_COLOR].cv, - TRUE/*foreground*/) ; - - gdk_draw_rectangle - (window, - PRIVATE (a_this)->gc, - TRUE, - box->padding_edge.x, box->padding_edge.y, - box->padding_edge.width, box->padding_edge.height) ; - - return CR_OK ; -} - - -static enum CRStatus -draw_inner_box (CRBoxView *a_this, - CRBox *a_box) -{ - GtkWidget *widget = NULL, *label = NULL ; - CRBox *box = NULL ; - - g_return_val_if_fail (a_this - && CR_IS_BOX_VIEW (a_this) - && a_box, - CR_BAD_PARAM_ERROR) ; - - widget = GTK_WIDGET (a_this) ; - g_return_val_if_fail (widget, CR_ERROR) ; - - box = a_box ; - g_return_val_if_fail (box, CR_ERROR) ; - - if (!box->content) - return CR_OK ; - - if (box->content->content_cache) - { - label = GTK_WIDGET (box->content->content_cache) ; - g_return_val_if_fail (label, CR_ERROR) ; - } - - g_return_val_if_fail (label, CR_ERROR) ; - - if (label->parent == NULL) - gtk_layout_put (GTK_LAYOUT (a_this), label, - box->inner_edge.x, - box->inner_edge.y) ; - else - gtk_layout_move (GTK_LAYOUT (a_this), label, - box->inner_edge.x, - box->inner_edge.y) ; - - gtk_widget_show_all (widget) ; - - return CR_OK ; -} - - -static enum CRStatus -draw_box (CRBoxView *a_this, - CRBox *a_box, - GdkRectangle *a_region_to_draw) -{ - CRBox *cur_box = NULL ; - GtkWidget *widget = NULL; - - g_return_val_if_fail (a_this - && CR_IS_BOX_VIEW (a_this) - && a_box, - CR_BAD_PARAM_ERROR) ; - - widget = GTK_WIDGET (a_this) ; - g_return_val_if_fail (widget, CR_ERROR) ; - - if (!PRIVATE (a_this)->gc) - { - PRIVATE (a_this)->gc = gdk_gc_new - (GDK_DRAWABLE (GTK_LAYOUT (a_this)->bin_window)) ; - g_return_val_if_fail (PRIVATE (a_this)->gc, - CR_ERROR) ; - - gdk_gc_copy (PRIVATE (a_this)->gc, - GTK_WIDGET (a_this)->style->base_gc[widget->state]); - } - - for (cur_box = a_box; cur_box ; cur_box = cur_box->next) - { - /*draw_margins (a_this, cur_box) ;*/ - draw_paddings (a_this, cur_box) ; - draw_inner_box (a_this, cur_box) ; - draw_borders (a_this, cur_box) ; - - if (cur_box->children) - { - draw_box (a_this, - cur_box->children, - a_region_to_draw) ; - } - } - - return CR_OK ; -} - -/********************************** - *Public funtions - **********************************/ - -GType -cr_box_view_get_type (void) -{ - static GType type = 0 ; - - if (type == 0) - { - static const GTypeInfo type_info = - { - sizeof (CRBoxViewClass), - NULL,NULL, - (GClassInitFunc)cr_box_view_class_init, - NULL, NULL, - sizeof (CRBoxView), - 0, - (GInstanceInitFunc)cr_box_view_init - } ; - - type = g_type_register_static (GTK_TYPE_LAYOUT, - "CRBoxView", &type_info, 0) ; - } - - return type ; -} - - -CRBoxView * -cr_box_view_new_from_xml_css_bufs (const guchar *a_xml_buf, - const guchar *a_css_buf) -{ - enum CRStatus status = CR_OK ; - CRStyleSheet *sheet = NULL; - xmlDoc * xml_doc = NULL; - CRBoxView *result = NULL ; - gulong len = 0 ; - CRCascade *cascade = NULL ; - CRBoxModel *box_model = NULL ; - - result = g_object_new (CR_TYPE_BOX_VIEW, NULL) ; - g_return_val_if_fail (result, NULL) ; - - len = strlen (a_css_buf) ; - status = cr_om_parser_simply_parse_buf (a_css_buf, len, CR_UTF_8, - &sheet) ; - - if (status != CR_OK || !sheet) - { - cr_utils_trace_info ("Could not parse css buf") ; - status = CR_ERROR ; - goto cleanup ; - } - - len = strlen (a_xml_buf) ; - xml_doc = xmlParseMemory (a_xml_buf, len) ; - if (!xml_doc) - { - cr_utils_trace_info ("Could not parse xml buf") ; - status = CR_ERROR ; - goto cleanup ; - } - - PRIVATE (result)->layeng = cr_lay_eng_new (GTK_LAYOUT (result)) ; - if (!PRIVATE (result)->layeng) - { - cr_utils_trace_info ("Could not instanciate the layout engine. " - "The system may be out of memory") ; - cr_box_view_destroy (GTK_OBJECT (result)) ; - return NULL ; - } - - cascade = cr_cascade_new (sheet, NULL, NULL) ; - - if (!cascade) - { - cr_utils_trace_info ("could not create the cascade") ; - cr_utils_trace_info - ("The system is possibly out of memory") ; - goto cleanup ; - } - sheet = NULL ; - - status = cr_lay_eng_create_box_model (PRIVATE (result)->layeng, - xml_doc, cascade, - &box_model) ; - if (status != CR_OK) - { - cr_utils_trace_info ("could not build the annotated doc") ; - goto cleanup ; - } - - if (box_model) - { - box_model->box.inner_edge.width = 800 ; - box_model->box.inner_edge.max_width = 800 ; - box_model->box.inner_edge.width = 600 ; - - cr_box_view_set_box_model (result, box_model) ; - gtk_layout_set_size (GTK_LAYOUT (result), 1024, 768) ; - g_signal_connect (G_OBJECT (result), - "expose-event", - (GCallback)expose_event_cb, - NULL) ; - - return result ; - } - - cleanup: - if (sheet) - { - cr_stylesheet_destroy (sheet) ; - sheet = NULL ; - } - - if (xml_doc) - { - xmlFreeDoc (xml_doc) ; - xml_doc = NULL ; - } - - if (cascade) - { - cr_cascade_destroy (cascade) ; - cascade = NULL ; - } - - if (box_model) - { - cr_box_destroy ((CRBox*)box_model) ; - box_model = NULL ; - } - - if (result) - { - gtk_object_destroy (GTK_OBJECT (result)) ; - } - - return NULL ; -} - - -CRBoxView * -cr_box_view_new_from_bm (CRBoxModel *a_box_root) -{ - CRBoxView *result = NULL ; - - result = g_object_new (CR_TYPE_BOX_VIEW, NULL) ; - g_return_val_if_fail (result, NULL) ; - - cr_box_view_set_box_model (result, a_box_root) ; - gtk_layout_set_size (GTK_LAYOUT (result), 1024, 768) ; - g_signal_connect (G_OBJECT (result), - "expose-event", - (GCallback)expose_event_cb, - NULL) ; - - PRIVATE (result)->layeng = cr_lay_eng_new (GTK_LAYOUT (result)) ; - if (!PRIVATE (result)->layeng) - { - cr_utils_trace_info ("Could not instanciate the layout engine. " - "The system may be out of memory") ; - cr_box_view_destroy (GTK_OBJECT (result)) ; - - return NULL ; - } - return result ; -} - - -enum CRStatus -cr_box_view_set_box_model (CRBoxView *a_this, - CRBoxModel *a_box_model) -{ - g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR) ; - - if (PRIVATE (a_this)->box_model) - { - if (cr_box_unref ((CRBox*)PRIVATE (a_this)->box_model) == TRUE) - PRIVATE (a_this) = NULL ; - } - - PRIVATE (a_this)->box_model = a_box_model ; - if (a_box_model) - cr_box_ref ((CRBox*)a_box_model) ; - - return TRUE ; -} - -enum CRStatus -cr_box_view_layout (CRBoxView *a_this) -{ - - g_return_val_if_fail (a_this - && CR_IS_BOX_VIEW (a_this) - && PRIVATE (a_this)->box_model, - CR_BAD_PARAM_ERROR) ; - - cr_lay_eng_layout_box_tree (PRIVATE (a_this)->layeng, - PRIVATE (a_this)->box_model->box.children) ; - /*cr_box_dump_to_file (PRIVATE (a_this)->box_model->box.children, - 0, stdout) ;*/ - - return CR_OK ; -} - -enum CRStatus -cr_box_view_get_box_model (CRBoxView *a_this, CRBoxModel **a_box_model) -{ - g_return_val_if_fail (a_this - && PRIVATE (a_this), - CR_BAD_PARAM_ERROR) ; - - *a_box_model = PRIVATE (a_this)->box_model ; - return TRUE ; -} - -void -cr_box_view_destroy (GtkObject *a_this) -{ - CRBoxView *self = NULL ; - - g_return_if_fail (a_this && CR_IS_BOX_VIEW (a_this)) ; - - self = CR_BOX_VIEW (a_this) ; - g_return_if_fail (self && PRIVATE (self) ) ; - - if (PRIVATE (self)->box_model) - { - cr_box_unref ((CRBox*)PRIVATE (self)->box_model) ; - PRIVATE (self)->box_model = NULL ; - } - - if (PRIVATE (self)->gc) - { - gdk_gc_unref (PRIVATE (self)->gc) ; - PRIVATE (self)->gc = NULL ; - } - - if (PRIVATE (self)) - { - g_free (PRIVATE (self)) ; - PRIVATE (self) = NULL ; - } - - if (gv_parent_class - && GTK_OBJECT_CLASS (gv_parent_class)->destroy) - { - GTK_OBJECT_CLASS (gv_parent_class)->destroy (a_this) ; - } -} diff --git a/src/layeng/cr-box-view.h b/src/layeng/cr-box-view.h deleted file mode 100644 index 6839352..0000000 --- a/src/layeng/cr-box-view.h +++ /dev/null @@ -1,83 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */ - -/* - * This file is part of The Croco Library - * - * Copyright (C) 2002-2003 Dodji Seketeli <dodji@seketeli.org> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2.1 of - * the GNU Lesser General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the - * GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -/* - *$Id$ - */ -#ifndef __CR_BOX_VIEW__ -#define __CR_BOX_VIEW__ - - -#include <gnome.h> -#include <cr-box.h>/*the box model*/ - -G_BEGIN_DECLS - -#define CR_TYPE_BOX_VIEW (cr_box_view_get_type ()) -#define CR_BOX_VIEW(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), CR_TYPE_BOX_VIEW, CRBoxView)) -#define CR_BOX_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), CR_TYPE_BOX_VIEW, CRBoxViewClass)) -#define CR_IS_BOX_VIEW(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), CR_TYPE_BOX_VIEW)) -#define CR_IS_BOX_VIEW_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), CR_TYPE_BOX_VIEW)) -#define CR_BOX_VIEW_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS ((obj), CR_TYPE_BOX_VIEW, CRBoxViewClass)) - -typedef struct _CRBoxView CRBoxView ; -typedef struct _CRBoxViewClass CRBoxViewClass ; -typedef struct _CRBoxViewPriv CRBoxViewPriv ; - -struct _CRBoxView -{ - GtkLayout parent_widget ; - CRBoxViewPriv *priv ; -} ; - -struct _CRBoxViewClass -{ - GtkLayoutClass parent_class ; -} ; - - -GType -cr_box_view_get_type (void) ; - -CRBoxView * -cr_box_view_new_from_xml_css_bufs (const guchar *a_xml_buf, - const guchar *a_css_buf) ; -enum CRStatus -cr_box_view_get_box_model (CRBoxView *a_this, CRBoxModel **a_box_model) ; - -enum CRStatus -cr_box_view_set_box_model (CRBoxView *a_this, - CRBoxModel *a_box_model) ; -CRBoxView * -cr_box_view_new_from_bm (CRBoxModel *a_box_root) ; - -enum CRStatus -cr_box_view_layout (CRBoxView *a_this) ; - -void -cr_box_view_destroy (GtkObject *a_this) ; - -G_END_DECLS - -#endif diff --git a/src/layeng/cr-box.c b/src/layeng/cr-box.c deleted file mode 100644 index 3d0a437..0000000 --- a/src/layeng/cr-box.c +++ /dev/null @@ -1,739 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */ - -/* - * This file is part of The Croco Library - * - * Copyright (C) 2002-2003 Dodji Seketeli <dodji@seketeli.org> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2.1 of the GNU Lesser General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -/* - *$Id$ - */ - -#include <string.h> -#include "cr-box.h" - -/** - *@file - *The definition file of the #CRBox class. - */ - - -static enum CRStatus -cr_box_construct (CRBox *a_this, CRStyle *a_style, - gboolean a_set_default_style) ; - -static enum CRStatus -cr_box_edge_to_string (CRBoxEdge *a_this, - gulong a_nb_indent, - GString **a_string) ; - -static enum CRBoxType -cr_box_guess_type (CRStyle *a_style) ; - - -/****************************** - *Private methods - ******************************/ - -/** - *Guess the type of a box from the 'position' rule - *contained in its style data structure. - *@param a_style the style data structure associated to the box. - */ -static enum CRBoxType -cr_box_guess_type (CRStyle *a_style) -{ - enum CRBoxType box_type = BOX_TYPE_INLINE ; - - if (!a_style) - return box_type ; - - switch (a_style->display) - { - case DISPLAY_NONE: - break ; - - case DISPLAY_INLINE: - case DISPLAY_MARKER: - box_type = BOX_TYPE_INLINE ; - break ; - - case DISPLAY_BLOCK: - case DISPLAY_LIST_ITEM: - case DISPLAY_TABLE: - case DISPLAY_INLINE_TABLE: - case DISPLAY_TABLE_ROW_GROUP: - case DISPLAY_TABLE_HEADER_GROUP: - case DISPLAY_TABLE_FOOTER_GROUP: - case DISPLAY_TABLE_ROW: - case DISPLAY_TABLE_COLUMN_GROUP: - case DISPLAY_TABLE_COLUMN: - case DISPLAY_TABLE_CELL: - case DISPLAY_TABLE_CAPTION: - box_type = BOX_TYPE_BLOCK ; - break ; - - case DISPLAY_COMPACT: - box_type = BOX_TYPE_COMPACT ; - break ; - - case DISPLAY_RUN_IN: - box_type = BOX_TYPE_RUN_IN ; - break ; - - case DISPLAY_INHERIT: - if (a_style->parent_style) - box_type = - cr_box_guess_type (a_style->parent_style) ; - break ; - - default: - box_type = BOX_TYPE_INLINE ; - break ; - } - - return box_type ; -} - - -static enum CRStatus -cr_box_construct (CRBox *a_this, CRStyle *a_style, - gboolean a_set_default_style) -{ - CRStyle *style = a_style ; - - if (!style && a_set_default_style == TRUE) - { - style = cr_style_new () ; - if (!style) - { - cr_utils_trace_info - ("Could not create style object") ; - cr_utils_trace_info ("System may be out of memory") ; - return CR_ERROR ; - } - } - - a_this->style = style ; - if (a_this->style) - cr_style_ref (a_this->style) ; - a_this->type = cr_box_guess_type (a_this->style) ; - - return CR_OK ; -} - - - -static enum CRStatus -cr_box_edge_to_string (CRBoxEdge *a_this, - gulong a_nb_indent, - GString **a_string) -{ - GString *result = NULL ; - - if (*a_string) - { - result = *a_string ; - } - else - { - result = g_string_new (NULL) ; - if (!result) - { - cr_utils_trace_info ("Out of memory") ; - return CR_ERROR ; - } - } - - cr_utils_dump_n_chars2 (' ', result, - a_nb_indent) ; - g_string_append_printf (result, "(%ld, %ld)\n", - (long int)a_this->x, - (long int) a_this->y) ; - cr_utils_dump_n_chars2 (' ', result, - a_nb_indent) ; - g_string_append_printf (result, "width: %ld\n", - (long int)a_this->width) ; - - cr_utils_dump_n_chars2 (' ', result, - a_nb_indent) ; - g_string_append_printf (result, "max-width: %ld\n", - (long int)a_this->max_width) ; - - cr_utils_dump_n_chars2 (' ', - result, a_nb_indent) ; - g_string_append_printf (result, "height: %ld\n", - (long int)a_this->height) ; - cr_utils_dump_n_chars2 (' ', - result, a_nb_indent) ; - g_string_append_printf (result, "x_offset: %ld\n", - (long int)a_this->x_offset) ; - cr_utils_dump_n_chars2 (' ', result, - a_nb_indent) ; - g_string_append_printf (result, "y_offset: %ld\n", - (long int)a_this->y_offset) ; - - return CR_OK ; -} - -/******************************* - *Public methods - *******************************/ - -/** - *Instanciates a new #CRBoxData. - *@param a_node the xml node to store in the box. - *@return the newly built #CRBoxData, or null if an error arises. - */ -CRBoxData * -cr_box_data_new (xmlNode *a_node) -{ - CRBoxData *result = NULL ; - - result = g_try_malloc (sizeof (CRBoxData)) ; - if (!result) - { - cr_utils_trace_info ("Out of memory") ; - return NULL; - } - memset (result, 0, sizeof (CRBoxData)) ; - result->xml_node = a_node ; - return result ; -} - - -/** - *Destructor of #CRBoxData. - *@param a_this the current instance - *of #CRBoxData to be destroyed. - */ -void -cr_box_data_destroy (CRBoxData *a_this) -{ - if (!a_this) - return ; - - g_free (a_this) ; -} - -/** - *Instanciates a new #CRBoxContent and set the - *content to text content. - *@param a_text the text content. - */ -CRBoxContent * -cr_box_content_new_from_text (guchar *a_text) -{ - CRBoxContent *result = NULL ; - - g_return_val_if_fail (a_text, NULL) ; - - result = g_try_malloc (sizeof (CRBoxContent)) ; - if (!result) - { - cr_utils_trace_info ("Out of memory") ; - return NULL ; - } - memset (result, 0, sizeof (CRBoxContent)) ; - result->u.text = g_strdup (a_text) ; - result->type = TEXT_CONTENT_TYPE ; - return result ; -} - -/** - *Destructor of #CRBoxContent. - *@param a_this the current instance of #CRBoxContent - *to be destroyed. - */ -void -cr_box_content_destroy (CRBoxContent *a_this) -{ - if (!a_this) - return ; - - switch (a_this->type) - { - case TEXT_CONTENT_TYPE: - if (a_this->u.text) - { - g_free (a_this->u.text) ; - a_this->u.text = NULL ; - } - break ; - - default: - cr_utils_trace_info ("Unrecognized box content type") ; - cr_utils_trace_info ("This seems to be a mem leak") ; - break ; - } - - g_free (a_this) ; - return ; -} - - -/** - *Creates a new box model. - *This box model contains an empty box tree. - *Box tree may be added by calling cr_box_append_child(). - *@return the newly built instance of #CRBoxModel, or NULL if an - *error arises. - */ -CRBoxModel * -cr_box_model_new (void) -{ - CRBoxModel *result = NULL ; - - result = g_try_malloc (sizeof (CRBoxModel)) ; - if (!result) - { - cr_utils_trace_info ("Out of memory") ; - return NULL ; - } - - memset (result, 0, sizeof (CRBoxModel)) ; - - cr_box_construct (&result->box, NULL, FALSE) ; - - ((CRBox*)result)->type = BOX_TYPE_BOX_MODEL ; - ((CRBox*)result)->box_model = result ; - - return result ; -} - - -void -cr_box_model_destroy (CRBoxModel *a_this) -{ - g_return_if_fail (a_this) ; - - cr_box_destroy (&a_this->box) ; - - g_free (a_this) ; -} - - -void -cr_box_model_ref (CRBoxModel *a_this) -{ - if (a_this && a_this->ref_count) - { - a_this->ref_count ++ ; - } -} - -gboolean -cr_box_model_unref (CRBoxModel *a_this) -{ - if (a_this && a_this->ref_count) - { - a_this->ref_count -- ; - } - - if (a_this && a_this->ref_count == 0) - { - cr_box_model_destroy (a_this) ; - return TRUE ; - } - - return FALSE ; -} - - -/** - *Instanciates a new box. - *Everything is initialized to zero in it. - *@return the newly created box. - */ -CRBox * -cr_box_new (CRStyle *a_style, gboolean a_default_style) -{ - CRBox *result = NULL ; - - result = g_try_malloc (sizeof (CRBox)) ; - if (!result) - { - cr_utils_trace_info ("Out of memory") ; - goto error ; - } - memset (result, 0, sizeof (CRBox)) ; - - if (cr_box_construct (result, a_style, a_default_style) == CR_OK) - return result ; - - error: - if (result) - { - cr_box_destroy (result) ; - result = NULL ; - } - - return NULL ; -} - -/** - *Appends a child box to at the end of the current box's children. - *@param a_this the current box. - *@param a_to_append, the box to append. - *@retrurn CR_OK upon successfull completion, an error code otherwise. - */ -enum CRStatus -cr_box_append_child (CRBox *a_this, CRBox *a_to_append) -{ - CRBox * cur = NULL ; - - g_return_val_if_fail (a_this - && a_this->box_model - && a_to_append, CR_BAD_PARAM_ERROR) ; - - if (!a_this->children) - { - a_this->children = a_to_append ; - a_to_append->prev = NULL ; - a_to_append->parent = a_this ; - a_to_append->box_model = a_this->box_model ; - return CR_OK ; - } - - for (cur = a_this->children ; cur && cur->next ; cur = cur->next) - ; - - cur->next = a_to_append ; - a_to_append->prev = cur ; - a_to_append->parent = a_this ; - a_to_append->box_model = a_this->box_model ; - - return CR_OK ; -} - - -/** - *Inserts a sibling box between two adjacent sibling nodes. - *@param a_prev the box after which we have to insert a new one. - *@param a_next the box before which we have to insert a new one. - *@param a_to_insert the node to insert. - */ -enum CRStatus -cr_box_insert_sibling (CRBox *a_prev, - CRBox *a_next, - CRBox *a_to_insert) -{ - g_return_val_if_fail (a_prev && a_prev->parent - && a_next && a_prev->next == a_next - && a_next->parent == a_prev->parent - && a_prev->box_model - && a_prev->box_model == a_next->box_model - && a_to_insert - && a_to_insert->parent != a_prev->parent, - CR_BAD_PARAM_ERROR) ; - - a_prev->next = a_to_insert ; - a_to_insert->prev = a_prev ; - a_to_insert->next = a_next ; - a_next->prev = a_to_insert ; - a_to_insert->parent = a_prev->parent ; - a_to_insert->box_model = a_prev->box_model ; - - return CR_OK ; -} - - -/** - *This is for debug purposes ... - *Gives a string representation of the box tree. - *@return the build string of NULL in case of an error. - */ -enum CRStatus -cr_box_to_string (CRBox *a_this, - gulong a_nb_indent, - GString **a_string) -{ - GString *result = NULL ; - CRBox *cur_box = NULL ; - - g_return_val_if_fail (a_this && a_string, - CR_BAD_PARAM_ERROR) ; - - if (*a_string) - { - result = *a_string ; - } - else - { - result = g_string_new (NULL) ; - if (!result) - { - cr_utils_trace_info ("Out of memory") ; - return CR_ERROR ; - } - *a_string = result ; - } - - for (cur_box = a_this ; cur_box ; cur_box = cur_box->next) - { - if (cur_box->prev || cur_box->parent) - g_string_append_printf (result, "\n\n") ; - - cr_utils_dump_n_chars2 (' ', result, a_nb_indent) ; - - switch (cur_box->type) - { - case BOX_TYPE_BLOCK: - g_string_append_printf (result, "BLOCK") ; - break ; - - case BOX_TYPE_ANONYMOUS_BLOCK: - g_string_append_printf (result, "ANONYMOUS BLOCK") ; - break ; - - case BOX_TYPE_INLINE: - g_string_append_printf (result, "INLINE") ; - break ; - - case BOX_TYPE_ANONYMOUS_INLINE: - g_string_append_printf (result, "ANONYMOUS INLINE") ; - break ; - - case BOX_TYPE_COMPACT: - g_string_append_printf (result, "COMPACT") ; - break ; - - case BOX_TYPE_RUN_IN: - g_string_append_printf (result, "RUN IN") ; - break ; - - case BOX_TYPE_BOX_MODEL: - g_string_append_printf (result, "Root") ; - break ; - - default: - g_string_append_printf (result, "UNKNOWN") ; - break ; - } - - g_string_append_printf (result, " box\n") ; - cr_utils_dump_n_chars2 (' ', result, a_nb_indent) ; - g_string_append_printf (result, "{") ; - - if (cur_box->box_data && cur_box->box_data->xml_node) - { - switch (cur_box->box_data->xml_node->type) - { - case XML_ELEMENT_NODE: - cr_utils_dump_n_chars2 - (' ', result, a_nb_indent) ; - g_string_append_printf - (result, "xml-node-name: %s\n", - cur_box->box_data->xml_node->name) ; - break ; - - case XML_TEXT_NODE: - cr_utils_dump_n_chars2 - (' ', result, a_nb_indent) ; - g_string_append_printf - (result, "xml-text-node\n") ; - break ; - - default: - break ; - } - } - - cr_utils_dump_n_chars2 (' ', result, a_nb_indent + 2) ; - g_string_append_printf (result, "/*****%s begin*****/\n", - "outer_edge") ; - cr_box_edge_to_string (&cur_box->outer_edge, - a_nb_indent + 2, &result) ; - cr_utils_dump_n_chars2 (' ', result, a_nb_indent + 2) ; - g_string_append_printf (result, "/*****%s end*****/\n", - "outer_edge") ; - - cr_utils_dump_n_chars2 (' ', result, a_nb_indent + 2) ; - g_string_append_printf (result, "/*****%s begin*****/\n", - "border_edge") ; - cr_box_edge_to_string (&cur_box->border_edge, - a_nb_indent + 2, &result) ; - cr_utils_dump_n_chars2 (' ', result, a_nb_indent + 2) ; - g_string_append_printf (result, "/*****%s end*****/\n", - "border_edge") ; - - cr_utils_dump_n_chars2 (' ', result, a_nb_indent + 2) ; - g_string_append_printf (result, "/*****%s begin*****/\n", - "padding_edge") ; - cr_box_edge_to_string (&cur_box->padding_edge, - a_nb_indent + 2, &result) ; - cr_utils_dump_n_chars2 (' ', result, a_nb_indent + 2) ; - g_string_append_printf (result, "/*****%s end*****/\n", - "padding_edge") ; - - cr_utils_dump_n_chars2 (' ', result, a_nb_indent + 2) ; - g_string_append_printf (result, "/*****%s begin*****/\n", - "inner_edge") ; - cr_box_edge_to_string (&cur_box->inner_edge, - a_nb_indent + 2, &result) ; - cr_utils_dump_n_chars2 (' ', result, a_nb_indent + 2) ; - g_string_append_printf (result, "/*****%s end*****/\n", - "inner_edge") ; - - if (cur_box->children) - { - g_string_append_printf (result, "\n") ; - cr_box_to_string (cur_box->children, - a_nb_indent + 2, &result) ; - } - - g_string_append_printf (result, "\n") ; - cr_utils_dump_n_chars2 (' ', result, a_nb_indent) ; - g_string_append_printf (result, "}\n") ; - } - - return CR_OK ; -} - -enum CRStatus -cr_box_dump_to_file (CRBox *a_this, - gulong a_nb_indent, - FILE *a_filep) -{ - GString *str = NULL ; - enum CRStatus status = CR_OK ; - - g_return_val_if_fail (a_this && a_filep, - CR_BAD_PARAM_ERROR) ; - - status = cr_box_to_string (a_this, a_nb_indent, &str) ; - - if (status != CR_OK) - { - cr_utils_trace_info ("An error occured " - "during in memory serialisation") ; - goto cleanup ; - } - - if (!str || !str->str) - { - cr_utils_trace_info ("Error: Box could not be serialised") ; - goto cleanup ; - } - - if (!fwrite (str->str, 1, str->len, a_filep)) - { - cr_utils_trace_info ("An error occured during" - "serialisation into file") ; - status = CR_ERROR ; - goto cleanup ; - } - - status = CR_OK ; - - cleanup: - - if (str) - { - g_string_free (str, TRUE) ; - str = NULL ; - } - return status ; -} - -/** - *Increments the reference count of - *the current instance of #CRBox. - */ -enum CRStatus -cr_box_ref (CRBox *a_this) -{ - g_return_val_if_fail (a_this, CR_BAD_PARAM_ERROR) ; - - a_this->ref_count ++ ; - - return TRUE ; -} - - -/** - *Decrements the current instance's ref count. - *If the ref count reaches zero, the instance is destroyed. - *@param a_this the current instance. - *@return TRUE if the ref count reached zero and the instance has been - *destroyed, FALSE otherwise. - */ -gboolean -cr_box_unref (CRBox *a_this) -{ - g_return_val_if_fail (a_this, FALSE) ; - - if (a_this->ref_count) - a_this->ref_count -- ; - - if (a_this->ref_count == 0) - { - cr_box_destroy (a_this) ; - return TRUE ; - } - - return FALSE ; -} - - -/** - *Destructor of #CRBox. - *recursively destroys all - *the children nodes of the current node. - *@param a_this the current box to destroy. - */ -void -cr_box_destroy (CRBox *a_this) - -{ - CRBox *cur_box = NULL ; - - g_return_if_fail (a_this) ; - - for (cur_box = a_this; cur_box && cur_box->next ; - cur_box = cur_box->next) ; - - for (; cur_box ; cur_box = cur_box->prev) - { - if (cur_box->content) - { - cr_box_content_destroy (cur_box->content) ; - cur_box->content = NULL ; - } - - if (cur_box->style) - { - cr_style_unref (cur_box->style) ; - cur_box->style = NULL ; - } - - if (cur_box->next) - { - g_free (cur_box->next) ; - cur_box->next = NULL ; - } - - if (cur_box->children) - { - cr_box_destroy (cur_box->children) ; - g_free (cur_box->children) ; - cur_box->children = NULL ; - } - } -} - diff --git a/src/layeng/cr-box.h b/src/layeng/cr-box.h deleted file mode 100644 index d96fe42..0000000 --- a/src/layeng/cr-box.h +++ /dev/null @@ -1,293 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */ - -/* - * This file is part of The Croco Library - * - * Copyright (C) 2002-2003 Dodji Seketeli <dodji@seketeli.org> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2.1 of the GNU Lesser General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#ifndef __CR_BOX_H__ -#define __CR_BOX_H__ - -#include "cr-style.h" -#include "libxml/tree.h" - -/* - *$Id$ - */ - -G_BEGIN_DECLS - -/** - *@file - *the declaration of the #CRBox class. - */ -enum CRBoxContentType -{ - NO_CONTENT_TYPE, - TEXT_CONTENT_TYPE, - IMAGE_CONTENT_TYPE -} ; - -typedef struct _CRImageContentDesc CRImageContentDesc ; -struct _CRImageContentDesc -{ - guchar *img_buf ; - gulong *len ; - guchar *img_path ; -} ; - -typedef struct _CRBoxContent CRBoxContent ; -struct _CRBoxContent -{ - enum CRBoxContentType type ; - union - { - guchar *text ; - CRImageContentDesc *img_desc ; - } u ; - - /* - *a place where the rendered content can be cached. - *This can be usefull because sometime, during the layout, - *calculating the size of the content is better achieve by - *rendering it. In this case, the rendered content is just cached - *here so that the rendering stage can just pick it. - */ - gpointer content_cache ; -} ; - -typedef struct _CRBoxEdge CRBoxEdge ; - -/** - *An internal data structure - *used by #CRBox. - *An edge is an rectangular area - *defined by the coordinates of the it top left corner, - *its width and height. - */ -struct _CRBoxEdge -{ - gulong x, y, width, max_width, - height, x_offset, y_offset, - child_rmost_x ; -} ; - - -enum CRBoxType -{ - BOX_TYPE_UNDEFINED, - BOX_TYPE_BOX_MODEL, - BOX_TYPE_BLOCK, - BOX_TYPE_ANONYMOUS_BLOCK, - BOX_TYPE_INLINE, - BOX_TYPE_ANONYMOUS_INLINE, - BOX_TYPE_COMPACT, - BOX_TYPE_RUN_IN -} ; - -typedef struct _CRBoxData CRBoxData ; - -/** - *Some data stored in the box. - *these data are about the node which - *generated the current box. - */ -struct _CRBoxData -{ - /** - *The xml node which generated - *the css box. If NULL, it means - *that this node is an anonymous node - */ - xmlNode *xml_node ; -} ; - -CRBoxData * -cr_box_data_new (xmlNode *a_node) ; - -void -cr_box_data_destroy (CRBoxData *a_this) ; - -typedef struct _CRBoxModel CRBoxModel ; -typedef struct _CRBox CRBox ; - -/** - *The CRBox class. - *Abstracts the css2 box as defined in the - *css2 spec in chapter 8. - *It is actually a tree of boxes, each being "generated" - *by an xml document tree node. - */ -struct _CRBox -{ - enum CRBoxType type ; - - /** - *The inner edge, or content edge. - *Is the one that immediately wraps - *the content of the box. - *The content of the box may be - *a text, an image, or a set of boxes. - *If the content is a set of boxes, then - *this set is inevitably the set of children - *boxes of this current box. - */ - CRBoxEdge inner_edge ; - - /** - *The padding edge. - *It includes the inner_edge plus a - *a surrounding area called "padding". - *When the padding is inexistent, the - *padding edge equals the inner or content edge. - */ - CRBoxEdge padding_edge ; - - /** - *The border edge. - *It includes the padding edge plus - *a surrounding area called "border". - *If the border is inexistant, the - *border edge equals the padding edge. - */ - CRBoxEdge border_edge ; - - /** - *The outer edge aka margin edge. - *It includes the border edge plus - *a surrounding area called "margin". - *If the border is inexistant, the outer - *edge equals the border_edge. - */ - CRBoxEdge outer_edge ; - - /** - *The values of all the preceding - *edges are infered from the value - *of the 'style' field. - */ - - /** - *The content (text or image) of this - *box - */ - CRBoxContent *content ; - - /** - *if TRUE, it means that this box has - *a simple content. Simple content means - *either a text or image content. - *Normally, to be logic, if this is - *set to TRUE, the children pointer should - *be NULL ... see what I mean ? - */ - gboolean as_simple_content ; - - /** - *The value infered from what has been found - *in the css stylesheet. - */ - CRStyle *style ; - - /**the containing box*/ - CRBox *parent ; - - /**the next box in the flow*/ - CRBox *next ; - - /**the previous box in the flow*/ - CRBox *prev ; - - /**the children (contained) boxes*/ - CRBox *children ; - - CRBoxModel * box_model ; - - /**some custom data used by libcroco*/ - CRBoxData *box_data ; - /**some application data that will never - *be used by libcroco. Applications - *are free to use it. - */ - gpointer *app_data ; - - gulong ref_count ; -} ; - -struct _CRBoxModel -{ - CRBox box ; - gulong viewport_width ; - gulong viewport_height ; - gulong ref_count ; -} ; - - -CRBoxModel * -cr_box_model_new (void) ; - -void -cr_box_model_destroy (CRBoxModel *a_this) ; - -void -cr_box_model_ref (CRBoxModel *a_this) ; - -gboolean -cr_box_model_unref (CRBoxModel *a_this) ; - -CRBoxContent * -cr_box_content_new_from_text (guchar *a_text) ; - -void -cr_box_content_destroy (CRBoxContent *a_this) ; - -CRBox * -cr_box_new (CRStyle *a_this, gboolean a_set_default_style) ; - -enum CRStatus -cr_box_insert_sibling (CRBox *a_prev, - CRBox *a_next, - CRBox *a_to_insert) ; -enum CRStatus -cr_box_to_string (CRBox *a_this, - gulong a_nb_indent, - GString **a_string) ; - -enum CRStatus -cr_box_dump_to_file (CRBox *a_this, - gulong a_nb_indent, - FILE *a_filep) ; - -enum CRStatus -cr_box_ref (CRBox *a_this) ; - - -gboolean -cr_box_unref (CRBox *a_this) ; - -enum CRStatus -cr_box_append_child (CRBox *a_this, CRBox *a_to_append) ; - -void -cr_box_destroy (CRBox *a_this) ; - - -G_END_DECLS - -#endif /*__CR_BOX_H__*/ - diff --git a/src/layeng/cr-lay-eng.c b/src/layeng/cr-lay-eng.c deleted file mode 100644 index 9c217f7..0000000 --- a/src/layeng/cr-lay-eng.c +++ /dev/null @@ -1,1844 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */ - -/* - * This file is part of The Croco Library - * - * Copyright (C) 2002-2003 Dodji Seketeli <dodji@seketeli.org> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2.1 of the - * GNU Lesser General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the - * GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -/* - *$Id$ - */ - -#include <gnome.h> -#include <gdk/gdk.h> -#include <string.h> -#include "cr-lay-eng.h" -#include "cr-sel-eng.h" - -#define PRIVATE(a_this) ((a_this)->priv) - -const gulong gv_predefined_abs_font_size_tab [NB_PREDEFINED_ABSOLUTE_FONT_SIZES] -= -{ - 7, /*FONT_SIZE_XX_SMALL*/ - 9,/*FONT_SIZE_X_SMALL*/ - 11, /*FONT_SIZE_SMALL*/ - 14, /*FONT_MEDIUM*/ - 17, /*FONT_LARGE*/ - 20, /*FONT_X_LARGE*/ - 24 /*FONT_XX_LARGE*/ -} ; - -/** - *@file - *The definition of the #CRLayEng class. - *Highly unstable and experimental so far. - *This is in developement so the api is *really* gonna change ... - */ - -struct _CRLayEngPriv -{ - gboolean update_parent_box_size ; - CRCascade *cascade ; - CRSelEng *sel_eng ; - GtkLayout *layout ; - gulong xdpi ;/*x resolution*/ - gulong ydpi ; /*y resolution*/ - gulong rightmost_x ; -} ; - - -enum CRDirection -{ - DIR_UNKNOWN = 0, - DIR_VERTICAL, - DIR_HORIZONTAL -} ; - -static gboolean gv_layeng_initialized = FALSE ; - -static void -init_anonymous_text_box (CRBox *a_box) ; - -static enum CRStatus -style_specified_2_computed_values (CRLayEng *a_this, - CRStyle *a_style, - CRBox *a_parent_box) ; - -static CRBox * -create_box_tree_real (CRLayEng * a_this, - xmlNode *a_root_node, - CRBox *a_parent_box) ; - -static glong -get_box_bottommost_y (CRBox *a_this) ; - -static glong -get_box_rightmost_x (CRBox *a_this) ; - -static enum CRStatus -compute_and_set_box_dimensions (CRLayEng *a_this, - CRBox *a_cur_box) ; - -static enum CRStatus -layout_inline_box (CRLayEng *a_this, - CRBox *a_cur_box) ; - -static enum CRStatus -layout_block_box (CRLayEng *a_this, - CRBox *a_cur_box) ; - -static enum CRStatus -layout_box_in_normal_flow (CRLayEng *a_this, - CRBox *a_cur_box) ; - -static enum CRStatus -layout_box (CRLayEng *a_this, CRBox *a_cur_box) ; - -static enum CRStatus -compute_text_box_inner_edge_size (CRLayEng *a_this, - CRBox *a_box) ; - -static enum CRStatus -adjust_parent_inner_edge_size (CRLayEng *a_this, - CRBox *a_cur_box) ; - -static enum CRStatus -normalize_num (CRLayEng *a_this, - CRNum *a_dest_num, - CRNum *a_src_num, - enum CRDirection a_dir) ; - -/********************** - *Private methods. - **********************/ - -/** - *Sets the box style values so that - *it has no padding, no border, no margin. - *The other style values are left as is cause - *they must have been set prior to calling this - *function. - */ -static void -init_anonymous_text_box (CRBox *a_box) -{ - glong i = 0 ; - - g_return_if_fail (a_box && a_box->style) ; - - for (i = 0 ; i< NB_NUM_PROPS ; i++) - { - switch (i) - { - case NUM_PROP_PADDING_TOP: - case NUM_PROP_PADDING_RIGHT: - case NUM_PROP_PADDING_BOTTOM: - case NUM_PROP_PADDING_LEFT: - case NUM_PROP_BORDER_TOP: - case NUM_PROP_BORDER_RIGHT: - case NUM_PROP_BORDER_BOTTOM: - case NUM_PROP_BORDER_LEFT: - case NUM_PROP_MARGIN_TOP: - case NUM_PROP_MARGIN_RIGHT: - case NUM_PROP_MARGIN_BOTTOM: - case NUM_PROP_MARGIN_LEFT: - cr_num_set (&a_box->style->num_props[i].sv, - 0, NUM_LENGTH_PX) ; - break ; - - default: - break ; - } - - } - - for (i = 0 ; i< NB_BORDER_STYLE_PROPS ; i++) - { - a_box->style->border_style_props[i] = BORDER_STYLE_NONE ; - } - - a_box->style->float_type = FLOAT_NONE ; -} - - -static enum CRStatus -normalize_num (CRLayEng *a_this, - CRNum *a_dest_num, - CRNum *a_src_num, - enum CRDirection a_dir) -{ - g_return_val_if_fail (a_this && a_dest_num - && a_src_num, - CR_BAD_PARAM_ERROR) ; - - switch (a_src_num->type) - { - case NUM_LENGTH_PX: - cr_num_copy (a_dest_num, a_src_num) ; - /*a_dest_num->type = NUM_LENGTH_PX ;*/ - break ; - - case NUM_LENGTH_EM: - case NUM_LENGTH_EX: - break ; - - case NUM_LENGTH_IN: - if (a_dir == DIR_HORIZONTAL) - { - a_dest_num->val = a_src_num->val - * PRIVATE (a_this)->xdpi ; - } - else if (a_dir == DIR_VERTICAL) - { - a_dest_num->val = a_src_num->val - * PRIVATE (a_this)->ydpi ; - } - else - { - cr_utils_trace_info ("Bad direction given") ; - return CR_BAD_PARAM_ERROR ; - } - a_dest_num->type = NUM_LENGTH_PX ; - break ; - - case NUM_LENGTH_CM: - /*1 inch == 25.4 mm*/ - if (a_dir == DIR_HORIZONTAL) - { - a_dest_num->val = a_src_num->val / 2.54 * - PRIVATE (a_this)->xdpi ; - } - else if (a_dir == DIR_VERTICAL) - { - a_dest_num->val = a_src_num->val / 2.54 * - PRIVATE (a_this)->ydpi ; - } - else - { - cr_utils_trace_info ("Bad direction given") ; - return CR_BAD_PARAM_ERROR ; - } - - a_dest_num->type = NUM_LENGTH_PX ; - break ; - - case NUM_LENGTH_MM: - /*1 inch == 25.4 mm*/ - if (a_dir == DIR_HORIZONTAL) - { - a_dest_num->val = a_src_num->val / 25.4 * - PRIVATE (a_this)->xdpi ; - } - else if (a_dir == DIR_VERTICAL) - { - a_dest_num->val = a_src_num->val / 25.4 * - PRIVATE (a_this)->ydpi ; - } - else - { - cr_utils_trace_info ("Bad direction given") ; - return CR_BAD_PARAM_ERROR ; - } - a_dest_num->type = NUM_LENGTH_PX ; - break ; - - case NUM_LENGTH_PT: - /*1 point == 1/72 inch*/ - if (a_dir == DIR_HORIZONTAL) - { - a_dest_num->val = a_src_num->val * - PRIVATE (a_this)->xdpi / 72 ; - } - else if (a_dir == DIR_VERTICAL) - { - a_dest_num->val = a_src_num->val * - PRIVATE (a_this)->ydpi / 72 ; - } - else - { - cr_utils_trace_info ("Bad direction given") ; - return CR_BAD_PARAM_ERROR ; - } - - a_dest_num->type = NUM_LENGTH_PX ; - break ; - - case NUM_LENGTH_PC: - /*1 pica == 12 points*/ - if (a_dir == DIR_HORIZONTAL) - { - a_dest_num->val = a_src_num->val * - PRIVATE (a_this)->xdpi / 72 * 12 ; - } - else if (a_dir == DIR_VERTICAL) - { - a_dest_num->val = a_src_num->val * - PRIVATE (a_this)->ydpi / 72 * 12 ; - } - else - { - cr_utils_trace_info ("Bad direction given") ; - return CR_BAD_PARAM_ERROR ; - } - - a_dest_num->type = NUM_LENGTH_PX ; - break ; - - case NUM_ANGLE_DEG: - a_dest_num->val = a_src_num->val ; - - break ; - case NUM_ANGLE_RAD: - a_dest_num->val = a_src_num->val * 180 / 3.1415 ; - a_dest_num->type = NUM_ANGLE_DEG ; - break ; - - case NUM_ANGLE_GRAD: - a_dest_num->val = a_src_num->val * 90 / 100 ; - a_dest_num->type = NUM_ANGLE_DEG ; - break ; - - case NUM_TIME_MS: - a_dest_num->val = a_src_num->val ; - - break ; - - case NUM_TIME_S: - a_dest_num->val = a_src_num->val * 1000 ; - a_dest_num->type = NUM_TIME_MS ; - break ; - - case NUM_FREQ_HZ: - a_dest_num->val = a_src_num->val ; - break ; - - case NUM_FREQ_KHZ: - a_dest_num->val = a_src_num->val * 1000 ; - a_dest_num->type = NUM_FREQ_HZ ; - break ; - - case NUM_PERCENTAGE: - cr_utils_trace_info ("a PERCENTAGE cannot be normalized") ; - return CR_BAD_PARAM_ERROR ; - - default: - - cr_num_copy (a_dest_num, a_src_num) ; - break ; - } - - return CR_OK ; -} - -static enum CRStatus -style_specified_2_computed_values (CRLayEng *a_this, - CRStyle *a_style, - CRBox *a_parent_box) -{ - glong i = 0 ; - CRBoxEdge *parent_inner_edge = NULL; - - g_return_val_if_fail (a_style && a_this, - CR_BAD_PARAM_ERROR) ; - - /* - *walk thru the numerical properties (num_props) and - *compute their computed value. - */ - for (i = 0 ; i < NB_NUM_PROPS ; i++) - { - switch (i) - { - case NUM_PROP_TOP: - case NUM_PROP_BOTTOM: - case NUM_PROP_PADDING_TOP: - case NUM_PROP_PADDING_BOTTOM: - case NUM_PROP_BORDER_TOP: - case NUM_PROP_BORDER_BOTTOM: - case NUM_PROP_MARGIN_TOP: - case NUM_PROP_MARGIN_BOTTOM: - if (a_style->num_props[i].sv.type == NUM_PERCENTAGE) - { - /* - *TODO: compute the computed value - *using the parent box size. - */ - if (a_parent_box) - { - parent_inner_edge = - &a_parent_box->inner_edge ; - } - - g_return_val_if_fail (parent_inner_edge, - CR_BAD_PARAM_ERROR) ; - - a_style->num_props[i].cv.val = - parent_inner_edge->height * - a_style->num_props[i].sv.val / 100 ; - } - else - { - normalize_num (a_this, - &a_style->num_props[i].cv, - &a_style->num_props[i].sv, - DIR_VERTICAL) ; - } - break ; - - case NUM_PROP_RIGHT: - case NUM_PROP_LEFT: - case NUM_PROP_PADDING_LEFT: - case NUM_PROP_PADDING_RIGHT: - case NUM_PROP_BORDER_LEFT: - case NUM_PROP_BORDER_RIGHT: - case NUM_PROP_MARGIN_LEFT: - case NUM_PROP_MARGIN_RIGHT: - if (a_style->num_props[i].sv.type == NUM_PERCENTAGE) - { - /* - *TODO: compute the computed value - *using the parent box size. - */ - if (a_parent_box) - { - parent_inner_edge = - &a_parent_box->inner_edge ; - } - - g_return_val_if_fail (parent_inner_edge, - CR_BAD_PARAM_ERROR) ; - - a_style->num_props[i].cv.val = - a_style->parent_style-> - num_props[NUM_PROP_WIDTH].cv.val * - a_style->num_props[i].sv.val / 100 ; - } - else - { - normalize_num (a_this, - &a_style->num_props[i].cv, - &a_style->num_props[i].sv, - DIR_HORIZONTAL) ; - } - break ; - - case NUM_PROP_WIDTH: - if (a_style->num_props[i].sv.type == NUM_PERCENTAGE) - { - /* - *TODO: compute the computed value - *using the parent box size. - */ - if (a_parent_box) - { - parent_inner_edge = - &a_parent_box->inner_edge ; - } - - g_return_val_if_fail (parent_inner_edge, - CR_BAD_PARAM_ERROR) ; - - a_style->num_props[i].cv.val = - a_style->parent_style-> - num_props[NUM_PROP_WIDTH].cv.val * - a_style->num_props[i].sv.val / 100 ; - - a_style->num_props[i].cv.val -= - (a_style->num_props[NUM_PROP_MARGIN_LEFT].cv.val - +a_style->num_props[NUM_PROP_MARGIN_RIGHT].cv.val - +a_style->num_props[NUM_PROP_BORDER_LEFT].cv.val - +a_style->num_props[NUM_PROP_BORDER_RIGHT].cv.val - +a_style->num_props[NUM_PROP_PADDING_LEFT].cv.val - +a_style->num_props[NUM_PROP_PADDING_RIGHT].cv.val); - a_style->num_props[i].cv.type = - NUM_LENGTH_PX ; - } - else - { - normalize_num (a_this, - &a_style->num_props[i].cv, - &a_style->num_props[i].sv, - DIR_HORIZONTAL) ; - } - break ; - default: - normalize_num (a_this, - &a_style->num_props[i].cv, - &a_style->num_props[i].sv, - DIR_UNKNOWN) ; - break ; - } - } - - for (i = 0 ; i < NB_RGB_PROPS; i++) - { - cr_rgb_set_from_rgb (&a_style->rgb_props[i].cv, - &a_style->rgb_props[i].sv) ; - } - - /************************************* - *Now compute the specific css2 specification recommendations. - *This can seem ugly, but it needs to be done. I do it here untill - *I find a better place for it. - ***************************************/ - - /* - *css2 spec chap 8.5.3 says that if border-style-x is set to - *'none', it forces border-x to have a width of zero. - *For the time being, we consider the 'none' and 'hidden' values - *being equal untill be implement the support of table. - */ - if ((a_style->border_style_props[BORDER_STYLE_PROP_TOP] == - BORDER_STYLE_NONE) - || (a_style->border_style_props[BORDER_STYLE_PROP_TOP] == - BORDER_STYLE_HIDDEN)) - { - cr_num_set (&a_style->num_props[NUM_PROP_BORDER_TOP].cv, - 0, NUM_LENGTH_PX) ; - } - - if ((a_style->border_style_props[BORDER_STYLE_PROP_RIGHT] == - BORDER_STYLE_NONE) - || (a_style->border_style_props[BORDER_STYLE_PROP_RIGHT] == - BORDER_STYLE_HIDDEN)) - { - cr_num_set (&a_style->num_props[NUM_PROP_BORDER_RIGHT].cv, - 0, NUM_LENGTH_PX) ; - } - - if ((a_style->border_style_props[BORDER_STYLE_PROP_BOTTOM] == - BORDER_STYLE_NONE) - || (a_style->border_style_props[BORDER_STYLE_PROP_BOTTOM] == - BORDER_STYLE_HIDDEN)) - { - cr_num_set (&a_style->num_props[NUM_PROP_BORDER_BOTTOM].cv, - 0, NUM_LENGTH_PX) ; - } - - if ((a_style->border_style_props[BORDER_STYLE_PROP_LEFT] == - BORDER_STYLE_NONE) - || (a_style->border_style_props[BORDER_STYLE_PROP_LEFT] == - BORDER_STYLE_HIDDEN)) - { - cr_num_set (&a_style->num_props[NUM_PROP_BORDER_LEFT].cv, - 0, NUM_LENGTH_PX) ; - } - - - return CR_OK ; -} - -/** - *Creates a box sub tree from an xml node tree. - *@param a_this the current instance of #CRLayEng. - *@param a_root_node the root node of the xml tree. - *@param a_parent_box the root of the box tree to build. - *@return the newly built box tree, or NULL if an error - *happens. - */ -static CRBox * -create_box_tree_real (CRLayEng * a_this, - xmlNode *a_root_node, - CRBox *a_parent_box) -{ - enum CRStatus status = CR_OK ; - xmlNode *cur = NULL ; - CRBox *cur_box = NULL ; - CRBoxData *box_data = NULL ; - - g_return_val_if_fail (a_this - && PRIVATE (a_this) - && PRIVATE (a_this)->cascade - && a_root_node, NULL) ; - - if (!PRIVATE (a_this)->sel_eng) - { - PRIVATE (a_this)->sel_eng = cr_sel_eng_new () ; - if (!PRIVATE (a_this)->sel_eng) - { - cr_utils_trace_info - ("Could not create selection engine") ; - cr_utils_trace_info - ("System may be out of memory") ; - return NULL ; - } - } - - for (cur = a_root_node ; cur ; cur = cur->next) - { - CRStyle *style = NULL, *parent_style = NULL ; - - if (cur->type != XML_ELEMENT_NODE - && cur->type != XML_TEXT_NODE) - continue ; - - /*build here the node annotation*/ - if (cur->parent && a_parent_box && a_parent_box->style) - parent_style = a_parent_box->style ; - - if (cur->type == XML_ELEMENT_NODE) - { - status = - cr_sel_eng_get_matched_style - (PRIVATE (a_this)->sel_eng, - PRIVATE (a_this)->cascade, - cur, parent_style, &style) ; - - if (status != CR_OK - || (style && style->display == DISPLAY_NONE)) - { - continue ; - } - - /*here, build the box, - *append it to the box tree - *and update all it attributes but - *the positioning. The positioning will - *be updated later via the cr_box_layout() method. - */ - /*style_specified_2_computed_values - (a_this, style, a_parent_box) ;*/ - - cur_box = cr_box_new (style, TRUE) ; - if (!cur_box) - { - cr_utils_trace_info - ("Could not create a box") ; - cr_utils_trace_info - ("The system may be out of memory") ; - return NULL ; - } - - if (a_parent_box) - cr_box_append_child (a_parent_box, - cur_box) ; - style = NULL ; - - /* - *store a pointer to the node that generated - *the current box into that current box. - */ - box_data = cr_box_data_new (cur) ; - if (!box_data) - { - cr_utils_trace_info ("Out of memory") ; - goto error ; - } - cur_box->box_data = box_data ; - box_data = NULL ; - - if (style) - { - cr_style_destroy (style) ; - style = NULL ; - } - } - else if (cur->type == XML_TEXT_NODE) - { - CRBoxContent *box_content = NULL ; - xmlChar *node_text = NULL ; - CRStyle * style_dup = NULL ; - - if (xmlIsBlankNode (cur)) - continue ; - - node_text = xmlNodeGetContent (cur) ; - if (node_text) - { - box_content = - cr_box_content_new_from_text - (node_text) ; - xmlFree (node_text) ; - node_text = NULL ; - } - if (box_content) - { - /* - *create here an anonymous box - *which style inherits the style - *of the parent box. - */ - style_dup = cr_style_dup (parent_style) ; - if (!style_dup) - { - cr_utils_trace_info - ("cr_style_dup " - "Maybe out of memory") ; - goto error ; - } - - cur_box = cr_box_new (style_dup, TRUE) ; - if (!cur_box) - { - cr_utils_trace_info - ("could not create " - "anonymous box") ; - goto error ; - } - cur_box->content = box_content ; - box_content = NULL ; - - /* - *by default, text/img boxes are inline. - */ - cur_box->type = BOX_TYPE_INLINE ; - cur_box->style->display = DISPLAY_INLINE ; - - /* - *store a pointer to the node that generated - *the current box into that current box. - */ - box_data = cr_box_data_new (cur) ; - if (!box_data) - { - cr_utils_trace_info - ("Out of memory") ; - goto error ; - } - cur_box->box_data = box_data ; - box_data = NULL ; - - /* - *the anonymous box - *must have no margin, - *no padding, no border, - *no border style, no offset - */ - init_anonymous_text_box (cur_box) ; - - /*style_specified_2_computed_values - (a_this, cur_box->style, a_parent_box) ;*/ - - cr_box_append_child (a_parent_box, - cur_box) ; - cur_box = NULL ; - - - } - } - else - { - cr_utils_trace_info - ("xml node type neither element nor text") ; - cr_utils_trace_info - ("this should not happen. This is a bug") ; - } - - /*walk through what remains from the tree*/ - if (cur->children) - { - create_box_tree_real - (a_this, cur->children, cur_box) ; - } - } - - return cur_box ; - - error: - if (cur_box) - { - cr_box_destroy (cur_box) ; - cur_box = NULL ; - } - if (box_data) - { - cr_box_data_destroy (box_data) ; - box_data = NULL ; - } - - return NULL ; -} - - -static glong -get_box_bottommost_y (CRBox *a_this) -{ - if (!a_this) - return 0 ; - - return (a_this->outer_edge.y - + - a_this->outer_edge.y_offset - + - a_this->outer_edge.height) ; -} - -/** - *Computes the abscissa of the rightmost side - *of the current box. - *@param a_box the current box. - *@return a positve or 0 number if the computation went well, - *-1 otherwise. - */ -static glong -get_box_rightmost_x (CRBox *a_this) -{ - if (!a_this) - return 0 ; - - return (a_this->outer_edge.x - + - a_this->outer_edge.x_offset - + - a_this->outer_edge.width) ; -} - - -/** - *computes the inner edge size of a box which - *contents text only. - *This fonction uses pango to compute the size - *of the box. Note that layout_text_in_box must have - *been called prior to this function. - *Note that this is highly experimental for the time being. - *It more a design sketch than a real working code. - *@param a_this in/out parameter the current box which inner edge is to - *be computed. - *@return TRUE if the inner edge has been computed, FALSE otherwise. - */ -static enum CRStatus -compute_text_box_inner_edge_size (CRLayEng *a_this, - CRBox *a_box) -{ - enum CRStatus status = CR_OK ; - GtkWidget *label = NULL ; - PangoLayout *pgo_layout = NULL ; - PangoRectangle ink_rect = {0}, logical_rect = {0} ; - - g_return_val_if_fail (a_this - && a_box - && a_box->content - && a_box->content->type == TEXT_CONTENT_TYPE, - CR_BAD_PARAM_ERROR) ; - - if (a_box->content->u.text == NULL - || strlen (a_box->content->u.text) == 0) - { - a_box->inner_edge.width = 0 ; - a_box->inner_edge.height = 0 ; - return CR_OK ; - } - - g_return_val_if_fail (a_box->content->content_cache, - CR_BAD_PARAM_ERROR) ; - - label = a_box->content->content_cache ; - - if (label->parent == GTK_WIDGET (PRIVATE (a_this)->layout)) - gtk_layout_move (PRIVATE (a_this)->layout, - label, - a_box->inner_edge.x, - a_box->inner_edge.y) ; - else - gtk_layout_put (PRIVATE (a_this)->layout, - label, - a_box->inner_edge.x, - a_box->inner_edge.y) ; - - gtk_widget_show_all (GTK_WIDGET (PRIVATE (a_this)->layout)) ; - - pgo_layout = gtk_label_get_layout (GTK_LABEL (label)) ; - - pango_layout_get_pixel_extents (pgo_layout, &ink_rect, - &logical_rect) ; - - /*gtk_widget_size_request (label, &requisition) ;*/ - - if (cr_num_is_fixed_length - (&a_box->style->num_props[NUM_PROP_WIDTH].cv)) - { - a_box->inner_edge.width = - a_box->style->num_props[NUM_PROP_WIDTH].cv.val ; - } - else - { - a_box->inner_edge.width = logical_rect.width ; - } - - a_box->inner_edge.height = logical_rect.height ; - - return status ; -} - - -static enum CRStatus -layout_text_in_box (CRLayEng *a_this, CRBox *a_text_box) -{ - enum CRStatus status = CR_OK ; - GtkWidget *label = NULL ; - PangoLayout * pgo_layout = NULL ; - PangoAttrList *pgo_attr_list = NULL ; - glong wrap_width = 0 ; - - g_return_val_if_fail (a_this && a_text_box - && a_text_box->content - && (a_text_box->content->type - == TEXT_CONTENT_TYPE) - && a_text_box->content->u.text, - CR_BAD_PARAM_ERROR) ; - - g_return_val_if_fail ((a_text_box->parent->inner_edge.max_width - + a_text_box->parent->inner_edge.x) - >= a_text_box->inner_edge.x, - CR_BAD_PARAM_ERROR) ; - - if (!a_text_box->content->content_cache) - { - a_text_box->content->content_cache = - gtk_label_new (NULL) ; - g_return_val_if_fail (a_text_box->content->content_cache, - CR_ERROR) ; - } - - label = a_text_box->content->content_cache ; - g_return_val_if_fail (GTK_IS_LABEL (label), CR_ERROR) ; - - gtk_label_set_text (GTK_LABEL (label), - a_text_box->content->u.text) ; - gtk_misc_set_alignment (GTK_MISC (label),0, 0) ; - gtk_misc_set_padding (GTK_MISC (label), 0, 0) ; - gtk_label_set_use_markup (GTK_LABEL (label), - FALSE) ; - gtk_label_set_use_underline (GTK_LABEL (label), - FALSE) ; - pgo_layout = gtk_label_get_layout (GTK_LABEL (label)) ; - - wrap_width = a_text_box->inner_edge.max_width ; - - gtk_label_set_line_wrap (GTK_LABEL (label), TRUE) ; - gtk_widget_set_size_request (label, wrap_width, - -1) ; - /* - *TODO: set the font description attributes. - */ - - pgo_attr_list = - pango_attr_list_new () ; - g_return_val_if_fail (pgo_attr_list, CR_ERROR) ; - - status = cr_lay_eng_style_to_pango_font_attribute - (a_text_box->style, pgo_attr_list, - strlen (a_text_box->content->u.text)) ; - - gtk_label_set_attributes (GTK_LABEL (label), pgo_attr_list) ; - - return status ; -} - -/** - *Computes the size and positions of border edge, pading edge, - *and inner edge. Also compute the size of the outer edge (aka margin edge). - *All these calculations are done relatively to the position of the outer edge. - *Which means that the position (x,y) of the outer edge *must* be set prior - *to calling this function. - *Note that this function calls layout_box() to compute the size of - *the inner edge if it contains non terminal boxes. - *@param a_this the layout engine. - *@param a_cur_box the box. - *@return CR_OK upon successfull completion, an error code otherwise. - */ -static enum CRStatus -compute_and_set_box_dimensions (CRLayEng *a_this, - CRBox *a_cur_box) -{ - enum CRStatus status = CR_OK ; - - g_return_val_if_fail (a_cur_box && a_cur_box->style, - CR_BAD_PARAM_ERROR) ; - - /******************************************* - *1/set the left border and - *left padding edges. - *2/compute the left most x and topmost y of - *the inner box. - *3/compute the max_width of the inner edge. - * - *4/Compute the outer edge of the contained - *box; this is recursive. - *******************************************/ - - /* - *step 1/ - */ - - /* - *TODO: collapse this margin !!!. - *See css2 chap 8.3.1 to see what "collapsing" means. - */ - a_cur_box->border_edge.x = - a_cur_box->outer_edge.x - + - a_cur_box->style->num_props[NUM_PROP_MARGIN_LEFT].cv.val ; - a_cur_box->border_edge.y = - a_cur_box->outer_edge.y - + - a_cur_box->style->num_props[NUM_PROP_MARGIN_TOP].cv.val ; - - a_cur_box->padding_edge.x = - a_cur_box->border_edge.x - + - a_cur_box->style->num_props[NUM_PROP_BORDER_LEFT].cv.val ; - - a_cur_box->padding_edge.y = - a_cur_box->border_edge.y - + - a_cur_box->style->num_props[NUM_PROP_BORDER_TOP].cv.val ; - - /* - *Step 2/ - */ - a_cur_box->inner_edge.x = - a_cur_box->padding_edge.x - + - a_cur_box->style->num_props[NUM_PROP_PADDING_LEFT].cv.val ; - a_cur_box->inner_edge.y = - a_cur_box->padding_edge.y - + - a_cur_box->style->num_props[NUM_PROP_PADDING_LEFT].cv.val ; - - /* - *Step 3/ - */ - a_cur_box->inner_edge.max_width = - (a_cur_box->parent->inner_edge.x + - a_cur_box->parent->inner_edge.max_width) - - a_cur_box->inner_edge.x - - (a_cur_box->style->num_props[NUM_PROP_MARGIN_RIGHT].cv.val - + a_cur_box->style->num_props[NUM_PROP_BORDER_RIGHT].cv.val - + a_cur_box->style->num_props[NUM_PROP_PADDING_RIGHT].cv.val) ; - - /* - *Step 4. - */ - if (cr_num_is_fixed_length - (&a_cur_box->style->num_props[NUM_PROP_WIDTH].cv) == TRUE) - { - a_cur_box->inner_edge.width = - a_cur_box->style->num_props[NUM_PROP_WIDTH].cv.val ; - - if (a_cur_box->inner_edge.max_width > - a_cur_box->style->num_props[NUM_PROP_WIDTH].cv.val) - { - a_cur_box->inner_edge.max_width = - a_cur_box->style-> - num_props[NUM_PROP_WIDTH].cv.val ; - } - } - - if (a_cur_box->children) - { - /* - *layout the children boxes. This function call will - *also update the current inner_edge size. - */ - status = layout_box (a_this, a_cur_box->children) ; - g_return_val_if_fail (status == CR_OK, status) ; - } - else - { - /* - *this box may have a content. - *TODO: compute it's width and height. - *then, when computed, update the - *children max width size in the parent box. - */ - if (a_cur_box->content) - { - switch (a_cur_box->content->type) - { - case TEXT_CONTENT_TYPE: - if (a_cur_box->parent - && cr_num_is_fixed_length - (&a_cur_box->parent->style-> - num_props[NUM_PROP_WIDTH].cv)) - { - cr_num_copy - (&a_cur_box->style-> - num_props[NUM_PROP_WIDTH].cv, - &a_cur_box->parent->style-> - num_props[NUM_PROP_WIDTH].cv) ; - } - layout_text_in_box (a_this, a_cur_box) ; - compute_text_box_inner_edge_size - (a_this, a_cur_box) ; - break ; - - case IMAGE_CONTENT_TYPE: - cr_utils_trace_info - ("image content not " - "supported yet") ; - break ; - case NO_CONTENT_TYPE: - cr_utils_trace_info - ("incoherent box model. " - "We should have either " - "image or text here. " - "found NO_CONTENT_TYPE " - "intead") ; - break ; - default: - cr_utils_trace_info - ("Unknown content type") ; - break ; - } - } - } - - /******************************************* - *Inner edge position (x,y) and size computing is - *finished. - *Now, we can compute the widths of the - *remaining three other boxes - *(padding edge, border edge and outer edge) - ******************************************/ - a_cur_box->padding_edge.width = a_cur_box->inner_edge.width + - a_cur_box->style->num_props[NUM_PROP_PADDING_RIGHT].cv.val + - a_cur_box->style->num_props[NUM_PROP_PADDING_LEFT].cv.val ; - a_cur_box->padding_edge.height = a_cur_box->inner_edge.height + - a_cur_box->style->num_props[NUM_PROP_PADDING_TOP].cv.val + - a_cur_box->style->num_props[NUM_PROP_PADDING_BOTTOM].cv.val ; - - a_cur_box->border_edge.width = a_cur_box->padding_edge.width + - a_cur_box->style->num_props[NUM_PROP_BORDER_RIGHT].cv.val + - a_cur_box->style->num_props[NUM_PROP_BORDER_LEFT].cv.val ; - a_cur_box->border_edge.height = a_cur_box->padding_edge.height + - a_cur_box->style->num_props[NUM_PROP_BORDER_TOP].cv.val + - a_cur_box->style->num_props[NUM_PROP_BORDER_BOTTOM].cv.val ; - - a_cur_box->outer_edge.width = a_cur_box->border_edge.width + - a_cur_box->style->num_props[NUM_PROP_MARGIN_LEFT].cv.val + - a_cur_box->style->num_props[NUM_PROP_MARGIN_RIGHT].cv.val ; - a_cur_box->outer_edge.height = a_cur_box->border_edge.height + - a_cur_box->style->num_props[NUM_PROP_MARGIN_TOP].cv.val + - a_cur_box->style->num_props[NUM_PROP_MARGIN_BOTTOM].cv.val ; - - if (a_cur_box->parent->inner_edge.child_rmost_x - < a_cur_box->outer_edge.x + a_cur_box->outer_edge.width) - { - a_cur_box->parent->inner_edge.child_rmost_x = - a_cur_box->outer_edge.x + - a_cur_box->outer_edge.width ; - } - - return CR_OK ; -} - -/** - *Adjusts the size of the inner edge of this box's parent. - *That is, increases (if needed) the parent inner edge's width/height. - *@param a_this the current instance of #CRBox. - *@param a_cur_box the box to consider. - */ -static enum CRStatus -adjust_parent_inner_edge_size (CRLayEng *a_this, - CRBox *a_cur_box) -{ - g_return_val_if_fail (a_cur_box - && a_this - && PRIVATE (a_this), - CR_BAD_PARAM_ERROR) ; -/* - if (a_cur_box->parent - && a_cur_box->parent->style - && (cr_num_is_fixed_length - (&a_cur_box->parent->style->num_props[NUM_PROP_WIDTH].cv) == TRUE)) - { - return CR_OK ; - } -*/ - if (PRIVATE (a_this)->update_parent_box_size == TRUE - && a_cur_box->parent) - { - gulong parent_inner_edge_right_bound = - a_cur_box->parent->inner_edge.x + - a_cur_box->parent->inner_edge.width ; - gulong outer_edge_right_bound = - a_cur_box->outer_edge.x + - a_cur_box->outer_edge.width ; - - if (parent_inner_edge_right_bound - < - outer_edge_right_bound) - { - /* - *parent inner edge is too short to - *contain this box outer edge. - *So, we just enlarge it. - */ - a_cur_box->parent->inner_edge.width = - outer_edge_right_bound - - a_cur_box->parent->inner_edge.x ; - } - } - - /* - *Make sure the parent inner_edge.heigth is big enough - *to contain the current box. - */ - if (a_cur_box->parent) - { - gulong parent_inner_edge_bottom_bound = - a_cur_box->parent->inner_edge.y + - a_cur_box->parent->inner_edge.height ; - gulong outer_edge_bottom_bound = - a_cur_box->outer_edge.y + - a_cur_box->outer_edge.height ; - - if (parent_inner_edge_bottom_bound < - outer_edge_bottom_bound) - { - a_cur_box->parent->inner_edge.height = - outer_edge_bottom_bound - - a_cur_box->parent->inner_edge.y ; - } - } - - return CR_OK ; -} - -/** - *Layout a box in block formating context. - *See css2 spec in chapters 9.2. - *@param a_this the current instance of CRLayEng. - *@param a_cur_box the current box to layout. - *@return CR_OK upon successfull completion, an error code otherwise. - */ -static enum CRStatus -layout_block_box (CRLayEng *a_this, - CRBox *a_cur_box) -{ - enum CRStatus status = CR_OK ; - CRBox *cont_box = NULL; - - g_return_val_if_fail (a_cur_box && a_cur_box->style, - CR_BAD_PARAM_ERROR) ; - - cont_box = a_cur_box->parent ; - - /************************************ - *We are in a block formating context - ************************************/ - - /* - *position the 'x' of the top - *leftmost corner of this box - *at the leftmost abscissa of it's - *containing box. - *Position the 'y' of - *the top left corner of this - *just under the previous box. - */ - if (!cont_box) - { - a_cur_box->outer_edge.x = 0 ; - a_cur_box->outer_edge.y = 0 ; - a_cur_box->inner_edge.width = 800 ; - a_cur_box->inner_edge.height = 600 ; - a_cur_box->inner_edge.max_width = 800 ; - } - else - { - a_cur_box->outer_edge.x = - cont_box->inner_edge.x ; - if (a_cur_box->prev) - { - a_cur_box->outer_edge.y = - get_box_bottommost_y (a_cur_box->prev) ; - } - else - { - a_cur_box->outer_edge.y = - cont_box->inner_edge.y ; - } - } - - g_return_val_if_fail (a_cur_box->parent->inner_edge.max_width - + a_cur_box->parent->inner_edge.x - > a_cur_box->outer_edge.x, - CR_ERROR) ; - - status = compute_and_set_box_dimensions (a_this, - a_cur_box) ; - return status ; -} - - -/** - *Layout a box in an inline formating context. - *See css2 spec in chapters 9.2. - *@param a_this the layout engine. - *@param a_cur_box the current box to layout. - *@return CR_OK upon successfull completion, an error code otherwise. - */ -static enum CRStatus -layout_inline_box (CRLayEng *a_this, - CRBox *a_cur_box) -{ - CRBox *cont_box = NULL, *prev_box = NULL ; - enum CRStatus status = CR_OK ; - - g_return_val_if_fail (a_cur_box && a_cur_box->style, - CR_BAD_PARAM_ERROR) ; - - cont_box = a_cur_box->parent ; - prev_box = a_cur_box->prev ; - - /************************************ - *We are in an inline formating context - ************************************/ - - /******************************************** - *position the 'x' of the top - *leftmost corner of this box - *one pixel right after the rightmost x - *of the preceding box. - *Position the 'y' of this box to - *the y of the previous box. - ********************************************/ - - if (!prev_box) - { - /* - *this box is the leftmost box contained in its containing - *box. - */ - if (cont_box) - { - a_cur_box->outer_edge.x = cont_box->inner_edge.x ; - a_cur_box->outer_edge.y = cont_box->inner_edge.y ; - } - else - { - /*this box does not have any containing box*/ - a_cur_box->outer_edge.x = 0 ; - a_cur_box->outer_edge.y = 0 ; - } - } - else - { - a_cur_box->outer_edge.x = - get_box_rightmost_x (prev_box) + 1 ; - a_cur_box->outer_edge.y = prev_box->outer_edge.y ; - } - - /******************************************* - *Now, compute the inner edge of this box; - *which means - *1/set the left border and - *left padding edges. - *2/compute the left most x and topmost y of - *the inner box and. - *3/Compute the outer edge of the containing - *box; this is recursive. - *******************************************/ - - status = compute_and_set_box_dimensions (a_this, - a_cur_box) ; - - return status ; -} - -/** - *Lay the box out according to "Normal flow" - *as decribed in css2 spec chap 9.4. - *In normal flow, a box belongs to a formating context - *that may be block or inline. In block formating context, - *boxes are laid out verticaly, one under an other. - *In inline formatting context, boxes are laid out horizontally, - *usually from the left to the right, unless we support bidi. - *@param a_this the layout engine. - *@param a_cur_box the current box. - *@return CR_OK upon successfull completion, an error code otherwise. - */ -static enum CRStatus -layout_box_in_normal_flow (CRLayEng *a_this, - CRBox *a_cur_box) -{ - enum CRStatus status = CR_OK ; - - g_return_val_if_fail (a_cur_box && a_cur_box->style, - CR_BAD_PARAM_ERROR) ; - - /* - *Only boxes that have - *the position rule set to 'static' or 'relative' - *can be part of a normal formatting context. - */ - if (a_cur_box->style->position != POSITION_STATIC - && a_cur_box->style->position != POSITION_RELATIVE) - { - return CR_UNEXPECTED_POSITION_SCHEME ; - } - - /* - *TODO - *compute the "computed values" of the style data structure. - */ - switch (a_cur_box->type) - { - case BOX_TYPE_BLOCK: - case BOX_TYPE_ANONYMOUS_BLOCK: - layout_block_box (a_this, a_cur_box) ; - break ; - - case BOX_TYPE_COMPACT: - case BOX_TYPE_RUN_IN: - case BOX_TYPE_INLINE: - case BOX_TYPE_ANONYMOUS_INLINE: - layout_inline_box (a_this, a_cur_box) ; - break ; - - default: - break ; - } - - - return status ; -} - - -/** - *Layout a box. - *This function determine the flow scheme (e.g: normal flow etc ...) - *and call the right specialized function that knows how to perform - *the layout according to that flow scheme. - *Note that a flow scheme is local to a box. A child box can have a - *different flow scheme for example. So the lower level function called - *by layout_box() can also call layout_box() to perform the layout of their - *children boxes. - *@param a_this the layout engine. - *@param a_cur_box the current box. - */ -static enum CRStatus -layout_box (CRLayEng *a_this, - CRBox *a_cur_box) -{ - CRBox *cur_box = NULL ; - - g_return_val_if_fail (a_cur_box && a_cur_box->style, - CR_BAD_PARAM_ERROR) ; - - PRIVATE (a_this)->update_parent_box_size = TRUE ; - - for (cur_box = a_cur_box ; cur_box ; - cur_box = cur_box->next) - { - style_specified_2_computed_values (a_this, cur_box->style, - cur_box->parent) ; - - switch (cur_box->style->position) - { - case POSITION_STATIC: - case POSITION_RELATIVE: - layout_box_in_normal_flow - (a_this, cur_box) ; - break ; - - case POSITION_ABSOLUTE: - case POSITION_FIXED: - /*cr_box_layout_absolute (a_cur_box) ;*/ - break ; - - case POSITION_INHERIT: - break ; - } - - /* - *make sure the parent inner_edge is big enough to contain - *the current box. - */ - adjust_parent_inner_edge_size (a_this, - cur_box) ; - } - - return CR_OK ; -} - -/********************** - *Public methods. - **********************/ - -/** - *The first function to call prior to any other - *method of the layout engine. - *@param a_argc the argc parameter passed to the standard C main entry point. - *@param a_argv the argv parameter passed to the standard C main entry point. - */ -void -cr_lay_eng_init (glong a_argc, gchar ** a_argv) -{ - - if (gv_layeng_initialized == FALSE) - { - gtk_init ((int*)&a_argc, &a_argv) ; - gv_layeng_initialized = TRUE ; - } -} - - -/** - *Instanciates a new Layout Engine. - *return the new instance of #CRLayEng or NULL if - *an error occured. - */ -CRLayEng * -cr_lay_eng_new (GtkLayout *a_layout) -{ - CRLayEng *result = NULL ; - - if (gv_layeng_initialized == FALSE) - { - cr_utils_trace_info ("Layout Engine must be initialized " - "by calling cr_lay_eng_init() first") ; - return NULL ; - } - - result = g_try_malloc (sizeof (CRLayEng)) ; - if (!result) - { - cr_utils_trace_info ("Out of memory") ; - return NULL ; - } - memset (result, 0, sizeof (CRLayEng)) ; - - PRIVATE (result) = g_try_malloc (sizeof (CRLayEngPriv)) ; - if (!PRIVATE (result)) - { - cr_utils_trace_info ("Out of memory") ; - g_free (result) ; - result = NULL ; - return NULL ; - } - memset (PRIVATE (result), 0, sizeof (CRLayEngPriv)) ; - - PRIVATE (result)->layout = a_layout ; - - PRIVATE (result)->xdpi = gdk_screen_width () / - gdk_screen_width_mm () * 25.4 ; - PRIVATE (result)->ydpi = gdk_screen_height () / - gdk_screen_height_mm () * 25.4 ; - - return result ; -} - -/** - *Creates the box model from an xml document. - *@param a_this the current instance of #CRLayEng. - *@param a_doc the current xml document. - *@param a_cascade the css2 stylesheet cascade. - *@param a_box_model out parameter. The returned - *@return CR_OK upon successfull completion, an error code - *otherwise. - */ -enum CRStatus -cr_lay_eng_create_box_model (CRLayEng *a_this, - xmlDoc *a_doc, - CRCascade *a_cascade, - CRBoxModel **a_box_model) -{ - xmlNode *root_node = NULL ; - CRBox *box_tree = NULL; - - g_return_val_if_fail (a_this && a_doc && a_cascade, - CR_BAD_PARAM_ERROR) ; - - root_node = xmlDocGetRootElement (a_doc) ; - - if (!root_node) - return CR_NO_ROOT_NODE_ERROR ; - - PRIVATE (a_this)->cascade = a_cascade ; - - if (!*a_box_model) - { - *a_box_model = cr_box_model_new () ; - } - - box_tree = - create_box_tree_real (a_this, root_node, - (CRBox*)*a_box_model) ; - - if (box_tree) - return CR_OK ; - else - return CR_ERROR ; -} - - - -/** - *Recursively computes the sizes and positions of each - *box in the box tree. - *@param a_this - *@param a_box_tree - *@return - */ -enum CRStatus -cr_lay_eng_layout_box_tree (CRLayEng *a_this, - CRBox *a_box_tree) -{ - enum CRStatus status = CR_OK ; - - g_return_val_if_fail (a_this && a_box_tree, - CR_BAD_PARAM_ERROR) ; - - status = layout_box (a_this, a_box_tree) ; - - return status ; -} - - -/** - *@param a_style the style data structure to consider. - *@param a_pgo_attrs the output pango attributes list populated - *in case of successful completion - *@param a_text_len the length of the text the style is to be - *applied to. (in number of bytes, not number of characters) - *@return CR_OK upon successful completion, an error code otherwise. - */ -enum CRStatus -cr_lay_eng_style_to_pango_font_attribute (CRStyle *a_style, - PangoAttrList *a_pgo_attrs, - gulong a_text_len) -{ - enum CRStatus status = CR_OK ; - PangoAttribute * pgo_attr = NULL ; - PangoFontDescription *pgo_font_desc = NULL ; - PangoStyle pgo_style = PANGO_STYLE_NORMAL ; - guchar *font_family = NULL ; - PangoWeight pgo_weight = PANGO_WEIGHT_NORMAL ; - - g_return_val_if_fail (a_pgo_attrs - && a_style, - CR_BAD_PARAM_ERROR) ; - - pgo_font_desc = pango_font_description_new () ; - if (!pgo_font_desc) - { - cr_utils_trace_info ("Could not instanciate " - "pango font description") ; - return CR_ERROR ; - } - - if (a_style->font_size) - /*set font size*/ - switch (a_style->font_size->type) - { - case PREDEFINED_ABSOLUTE_FONT_SIZE: - if ( !(a_style->font_size->value.predefined - < NB_PREDEFINED_ABSOLUTE_FONT_SIZES)) - { - status = CR_OUT_OF_BOUNDS_ERROR ; - goto cleanup ; - } - pango_font_description_set_size - (pgo_font_desc, - gv_predefined_abs_font_size_tab - [a_style->font_size->value.predefined] - * PANGO_SCALE) ; - break ; - - case ABSOLUTE_FONT_SIZE: - if (!a_style->font_size->value.absolute) - { - status = CR_BAD_PARAM_ERROR ; - goto cleanup ; - } - pango_font_description_set_size - (pgo_font_desc, - a_style->font_size->value.absolute->val - * PANGO_SCALE) ; - break ; - - case RELATIVE_FONT_SIZE: - cr_utils_trace_info ("relative font size are not supported " - "yes") ; - - break ; - - case INHERITED_FONT_SIZE: - cr_utils_trace_info ("inherited font size are not supported " - "yes") ; - break ; - } - - - /*set font family*/ - if (a_style->font_family) - font_family = cr_font_family_to_string (a_style->font_family, - TRUE) ; - if (font_family) - { - pango_font_description_set_family (pgo_font_desc, - font_family) ; - } - - /*set style*/ - switch (a_style->font_style) - { - case FONT_STYLE_NORMAL: - pgo_style = PANGO_STYLE_NORMAL ; - break ; - - case FONT_STYLE_ITALIC: - pgo_style = PANGO_STYLE_ITALIC ; - break ; - - case FONT_STYLE_OBLIQUE: - pgo_style = PANGO_STYLE_OBLIQUE ; - break ; - - case FONT_STYLE_INHERIT: - cr_utils_trace_info ("font-style: inherit not supported yet") ; - break ; - - default: - cr_utils_trace_info ("unknown font-sytle property value") ; - break ; - } - - pango_font_description_set_style (pgo_font_desc, - pgo_style) ; - - /*set font weight*/ - switch (a_style->font_weight) - { - case FONT_WEIGHT_NORMAL: - pgo_weight = PANGO_WEIGHT_NORMAL ; - break ; - - case FONT_WEIGHT_BOLD: - pgo_weight = PANGO_WEIGHT_BOLD; - break ; - - case FONT_WEIGHT_BOLDER: - cr_utils_trace_info - ("font-weight: bolder is not supported yet"); - break ; - - case FONT_WEIGHT_LIGHTER: - cr_utils_trace_info - ("font-weight: lighter is not supported yet"); - break ; - - case FONT_WEIGHT_100: - pgo_weight = 100 ; - break ; - - case FONT_WEIGHT_200: - pgo_weight = 200; - break ; - - case FONT_WEIGHT_300: - pgo_weight = 300 ; - break ; - - case FONT_WEIGHT_400: - pgo_weight = 400 ; - break ; - - case FONT_WEIGHT_500: - pgo_weight = 500 ; - break ; - - case FONT_WEIGHT_600: - pgo_weight = 600 ; - break ; - - case FONT_WEIGHT_700: - pgo_weight = 700 ; - break ; - - case FONT_WEIGHT_800: - pgo_weight = 800 ; - break ; - - case FONT_WEIGHT_900: - pgo_weight = 900 ; - break ; - - case FONT_WEIGHT_INHERIT: - cr_utils_trace_info - ("font-weight: inherit is not supported yet.") ; - break ; - - default: - cr_utils_trace_info ("unknown property value") ; - break ; - } - - pango_font_description_set_weight (pgo_font_desc, - pgo_weight) ; - - pgo_attr = pango_attr_font_desc_new (pgo_font_desc) ; - if (!pgo_attr) - { - status = CR_INSTANCIATION_FAILED_ERROR ; - goto cleanup ; - } - pgo_attr->start_index = 0 ; - pgo_attr->end_index = a_text_len ; - pango_attr_list_change (a_pgo_attrs, pgo_attr) ; - pgo_attr = NULL ; - - - cleanup: - - if (pgo_attr) - { - pango_attribute_destroy (pgo_attr) ; - pgo_attr = NULL ; - } - if (pgo_font_desc) - { - pango_font_description_free (pgo_font_desc) ; - pgo_font_desc = NULL ; - } - - return status ; -} - -/** - *Destuctor of #CRLayEng. - *@param a_this the current instance of #CRLayEng. - */ -void -cr_lay_eng_destroy (CRLayEng *a_this) -{ - g_return_if_fail (a_this) ; - - if (PRIVATE (a_this)->sel_eng) - { - cr_sel_eng_destroy (PRIVATE (a_this)->sel_eng) ; - PRIVATE (a_this)->sel_eng = NULL ; - } - - if (PRIVATE (a_this)) - { - g_free (PRIVATE (a_this)) ; - PRIVATE (a_this) = NULL ; - } - - if (a_this) - { - g_free (a_this) ; - } -} diff --git a/src/layeng/cr-lay-eng.h b/src/layeng/cr-lay-eng.h deleted file mode 100644 index a77c0b7..0000000 --- a/src/layeng/cr-lay-eng.h +++ /dev/null @@ -1,78 +0,0 @@ -/* -*- Mode: C; indent-tabs-mode:nil; c-basic-offset: 8-*- */ - -/* - * This file is part of The Croco Library - * - * Copyright (C) 2002-2003 Dodji Seketeli <dodji@seketeli.org> - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of version 2.1 of the - * GNU Lesser General Public - * License as published by the Free Software Foundation. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the - * GNU Lesser General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 - * USA - */ - -#ifndef __CR_LAY_ENG_H__ -#define __CR_LAY_ENG_H__ - -#include <libxml/tree.h> -#include <pango/pango.h> -#include "cr-utils.h" -#include "cr-cascade.h" -#include "cr-box.h" - -/** - *@file - *the declaration of the #CRLayEng class. - */ - -G_BEGIN_DECLS - -typedef struct _CRLayEngPriv CRLayEngPriv ; - -/** - *The abstraction of the Layout engine of libcroco. - */ -typedef struct -{ - CRLayEngPriv *priv ; -} CRLayEng ; - - - -void -cr_lay_eng_init (glong a_argc, gchar ** a_argv) ; - -CRLayEng * -cr_lay_eng_new (GtkLayout *a_layout) ; - -enum CRStatus -cr_lay_eng_create_box_model (CRLayEng *a_this, - xmlDoc *a_xml_doc, - CRCascade *a_cascade, - CRBoxModel **a_box_model) ; - -enum CRStatus -cr_lay_eng_layout_box_tree (CRLayEng *a_this, - CRBox *a_box_tree) ; - -enum CRStatus -cr_lay_eng_style_to_pango_font_attribute (CRStyle *a_style, - PangoAttrList *a_pgo_attrs, - gulong a_text_len) ; -void -cr_lay_eng_destroy (CRLayEng *a_this) ; - -G_END_DECLS - -#endif /*__CR_LAYOUT_ENG_H__*/ diff --git a/src/libcroco-config.h b/src/libcroco-config.h new file mode 100644 index 0000000..f16cc00 --- /dev/null +++ b/src/libcroco-config.h @@ -0,0 +1,18 @@ +#ifndef LIBCROCO_VERSION_NUMBER +#define LIBCROCO_VERSION_NUMBER 400 +#endif + +#ifndef LIBCROCO_VERSION +#define LIBCROCO_VERSION "0.4.0" +#endif + +#ifndef G_DISABLE_CHECKS +#if 0 +#define G_DISABLE_CHECKS 0 +#endif +#endif + +#if 1 +#define CROCO_HAVE_LIBXML2 1 +#endif + diff --git a/src/parser/libcroco-config.h.in b/src/libcroco-config.h.in index 9483fe4..e817cd8 100644 --- a/src/parser/libcroco-config.h.in +++ b/src/libcroco-config.h.in @@ -12,22 +12,6 @@ #endif #endif -#if @CROCO_TESTS_ENABLED@ -#define CROCO_TESTS_ENABLED 1 -#endif - -#if @CROCO_SELENG_ENABLED@ -#define CROCO_SELENG_ENABLED 1 -#endif - -#if @CROCO_LAYENG_ENABLED@ -#define CROCO_LAYENG_ENABLED 1 -#endif - -#if @CROCO_HAVE_LIBGNOMEUI2@ -#define CROCO_HAVE_LIBGNOMEUI2 @CROCO_HAVE_LIBGNOMEUI2@ -#endif - #if @CROCO_HAVE_LIBXML2@ #define CROCO_HAVE_LIBXML2 @CROCO_HAVE_LIBXML2@ #endif diff --git a/src/libcroco.h b/src/libcroco.h index 28a999d..5562511 100644 --- a/src/libcroco.h +++ b/src/libcroco.h @@ -21,31 +21,22 @@ #ifndef __LIBCROCO_H__ #define __LIBCROCO_H__ -#include "parser/libcroco-config.h" +#include "libcroco-config.h" -#include "parser/cr-utils.h" -#include "parser/cr-pseudo.h" -#include "parser/cr-term.h" -#include "parser/cr-attr-sel.h" -#include "parser/cr-simple-sel.h" -#include "parser/cr-selector.h" -#include "parser/cr-enc-handler.h" -#include "parser/cr-doc-handler.h" -#include "parser/cr-input.h" -#include "parser/cr-parser.h" -#include "parser/cr-statement.h" -#include "parser/cr-stylesheet.h" -#include "parser/cr-om-parser.h" - -#ifdef CROCO_SELENG_ENABLED /*The selection engine headers*/ -#include "seleng/cr-sel-eng.h" -#include "seleng/cr-style.h" -#endif /*CROCO_SELENG_ENABLED*/ - -#ifdef CROCO_LAYENG_ENABLED /*the layout engine headers*/ -#include "layeng/cr-box.h" -#include "layeng/cr-box-view.h" -#include "layeng/cr-lay-eng.h" -#endif +#include "cr-utils.h" +#include "cr-pseudo.h" +#include "cr-term.h" +#include "cr-attr-sel.h" +#include "cr-simple-sel.h" +#include "cr-selector.h" +#include "cr-enc-handler.h" +#include "cr-doc-handler.h" +#include "cr-input.h" +#include "cr-parser.h" +#include "cr-statement.h" +#include "cr-stylesheet.h" +#include "cr-om-parser.h" +#include "cr-sel-eng.h" +#include "cr-style.h" #endif /*__LIBCROCO_H__*/ diff --git a/src/parser/Makefile.am b/src/parser/Makefile.am deleted file mode 100644 index acc72be..0000000 --- a/src/parser/Makefile.am +++ /dev/null @@ -1,74 +0,0 @@ -lib_LTLIBRARIES=libcroco.la - -crparserincdir=$(includedir)/@PACKAGE@/parser -crparserinc_HEADERS=cr-additional-sel.h \ -cr-attr-sel.h \ -cr-cascade.h \ -cr-declaration.h \ -cr-doc-handler.h \ -cr-enc-handler.h \ -cr-input.h \ -cr-num.h \ -cr-om-parser.h \ -cr-parser.h \ -cr-pseudo.h \ -cr-rgb.h \ -cr-selector.h \ -cr-simple-sel.h \ -cr-statement.h \ -cr-stylesheet.h \ -cr-term.h \ -cr-tknzr.h \ -cr-token.h \ -cr-utils.h \ -libcroco-config.h - -#the core parser files -SRCS=\ -cr-utils.c \ -cr-utils.h \ -cr-input.c \ -cr-input.h \ -cr-enc-handler.c \ -cr-enc-handler.h \ -cr-num.c \ -cr-num.h \ -cr-rgb.c \ -cr-rgb.h \ -cr-token.c \ -cr-token.h \ -cr-tknzr.c \ -cr-tknzr.h \ -cr-term.c \ -cr-term.h \ -cr-attr-sel.c \ -cr-attr-sel.h \ -cr-pseudo.c \ -cr-pseudo.h \ -cr-additional-sel.c \ -cr-additional-sel.h \ -cr-simple-sel.c \ -cr-simple-sel.h \ -cr-selector.c \ -cr-selector.h \ -cr-doc-handler.c \ -cr-doc-handler.h \ -cr-parser.c \ -cr-parser.h \ -cr-declaration.c \ -cr-declaration.h \ -cr-statement.c \ -cr-statement.h \ -cr-stylesheet.c \ -cr-stylesheet.h \ -cr-cascade.c \ -cr-cascade.h \ -cr-om-parser.c \ -cr-om-parser.h - -libcroco_la_SOURCES= $(SRCS) - -INCLUDES=-I$(top_srcdir) -I$(top_srcdir)/intl \ -@GLIB2_CFLAGS@ -libcroco_la_LDFLAGS=-version-info @LIBCROCO_VERSION_INFO@ \ -@GLIB2_CFLAGS@ diff --git a/src/seleng/Makefile.am b/src/seleng/Makefile.am deleted file mode 100644 index 25ad853..0000000 --- a/src/seleng/Makefile.am +++ /dev/null @@ -1,18 +0,0 @@ -SELENG_SRCS= cr-style.c cr-style.h cr-sel-eng.c cr-sel-eng.h cr-fonts.c cr-fonts.h -EXTRA_DIST=$(SELENG_SRCS) - -if HAVE_SELENG -lib_LTLIBRARIES=libcrseleng.la - -crselengincdir=$(includedir)/@PACKAGE@/seleng -crselenginc_HEADERS= cr-fonts.h cr-sel-eng.h cr-style.h - -#the selection engine files - -libcrseleng_la_SOURCES=$(SELENG_SRCS) -INCLUDES=-I$(top_srcdir) -I$(top_srcdir)/src/parser -I$(top_srcdir)/intl \ -@GLIB2_CFLAGS@ @LIBXML2_CFLAGS@ - -LDADD=$(top_srcdir)/src/parser/libcroco.la -endif -libcrseleng_la_LDFLAGS=-version-info @LIBCRSELENG_VERSION_INFO@ @LIBXML2_LIBS@ diff --git a/tests/Makefile.am b/tests/Makefile.am index 8aa5ccd..0987a4e 100644 --- a/tests/Makefile.am +++ b/tests/Makefile.am @@ -1,40 +1,20 @@ SUBDIRS=test-inputs test-output-refs -if HAVE_TESTS - -core_tests=@CORE_TESTS@ -seleng_tests=@SELENG_TESTS@ -layeng_tests=@LAYENG_TESTS@ -PRGS = $(core_tests) $(seleng_tests) $(layeng_tests) - #the list of all possible tests goes here. #The real tests that are gonna be compiled are defined #in configure.in due to automake AM_CONDITIONAL() being bugged -EXTRA_PROGRAMS=test0 test1 test2 test3 test4 test5 test6 test7 -noinst_PROGRAMS=$(PRGS) - +testprogs=test0 test1 test2 test3 test4 test5 test6 +noinst_PROGRAMS=$(testprogs) test0_SOURCES=test0-main.c -test1_SOURCES=test1-main.c +test1_SOURCES=test1-main.c test2_SOURCES=test2-main.c cr-test-utils.c cr-test-utils.h test3_SOURCES=test3-main.c cr-test-utils.c cr-test-utils.h test4_SOURCES=test4-main.c cr-test-utils.c cr-test-utils.h test5_SOURCES=test5-main.c cr-test-utils.c cr-test-utils.h test6_SOURCES=test6-main.c cr-test-utils.c cr-test-utils.h -test7_SOURCES=test7-main.c cr-test-utils.c cr-test-utils.h - -croco_parser_lib=$(top_builddir)/src/parser/@CROCO_PARSER_LIB@ - -if HAVE_SELENG -croco_seleng_lib=$(top_builddir)/src/seleng/@CROCO_SELENG_LIB@ -endif - -if HAVE_LAYENG -croco_layeng_lib=$(top_builddir)/src/layeng/@CROCO_LAYENG_LIB@ -croco_layeng_needed_includes=`pkg-config --cflags libgnomeui-2.0` -croco_layeng_needed_libs=`pkg-config --libs libgnomeui-2.0` -endif -LDADD=$(croco_parser_lib) $(croco_seleng_lib) $(croco_layeng_lib) +croco_lib=$(top_builddir)/src/@CROCO_LIB@ +LDADD=$(croco_lib) INCLUDES=-I$(top_srcdir)/intl \ -I$(top_srcdir)/src \ @@ -44,6 +24,5 @@ INCLUDES=-I$(top_srcdir)/intl \ `pkg-config --cflags glib-2.0` \ $(croco_layeng_needed_includes) -LDFLAGS=`pkg-config --libs glib-2.0` $(croco_layeng_needed_libs) @LIBXML2_LIBS@ -AM_CFLAGS=-Wall -I. @LIBXML2_CFLAGS@ -endif
\ No newline at end of file +LDFLAGS=@GLIB2_LIBS@ @LIBXML2_LIBS@ +AM_CFLAGS=-I. @LIBXML2_CFLAGS@ @GLIB2_CFLAGS@ |