[drgeo/goffice: 69/82] add goffice subdirectory and mime type management. test for goffice and



commit ee1ddb28012758d6e2d118ffff0345bed4d84f0c
Author: Jean Brefort <jean brefort normalesup org>
Date:   Sat Feb 4 07:51:32 2006 +0000

    add goffice subdirectory and mime type management. test for goffice and
    
    2006-02-04  Jean Brefort  <jean brefort normalesup org>
    
    	* Makefile.am: add goffice subdirectory and mime type management.
    	* configure.ac: test for goffice and mime type stuff.
    	* drgeo.xml.in: new mime type.
    	* drgenius_config.cc: moved to geo directroy.
    	* drgenius_config.h: ditto.
    	* drgenius_main.cc: make it compile with new architecture.
    	* drgenius_mdi.cc: now derives from drgeoMDI base class.
    	* drgenius_mdi.h: ditto.
    	* drgenius_view.cc: moved to geo directroy.
    	* drgenius_view.h: ditto.
    	* drgeo_exportLatexDialog.cc: ditto.
    	* drgeo_exportLatexDialog.h: ditto.
    	* editor_view.cc: ditto.
    	* editor_view.h: ditto.
    	* geo_view.cc: ditto.
    	* geo_view.h: ditto.
    	* geo/Makefile.am: add new files.
    	* geo/drgeo_config.cc: moved from topsrcdir and renamed.
    	* geo/drgeo_config.h: ditto.
    	* geo/drgeo_control.cc: make it compile with new architecture.
    	* geo/drgeo_dialog.cc: ditto.
    	* geo/drgeo_exportLatexDialog.cc: moved from topsrcdir.
    	* geo/drgeo_exportLatexDialog.h: ditto.
    	* geo/drgeo_figure.cc: make it compile with new architecture.
    	* geo/drgeo_figure.h: ditto.
    	* geo/drgeo_geometricObject.cc: ditto.
    	* geo/drgeo_gtkdrawable.cc: ditto.
    	* geo/drgeo_gtkhelpers.cc: ditto.
    	* geo/drgeo_gtkmacro.cc: ditto.
    	* geo/drgeo_gtkproperty.cc: ditto.
    	* geo/drgeo_gtkstyle.cc: ditto.
    	* geo/drgeo_macro.cc: ditto.
    	* geo/drgeo_mdi.cc: new virtual mdi base class.
    	* geo/drgeo_mdi.h: ditto.
    	* geo/drgeo_menu.cc: make it compile with new architecture.
    	* geo/drgeo_point.cc: ditto.
    	* geo/drgeo_scm_helper.cc: ditto.
    	* geo/drgeo_scm_interface.cc: ditto.
    	* geo/drgeo_view.cc: moved from topsrcdir and renamed.
    	* geo/drgeo_view.h: ditto.
    	* geo/editor_view.cc: moved from topsrcdir.
    	* geo/editor_view.h: ditto.
    	* geo/geo_view.cc: ditto.
    	* geo/geo_view.h: ditto.
    	* geo/macro.cc: make it compile with new architecture.
    	* goffice/Makefile.am: new goffice plugin.
    	* goffice/drgeo.cc: ditto.
    	* goffice/goffice_mdi.cc: ditto.
    	* goffice/goffice_mdi.h: ditto.
    	* goffice/plugin.xml.in: ditto.

 ChangeLog                                          |   54 +++++++-
 Makefile.am                                        |   40 +++---
 configure.ac                                       |   25 +++
 drgenius_main.cc                                   |    3 +-
 drgenius_mdi.cc                                    |   59 ++++----
 drgenius_mdi.h                                     |   35 ++--
 drgeo.xml.in                                       |    9 +
 geo/Makefile.am                                    |   21 ++-
 drgenius_config.cc => geo/drgeo_config.cc          |    6 +-
 drgenius_config.h => geo/drgeo_config.h            |    6 +-
 geo/drgeo_control.cc                               |    4 +-
 geo/drgeo_dialog.cc                                |    4 +-
 .../drgeo_exportLatexDialog.cc                     |    8 +-
 .../drgeo_exportLatexDialog.h                      |    4 +-
 geo/drgeo_figure.cc                                |    2 +-
 geo/drgeo_figure.h                                 |    2 +-
 geo/drgeo_geometricObject.cc                       |    2 +-
 geo/drgeo_gtkdrawable.cc                           |    4 +-
 geo/drgeo_gtkhelpers.cc                            |    6 +-
 geo/drgeo_gtkmacro.cc                              |    6 +-
 geo/drgeo_gtkproperty.cc                           |    4 +-
 geo/drgeo_gtkstyle.cc                              |    4 +-
 geo/drgeo_macro.cc                                 |    4 +-
 editor_view.h => geo/drgeo_mdi.cc                  |   29 +---
 editor_view.h => geo/drgeo_mdi.h                   |   38 +++--
 geo/drgeo_menu.cc                                  |    7 +-
 geo/drgeo_point.cc                                 |    3 +-
 geo/drgeo_scm_helper.cc                            |    4 +-
 geo/drgeo_scm_interface.cc                         |    5 +-
 drgenius_view.cc => geo/drgeo_view.cc              |   36 ++--
 drgenius_view.h => geo/drgeo_view.h                |   12 +-
 editor_view.cc => geo/editor_view.cc               |    2 +-
 editor_view.h => geo/editor_view.h                 |    4 +-
 geo_view.cc => geo/geo_view.cc                     |    4 +-
 geo_view.h => geo/geo_view.h                       |    4 +-
 geo/macro.cc                                       |    4 +-
 goffice/Makefile.am                                |   32 ++++
 goffice/drgeo.cc                                   |  163 ++++++++++++++++++++
 editor_view.h => goffice/goffice_mdi.cc            |   61 ++++++--
 editor_view.h => goffice/goffice_mdi.h             |   38 +++--
 goffice/plugin.xml.in                              |   23 +++
 41 files changed, 556 insertions(+), 225 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 0925f16..f2751e4 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -27,6 +27,59 @@
 
 	* configure.ac: Add "zh_HK" to ALL_LINGUAS.
 
+2006-02-04  Jean Brefort  <jean brefort normalesup org>
+
+	* Makefile.am: add goffice subdirectory and mime type management.
+	* configure.ac: test for goffice and mime type stuff.
+	* drgeo.xml.in: new mime type.
+	* drgenius_config.cc: moved to geo directroy.
+	* drgenius_config.h: ditto.
+	* drgenius_main.cc: make it compile with new architecture.
+	* drgenius_mdi.cc: now derives from drgeoMDI base class.
+	* drgenius_mdi.h: ditto.
+	* drgenius_view.cc: moved to geo directroy.
+	* drgenius_view.h: ditto.
+	* drgeo_exportLatexDialog.cc: ditto.
+	* drgeo_exportLatexDialog.h: ditto.
+	* editor_view.cc: ditto.
+	* editor_view.h: ditto.
+	* geo_view.cc: ditto.
+	* geo_view.h: ditto.
+	* geo/Makefile.am: add new files.
+	* geo/drgeo_config.cc: moved from topsrcdir and renamed.
+	* geo/drgeo_config.h: ditto.
+	* geo/drgeo_control.cc: make it compile with new architecture.
+	* geo/drgeo_dialog.cc: ditto.
+	* geo/drgeo_exportLatexDialog.cc: moved from topsrcdir.
+	* geo/drgeo_exportLatexDialog.h: ditto.
+	* geo/drgeo_figure.cc: make it compile with new architecture.
+	* geo/drgeo_figure.h: ditto.
+	* geo/drgeo_geometricObject.cc: ditto.
+	* geo/drgeo_gtkdrawable.cc: ditto.
+	* geo/drgeo_gtkhelpers.cc: ditto.
+	* geo/drgeo_gtkmacro.cc: ditto.
+	* geo/drgeo_gtkproperty.cc: ditto.
+	* geo/drgeo_gtkstyle.cc: ditto.
+	* geo/drgeo_macro.cc: ditto.
+	* geo/drgeo_mdi.cc: new virtual mdi base class.
+	* geo/drgeo_mdi.h: ditto.
+	* geo/drgeo_menu.cc: make it compile with new architecture.
+	* geo/drgeo_point.cc: ditto.
+	* geo/drgeo_scm_helper.cc: ditto.
+	* geo/drgeo_scm_interface.cc: ditto.
+	* geo/drgeo_view.cc: moved from topsrcdir and renamed.
+	* geo/drgeo_view.h: ditto.
+	* geo/editor_view.cc: moved from topsrcdir.
+	* geo/editor_view.h: ditto.
+	* geo/geo_view.cc: ditto.
+	* geo/geo_view.h: ditto.
+	* geo/macro.cc: make it compile with new architecture.
+	* goffice/Makefile.am: new goffice plugin.
+	* goffice/drgeo.cc: ditto.
+	* goffice/goffice_mdi.cc: ditto.
+	* goffice/goffice_mdi.h: ditto.
+	* goffice/plugin.xml.in: ditto.
+
 2005-11-09  Hilaire Fernandes  <hilaire lilliput>
 
 	* drgenius_config.cc (initPreferencesBox): The property box must
