diff -uN sodipodi-0.33-orig/src/cinelerra.c sodipodi-0.33/src/cinelerra.c
--- sodipodi-0.33-orig/src/cinelerra.c	1970-01-01 01:00:00.000000000 +0100
+++ sodipodi-0.33/src/cinelerra.c	2003-12-26 22:42:01.000000000 +0100
@@ -0,0 +1,166 @@
+/* All of the code added to sodipodi for itnegration with cinelerra --
+ * minus the interface stuff etc. that has to go into sodipodi's main
+ * code. All of it is tagged with "CINELERRA". */
+
+#include <unistd.h>
+#include <sys/file.h>    
+#include <errno.h>
+#include "sodipodi.h"
+#include "desktop.h"
+#include "document.h"
+#include "sp-object.h"
+#include "file.h"
+#include "forward.h"
+#include "cinelerra.h"
+#include "helper/sp-intl.h"
+
+
+
+static guchar *sp_export_dpi = NULL;
+static guchar *sp_export_area = NULL;
+static guchar *sp_export_background = NULL;
+
+
+
+void cin_export(GtkWidget *widget, GdkEvent *event, gpointer data)
+{
+	SPDocument *doc;
+
+	doc = SP_ACTIVE_DOCUMENT;
+
+	cin_do_export_png(doc);
+
+	sp_file_save(NULL, NULL);
+
+}
+
+void cin_do_export_png(SPDocument *doc)
+{
+
+		/* This entire section is the sp_do_export_png function found in
+		 * main.c, which seems to be not for use globally. I made a few
+		 * minor modifications to get rid of gcc warnings and extra
+		 * pointers. */
+
+   ArtDRect area;
+   gdouble dpi;
+   gboolean has_area;
+   gint width, height;
+   guint32 bgcolor;
+
+
+	if(doc == NULL) {
+		printf("No Document to export\n");
+		return;
+	}
+
+
+   /* Check for and set up exporting path */
+   has_area = FALSE;
+   dpi = 72.0;
+
+   if (sp_export_dpi) {
+      dpi = atof (sp_export_dpi);
+      if ((dpi < 0.1) || (dpi > 10000.0)) {
+         g_warning ("DPI value %s out of range [0.1 - 10000.0]",
+							sp_export_dpi);
+         return;
+      }
+      g_print ("dpi is %g\n", dpi);
+   }
+
+   if (sp_export_area) {
+      /* Try to parse area (given in mm) */
+      if (sscanf (sp_export_area, "%lg:%lg:%lg:%lg", &area.x0, &area.y0,
+						&area.x1, &area.y1) == 4) {
+         area.x0 *= (72.0 / 25.4);
+         area.y0 *= (72.0 / 25.4);
+         area.x1 *= (72.0 / 25.4);
+         area.y1 *= (72.0 / 25.4);
+         has_area = TRUE;
+      } else {
+         g_warning ("Export area '%s' illegal (use 'x0:y0:x1:y1)",
+							sp_export_area);
+         return;
+      }
+      if ((area.x0 >= area.x1) || (area.y0 >= area.y1)) {
+         g_warning ("Export area '%s' has invalid values",
+							sp_export_area);
+         return;
+      }
+   } else {
+      /* Export the whole document */
+      area.x0 = 0.0;
+      area.y0 = 0.0;
+      area.x1 = sp_document_width (doc);
+      area.y1 = sp_document_height (doc);
+   }
+
+   /* Kill warning */
+   width = 0;
+   height = 0;
+
+   if (Cinelerra.width) {
+      width = atoi (Cinelerra.width);
+      if ((width < 16) || (width > 65536)) {
+         g_warning ("Export width %d out of range (16 - 65536)", width);
+         return;
+      }
+      dpi = (gdouble) width * 72.0 / (area.x1 - area.x0);
+   }
+
+   if (Cinelerra.height) {
+      height = atoi (Cinelerra.height);
+      if ((height < 16) || (height > 65536)) {
+         g_warning ("Export height %d out of range (16 - 65536)",
+							width);
+         return;
+      }
+      dpi = (gdouble) height * 72.0 / (area.y1 - area.y0);
+   }
+
+   if (!Cinelerra.width) {
+      width = (gint) ((area.x1 - area.x0) * dpi / 72.0 + 0.5);
+   }
+
+   if (!Cinelerra.height) {
+      height = (gint) ((area.y1 - area.y0) * dpi / 72.0 + 0.5);
+   }
+
+   bgcolor = 0x00000000;
+   if (sp_export_background) {
+      bgcolor = sp_svg_read_color (sp_export_background, 0xffffff00);
+      bgcolor |= 0xff;
+   }
+   g_print ("Background is %x\n", bgcolor);
+
+   g_print ("Exporting %g %g %g %g to %d x %d rectangle\n", area.x0,
+				area.y0, area.x1, area.y1, width, height);
+
+   if ((width >= 16) || (height >= 16) || (width < 65536) || (height < 65536)) {
+   // We lock the file so there is just one reader/writer at a time
+      guchar *filename_lock;
+      int fh_lockfile;
+      filename_lock = g_strconcat(Cinelerra.exportfile, ".lock");
+//	printf("Sodipodi locking %s! \n", filename_lock);
+      fh_lockfile = open (filename_lock, O_CREAT|O_RDWR);
+      int res = lockf(fh_lockfile, F_LOCK, 10);    // Blocking call - will wait for other sodipodi or cinelerra
+  //    printf("Sodipodi: filehandle: %i, res: %i, errno: %i\n", fh_lockfile, res, errno);
+  //    perror("Sodierror");
+      free(filename_lock);
+                                                                                                                                         
+
+
+      sp_export_png_file (doc, (guchar *) Cinelerra.exportfile,
+									area.x0, area.y0, area.x1,
+									area.y1, width, height, bgcolor);
+      lockf(fh_lockfile, F_ULOCK, 0);
+//	printf("Sodipodi unlocking!\n");
+
+   } else {
+      g_warning ("Calculated bitmap dimensions %d %d out of range (16 - 65535)",
+						 width, height);
+   }
+
+}
+
diff -uN sodipodi-0.33-orig/src/cinelerra.h sodipodi-0.33/src/cinelerra.h
--- sodipodi-0.33-orig/src/cinelerra.h	1970-01-01 01:00:00.000000000 +0100
+++ sodipodi-0.33/src/cinelerra.h	2003-12-26 22:42:03.000000000 +0100
@@ -0,0 +1,11 @@
+struct _Cinelerra {
+	const guchar *exportfile;
+	const guchar *svgfile;
+	const guchar *width;
+	const guchar *height;
+} Cinelerra;
+
+
+
+void cin_export(GtkWidget *widget, GdkEvent *event, gpointer data);
+void cin_do_export_png(SPDocument *doc);
diff -uN sodipodi-0.33-orig/src/desktop.c sodipodi-0.33/src/desktop.c
--- sodipodi-0.33-orig/src/desktop.c	2003-11-22 23:22:53.000000000 +0100
+++ sodipodi-0.33/src/desktop.c	2003-12-26 22:41:37.000000000 +0100
@@ -47,6 +47,8 @@
 #include "sp-namedview.h"
 #include "sp-item.h"
 #include "sp-root.h"
