goffice r2372 - in trunk: . docs/reference goffice goffice/graph



Author: emmanuel
Date: Tue Apr 14 15:05:33 2009
New Revision: 2372
URL: http://svn.gnome.org/viewvc/goffice?rev=2372&view=rev

Log:
2009-04-14  Emmanuel Pacaud <emmanuel gnome org>

	GMathml is dead, long live Lasem.

	The Lasem library is GMathml + SVG support. All the GMathml functions
	have been renamed in order to use the new Lasem namespace (LsmFoo).
	Equation support is still disabled by default, and can be enabled
	using --with-lasem.

	The code is not yet available in its own git repository, but it can be
	retrieved in the svg branch of the old GMathml repository for now.

Modified:
   trunk/Makefile.am
   trunk/configure.in
   trunk/docs/reference/Makefile.am
   trunk/goffice/goffice.c
   trunk/goffice/graph/Makefile.am
   trunk/goffice/graph/gog-chart.c
   trunk/goffice/graph/gog-equation.c
   trunk/goffice/graph/gog-renderer.c
   trunk/goffice/graph/gog-renderer.h
   trunk/goffice/graph/gog-theme.c

Modified: trunk/Makefile.am
==============================================================================
--- trunk/Makefile.am	(original)
+++ trunk/Makefile.am	Tue Apr 14 15:05:33 2009
@@ -13,7 +13,7 @@
 
 DISTCLEANFILES = intltool-extract intltool-merge intltool-update doltcompile doltlibtool
 
-DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --with-gmathml
+DISTCHECK_CONFIGURE_FLAGS = --enable-gtk-doc --with-lasem
 
 pkgconfigdir = $(libdir)/pkgconfig
 pkgconfig_DATA = libgoffice- GOFFICE_API_VER@.pc

Modified: trunk/configure.in
==============================================================================
--- trunk/configure.in	(original)
+++ trunk/configure.in	Tue Apr 14 15:05:33 2009
@@ -117,22 +117,22 @@
 EXTRA_DEPS=
 
 dnl ***********************
-dnl Should we use gmathml ?
+dnl Should we use lasem ?
 dnl ***********************
 
-goffice_with_gmathml=false
-AC_ARG_WITH(gmathml, [  --with-gmathml          Build with gmathml use])
-if test "x$with_gmathml" = xyes; then
-	PKG_CHECK_MODULES(GMathml, gmathml >= 0.0.1)
-	goffice_with_gmathml=true
-fi
-if test "x$goffice_with_gmathml" = "xtrue" ; then
-	AC_DEFINE(GOFFICE_WITH_GMATHML, 1, [Define if GMathml is used])
-	goffice_reqs="$goffice_reqs gmathml >= 0.0.1 "
-	EXTRA_DEPS="$EXTRA_DEPS gmathml"
+goffice_with_lasem=false
+AC_ARG_WITH(lasem, [  --with-lasem          Build with lasem use])
+if test "x$with_lasem" = xyes; then
+	PKG_CHECK_MODULES(Lasem, lasem >= 0.0.1)
+	goffice_with_lasem=true
+fi
+if test "x$goffice_with_lasem" = "xtrue" ; then
+	AC_DEFINE(GOFFICE_WITH_LASEM, 1, [Define if Lasem is used])
+	goffice_reqs="$goffice_reqs lasem >= 0.0.1 "
+	EXTRA_DEPS="$EXTRA_DEPS lasem"
 fi
 
-AM_CONDITIONAL(GOFFICE_WITH_GMATHML, $goffice_with_gmathml)
+AM_CONDITIONAL(GOFFICE_WITH_LASEM, $goffice_with_lasem)
 
 dnl *******************
 dnl Should we use gconf ?

Modified: trunk/docs/reference/Makefile.am
==============================================================================
--- trunk/docs/reference/Makefile.am	(original)
+++ trunk/docs/reference/Makefile.am	Tue Apr 14 15:05:33 2009
@@ -58,7 +58,7 @@
 		foo-canvas-marshal.h			\
 		ucp.h
 
-if GOFFICE_WITH_GMATHML
+if GOFFICE_WITH_LASEM
 else
 IGNORE_HFILES += gog-equation.h
 endif

Modified: trunk/goffice/goffice.c
==============================================================================
--- trunk/goffice/goffice.c	(original)
+++ trunk/goffice/goffice.c	Tue Apr 14 15:05:33 2009
@@ -56,7 +56,7 @@
 #undef STRICT
 #endif
 