@@ -2699,4 +2752,3 @@ Fri Jan 02 21:21:27 1998  George Lebl  <jirka 5z com>
 
 	* calc.c: added #include "funclib.h", and it will add all the
 	  funclib functions the first time evalexpr is run.
-
diff --git a/Makefile.am b/Makefile.am
index 6f11f31..5b9f233 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -2,7 +2,7 @@ helpdir = $(datadir)/drgeo/help
 gladedir = $(datadir)/drgeo/glade
 scmdir = $(datadir)/drgeo/scm
 appicondir = $(datadir)/pixmaps
-SUBDIRS = po geo examples icons glade scm plugin encode
+SUBDIRS = po geo examples icons glade scm plugin encode goffice
 
 INCLUDES = \
 	-DGNOMELOCALEDIR=\""$(datadir)/locale"\" 	\
@@ -21,40 +21,35 @@ drgeo_SOURCES = \
 	drgenius_main.cc	\
 	drgenius_mdi.cc		\
 	drgenius_mdi.h		\
-	drgenius_config.cc	\
-	drgenius_config.h	\
 	xmlinclude.h		\
 	drgenius_help.h		\
 	drgeo_adaptDialog.h	\
 	drgeo_adaptDialog.cc	\
-	drgenius_view.cc	\
-	drgenius_view.h		\
-	geo_view.cc		\
-	geo_view.h		\
-	editor_view.h		\
-	editor_view.cc		\
 	drgeo_init.h		\
 	drgeo_init.cc		\
 	drgeo_printer.h		\
-	drgeo_printer.cc	\
-	drgeo_exportLatexDialog.h	\
-	drgeo_exportLatexDialog.cc
+	drgeo_printer.cc
 
 drgeo_LDFLAGS = -export-dynamic
 
 drgeo_LDADD = \
-   $(top_builddir)/geo/libgeo.a \
+   $(top_builddir)/geo/libgeo.la \
 	$(INTLLIBS) \
 	$(DRGEO_LIBS) \
 	$(GUILE_LDFLAGS) \
 	-lcrypt 		
 #	-lefence
 
+mimedir = $(datadir)/mime/packages
+mime_in_files = drgeo.xml.in
+mime_DATA = $(mime_in_files:.xml.in=.xml)
+ INTLTOOL_XML_RULE@
+
 EXTRA_DIST = \
 	drgeo.spec.in $(desktop_in_files) TODO README NEWS AUTHORS COPYING \
-	intltool-extract.in intltool-merge.in intltool-update.in
+	intltool-extract.in intltool-merge.in intltool-update.in $(mime_in_files)
 
-CLEANFILES = *~ core
+CLEANFILES = *~ core drgeo.xml
 
 desktopdir = $(datadir)/applications
 desktop_in_files = drgeo.desktop.in
@@ -64,11 +59,14 @@ desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
 dist-hook:
 	cp drgeo.spec $(distdir)
 
+DISTCHECK_CONFIGURE_FLAGS = --disable-update-databases
 
+install-data-hook:
+if UPDATE_DATABASES
+	update-mime-database $(datadir)/mime
+endif
 
-
-
-
-
-
-
+uninstall-hook:
+if UPDATE_DATABASES
+	update-mime-database $(datadir)/mime
+endif
diff --git a/configure.ac b/configure.ac
index 703af6c..4fc52f8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -19,6 +19,14 @@ AC_PROG_LN_S
 AC_PROG_MAKE_SET
 AC_PROG_LIBTOOL
 
+AC_ARG_ENABLE([update-databases],
+	AC_HELP_STRING([--disable-update-databases],[do not run the update-desktop-database or update-mime-database utilities, mostly useful for package maintainers]),[
+	update_databases=$enableval
+	],[
+	update_databases=yes]
+)
+AM_CONDITIONAL(UPDATE_DATABASES,test "$update_databases" = "yes")
+
 dnl AM_PROG_LIBTOOL
 dnl AM_PATH_GLIB(1.2.0,,,gmodule)
 
@@ -33,6 +41,22 @@ AC_SUBST(DRGEO_LIBS)
 GUILE_PROGS
 
 dnl **********************************************************************
+dnl * CHECK FOR GOFFICE STUFF						 *
+dnl **********************************************************************
+
+PKG_CHECK_MODULES(GODRGEO, libgoffice-0.3 >= 0.3.0, [go_has_component=yes], [go_has_component=no])
+if test $go_has_component = yes; then
+	AC_SUBST(GODRGEO_CFLAGS)
+	AC_SUBST(GODRGEO_LIBS)
+	GOFFICE_PLUGINS_DIR=`pkg-config --variable=GOffice_plugins_dir libgoffice-0.3`
+	AC_SUBST(GOFFICE_PLUGINS_DIR)
+	echo "yes"
+else
+	echo "no"
+fi
+AM_CONDITIONAL(WITH_GOFFICE,test "$go_has_component" = "yes")
+
+dnl **********************************************************************
 dnl * 	DEFINE EXTRA 
 dnl **********************************************************************
 
@@ -77,5 +101,6 @@ encode/Makefile
 plugin/Makefile
 plugin/drgeo/Makefile
 plugin/drgeo/progs/Makefile
+goffice/Makefile
 ])
 AC_OUTPUT
diff --git a/drgenius_main.cc b/drgenius_main.cc
index b4ebca9..03b1457 100644
--- a/drgenius_main.cc
+++ b/drgenius_main.cc
@@ -31,7 +31,7 @@
 
 #include "drgeo_init.h"
 #include "drgenius_mdi.h"
-#include "drgenius_config.h"
+#include "drgeo_config.h"
 #include "drgeo_scm_api.h"
 #include "drgeo_scm_interface.h"
 #include "drgenius_help.h"
@@ -212,4 +212,3 @@ main (int argc, char *argv[])
   gh_enter (argc, argv, main_prog);
   return 0;
 }
-
diff --git a/drgenius_mdi.cc b/drgenius_mdi.cc
index 87be3dd..97d98e8 100644
--- a/drgenius_mdi.cc
+++ b/drgenius_mdi.cc
@@ -29,10 +29,9 @@
 #include "drgeo_gtkdrawable.h"
 #include "geo_view.h"
 #include "editor_view.h"
-#include "drgenius_config.h"
+#include "drgeo_config.h"
 #include "drgeo_adaptDialog.h"
 #include "macro.h"
-#include "drgenius_config.h"
 #include "drgeo_gtkhelpers.h"
 #include "drgeo_scm_helper.h"
 #include "drgeo_tool.h"
@@ -52,7 +51,7 @@ extern drgeniusMDI *mdi;
 extern gboolean texmacsMode;
 extern const char* drgeniusHelp[];
 
-drgeniusMDI::drgeniusMDI ()
+drgeniusMDI::drgeniusMDI (): drgeoMDI ()
 {
   GladeXML *xml;
   GtkWidget *w;
@@ -100,13 +99,17 @@ drgeniusMDI::drgeniusMDI ()
   setNullView ();
 }
 