+// CINELERRA
+#include "cinelerra.h"
 
 /* fixme: Lauris */
 #include "file.h"
@@ -760,6 +762,16 @@
 	dtw->vscrollbar = gtk_vscrollbar_new (GTK_ADJUSTMENT (dtw->vadj));
 	gtk_table_attach (GTK_TABLE (tbl), dtw->vscrollbar, 2, 3, 1, 2, GTK_FILL, GTK_EXPAND | GTK_FILL, 0, 0);
 
+   /* CINELERRA export button */
+	if(Cinelerra.exportfile != NULL) {
+	   dtw->exbtn = gtk_button_new_with_label("E");
+		gtk_table_attach(GTK_TABLE(tbl), dtw->exbtn, 2, 3, 2, 3, GTK_FILL,
+											GTK_FILL, 0, 0);
+		g_signal_connect (G_OBJECT (dtw->exbtn), "button_release_event",
+  	     		            G_CALLBACK (cin_export), dtw);
+	}
+
+
 	/* Canvas */
 	w = gtk_frame_new (NULL);
 	gtk_frame_set_shadow_type (GTK_FRAME (w), GTK_SHADOW_IN);
diff -uN sodipodi-0.33-orig/src/desktop.h sodipodi-0.33/src/desktop.h
--- sodipodi-0.33-orig/src/desktop.h	2003-11-22 23:22:53.000000000 +0100
+++ sodipodi-0.33/src/desktop.h	2003-12-26 22:41:37.000000000 +0100
@@ -137,6 +137,9 @@
 
         GtkWidget *mbtn;
 
+	/* CINELERRA export button */
+	GtkWidget *exbtn;
+
 	GtkWidget *hscrollbar, *vscrollbar;
 
 	/* Rulers */
diff -uN sodipodi-0.33-orig/src/main.c sodipodi-0.33/src/main.c
--- sodipodi-0.33-orig/src/main.c	2003-11-26 23:41:53.000000000 +0100
+++ sodipodi-0.33/src/main.c	2003-12-26 22:41:37.000000000 +0100
@@ -78,6 +78,8 @@
 
 #include "helper/sp-intl.h"
 
+#include "cinelerra.h" // CINELERRA
+
 #ifndef HAVE_BIND_TEXTDOMAIN_CODESET
 #define bind_textdomain_codeset(p,c)
 #endif
