From: janneke <janneke>
Date: Mon, 14 Jun 2004 16:41:09 +0000 (+0000)
Subject: * scm/framework-gnome.scm (output-framework-gnome): Try loading
X-Git-Tag: release/2.3.9^2~122
X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=8489429e7a92072758c21a9ef045665509ee99cd;p=lilypond.git

* scm/framework-gnome.scm (output-framework-gnome): Try loading
gnome modules from non-toplevel.

* lily/ly-module.cc (ly:import-module): Export to ly:.
---

diff --git a/ChangeLog b/ChangeLog
index 4c94a60dca..3f65b6dc6c 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2004-06-14  Jan Nieuwenhuizen  <janneke@gnu.org>
 
+	* scm/framework-gnome.scm (output-framework-gnome): Try loading
+	gnome modules from non-toplevel.
+
+	* lily/ly-module.cc (ly:import-module): Export to ly:.
+
 	* lily/paper-score.cc (process): Do not show progress newline.
 
 	* lily/paper-book.cc (output, classic_output): Show progess
diff --git a/lily/include/ly-module.hh b/lily/include/ly-module.hh
index 9d2e54095e..1862845cde 100644
--- a/lily/include/ly-module.hh
+++ b/lily/include/ly-module.hh
@@ -1,19 +1,17 @@
 /*
   ly-module.hh -- declare  module related helper functions 
 
- source file of the GNU LilyPond music typesetter
+  source file of the GNU LilyPond music typesetter
 
  (c) 2002--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-
  */
-
 #ifndef LY_MODULE_HH
 #define LY_MODULE_HH
 
 #include "lily-guile.hh"
 
 SCM ly_make_anonymous_module (bool safe);
-void ly_import_module (SCM dest, SCM src);
+SCM ly_import_module (SCM dest, SCM src);
 SCM ly_module2alist (SCM mod);
 SCM ly_module_lookup (SCM module, SCM sym);
 SCM ly_modules_lookup (SCM modules, SCM sym, SCM);
diff --git a/lily/ly-module.cc b/lily/ly-module.cc
index 6e344e6077..24ddaf8d7e 100644
--- a/lily/ly-module.cc
+++ b/lily/ly-module.cc
@@ -1,10 +1,9 @@
 /*
   ly-module.cc --  implement guile module stuff.
-  
+
   source file of the GNU LilyPond music typesetter
-  
-  (c) 2002--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 
+  (c) 2002--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "main.hh"
@@ -71,12 +70,14 @@ ly_module_define (void *closure, SCM key, SCM val, SCM result)
 /* Ugh signature of scm_internal_hash_fold () is inaccurate.  */
 typedef SCM (*Hash_cl_func)();
 
-void
-ly_import_module (SCM dest, SCM src)
+LY_DEFINE (ly_import_module, "ly:import-module",
+	   2, 0, 0, (SCM dest, SCM src),
+	   "Import all bindings from module SRC into DEST.")
 {
   SCM_VALIDATE_MODULE (1, src);
   scm_internal_hash_fold ((Hash_cl_func) &ly_module_define, (void*) dest,
 			  SCM_EOL, SCM_MODULE_OBARRAY (src));
+  return SCM_UNDEFINED;
 }
 
 static SCM
diff --git a/scm/framework-gnome.scm b/scm/framework-gnome.scm
index aff36185a8..33c8953224 100644
--- a/scm/framework-gnome.scm
+++ b/scm/framework-gnome.scm
@@ -10,7 +10,50 @@
 (define-public (output-framework-gnome outputter book scopes fields basename)
   (let* ((bookpaper (ly:paper-book-book-paper book))
 	 (pages (list->vector (ly:paper-book-pages book))))
+
+;; try #1
+    (if #f
+	(use-modules 
+	 (gnome gtk)
+	 (gnome gtk gdk-event)
+	 (gnome gw canvas)))
+
+;; try #2
+    ;; waarom maken ze dit nou allemaal toch weer zo moeilijk?
+    ;; is there any documentation about modules for guile 1.6.4?
+    (map (lambda (x) (ly:import-module (current-module) (resolve-module x)))
+	 '((gnome gtk)
+	   (gnome gtk gdk-event)
+	   (gnome gw canvas)))
+
+    (if #f
+	(let* ((window (make <gtk-window> #:type 'toplevel)))
+	  (write window)))
     
+    ;; try #3
+    (if #f
+	(let ((the-module-previously-known-as-current-module (current-module)))
+	  (map (lambda (x) (ly:import-module
+			    the-module-previously-known-as-current-module
+			    (resolve-module x)))
+	       '((gnome gtk)
+		 (gnome gtk gdk-event)
+		 (gnome gw canvas)))
+	  
+	  (eval '(let* ((window (make <gtk-window> #:type 'toplevel)))
+		   (write window))
+		the-module-previously-known-as-current-module)))
+
+   ;;try #4
+    (if #f
+	(eval '(use-modules
+		(gnome gtk)
+		(gnome gtk gdk-event)
+		(gnome gw canvas))
+	      (let* ((window (make <gtk-window> #:type 'toplevel)))
+		(write window))
+	      (current-module)))
+
     (ly:outputter-dump-stencil
      outputter
      (ly:make-stencil (list 'main outputter bookpaper pages)
diff --git a/scm/output-gnome.scm b/scm/output-gnome.scm
index e5701a1c22..c1d6e4954d 100644
--- a/scm/output-gnome.scm
+++ b/scm/output-gnome.scm
@@ -308,8 +308,6 @@ lilypond-bin -fgnome input/simple-song.ly
 		     (list line col file)
 		     #f)))
 
-
-
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;; gnome stuff  --- move to framework-gnome
 (define (dump-page number)