-#ifdef GOFFICE_WITH_GMATHML
+#ifdef GOFFICE_WITH_LASEM
 #include <goffice/graph/gog-equation.h>
 #endif
 
@@ -143,7 +143,7 @@
 	(void) GOG_TYPE_LABEL;
 	(void) GOG_TYPE_GRID;
 	(void) GOG_TYPE_GRID_LINE;
-#ifdef GOFFICE_WITH_GMATHML
+#ifdef GOFFICE_WITH_LASEM
 	(void) GOG_TYPE_EQUATION;
 #endif
 	(void) GOG_TYPE_ERROR_BAR;

Modified: trunk/goffice/graph/Makefile.am
==============================================================================
--- trunk/goffice/graph/Makefile.am	(original)
+++ trunk/goffice/graph/Makefile.am	Tue Apr 14 15:05:33 2009
@@ -96,7 +96,7 @@
 	gog-series-prefs.glade		\
 	gog-3d-box-prefs.glade
 
-if GOFFICE_WITH_GMATHML
+if GOFFICE_WITH_LASEM
   libgoffice_graph_la_SOURCES += gog-equation.c
   libgoffice_graph_la_HEADERS += gog-equation.h
   dist_glade_DATA += gog-equation-prefs.glade

Modified: trunk/goffice/graph/gog-chart.c
==============================================================================
--- trunk/goffice/graph/gog-chart.c	(original)
+++ trunk/goffice/graph/gog-chart.c	Tue Apr 14 15:05:33 2009
@@ -42,7 +42,7 @@
 #include <string.h>
 #include <math.h>
 
-#ifdef GOFFICE_WITH_GMATHML
+#ifdef GOFFICE_WITH_LASEM
 #include <goffice/graph/gog-equation.h>
 #endif
 
@@ -454,7 +454,7 @@
 	  GOG_POSITION_E|GOG_POSITION_ALIGN_CENTER, 
 	  GOG_OBJECT_NAME_BY_ROLE,
 	  NULL, NULL, NULL, NULL, NULL, NULL, { -1 } },