@@ -101,7 +103,8 @@
 	SP_ARG_EXPORT_SVG,
 	SP_ARG_SLIDESHOW,
 	SP_ARG_BITMAP_ICONS,
-	SP_ARG_LAST
+	SP_ARG_LAST,
+	CIN_ARG_EXPORT_FILE //CINELERRA export file
 };
 #endif
 
@@ -160,6 +163,9 @@
 	{"bitmap-icons", 'i', POPT_ARG_NONE, &sp_bitmap_icons, SP_ARG_BITMAP_ICONS,
 	 N_("Prefer bitmap (xpm) icons to SVG ones"),
 	 NULL},
+/* CINELERRA cmd line addition */
+	{"cinelerra-export-file", 0, POPT_ARG_STRING, &Cinelerra.exportfile,
+	 CIN_ARG_EXPORT_FILE, N_("Cinelerra export file"), NULL}, 
 	POPT_AUTOHELP POPT_TABLEEND
 };
 #else
@@ -207,7 +213,9 @@
 		    !strcmp (argv[i], "--help")) {
 			use_gui = FALSE;
 			break;
-		} else if (!strcmp (argv[i], "-x") || !strcmp (argv[i], "--with-gui")) {
+		} else if (!strcmp (argv[i], "-x") ||
+					!strcmp (argv[i], "--with-gui") ||
+					!strncmp (argv[i], "--cinelerra-export-file", 13)) {
 			use_gui = TRUE;
 			break;
 		}
@@ -515,6 +523,31 @@
 				fl = g_slist_append (fl, g_strdup (fn));
 			}
 			break;
+
+/* CINELERRA addition for args */
+		case CIN_ARG_EXPORT_FILE:
+			fn = poptGetOptArg (ctx);
+			if(fn != NULL && strlen(fn) > 0) {
+				gchar *tmp;
+				tmp = (gchar *) g_malloc(strlen(fn) + 5);
+				Cinelerra.exportfile = fn;
+				sprintf(tmp, "%s.svg", fn);
+				Cinelerra.svgfile = tmp;
+			} else {
+				g_error("--cinelerra-export-file found, but no filename!");
+			}
+			break;
+		case SP_ARG_EXPORT_WIDTH:
+			fn = poptGetOptArg(ctx);
+			if(fn != NULL)
+				Cinelerra.width = fn;
+			break;
+		case SP_ARG_EXPORT_HEIGHT:
+			fn = poptGetOptArg(ctx);
+			if(fn != NULL)
+				Cinelerra.height = fn;
+			break;
+/* END CINELERRA addition for args */
 		default:
 			break;
 		}
diff -uN sodipodi-0.33-orig/src/verbs.c sodipodi-0.33/src/verbs.c
--- sodipodi-0.33-orig/src/verbs.c	2003-11-16 22:26:01.000000000 +0100
+++ sodipodi-0.33/src/verbs.c	2003-12-26 22:41:37.000000000 +0100
@@ -51,6 +51,9 @@
 
 #include "verbs.h"
 
+/* CINELERRA */
+#include "cinelerra.h"
+
 static void sp_verbs_init (void);
 
 static SPAction *verb_actions = NULL;
@@ -362,12 +365,25 @@
 	}
 }
 
+static void
+sp_verb_action_cinelerra_perform (SPAction *action, void *data)
+{
+	switch((int) data) {
+		case SP_VERB_CINELERRA_EXPORT: 
+			cin_export(NULL, NULL, NULL);
+			break; 
+		default:
+			break;
+	}
+}
+
 static SPActionEventVector action_file_vector = {{NULL}, sp_verb_action_file_perform, NULL, NULL, sp_verb_action_set_shortcut};
 static SPActionEventVector action_edit_vector = {{NULL}, sp_verb_action_edit_perform, NULL, NULL, sp_verb_action_set_shortcut};
 static SPActionEventVector action_object_vector = {{NULL}, sp_verb_action_object_perform, NULL, NULL, sp_verb_action_set_shortcut};
 static SPActionEventVector action_ctx_vector = {{NULL}, sp_verb_action_ctx_perform, NULL, NULL, sp_verb_action_set_shortcut};
 static SPActionEventVector action_zoom_vector = {{NULL}, sp_verb_action_zoom_perform, NULL, NULL, sp_verb_action_set_shortcut};
 static SPActionEventVector action_dialog_vector = {{NULL}, sp_verb_action_dialog_perform, NULL, NULL, sp_verb_action_set_shortcut};
+static SPActionEventVector action_cinelerra_vector = {{NULL}, sp_verb_action_cinelerra_perform, NULL, NULL, sp_verb_action_set_shortcut};
 
 /* This one is from selection-chemistry */
 static SPActionEventVector action_selection_vector = {{NULL}, sp_selection_action_perform, NULL, NULL, sp_verb_action_set_shortcut};