+drgeniusMDI::~drgeniusMDI ()
+{
+}
+
 void 
 drgeniusMDI::newGeometricDocument (xmlNodePtr tree)
 {
-  drgeniusView *tmpView;
+  drgeoView *tmpView;
   GList *tmpList;
 
-  tmpView = (drgeniusView *) new geoView (tree);
+  tmpView = (drgeoView *) new geoView (tree);
   tmpList = addView (tmpView);
 
   if (tmpList != NULL)
@@ -119,10 +122,10 @@ drgeniusMDI::newGeometricDocument (xmlNodePtr tree)
 void 
 drgeniusMDI::newTextDocument (xmlNodePtr tree)
 {
-  drgeniusView *tmpView;
+  drgeoView *tmpView;
   GList *tmpList;
 
-  tmpView = (drgeniusView *) new editorView (tree);
+  tmpView = (drgeoView *) new editorView (tree);
   tmpList = addView (tmpView);
 
   if (tmpList != NULL)
@@ -212,13 +215,13 @@ drgeniusMDI::evaluateScmFigure (gchar *filename)
 }
 
 void
-drgeniusMDI::closeView (drgeniusView *v)
+drgeniusMDI::closeView (drgeoView *v)
 {
   p_viewList = removeView (v);
   reconcile_grayout_widget ();
 }
 void
-drgeniusMDI::renameView (drgeniusView *v, const gchar *newName)
+drgeniusMDI::renameView (drgeoView *v, const gchar *newName)
 {
   GtkWidget *w;
   gint n;
@@ -237,7 +240,7 @@ drgeniusMDI::renameView (drgeniusView *v, const gchar *newName)
   gtk_label_set_text (GTK_LABEL (w), newName);
 }
 
-drgeniusView *
+drgeoView *
 drgeniusMDI::activeView ()
 {
   return p_activeView;
@@ -349,7 +352,7 @@ drgeniusMDI::reconcile_grayout_widget ()
 }
 
 GList * 
-drgeniusMDI::addView (drgeniusView *v)
+drgeniusMDI::addView (drgeoView *v)
 {
   GtkWidget *label, *w;
   int curr_page;
@@ -402,7 +405,7 @@ drgeniusMDI::addView (drgeniusView *v)
 }
 
 GList *
-drgeniusMDI::removeView (drgeniusView *v)
+drgeniusMDI::removeView (drgeoView *v)
 {
   gint n;
   GList * tmp;
@@ -428,7 +431,7 @@ drgeniusMDI::removeView (drgeniusView *v)
   else
     {
       n = gtk_notebook_get_current_page (GTK_NOTEBOOK (p_noteBook));
-      p_activeView = (drgeniusView *) g_list_nth_data (tmp, n);
+      p_activeView = (drgeoView *) g_list_nth_data (tmp, n);
     }
 
   return tmp;
@@ -463,12 +466,12 @@ drgeniusMDI::setNullView ()
 void
 drgeniusMDI::setActiveView (gint page)
 {
-  p_activeView = (drgeniusView *) g_list_nth_data (p_viewList, page);
+  p_activeView = (drgeoView *) g_list_nth_data (p_viewList, page);
   reconcile_grayout_widget ();
 }
 
 void 
-drgeniusMDI::setActiveView (drgeniusView *v)
+drgeniusMDI::setActiveView (drgeoView *v)
 {
   gint page;
 
@@ -567,7 +570,7 @@ on_drgeoMain_delete_event (GtkWidget *widget, GdkEvent *event,
   GtkWidget *d;
   gint r;
 
-  drgeniusView *view;
+  drgeoView *view;
   if (texmacsMode)
     {
       // just send a encapsulated postscript version of the current
@@ -1014,7 +1017,7 @@ void
 save_as_cb (GtkWidget * widget, gpointer data)
 {
   GtkWidget *dialog;
-  drgeniusView *child;
+  drgeoView *child;
 
   child = mdi->activeView ();
 
@@ -1047,7 +1050,7 @@ save_as_cb (GtkWidget * widget, gpointer data)
 void
 save_cb (GtkWidget * widget, gpointer data)
 {
-  drgeniusView *child;
+  drgeoView *child;
 
   child = mdi->activeView ();
 
@@ -1209,7 +1212,7 @@ save_multiple_cb (GtkWidget * widget, gpointer data)
   GtkTreeIter iter;
   GList *childList;
   gint childNumber, i = 0;
-  drgeniusView *child;
+  drgeoView *child;
   GtkWidget *tree, *dialog;
   gchar *text[2], *dataName[] = {
     N_("Interactive 2D Figure"),
@@ -1255,7 +1258,7 @@ save_multiple_cb (GtkWidget * widget, gpointer data)
   
   while (i < childNumber)
     {
-      if ((child = (drgeniusView *) g_list_nth_data (childList, i)) == NULL)
+      if ((child = (drgeoView *) g_list_nth_data (childList, i)) == NULL)
 	break;
       text[1] = child->name ();
       switch (child->childType ())
@@ -1298,7 +1301,7 @@ save_multiple_cb (GtkWidget * widget, gpointer data)
 void 
 print_figure_cb (GtkWidget * widget, gpointer data)
 {
-  drgeniusView *child;
+  drgeoView *child;
   GladeXML *xml;  
   GtkWidget *w;
   GtkOptionMenu *list;
@@ -1389,7 +1392,7 @@ print_view (gint reply, GtkOptionMenu *list, int printerCount,
 void
 export_figure_to_flydraw_cb (GtkWidget * widget, gpointer data)
 {
-  drgeniusView *child;
+  drgeoView *child;
   gchar *fileName;
   gchar **split;
   GtkWidget *dlg;
@@ -1441,7 +1444,7 @@ export_figure_to_flydraw_cb (GtkWidget * widget, gpointer data)
 void
 export_figure_to_latex_cb (GtkWidget * widget, gpointer data)
 {
-  drgeniusView *child;
+  drgeoView *child;
   gchar *fileName;
   gchar **split;
   GtkWidget *dlg;
@@ -1493,7 +1496,7 @@ export_figure_to_latex_cb (GtkWidget * widget, gpointer data)
 void
 export_figure_to_postscript_cb (GtkWidget * widget, gpointer data)
 {
-  drgeniusView *child;
+  drgeoView *child;
   gchar *fileName;
   gchar **split;
   GtkWidget *dlg;
@@ -1546,7 +1549,7 @@ export_figure_to_postscript_cb (GtkWidget * widget, gpointer data)
 void
 export_figure_to_png_cb (GtkWidget * widget, gpointer data)
 {
-  drgeniusView *child;
+  drgeoView *child;
   gchar *fileName;
   gchar **split;
   GtkWidget *dlg;
@@ -1657,7 +1660,7 @@ rename_view_string (gint reply, GtkWidget *entry)
 void
 customize_interface_cb (GtkWidget * widget, gpointer data)
 {
-  drgeniusView *child;
+  drgeoView *child;
 
   child = mdi->activeView ();
 
@@ -1867,7 +1870,7 @@ saveSelectedRow (GtkTreeModel *model, GtkTreePath *path,
     {
      gtk_tree_model_get (model, iter, 
 			 2, &item, -1);
-       ((drgeniusView *) item )->saveNode (tree->xmlRootNode);
+       ((drgeoView *) item )->saveNode (tree->xmlRootNode);
     }
   else if (!strcmp (type, _("Macro-construction")))
     saveMacro (name, tree->xmlRootNode);
@@ -1898,7 +1901,7 @@ on_notebook_switchPage (GtkNotebook *notebook, GtkNotebookPage *page,
 
 void on_windowsMenu_cb (GtkWidget * widget, gpointer v)
 {
-  mdi->setActiveView ((drgeniusView *) v);
+  mdi->setActiveView ((drgeoView *) v);
 }
 
 void on_macroMenu_cb (GtkWidget * widget, gpointer v)
diff --git a/drgenius_mdi.h b/drgenius_mdi.h
index a667cf7..5ebf084 100644
--- a/drgenius_mdi.h
+++ b/drgenius_mdi.h
@@ -29,37 +29,38 @@
 #include <gmodule.h>
 
 #include "drgeo_printer.h"
+#include "drgeo_mdi.h"
 #include "xmlinclude.h"
-#include "drgenius_view.h"
+#include "drgeo_view.h"
 
 // This class handle the multi document interface
 
-class drgeniusMDI
+class drgeniusMDI: public drgeoMDI
 {
  public:
   drgeniusMDI ();
-  ~drgeniusMDI ();
-  void newGeometricDocument (xmlNodePtr tree);
+  virtual ~drgeniusMDI ();
+  virtual void newGeometricDocument (xmlNodePtr tree);
   void newTextDocument (xmlNodePtr tree);
   void openSession (gchar *filename);
   void evaluateScmFigure (gchar *filenalme);
-  void closeView (drgeniusView *v);
-  void renameView (drgeniusView *v, const gchar *newName);
-  drgeniusView * activeView ();
+  void closeView (drgeoView *v);
+  virtual void renameView (drgeoView *v, const gchar *newName);
+  virtual drgeoView * activeView ();
   GList * viewList ();
-  void reconcile_grayout_undo ();
+  virtual void reconcile_grayout_undo ();
   void reconcile_grayout_widget ();
-  GList *addView (drgeniusView *v);
-  GList *removeView (drgeniusView *v);
-  void setMessage (const gchar * msg);
+  GList *addView (drgeoView *v);
+  GList *removeView (drgeoView *v);
+  virtual void setMessage (const gchar * msg);
   void setNullView ();
   void setActiveView (gint page);
-  void setActiveView (drgeniusView *v);
-  GtkWindow * mainWindow ();
-  void setTransientDialog (GtkWindow * dialog);
+  void setActiveView (drgeoView *v);
+  virtual GtkWindow * mainWindow ();
+  virtual void setTransientDialog (GtkWindow * dialog);
   GtkWidget *getMenuItem (gint n);
-  void addMacroMenuItem (gchar *name, gchar *description);
-  void setMacroMenuItemDescription (gchar *name, gchar *description);
+  virtual void addMacroMenuItem (gchar *name, gchar *description);
+  virtual void setMacroMenuItemDescription (gchar *name, gchar *description);
  private:
   GtkWidget *p_undoButton, *p_undoItem, *p_redoButton, 
     *p_redoItem, *p_gridItem, *p_gridItemSc, *p_renameItem, *p_renameItemSc, *p_customUiItem,
@@ -69,7 +70,7 @@ class drgeniusMDI
     *p_windowsMenu, *p_macroMenu, *p_animationMenu;
   GtkTooltips *p_tooltipsMacro;
   GtkWindow *p_mainWindow;
-  drgeniusView *p_activeView;
+  drgeoView *p_activeView;
   GList *p_viewList;
   
 };
diff --git a/drgeo.xml.in b/drgeo.xml.in
new file mode 100644
index 0000000..5e86256
--- /dev/null
+++ b/drgeo.xml.in
@@ -0,0 +1,9 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info";>
+  <mime-type type="application/x-drgeo">
+    <_comment>Geometric figure</_comment>
+    <magic priority="70">
+      <match type="string" value="&lt;drgenius&gt;&lt;drgeo" offset="0:64"/>
+    </magic>
+  </mime-type>
+</mime-info>
diff --git a/geo/Makefile.am b/geo/Makefile.am
index 47d6003..bc016a9 100644
--- a/geo/Makefile.am
+++ b/geo/Makefile.am
@@ -1,5 +1,6 @@
 gladedir = $(datadir)/drgeo/glade
 helpdir = $(datadir)/drgeo/help
+scmdir = $(datadir)/drgeo/scm
 encodedir = $(datadir)/drgeo/encode
 
 SUBDIRS = 
@@ -11,12 +12,13 @@ INCLUDES = \
 	-DDRGEO_HELPDIR=\""$(helpdir)"\"		\
 	-DDRGEO_GLADEDIR=\""$(gladedir)"\"		\
 	-DDRGEO_ENCODEDIR=\""$(encodedir)"\"		\
+	-DDRGEO_SCMDIR=\""$(scmdir)"\"			\
 	-I$(includedir) 				\
 	$(DRGEO_CFLAGS)				
 
-noinst_LIBRARIES = libgeo.a
+lib_LTLIBRARIES = libgeo.la
 
-libgeo_a_SOURCES = \
+libgeo_la_SOURCES = \
 	drgeo_drawable.cc drgeo_drawable.h 			\
 	drgeo_gtkdrawable.cc drgeo_gtkdrawable.h 		\
 	drgeo_latexdrawable.cc drgeo_latexdrawable.h 		\
@@ -40,6 +42,17 @@ libgeo_a_SOURCES = \
 	var_decl.h 						\
 	xml.cc xml.h						\
 	drgeo_drgeoStyle.h					\
+	drgeo_mdi.h						\
+	drgeo_config.cc	\
+	drgeo_config.h	\
+	drgeo_view.cc	\
+	drgeo_view.h	\
+	geo_view.cc		\
+	geo_view.h		\
+	editor_view.h	\
+	editor_view.cc	\
+	drgeo_exportLatexDialog.h	\
+	drgeo_exportLatexDialog.cc		\
 	drgeo_drgeoVector.h drgeo_drgeoVector.cc		\
 	drgeo_geometricObject.h drgeo_geometricObject.cc	\
 	drgeo_point.h drgeo_point.cc				\
@@ -66,9 +79,9 @@ libgeo_a_SOURCES = \
 	drgeo_scm_interface.h drgeo_scm_interface.cc		\
 	drgeo_scm_api.h drgeo_scm_api.cc			\
 	drgeo_scm_helper.h drgeo_scm_helper.cc			\
-	drgeo_gtkhelpers.h drgeo_gtkhelpers.cc
+	drgeo_gtkhelpers.h drgeo_gtkhelpers.cc		\
+	drgeo_mdi.cc
 
 CLEANFILES = $(BUILT_SOURCES)
 
 EXTRA_DIST = DevelopersFAQ
-
diff --git a/drgenius_config.cc b/geo/drgeo_config.cc
similarity index 99%
rename from drgenius_config.cc
rename to geo/drgeo_config.cc
index a4de7bb..7f27a4a 100644
--- a/drgenius_config.cc
+++ b/geo/drgeo_config.cc
@@ -24,13 +24,13 @@
 
 #include <libintl.h>
 #include "define.h"
-#include "drgenius_config.h"
+#include "drgeo_config.h"
 #include "drgeo_gtkhelpers.h"
 #include "drgeo_drgeoStyle.h"
-#include "drgenius_mdi.h"
+#include "drgeo_mdi.h"
 
 extern int numericPrecision;
-extern drgeniusMDI *mdi;
+extern drgeoMDI *mdi;
 extern const char* drgeniusHelp[];
 static GtkDialog *propertyBox;
 static GladeXML *xmlPropertyBox;
diff --git a/drgenius_config.h b/geo/drgeo_config.h
similarity index 96%
rename from drgenius_config.h
rename to geo/drgeo_config.h
index c5c09fb..fa6c043 100644
--- a/drgenius_config.h
+++ b/geo/drgeo_config.h
@@ -22,8 +22,8 @@
  */
 
 
-#ifndef DRGENIUS_CONFIG_H
-#define DRGENIUS_CONFIG_H
+#ifndef DRGEO_CONFIG_H
+#define DRGEO_CONFIG_H
 
 #include <guile/gh.h>
 #include <glade/glade.h>
@@ -67,4 +67,4 @@ extern "C" {
   G_MODULE_EXPORT void on_psFile_changed (GtkWidget * widget, gpointer data);
 }
 
-#endif /* DRGENIUS_CONFIG_H */
+#endif /* DRGEO_CONFIG_H */
diff --git a/geo/drgeo_control.cc b/geo/drgeo_control.cc
index 1ea7225..bee4571 100644
--- a/geo/drgeo_control.cc
+++ b/geo/drgeo_control.cc
@@ -21,11 +21,11 @@
  */
 
 
-#include "drgenius_mdi.h"
+#include "drgeo_mdi.h"
 #include "drgeo_control.h"
 #include "drgeo_gtkdrawable.h"
 
-extern drgeniusMDI *mdi;
+extern drgeoMDI *mdi;
 
 drgeoControl::drgeoControl (geoView *view)
 {
diff --git a/geo/drgeo_dialog.cc b/geo/drgeo_dialog.cc
index 0c22e8c..f80cb52 100644
--- a/geo/drgeo_dialog.cc
+++ b/geo/drgeo_dialog.cc
@@ -28,9 +28,9 @@
 #include "drgeo_drawable.h"
 #include "drgeo_gtkdrawable.h"
 #include "drgeo_numeric.h"
-#include "drgenius_mdi.h"
+#include "drgeo_mdi.h"
 
-extern drgeniusMDI *mdi;
+extern drgeoMDI *mdi;
 
 // To enter free value
 static GtkWidget *drgeoEditDialog = NULL, *drgeoEntry;
diff --git a/drgeo_exportLatexDialog.cc b/geo/drgeo_exportLatexDialog.cc
similarity index 98%
rename from drgeo_exportLatexDialog.cc
rename to geo/drgeo_exportLatexDialog.cc
index 0f10694..4361e84 100644
--- a/drgeo_exportLatexDialog.cc
+++ b/geo/drgeo_exportLatexDialog.cc
@@ -1,9 +1,9 @@
 #include "drgeo_exportLatexDialog.h"
-#include "drgenius_mdi.h"
-#include "geo/drgeo_gtkdrawable.h"
-#include "geo/drgeo_point.h"
+#include "drgeo_mdi.h"
+#include "drgeo_gtkdrawable.h"
+#include "drgeo_point.h"
 
-extern drgeniusMDI *mdi;
+extern drgeoMDI *mdi;
 
 exportLatexdlg::exportLatexdlg (drgeoFigure *fig, liste_elem *figureList,
 				int size_mode, int document_mode)
diff --git a/drgeo_exportLatexDialog.h b/geo/drgeo_exportLatexDialog.h
similarity index 97%
rename from drgeo_exportLatexDialog.h
rename to geo/drgeo_exportLatexDialog.h
index 4e77caa..1f5d06b 100644
--- a/drgeo_exportLatexDialog.h
+++ b/geo/drgeo_exportLatexDialog.h
@@ -25,8 +25,8 @@
 
 #include <glade/glade.h>
 
-#include "drgenius_mdi.h"
-#include "geo/drgeo_figure.h"
+#include "drgeo_mdi.h"
+#include "drgeo_figure.h"
 
 #define LATEXDLG_AUTOMATIC 0
 #define LATEXDLG_FIXED 1
diff --git a/geo/drgeo_figure.cc b/geo/drgeo_figure.cc
index d206db9..1d59126 100644
--- a/geo/drgeo_figure.cc
+++ b/geo/drgeo_figure.cc
@@ -47,7 +47,7 @@
 #include "drgeo_buildObject.h"
 #include "drgeo_dialog.h"
 #include "traite.h"
-#include "../drgeo_exportLatexDialog.h" //modif
+#include "drgeo_exportLatexDialog.h" //modif
 
 extern struct
 {
diff --git a/geo/drgeo_figure.h b/geo/drgeo_figure.h
index 8fbd278..e147c3b 100644
--- a/geo/drgeo_figure.h
+++ b/geo/drgeo_figure.h
@@ -36,7 +36,7 @@ class ScmInterface;
 #include "mode_obj.h"
 #include "drgeo_drawable.h"
 #include "drgeo_command.h"
-#include "drgenius_config.h"
+#include "drgeo_config.h"
 #include "drgeo_scm_interface.h"
 
 #define DRGEO_TOOLS_NUMBER 35
diff --git a/geo/drgeo_geometricObject.cc b/geo/drgeo_geometricObject.cc
index e9bce75..d5a8b8b 100644
--- a/geo/drgeo_geometricObject.cc
+++ b/geo/drgeo_geometricObject.cc
@@ -25,7 +25,7 @@
 
 #include "drgeo_geometricObject.h"
 #include "liste_elem.h"
-#include "drgenius_config.h"
+#include "drgeo_config.h"
 
 static char *colorName[DRGEO_NUMBER_COLOR] = {
   "Black", "DarkGrey", "Grey", "White", "DarkGreen", "Green", "DarkBlue",
diff --git a/geo/drgeo_gtkdrawable.cc b/geo/drgeo_gtkdrawable.cc
index 2d2c67e..2fb7cc7 100644
--- a/geo/drgeo_gtkdrawable.cc
+++ b/geo/drgeo_gtkdrawable.cc
@@ -29,9 +29,9 @@
 #include "drgeo_gtkproperty.h"
 #include "drgeo_gtkdrawable.h"
 #include "drgeo_menu.h"
-#include "drgenius_mdi.h"
+#include "drgeo_mdi.h"
 
-extern drgeniusMDI *mdi;
+extern drgeoMDI *mdi;
 
 #define WIDGET_HEIGHT(w) (((w)->allocation).height)
 #define WIDGET_WIDTH(w) (((w)->allocation).width)
diff --git a/geo/drgeo_gtkhelpers.cc b/geo/drgeo_gtkhelpers.cc
index 8c62743..dbb0cff 100644
--- a/geo/drgeo_gtkhelpers.cc
+++ b/geo/drgeo_gtkhelpers.cc
@@ -26,13 +26,13 @@
 #include <libintl.h>
 
 #include "drgeo_gtkhelpers.h"
-#include "drgenius_config.h"
-#include "drgenius_mdi.h"
+#include "drgeo_config.h"
+#include "drgeo_mdi.h"
 
 #define  _(x)  gettext (x)
 #define N_(x)  x
 
-extern drgeniusMDI* mdi;
+extern drgeoMDI* mdi;
 
 gchar * 
 gtk_text_view_get_text (GtkTextView *view)
diff --git a/geo/drgeo_gtkmacro.cc b/geo/drgeo_gtkmacro.cc
index 3ac0355..4fe1dcd 100644
--- a/geo/drgeo_gtkmacro.cc
+++ b/geo/drgeo_gtkmacro.cc
@@ -28,9 +28,9 @@
 #include "drgeo_numeric.h"
 #include "drgeo_command.h"
 #include "drgeo_gtkhelpers.h"
-#include "drgenius_mdi.h"
+#include "drgeo_mdi.h"
 
-extern drgeniusMDI *mdi;
+extern drgeoMDI *mdi;
 
 // Help functions
 
@@ -606,5 +606,3 @@ drgeoGtkMacroPlayDialog::previousWidget ()
 {
   return GTK_BUTTON (p_previous);
 }
-
-
diff --git a/geo/drgeo_gtkproperty.cc b/geo/drgeo_gtkproperty.cc
index 4afb4fe..2926da0 100644
--- a/geo/drgeo_gtkproperty.cc
+++ b/geo/drgeo_gtkproperty.cc
@@ -31,9 +31,9 @@
 #include "drgeo_point.h"
 #include "drgeo_script.h"
 #include "drgeo_gtkhelpers.h"
-#include "drgenius_mdi.h"
+#include "drgeo_mdi.h"
 
-extern drgeniusMDI *mdi;
+extern drgeoMDI *mdi;
 extern const char * drgeniusHelp[];
 
 // Callback for the free point property dialog
diff --git a/geo/drgeo_gtkstyle.cc b/geo/drgeo_gtkstyle.cc
index ae475ee..539869a 100644
--- a/geo/drgeo_gtkstyle.cc
+++ b/geo/drgeo_gtkstyle.cc
@@ -29,9 +29,9 @@
 #include "drgeo_numeric.h"
 #include "drgeo_command.h"
 #include "drgeo_gtkhelpers.h"
-#include "drgenius_mdi.h"
+#include "drgeo_mdi.h"
 
-extern drgeniusMDI *mdi;
+extern drgeoMDI *mdi;
 extern const char * drgeniusHelp[];
 
 // Event handlers.
diff --git a/geo/drgeo_macro.cc b/geo/drgeo_macro.cc
index 6c44b0f..720a1a1 100644
--- a/geo/drgeo_macro.cc
+++ b/geo/drgeo_macro.cc
@@ -24,9 +24,9 @@
 #include "drgeo_macro.h"
 #include "traite.h"
 #include "define.h"
-#include "drgenius_mdi.h"
+#include "drgeo_mdi.h"
 
-extern drgeniusMDI *mdi;
+extern drgeoMDI *mdi;
 
 
 drgeoMacroBuilder::drgeoMacroBuilder (drgeoFigure * figure)
diff --git a/editor_view.h b/geo/drgeo_mdi.cc
similarity index 62%
copy from editor_view.h
copy to geo/drgeo_mdi.cc
index 812cfec..a984f51 100644
--- a/editor_view.h
+++ b/geo/drgeo_mdi.cc
@@ -1,6 +1,6 @@
 /* Dr Genius an interactive geometry software
- * (C) Copyright Hilaire Fernandes  2003
- * hilaire ofset org 
+ * (C) Copyright Jean Bréfort  2006
+ * jean brefort normalesup org 
  * 
  *
  *
@@ -20,24 +20,13 @@
  * 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#ifndef EDITOR_VIEW_H
-#define EDITOR_VIEW_H
+#include <config.h>
+#include "drgeo_mdi.h"
 
-#include "drgenius_view.h"
-
-class editorView:public drgeniusView
+drgeoMDI::drgeoMDI ()
 {
- public:
-  editorView (xmlNodePtr editorXml);
-  ~editorView ();
-  gboolean saveNode (xmlNodePtr tree);
-  gpointer createWidgetView ();
-  void updateUserInterface () {};
-  GtkWidget * widgetView ();
- private:
-  GtkWidget *p_textView, *p_view;
-};
-
+}
 
-
-#endif /* EDITOR_VIEW_H */
+drgeoMDI::~drgeoMDI ()
+{
+}
diff --git a/editor_view.h b/geo/drgeo_mdi.h
similarity index 51%
copy from editor_view.h
copy to geo/drgeo_mdi.h
index 812cfec..dd929e9 100644
--- a/editor_view.h
+++ b/geo/drgeo_mdi.h
@@ -1,6 +1,6 @@
 /* Dr Genius an interactive geometry software
- * (C) Copyright Hilaire Fernandes  2003
- * hilaire ofset org 
+ * (C) Copyright Jean Bréfort  2006
+ * jean brefort normalesup org 
  * 
  *
  *
@@ -20,24 +20,26 @@
  * 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#ifndef EDITOR_VIEW_H
-#define EDITOR_VIEW_H
+#ifndef DRGEO_MDI_H
+#define DRGEO_MDI_H
 
-#include "drgenius_view.h"
+#include "drgeo_view.h"
 
-class editorView:public drgeniusView
+class drgeoMDI
 {
- public:
-  editorView (xmlNodePtr editorXml);
-  ~editorView ();
-  gboolean saveNode (xmlNodePtr tree);
-  gpointer createWidgetView ();
-  void updateUserInterface () {};
-  GtkWidget * widgetView ();
- private:
-  GtkWidget *p_textView, *p_view;
-};
-
+public:
+	drgeoMDI ();
+	virtual ~drgeoMDI ();
 
+	virtual void renameView (drgeoView *v, const gchar *newName) = 0;
+	virtual drgeoView * activeView () = 0;
+	virtual void setMessage (const gchar * msg) = 0;
+	virtual GtkWindow * mainWindow () = 0;
+	virtual void setTransientDialog (GtkWindow * dialog) = 0;
+	virtual void addMacroMenuItem (gchar *name, gchar *description) = 0;
+	virtual void reconcile_grayout_undo () = 0;
+	virtual void newGeometricDocument (xmlNodePtr tree) = 0;
+	virtual void setMacroMenuItemDescription (gchar *name, gchar *description) = 0;
+};
 
-#endif /* EDITOR_VIEW_H */
+#endif /* DRGEO_MDI_H */
diff --git a/geo/drgeo_menu.cc b/geo/drgeo_menu.cc
index d8dcc17..5ddc812 100644
--- a/geo/drgeo_menu.cc
+++ b/geo/drgeo_menu.cc
@@ -25,9 +25,9 @@
 #include "drgeo_gtkdrawable.h"
 #include "geo_view.h"
 #include "drgeo_control.h"
-#include "drgenius_mdi.h"
+#include "drgeo_mdi.h"
 
-extern drgeniusMDI *mdi;
+extern drgeoMDI *mdi;
 
 drgeoMenu::drgeoMenu (geoView *view):
   drgeoControl (view)
@@ -145,6 +145,3 @@ showGeoMenu (GtkWidget *menu, GdkEvent *event )
   }
   return false;
 }
-
-
-
diff --git a/geo/drgeo_point.cc b/geo/drgeo_point.cc
index 68f4a55..052b0e2 100644
--- a/geo/drgeo_point.cc
+++ b/geo/drgeo_point.cc
@@ -28,7 +28,7 @@
 #include "drgeo_repere.h"
 #include "drgeo_drgeoStyle.h"
 #include "drgeo_drawable.h"
-#include "drgenius_config.h"
+#include "drgeo_config.h"
 
 point::point (drgeoPoint & p, liste_elem & parents, pointType type, gboolean createdFromMacro, liste_elem * figureList):
 geometricObject (createdFromMacro, figureList)
@@ -557,4 +557,3 @@ point::preferedShape (gchar *attr)
   else if (!strcmp (str, "SquarreEmpty"))
     return drgeoPointRecEmpty;
 }
-
diff --git a/geo/drgeo_scm_helper.cc b/geo/drgeo_scm_helper.cc
index 984d696..d561cac 100644
--- a/geo/drgeo_scm_helper.cc
+++ b/geo/drgeo_scm_helper.cc
@@ -25,9 +25,9 @@
 #include <libintl.h>
 #include "define.h"
 #include "drgeo_scm_helper.h"
-#include "drgenius_mdi.h"
+#include "drgeo_mdi.h"
 
-extern drgeniusMDI *mdi;
+extern drgeoMDI *mdi;
 
 static gboolean DGSerror = FALSE;
 
diff --git a/geo/drgeo_scm_interface.cc b/geo/drgeo_scm_interface.cc
index fd5b23a..f5e2edf 100644
--- a/geo/drgeo_scm_interface.cc
+++ b/geo/drgeo_scm_interface.cc
@@ -21,7 +21,7 @@
  * 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include "drgenius_mdi.h"
+#include "drgeo_mdi.h"
 #include "drgeo_scm_interface.h"
 #include "drgeo_scm_helper.h"
 #include "drgeo_point.h"
@@ -36,11 +36,10 @@
 #include "drgeo_numeric.h"
 #include "drgeo_angle.h"
 #include "liste_elem.h"
-#include "drgenius_mdi.h"
 #include "geo_view.h"
 #include "drgeo_gtkdrawable.h"
 
-extern drgeniusMDI *mdi;
+extern drgeoMDI *mdi;
 
 ScmInterface::ScmInterface (drgeoFigure *figure)
 {
diff --git a/drgenius_view.cc b/geo/drgeo_view.cc
similarity index 75%
rename from drgenius_view.cc
rename to geo/drgeo_view.cc
index 12bfa9f..34d35c9 100644
--- a/drgenius_view.cc
+++ b/geo/drgeo_view.cc
@@ -20,9 +20,9 @@
  * 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#include "drgenius_view.h"
+#include "drgeo_view.h"
 
-drgeniusView::drgeniusView (drgeniusViewType type, gboolean save)
+drgeoView::drgeoView (drgeoViewType type, gboolean save)
 {
   this->p_name = NULL;
   this->p_filename = NULL;
@@ -31,15 +31,15 @@ drgeniusView::drgeniusView (drgeniusViewType type, gboolean save)
   this->p_toolbar = NULL;
 }
 
-drgeniusView::
-~drgeniusView ()
+drgeoView::
+~drgeoView ()
 {
   g_free (p_name);
   g_free (p_filename);
 }
 
 gboolean
-drgeniusView::save (gchar *filename)
+drgeoView::save (gchar *filename)
 {
   if (p_supportsSave)
     {
@@ -52,31 +52,31 @@ drgeniusView::save (gchar *filename)
 }
 
 gboolean
-drgeniusView::undo (gint n)
+drgeoView::undo (gint n)
 {
   return false;
 }
 
 gboolean
-drgeniusView::redo (gint n)
+drgeoView::redo (gint n)
 {
   return true;
 }
 
 gboolean
-drgeniusView::undoActive ()
+drgeoView::undoActive ()
 {
   return false;
 }
 
 gboolean
-drgeniusView::redoActive ()
+drgeoView::redoActive ()
 {
   return false;
 }
 
 void 
-drgeniusView::setToolbar (GtkWidget *w)
+drgeoView::setToolbar (GtkWidget *w)
 {
   if (this->p_toolbar)
     gtk_object_destroy (GTK_OBJECT (this->p_toolbar));
@@ -84,44 +84,44 @@ drgeniusView::setToolbar (GtkWidget *w)
 }
 
 GtkWidget *
-drgeniusView::toolbar ()
+drgeoView::toolbar ()
 {
   return p_toolbar;
 }
 
 gboolean
-drgeniusView::supportsSave ()
+drgeoView::supportsSave ()
 {
   return p_supportsSave;
 }
 
-drgeniusViewType
-drgeniusView::childType ()
+drgeoViewType
+drgeoView::childType ()
 {
   return p_childType;
 }
 
 gchar *
-drgeniusView::filename ()
+drgeoView::filename ()
 {
   return p_filename;
 }
 
 gchar *
-drgeniusView::name ()
+drgeoView::name ()
 {
   return p_name;
 }
 
 void 
-drgeniusView::setName (const gchar *name)
+drgeoView::setName (const gchar *name)
 {
   g_free (p_name);
   p_name = g_strdup (name);
 }
 
 void 
-drgeniusView::setFilename (const gchar *filename)
+drgeoView::setFilename (const gchar *filename)
 {
   g_free (p_filename);
   p_filename = g_strdup (filename);
diff --git a/drgenius_view.h b/geo/drgeo_view.h
similarity index 90%
rename from drgenius_view.h
rename to geo/drgeo_view.h
index d13f7e1..7e39a99 100644
--- a/drgenius_view.h
+++ b/geo/drgeo_view.h
@@ -28,17 +28,17 @@
 #include "xmlinclude.h"
 
 
-enum drgeniusViewType
+enum drgeoViewType
 {
   FIGURE_CHILD,
   EDITOR_CHILD
 };
 
-class drgeniusView
+class drgeoView
 {
  public:
-  drgeniusView (drgeniusViewType type, gboolean save);
-  virtual ~ drgeniusView ();
+  drgeoView (drgeoViewType type, gboolean save);
+  virtual ~ drgeoView ();
   virtual gboolean save (gchar *filename);
   virtual gboolean saveNode (xmlNodePtr tree) = 0;
   virtual gboolean undo (gint n);
@@ -55,13 +55,13 @@ class drgeniusView
   virtual GtkWidget * widgetView () = 0;
 
   gboolean supportsSave ();
-  drgeniusViewType childType ();
+  drgeoViewType childType ();
   gchar * filename ();
   gchar * name ();
   void setName (const gchar *name);
   void setFilename (const gchar *name);
  protected:
-  drgeniusViewType p_childType;
+  drgeoViewType p_childType;
   gboolean p_supportsSave;
   gchar *p_filename, *p_name;
   GtkWidget *p_toolbar;
diff --git a/editor_view.cc b/geo/editor_view.cc
similarity index 98%
rename from editor_view.cc
rename to geo/editor_view.cc
index ad15e4d..dc06ea1 100644
--- a/editor_view.cc
+++ b/geo/editor_view.cc
@@ -30,7 +30,7 @@
 #define N_(x)  x
 
 editorView::editorView (xmlNodePtr editorXml):
-  drgeniusView (EDITOR_CHILD, true)
+  drgeoView (EDITOR_CHILD, true)
 {
   static gint counter = 1;
 
diff --git a/editor_view.h b/geo/editor_view.h
similarity index 94%
copy from editor_view.h
copy to geo/editor_view.h
index 812cfec..6f2b94c 100644
--- a/editor_view.h
+++ b/geo/editor_view.h
@@ -23,9 +23,9 @@
 #ifndef EDITOR_VIEW_H
 #define EDITOR_VIEW_H
 
-#include "drgenius_view.h"
+#include "drgeo_view.h"
 
-class editorView:public drgeniusView
+class editorView:public drgeoView
 {
  public:
   editorView (xmlNodePtr editorXml);
diff --git a/geo_view.cc b/geo/geo_view.cc
similarity index 99%
rename from geo_view.cc
rename to geo/geo_view.cc
index 5a8e048..162d72e 100644
--- a/geo_view.cc
+++ b/geo/geo_view.cc
@@ -25,7 +25,7 @@
 #include "drgeo_menu.h"
 #include "drgeo_toolbar.h"
 #include "drgeo_gtkdrawable.h"
-#include "drgenius_config.h"
+#include "drgeo_config.h"
 
 extern gchar *toolName[];
 
@@ -37,7 +37,7 @@ descriptionSelected_cb (GtkTreeSelection *selection, drgeoFigure *figure);
 
 
 geoView::geoView (xmlNodePtr drgeoXml):
-  drgeniusView (FIGURE_CHILD, true)
+  drgeoView (FIGURE_CHILD, true)
 {
   static gint counter = 1;
   drgeoGtkDrawable *drawable;
diff --git a/geo_view.h b/geo/geo_view.h
similarity index 96%
rename from geo_view.h
rename to geo/geo_view.h
index c965d12..906ec8e 100644
--- a/geo_view.h
+++ b/geo/geo_view.h
@@ -23,7 +23,7 @@
 #ifndef GEO_VIEW_H
 #define GEO_VIEW_H
 
-#include "drgenius_view.h"
+#include "drgeo_view.h"
 #include "drgeo_geometricObject.h"
 
 class drgeoGtkDrawable;
@@ -45,7 +45,7 @@ enum drgeoZoomFactor
   };
 
 
-class geoView:public drgeniusView
+class geoView:public drgeoView
 {
  public:
   geoView (xmlNodePtr drgeoXml);
diff --git a/geo/macro.cc b/geo/macro.cc
index d3ac689..95dcd33 100644
--- a/geo/macro.cc
+++ b/geo/macro.cc
@@ -38,9 +38,9 @@
 #include "drgeo_polygon.h"
 #include "drgeo_script.h"
 #include "traite.h"
-#include "drgenius_mdi.h"
+#include "drgeo_mdi.h"
 
-extern drgeniusMDI *mdi;
+extern drgeoMDI *mdi;
 
 
 /* Helper function to load/save a XML macro */
diff --git a/goffice/Makefile.am b/goffice/Makefile.am
new file mode 100644
index 0000000..83fdba3
--- /dev/null
+++ b/goffice/Makefile.am
@@ -0,0 +1,32 @@
+if WITH_GOFFICE
+
+goffice_drgeo_LTLIBRARIES = drgeo.la
+goffice_drgeodir = $(GOFFICE_PLUGINS_DIR)/drgeo
+drgeo_la_LDFLAGS = -module -avoid-version -no-undefined
+drgeo_la_LIBADD = \
+	$(top_builddir)/geo/libgeo.la \
+	@GODRGEO_LIBS@
+xml_DATA = $(xml_in_files:.xml.in=.xml)
+
+else
+
+goffice_drgeo_LTLIBRARIES =
+goffice_drgeodir =
+xml_DATA =
+
+endif
+
+AM_CPPFLAGS = -I$(top_srcdir) -DGNOMELOCALEDIR=\"$(datadir)/locale\" @GODRGEO_CFLAGS@
+
+drgeo_la_SOURCES =	\
+		drgeo.cc	\
+		goffice_mdi.cc	\
+		goffice_mdi.h
+
+xml_in_files = plugin.xml.in
+xmldir	 = $(goffice_drgeodir)
+
+ INTLTOOL_XML_RULE@
+
+EXTRA_DIST = $(xml_in_files) $(drgeo_la_SOURCES)
+DISTCLEANFILES = $(xml_in_files:.xml.in=.xml)
diff --git a/goffice/drgeo.cc b/goffice/drgeo.cc
new file mode 100644
index 0000000..d84e0df
--- /dev/null
+++ b/goffice/drgeo.cc
@@ -0,0 +1,163 @@
+/* 
+ * DrGeo GOffice component
+ * drgeo.cc
+ *
+ * Copyright (C) 2006
+ *
+ * Developed by Jean Bréfort <jean brefort normalesup org>
+ *
+ * This program is free software; you can redistribute it and/or 
+ * modify it under the terms of the GNU General Public License as 
+ * published by the Free Software Foundation; either version 2 of the
+ * License, or (at your option) any later version.
+ *
+ * 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 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
+ */
+ 
+#include <config.h>
+#include <drgenius_help.h>
+#include <geo/drgeo_figure.h>
+#include "goffice_mdi.h"
+
+#include <libxml/tree.h>
+#ifdef _
+#	undef _
+#	undef N_
+#endif
+#include <glib/gi18n-lib.h>
+#include <goffice/component/goffice-component.h>
+#include <goffice/component/go-component.h>
+#include <gsf/gsf-impl-utils.h>
+#include <goffice/app/module-plugin-defs.h>
+
+extern "C" {
+
+gofficeMDI *mdi;	
+
+extern GOPluginModuleDepend const go_plugin_depends [] = {
+    { "goffice", GOFFICE_API_VERSION }
+};
+extern GOPluginModuleHeader const go_plugin_header =
+	{ GOFFICE_MODULE_PLUGIN_MAGIC_NUMBER, G_N_ELEMENTS (go_plugin_depends) };
+
+typedef struct
+{
+	GOComponent parent;
+	drgeoFigure *figure;
+
+} GODrGeoComponent;
+
+typedef GOComponentClass GODrGeoComponentClass;
+
+#define GO_DRGEO_COMPONENT_TYPE	(go_drgeo_component_get_type ())
+#define GO_DRGEO_COMPONENT(o)		(G_TYPE_CHECK_INSTANCE_CAST ((o), GO_DRGEO_COMPONENT_TYPE, GODrGeoComponent))
+#define GO_IS_DRGEO_COMPONENT(o)	(G_TYPE_CHECK_INSTANCE_TYPE ((o), GO_DRGEO_COMPONENT_TYPE))
+
+GType go_drgeo_component_get_type (void);
+
+static GObjectClass *godrgeo_parent_klass;
+
+static gboolean
+go_drgeo_component_get_data (GOComponent *component, gpointer *data, int *length,
+									void (**clearfunc) (gpointer))
+{
+	GODrGeoComponent *godrgeo = GO_DRGEO_COMPONENT (component);
+	bool result = true;
+	return result;
+}
+
+static void
+go_drgeo_component_set_data (GOComponent *component, char const *data, int length)
+{
+	GODrGeoComponent *godrgeo = GO_DRGEO_COMPONENT (component);
+	xmlDocPtr xml;
+	if (!(xml = xmlParseMemory(data, length)) ||
+		xml->children == NULL ||
+		strcmp((char*)xml->children->name, "drgenius")) {
+		if (xml)
+			xmlFreeDoc (xml);
+		return;
+	}
+	godrgeo->figure = new drgeoFigure (xml->children->children);
+	xmlFreeDoc (xml);
+}
+
+static void
+go_drgeo_component_draw (GOComponent *component, int width_pixels, int height_pixels)
+{
+	GODrGeoComponent *godrgeo = GO_DRGEO_COMPONENT (component);
+}
+
+static void
+go_drgeo_component_print (GOComponent *component, GnomePrintContext *gpc,
+												double width, double height)
+{
+	GODrGeoComponent *godrgeo = GO_DRGEO_COMPONENT (component);
+}
+
+
+static void
+go_drgeo_component_finalize (GObject *obj)
+{
+	GODrGeoComponent *godrgeo = GO_DRGEO_COMPONENT (obj);
+	G_OBJECT_CLASS (godrgeo_parent_klass)->finalize (obj);
+}
+
+static void
+go_drgeo_component_init (GOComponent *component)
+{
+	GODrGeoComponent *godrgeo = GO_DRGEO_COMPONENT (component);
+	component->resizable = false;
+	component->editable = false;
+	component->needs_window = true;
+	godrgeo->figure = NULL;
+}
+
+static void
+go_drgeo_component_class_init (GOComponentClass *klass)
+{
+	GObjectClass *obj_klass = (GObjectClass *) klass;
+	obj_klass->finalize = go_drgeo_component_finalize;
+
+	godrgeo_parent_klass = (GObjectClass*) g_type_class_peek_parent (klass);
+
+	klass->get_data = go_drgeo_component_get_data;
+	klass->set_data = go_drgeo_component_set_data;
+	klass->draw = go_drgeo_component_draw;
+	klass->print = go_drgeo_component_print;
+//	klass->edit = go_drgeo_component_edit;
+}
+
+GSF_DYNAMIC_CLASS (GODrGeoComponent, go_drgeo_component,
+	go_drgeo_component_class_init, go_drgeo_component_init,
+	GO_COMPONENT_TYPE)
+
+/*************************************************************************************/
+
+G_MODULE_EXPORT void
+go_plugin_init (GOPlugin *plugin, GOCmdContext *cc)
+{
+	bindtextdomain (GETTEXT_PACKAGE, GNOMELOCALEDIR);
+#ifdef ENABLE_NLS
+	bind_textdomain_codeset (GETTEXT_PACKAGE, "UTF-8");
+#endif
+	GTypeModule *module = go_plugin_get_type_module (plugin);
+	go_drgeo_component_register_type (module);
+	mdi = new gofficeMDI ();
+}
+
+G_MODULE_EXPORT void
+go_plugin_shutdown (GOPlugin *plugin, GOCmdContext *cc)
+{
+	delete mdi;
+}
+
+}	// extern "C"
diff --git a/editor_view.h b/goffice/goffice_mdi.cc
similarity index 50%
copy from editor_view.h
copy to goffice/goffice_mdi.cc
index 812cfec..4309b16 100644
--- a/editor_view.h
+++ b/goffice/goffice_mdi.cc
@@ -1,6 +1,6 @@
 /* Dr Genius an interactive geometry software
- * (C) Copyright Hilaire Fernandes  2003
- * hilaire ofset org 
+ * (C) Copyright Jean Bréfort  2006
+ * jean brefort normalesup org 
  * 
  *
  *
@@ -20,24 +20,51 @@
  * 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#ifndef EDITOR_VIEW_H
-#define EDITOR_VIEW_H
+#include <config.h>
+#include "goffice_mdi.h"
 
-#include "drgenius_view.h"
+gofficeMDI::gofficeMDI (): drgeoMDI ()
+{
+}
+
+gofficeMDI::~gofficeMDI ()
+{
+}
+
+void gofficeMDI::renameView (drgeoView *v, const gchar *newName)
+{
+}
+
+drgeoView * gofficeMDI::activeView ()
+{
+	return NULL;
+}
+
+void gofficeMDI::setMessage (const gchar * msg)
+{
+}
+
+GtkWindow * gofficeMDI::mainWindow ()
+{
+	return NULL;
+}
+
+void gofficeMDI::setTransientDialog (GtkWindow * dialog)
+{
+}
 
-class editorView:public drgeniusView
+void gofficeMDI::addMacroMenuItem (gchar *name, gchar *description)
 {
- public:
-  editorView (xmlNodePtr editorXml);
-  ~editorView ();
-  gboolean saveNode (xmlNodePtr tree);
-  gpointer createWidgetView ();
-  void updateUserInterface () {};
-  GtkWidget * widgetView ();
- private:
-  GtkWidget *p_textView, *p_view;
-};
+}
 
+void gofficeMDI::reconcile_grayout_undo ()
+{
+}
 
+void gofficeMDI::newGeometricDocument (xmlNodePtr tree)
+{
+}
 
-#endif /* EDITOR_VIEW_H */
+void gofficeMDI::setMacroMenuItemDescription (gchar *name, gchar *description)
+{
+}
diff --git a/editor_view.h b/goffice/goffice_mdi.h
similarity index 51%
rename from editor_view.h
rename to goffice/goffice_mdi.h
index 812cfec..725fcde 100644
--- a/editor_view.h
+++ b/goffice/goffice_mdi.h
@@ -1,6 +1,6 @@
 /* Dr Genius an interactive geometry software
- * (C) Copyright Hilaire Fernandes  2003
- * hilaire ofset org 
+ * (C) Copyright Jean Bréfort  2006
+ * jean brefort normalesup org 
  * 
  *
  *
@@ -20,24 +20,26 @@
  * 675 Mass Ave, Cambridge, MA 02139, USA.
  */
 
-#ifndef EDITOR_VIEW_H
-#define EDITOR_VIEW_H
+#ifndef GOFFICE_MDI_H
+#define GOFFICE_MDI_H
 
-#include "drgenius_view.h"
+#include <geo/drgeo_mdi.h>
 
-class editorView:public drgeniusView
+class gofficeMDI: public drgeoMDI
 {
- public:
-  editorView (xmlNodePtr editorXml);
-  ~editorView ();
-  gboolean saveNode (xmlNodePtr tree);
-  gpointer createWidgetView ();
-  void updateUserInterface () {};
-  GtkWidget * widgetView ();
- private:
-  GtkWidget *p_textView, *p_view;
-};
-
+public:
+	gofficeMDI ();
+	virtual ~gofficeMDI ();
 
+	virtual void renameView (drgeoView *v, const gchar *newName);
+	virtual drgeoView * activeView ();
+	virtual void setMessage (const gchar * msg);
+	virtual GtkWindow * mainWindow ();
+	virtual void setTransientDialog (GtkWindow * dialog);
+	virtual void addMacroMenuItem (gchar *name, gchar *description);
+	virtual void reconcile_grayout_undo ();
+	virtual void newGeometricDocument (xmlNodePtr tree);
+	virtual void setMacroMenuItemDescription (gchar *name, gchar *description);
+};
 
-#endif /* EDITOR_VIEW_H */
+#endif /* GOFFICE_MDI_H */
diff --git a/goffice/plugin.xml.in b/goffice/plugin.xml.in
new file mode 100644
index 0000000..2bf97bd
--- /dev/null
+++ b/goffice/plugin.xml.in
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<plugin id="GOffice_drgeo">
+	<information>
+		<_name>Component : DrGeo</_name>
+		<_description>Geometrical figures</_description>
+	</information>
+	<loader type="Gnumeric_Builtin:module">
+		<attribute name="module_file" value="drgeo"/>
+	</loader>
+	<services>
+		<service type="component_engine" id="GODrGeoComponent">
+			<information>
+				<_description>Geometrical figures component engine</_description>
+			</information>
+		</service>
+		<service type="component_type" id="GODrGeoComponent">
+			<mime_type name="application/x-drgeo" priority="native"/>
+			<information>
+				<_description>Geometrical figures</_description>
+			</information>
+		</service>
+	</services>
+</plugin>



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