-#ifdef GOFFICE_WITH_GMATHML
+#ifdef GOFFICE_WITH_LASEM
 	{ N_("Equation"), "GogEquation",	11,
 	  GOG_POSITION_COMPASS|GOG_POSITION_ANY_MANUAL,
 	  GOG_POSITION_S|GOG_POSITION_ALIGN_CENTER,

Modified: trunk/goffice/graph/gog-equation.c
==============================================================================
--- trunk/goffice/graph/gog-equation.c	(original)
+++ trunk/goffice/graph/gog-equation.c	Tue Apr 14 15:05:33 2009
@@ -19,9 +19,9 @@
  * USA
  */
 
-#include <gmathmldocument.h>
-#include <gmathmlparser.h>
-#include <gmathmlmathelement.h>
+#include <lsmmathmldocument.h>
+#include <lsmdomparser.h>
+#include <lsmmathmlmathelement.h>
 
 #include <goffice/goffice-config.h>
 #include <goffice/graph/gog-outlined-object.h>
@@ -52,7 +52,7 @@
 
 	char *itex;
 	gboolean inline_mode;
-	GMathmlDocument *mathml;
+	LsmMathmlDocument *mathml;
 };
 
 typedef struct {
@@ -119,22 +119,22 @@
 static void
 _update_equation_style (GogEquation *equation, const GOStyle *style)
 {
-	GMathmlStyle *math_style;
-	GMathmlMathElement *math_element;
+	LsmMathmlStyle *math_style;
+	LsmMathmlMathElement *math_element;
 	PangoFontDescription *font_description;
 
 	if (equation->mathml == NULL)
 		return;
 
-	math_element = gmathml_document_get_math_element (equation->mathml);
+	math_element = lsm_mathml_document_get_root_element (equation->mathml);
 	if (math_element == NULL)
 		return;
 
-	math_style = gmathml_math_element_get_default_style (math_element);
+	math_style = lsm_mathml_math_element_get_default_style (math_element);
 	if (math_style == NULL)
 		return;
 
-	gmathml_style_set_math_color (math_style,
+	lsm_mathml_style_set_math_color (math_style,
 				      DOUBLE_RGBA_R (style->font.color),
 				      DOUBLE_RGBA_G (style->font.color),
 				      DOUBLE_RGBA_B (style->font.color),
@@ -142,34 +142,34 @@
 
 	font_description = style->font.font->desc;
 	if (font_description != NULL) {
-		GMathmlVariant math_variant;
+		LsmMathmlVariant math_variant;
 
 		if (pango_font_description_get_weight (font_description) >= PANGO_WEIGHT_BOLD) {
 			if (pango_font_description_get_style (font_description) == PANGO_STYLE_NORMAL)
-				math_variant = GMATHML_VARIANT_BOLD;
+				math_variant = LSM_MATHML_VARIANT_BOLD;
 			else
-				math_variant = GMATHML_VARIANT_BOLD_ITALIC;
+				math_variant = LSM_MATHML_VARIANT_BOLD_ITALIC;
 		} else {
 			if (pango_font_description_get_style (font_description) == PANGO_STYLE_NORMAL)
-				math_variant = GMATHML_VARIANT_NORMAL;
+				math_variant = LSM_MATHML_VARIANT_NORMAL;
 			else
-				math_variant = GMATHML_VARIANT_ITALIC;
+				math_variant = LSM_MATHML_VARIANT_ITALIC;
 		}
 
-		gmathml_style_set_math_family (math_style, pango_font_description_get_family (font_description));
-		gmathml_style_set_math_size_pt
+		lsm_mathml_style_set_math_family (math_style, pango_font_description_get_family (font_description));
+		lsm_mathml_style_set_math_size_pt
 			(math_style, pango_units_to_double (pango_font_description_get_size (font_description)));
-		gmathml_style_set_math_variant (math_style, math_variant);
+		lsm_mathml_style_set_math_variant (math_style, math_variant);
 	}
 
-	gmathml_math_element_set_default_style (math_element, math_style);
+	lsm_mathml_math_element_set_default_style (math_element, math_style);
 }
 
 static void
 gog_equation_update (GogObject *obj)
 {
 	GogEquation *equation = GOG_EQUATION (obj);
-	GMathmlDocument *mathml;
+	LsmMathmlDocument *mathml;
 	GString *itex;
 	char *itex_iter;
 	char *prev_char = '\0';
@@ -223,22 +223,24 @@
 	else
 		itex = g_string_append (itex, "$$");
 
-	mathml = gmathml_document_new_from_itex (itex->str);
+	mathml = lsm_mathml_document_new_from_itex (itex->str);
 
 	/* Keep the last valid mathml document if the itex -> mathml conversion fails.
 	 * It keep the equation from disappearing when the current equation entry is not a
 	 * well formed itex expression. */
 
-	if (gmathml_document_get_math_element (mathml) != NULL || is_blank) {
-		if (equation->mathml != NULL)
-			g_object_unref (equation->mathml);
-
-		equation->mathml = mathml;
-
-		_update_equation_style (equation,
-					go_styled_object_get_style (GO_STYLED_OBJECT (equation)));
-	} else
-		g_object_unref (mathml);
+	if (mathml != NULL) {
+		if (lsm_mathml_document_get_root_element (mathml) != NULL || is_blank) {
+			if (equation->mathml != NULL)
+				g_object_unref (equation->mathml);
+
+			equation->mathml = mathml;
+
+			_update_equation_style (equation,
+						go_styled_object_get_style (GO_STYLED_OBJECT (equation)));
+		} else
+			g_object_unref (mathml);
+	}
 
 	g_string_free (itex, TRUE);
 }
@@ -365,7 +367,7 @@
 typedef struct {
 	GogOutlinedView		 base;
 
-	GMathmlView 		*mathml_view;
+	LsmMathmlView 		*mathml_view;
 } GogEquationView;
 
 typedef GogOutlinedViewClass	GogEquationViewClass;
@@ -394,8 +396,9 @@
 		return;
 	}
 
-	gmathml_view_set_document (equation_view->mathml_view, equation->mathml);
-	gmathml_view_measure (equation_view->mathml_view, &width, &height);
+	lsm_dom_view_set_document (LSM_DOM_VIEW (equation_view->mathml_view),
+				   LSM_DOM_DOCUMENT (equation->mathml));
+	lsm_dom_view_measure (LSM_DOM_VIEW (equation_view->mathml_view), &width, &height);
 
 	requisition->w = gog_renderer_pt2r_x (view->renderer, width);
 	requisition->h = gog_renderer_pt2r_y (view->renderer, height);
@@ -418,7 +421,8 @@
 	if (equation->mathml == NULL)
 		return;
 
-	gmathml_view_set_document (equation_view->mathml_view, equation->mathml);
+	lsm_dom_view_set_document (LSM_DOM_VIEW (equation_view->mathml_view),
+				   LSM_DOM_DOCUMENT (equation->mathml));
 	gog_renderer_draw_equation (view->renderer, equation_view->mathml_view,
 				    view->residual.x, view->residual.y);
 }
@@ -450,7 +454,7 @@
 {
 	GogEquationView *view = GOG_EQUATION_VIEW (object);
 
-	view->mathml_view = gmathml_view_new (NULL, NULL);
+	view->mathml_view = lsm_mathml_view_new (NULL);
 }
 
 GSF_CLASS (GogEquationView, gog_equation_view,

Modified: trunk/goffice/graph/gog-renderer.c
==============================================================================
--- trunk/goffice/graph/gog-renderer.c	(original)
+++ trunk/goffice/graph/gog-renderer.c	Tue Apr 14 15:05:33 2009
@@ -1392,15 +1392,16 @@
 
 	return 1.0 / rend->scale;
 }
-#ifdef GOFFICE_WITH_GMATHML
+
+#ifdef GOFFICE_WITH_LASEM
 
 void
-gog_renderer_draw_equation (GogRenderer *renderer, GMathmlView *mathml_view, double x, double y)
+gog_renderer_draw_equation (GogRenderer *renderer, LsmMathmlView *mathml_view, double x, double y)
 {
 	cairo_t *cairo;
 
 	g_return_if_fail (GOG_IS_RENDERER (renderer));
-	g_return_if_fail (GMATHML_IS_VIEW (mathml_view));
+	g_return_if_fail (LSM_IS_MATHML_VIEW (mathml_view));
 
 	cairo = renderer->cairo;
 
@@ -1408,8 +1409,8 @@
 
 	cairo_scale (cairo, renderer->scale_x, renderer->scale_y);
 
-	gmathml_view_set_cairo (mathml_view, cairo);
-	gmathml_view_render (mathml_view, x / renderer->scale_x, y / renderer->scale_y);
+	lsm_dom_view_set_cairo (LSM_DOM_VIEW (mathml_view), cairo);
+	lsm_dom_view_render (LSM_DOM_VIEW (mathml_view), x / renderer->scale_x, y / renderer->scale_y);
 
 	cairo_restore (cairo);
 }

Modified: trunk/goffice/graph/gog-renderer.h
==============================================================================
--- trunk/goffice/graph/gog-renderer.h	(original)
+++ trunk/goffice/graph/gog-renderer.h	Tue Apr 14 15:05:33 2009
@@ -58,8 +58,8 @@
 } GtkAnchorType;
 #endif
 