@@ -379,6 +395,7 @@
 #define SP_VERB_IS_CONTEXT(v) ((v >= SP_VERB_CONTEXT_SELECT) && (v <= SP_VERB_CONTEXT_DROPPER))
 #define SP_VERB_IS_ZOOM(v) ((v >= SP_VERB_ZOOM_IN) && (v <= SP_VERB_ZOOM_SELECTION))
 #define SP_VERB_IS_DIALOG(v) ((v >= SP_VERB_DIALOG_DISPLAY) && (v <= SP_VERB_DIALOG_ITEM))
+#define SP_VERB_IS_CINELERRA(v) (v == SP_VERB_CINELERRA_EXPORT)
 
 typedef struct {
 	unsigned int code;
@@ -466,6 +483,8 @@
 	{SP_VERB_DIALOG_TEXT, "Dialogtext", N_("Text and Font"), N_("Text editing and font settings"), "object_font"},
 	{SP_VERB_DIALOG_XML_EDITOR, "DialogXMLEditor", N_("XML Editor"), N_("XML Editor"), NULL},
 	{SP_VERB_DIALOG_ITEM, "DialogItem", N_("Item Properties"), N_("Item properties"), NULL},
+	/* CINELERRA */
+	{SP_VERB_CINELERRA_EXPORT, "CinelerraExport", N_("Cinelerra Export"), N_("Cinelerra Export"), NULL},
 	/* Footer */
 	{SP_VERB_LAST, NULL, NULL, NULL, NULL}
 };
@@ -514,6 +533,14 @@
 						       (NRObjectEventVector *) &action_dialog_vector,
 						       sizeof (SPActionEventVector),
 						       (void *) v);
+		} else if (SP_VERB_IS_CINELERRA (v)) { /* CINELERRA */
+			if(Cinelerra.exportfile != NULL ) { /* Only if somone has used --cinelerra-export-file */
+				nr_active_object_add_listener ((NRActiveObject *) &verb_actions[v],
+									 (NRObjectEventVector *) &action_cinelerra_vector,
+      	                   sizeof (SPActionEventVector),
+         	                (void *) v);
+			}
+
 		}
 	}
 }
diff -uN sodipodi-0.33-orig/src/verbs.h sodipodi-0.33/src/verbs.h
--- sodipodi-0.33-orig/src/verbs.h	2003-11-16 01:07:56.000000000 +0100
+++ sodipodi-0.33/src/verbs.h	2003-12-26 22:41:37.000000000 +0100
@@ -92,6 +92,8 @@
 	SP_VERB_DIALOG_TEXT,
 	SP_VERB_DIALOG_XML_EDITOR,
 	SP_VERB_DIALOG_ITEM,
+	/* CINELERRA */
+	SP_VERB_CINELERRA_EXPORT,
 	/* Footer */
 	SP_VERB_LAST
 };
--- sodipodi-0.33-orig/src/Makefile.am	2003-11-23 15:25:21.000000000 +0100
+++ sodipodi-0.33/src/Makefile.am	2003-12-26 22:41:37.000000000 +0100
@@ -89,6 +89,7 @@
 	sp-namedview.c sp-namedview.h \
 	sp-guide.c sp-guide.h \
 	\
+	cinelerra.c cinelerra.h \
 	view.c view.h \
 	svg-view.c svg-view.h \
 	selection.c selection.h \
--- sodipodi-0.33-orig/src/shortcuts.c	2003-11-16 01:07:56.000000000 +0100
+++ sodipodi-0.33/src/shortcuts.c	2003-12-28 09:56:34.000000000 +0100
@@ -100,6 +100,10 @@
 	sp_shortcut_set_verb (SP_SHORTCUT_CONTROL_MASK | GDK_K, SP_VERB_SELECTION_COMBINE, TRUE);
 	sp_shortcut_set_verb (SP_SHORTCUT_SHIFT_MASK | SP_SHORTCUT_CONTROL_MASK | GDK_k, SP_VERB_SELECTION_BREAK_APART, TRUE);
 	sp_shortcut_set_verb (SP_SHORTCUT_SHIFT_MASK | SP_SHORTCUT_CONTROL_MASK | GDK_K, SP_VERB_SELECTION_BREAK_APART, TRUE);
+       /* CINELERRA */
+        sp_shortcut_set_verb (SP_SHORTCUT_SHIFT_MASK | SP_SHORTCUT_CONTROL_MASK | GDK_e, SP_VERB_CINELERRA_EXPORT, TRUE);
+        sp_shortcut_set_verb (SP_SHORTCUT_SHIFT_MASK | SP_SHORTCUT_CONTROL_MASK | GDK_E, SP_VERB_CINELERRA_EXPORT, TRUE);
+
 }
 
 static GHashTable *scdict = NULL;
