[lasem] svg_switch: dummy implementation, render first element without evaluation.
- From: Emmanuel Pacaud <emmanuel src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [lasem] svg_switch: dummy implementation, render first element without evaluation.
- Date: Fri, 26 Oct 2012 20:47:40 +0000 (UTC)
commit f84ca8bff9c33d2be27e7e52a110f52108021da2
Author: Emmanuel Pacaud <emmanuel gnome org>
Date: Fri Oct 26 22:46:44 2012 +0200
svg_switch: dummy implementation, render first element without evaluation.
docs/reference/lasem/Makefile.am | 1 +
src/Makefile.am | 2 +
src/lsmsvgdocument.c | 43 ++++++++++---------
src/lsmsvgswitchelement.c | 87 ++++++++++++++++++++++++++++++++++++++
src/lsmsvgswitchelement.h | 55 ++++++++++++++++++++++++
src/lsmsvgtypes.h | 23 +++++-----
6 files changed, 180 insertions(+), 31 deletions(-)
---
diff --git a/docs/reference/lasem/Makefile.am b/docs/reference/lasem/Makefile.am
index 2b750ea..4d05f0a 100644
--- a/docs/reference/lasem/Makefile.am
+++ b/docs/reference/lasem/Makefile.am
@@ -143,6 +143,7 @@ IGNORE_HFILES=\
lsmsvglineargradientelement.h \
lsmsvgradialgradientelement.h \
lsmsvgstopelement.h \
+ lsmsvgswitchelement.h \
lsmsvgpatternelement.h \
lsmsvgmaskelement.h \
lsmsvgfilterelement.h \
diff --git a/src/Makefile.am b/src/Makefile.am
index c27254e..710a649 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -122,6 +122,7 @@ LASEM_SVG_SRCS = \
lsmsvglineargradientelement.c \
lsmsvgradialgradientelement.c \
lsmsvgstopelement.c \
+ lsmsvgswitchelement.c \
lsmsvgpatternelement.c \
lsmsvgmaskelement.c \
lsmsvgfilterelement.c \
@@ -236,6 +237,7 @@ LASEM_SVG_HDRS = \
lsmsvglineargradientelement.h \
lsmsvgradialgradientelement.h \
lsmsvgstopelement.h \
+ lsmsvgswitchelement.h \
lsmsvgpatternelement.h \
lsmsvgmaskelement.h \
lsmsvgfilterelement.h \
diff --git a/src/lsmsvgdocument.c b/src/lsmsvgdocument.c
index e10e6a1..32be2e6 100644
--- a/src/lsmsvgdocument.c
+++ b/src/lsmsvgdocument.c
@@ -22,29 +22,11 @@
*/
#include <lsmdebug.h>
-#include <lsmsvgdocument.h>
+#include <lsmsvgcircleelement.h>
#include <lsmsvgclippathelement.h>
-#include <lsmsvgsvgelement.h>
-#include <lsmsvggelement.h>
#include <lsmsvgdefselement.h>
-#include <lsmsvguseelement.h>
-#include <lsmsvgimageelement.h>
-#include <lsmsvgsymbolelement.h>
-#include <lsmsvgmarkerelement.h>
-#include <lsmsvgrectelement.h>
-#include <lsmsvgcircleelement.h>
+#include <lsmsvgdocument.h>
#include <lsmsvgellipseelement.h>
-#include <lsmsvglineelement.h>
-#include <lsmsvgpolylineelement.h>
-#include <lsmsvgpolygonelement.h>
-#include <lsmsvgpathelement.h>
-#include <lsmsvgtextelement.h>
-#include <lsmsvgtspanelement.h>
-#include <lsmsvglineargradientelement.h>
-#include <lsmsvgradialgradientelement.h>
-#include <lsmsvgstopelement.h>
-#include <lsmsvgpatternelement.h>
-#include <lsmsvgmaskelement.h>
#include <lsmsvgfilterelement.h>
#include <lsmsvgfilterblend.h>
#include <lsmsvgfiltercomposite.h>
@@ -55,6 +37,25 @@
#include <lsmsvgfiltermergenode.h>
#include <lsmsvgfilterspecularlighting.h>
#include <lsmsvgfiltertile.h>
+#include <lsmsvggelement.h>
+#include <lsmsvgimageelement.h>
+#include <lsmsvglineargradientelement.h>
+#include <lsmsvglineelement.h>
+#include <lsmsvgmarkerelement.h>
+#include <lsmsvgmaskelement.h>
+#include <lsmsvgpolylineelement.h>
+#include <lsmsvgpolygonelement.h>
+#include <lsmsvgpathelement.h>
+#include <lsmsvgpatternelement.h>
+#include <lsmsvgradialgradientelement.h>
+#include <lsmsvgrectelement.h>
+#include <lsmsvgsvgelement.h>
+#include <lsmsvgstopelement.h>
+#include <lsmsvgswitchelement.h>
+#include <lsmsvgsymbolelement.h>
+#include <lsmsvgtextelement.h>
+#include <lsmsvgtspanelement.h>
+#include <lsmsvguseelement.h>
#include <lsmsvgview.h>
#include <string.h>
@@ -140,6 +141,8 @@ _create_element (LsmDomDocument *document, const char *tag_name)
node = lsm_svg_marker_element_new ();
else if (strcmp (tag_name, "clipPath") == 0)
node = lsm_svg_clip_path_element_new ();
+ else if (strcmp (tag_name, "switch") == 0)
+ node = lsm_svg_switch_element_new ();
else if (strcmp (tag_name, "filter") == 0)
node = lsm_svg_filter_element_new ();
else if (strcmp (tag_name, "feBlend") == 0)
diff --git a/src/lsmsvgswitchelement.c b/src/lsmsvgswitchelement.c
new file mode 100644
index 0000000..f4edad6
--- /dev/null
+++ b/src/lsmsvgswitchelement.c
@@ -0,0 +1,87 @@
+/* Lasem
+ *
+ * Copyright  2009 Emmanuel Pacaud
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author:
+ * Emmanuel Pacaud <emmanuel gnome org>
+ */
+
+#include <lsmsvgswitchelement.h>
+#include <lsmdebug.h>
+#include <stdio.h>
+
+static GObjectClass *parent_class;
+
+/* GdomNode implementation */
+
+static const char *
+lsm_svg_switch_element_get_node_name (LsmDomNode *node)
+{
+ return "switch";
+}
+
+/* GSwitchElement implementation */
+
+/* LsmSvgElement implementation */
+
+static void
+_render (LsmSvgElement *element, LsmSvgView *view)
+{
+ LsmDomNode *node;
+
+ for (node = LSM_DOM_NODE (element)->first_child; node != NULL; node = node->next_sibling)
+ if (LSM_IS_SVG_ELEMENT (node)) {
+ lsm_svg_element_render (LSM_SVG_ELEMENT (node), view);
+ return;
+ }
+}
+
+/* LsmSvgSwitchElement implementation */
+
+LsmDomNode *
+lsm_svg_switch_element_new (void)
+{
+ return g_object_new (LSM_TYPE_SVG_SWITCH_ELEMENT, NULL);
+}
+
+static void
+lsm_svg_switch_element_init (LsmSvgSwitchElement *self)
+{
+}
+
+/* LsmSvgSwitchElement class */
+
+
+static void
+lsm_svg_switch_element_class_init (LsmSvgSwitchElementClass *s_g_class)
+{
+ LsmDomNodeClass *d_node_class = LSM_DOM_NODE_CLASS (s_g_class);
+ LsmSvgElementClass *s_element_class = LSM_SVG_ELEMENT_CLASS (s_g_class);
+
+ parent_class = g_type_class_peek_parent (s_g_class);
+
+ d_node_class->get_node_name = lsm_svg_switch_element_get_node_name;
+
+ s_element_class->render = _render;
+
+ s_element_class->category =
+ LSM_SVG_ELEMENT_CATEGORY_CONTAINER |
+ LSM_SVG_ELEMENT_CATEGORY_STRUCTURAL;
+}
+
+G_DEFINE_TYPE (LsmSvgSwitchElement, lsm_svg_switch_element, LSM_TYPE_SVG_TRANSFORMABLE)
diff --git a/src/lsmsvgswitchelement.h b/src/lsmsvgswitchelement.h
new file mode 100644
index 0000000..2786dc3
--- /dev/null
+++ b/src/lsmsvgswitchelement.h
@@ -0,0 +1,55 @@
+/* Lasem
+ *
+ * Copyright  2012 Emmanuel Pacaud
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation; either
+ * version 2 of the License, or (at your option) any later version.
+ *
+ * This library 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
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General
+ * Public License along with this library; if not, write to the
+ * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
+ * Boston, MA 02111-1307, USA.
+ *
+ * Author:
+ * Emmanuel Pacaud <emmanuel gnome org>
+ */
+
+#ifndef LSM_SVG_SWITCH_ELEMENT_H
+#define LSM_SVG_SWITCH_ELEMENT_H
+
+#include <lsmsvgtypes.h>
+#include <lsmsvgtransformable.h>
+
+G_BEGIN_DECLS
+
+#define LSM_TYPE_SVG_SWITCH_ELEMENT (lsm_svg_switch_element_get_type ())
+#define LSM_SVG_SWITCH_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_CAST ((obj), LSM_TYPE_SVG_SWITCH_ELEMENT, LsmSvgSwitchElement))
+#define LSM_SVG_SWITCH_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_CAST ((klass), LSM_TYPE_SVG_SWITCH_ELEMENT, LsmSvgSwitchElementClass))
+#define LSM_IS_SVG_SWITCH_ELEMENT(obj) (G_TYPE_CHECK_INSTANCE_TYPE ((obj), LSM_TYPE_SVG_SWITCH_ELEMENT))
+#define LSM_IS_SVG_SWITCH_ELEMENT_CLASS(klass) (G_TYPE_CHECK_CLASS_TYPE ((klass), LSM_TYPE_SVG_SWITCH_ELEMENT))
+#define LSM_SVG_SWITCH_ELEMENT_GET_CLASS(obj) (G_TYPE_INSTANCE_GET_CLASS((obj), LSM_TYPE_SVG_SWITCH_ELEMENT, LsmSvgSwitchElementClass))
+
+typedef struct _LsmSvgSwitchElementClass LsmSvgSwitchElementClass;
+
+struct _LsmSvgSwitchElement {
+ LsmSvgTransformable base;
+};
+
+struct _LsmSvgSwitchElementClass {
+ LsmSvgTransformableClass base_class;
+};
+
+GType lsm_svg_switch_element_get_type (void);
+
+LsmDomNode * lsm_svg_switch_element_new (void);
+
+G_END_DECLS
+
+#endif
diff --git a/src/lsmsvgtypes.h b/src/lsmsvgtypes.h
index 348b080..0eba798 100644
--- a/src/lsmsvgtypes.h
+++ b/src/lsmsvgtypes.h
@@ -43,6 +43,17 @@ typedef struct _LsmSvgMarkerElement LsmSvgMarkerElement;
typedef struct _LsmSvgRectElement LsmSvgRectElement;
typedef struct _LsmSvgCircleElement LsmSvgCircleElement;
typedef struct _LsmSvgEllipseElement LsmSvgEllipseElement;
+typedef struct _LsmSvgFilterElement LsmSvgFilterElement;
+typedef struct _LsmSvgFilterPrimitive LsmSvgFilterPrimitive;
+typedef struct _LsmSvgFilterBlend LsmSvgFilterBlend;
+typedef struct _LsmSvgFilterComposite LsmSvgFilterComposite;
+typedef struct _LsmSvgFilterFlood LsmSvgFilterFlood;
+typedef struct _LsmSvgFilterGaussianBlur LsmSvgFilterGaussianBlur;
+typedef struct _LsmSvgFilterMerge LsmSvgFilterMerge;
+typedef struct _LsmSvgFilterMergeNode LsmSvgFilterMergeNode;
+typedef struct _LsmSvgFilterOffset LsmSvgFilterOffset;
+typedef struct _LsmSvgFilterSpecularLighting LsmSvgFilterSpecularLighting;
+typedef struct _LsmSvgFilterTile LsmSvgFilterTile;
typedef struct _LsmSvgLineElement LsmSvgLineElement;
typedef struct _LsmSvgPolylineElement LsmSvgPolylineElement;
typedef struct _LsmSvgPolygonElement LsmSvgPolygonElement;
@@ -53,19 +64,9 @@ typedef struct _LsmSvgGradientElement LsmSvgGradientElement;
typedef struct _LsmSvgLinearGradientElement LsmSvgLinearGradientElement;
typedef struct _LsmSvgRadialGradientElement LsmSvgRadialGradientElement;
typedef struct _LsmSvgStopElement LsmSvgStopElement;
+typedef struct _LsmSvgSwitchElement LsmSvgSwitchElement;
typedef struct _LsmSvgPatternElement LsmSvgPatternElement;
typedef struct _LsmSvgMaskElement LsmSvgMaskElement;
-typedef struct _LsmSvgFilterElement LsmSvgFilterElement;
-typedef struct _LsmSvgFilterPrimitive LsmSvgFilterPrimitive;
-typedef struct _LsmSvgFilterBlend LsmSvgFilterBlend;
-typedef struct _LsmSvgFilterComposite LsmSvgFilterComposite;
-typedef struct _LsmSvgFilterFlood LsmSvgFilterFlood;
-typedef struct _LsmSvgFilterGaussianBlur LsmSvgFilterGaussianBlur;
-typedef struct _LsmSvgFilterMerge LsmSvgFilterMerge;
-typedef struct _LsmSvgFilterMergeNode LsmSvgFilterMergeNode;
-typedef struct _LsmSvgFilterOffset LsmSvgFilterOffset;
-typedef struct _LsmSvgFilterSpecularLighting LsmSvgFilterSpecularLighting;
-typedef struct _LsmSvgFilterTile LsmSvgFilterTile;
typedef struct _LsmSvgView LsmSvgView;
typedef struct _LsmSvgStyle LsmSvgStyle;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]