-#ifdef GOFFICE_WITH_GMATHML
-#include <gmathmlview.h>
+#ifdef GOFFICE_WITH_LASEM
+#include <lsmmathmlview.h>
 #endif
 
 #include <cairo.h>
@@ -152,8 +152,8 @@
 
 GogRenderer 	*gog_renderer_new 		(GogGraph *graph);
 
-#ifdef GOFFICE_WITH_GMATHML
-void		 gog_renderer_draw_equation	(GogRenderer *renderer, GMathmlView *mathml_view,
+#ifdef GOFFICE_WITH_LASEM
+void		 gog_renderer_draw_equation	(GogRenderer *renderer, LsmMathmlView *mathml_view,
 						 double x, double y);
 #endif
 

Modified: trunk/goffice/graph/gog-theme.c
==============================================================================
--- trunk/goffice/graph/gog-theme.c	(original)
+++ trunk/goffice/graph/gog-theme.c	Tue Apr 14 15:05:33 2009
@@ -608,7 +608,7 @@
 	gog_theme_add_element (theme, style,
 		NULL, "GogRegEqn", NULL);
 
-#ifdef GOFFICE_WITH_GMATHML
+#ifdef GOFFICE_WITH_LASEM
 	/* Equations */
 	style = go_style_new ();
 	style->outline.dash_type = GO_LINE_NONE;
@@ -738,7 +738,7 @@
 	gog_theme_add_element (theme, style,
 		NULL, "GogRegEqn", NULL);
 
-#ifdef GOFFICE_WITH_GMATHML
+#ifdef GOFFICE_WITH_LASEM
 	/* Equations */
 	style = go_style_new ();
 	style->outline.dash_type = GO_LINE_NONE;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]