[gsharp-cvs] CVS update: gsharp/buffer.lisp gsharp/gui.lisp gsharp/packages.lisp

Robert Strandh rstrandh at common-lisp.net
Tue Nov 1 00:23:29 UTC 2005


Update of /project/gsharp/cvsroot/gsharp
In directory common-lisp.net:/tmp/cvs-serv29573

Modified Files:
	buffer.lisp gui.lisp packages.lisp 
Log Message:
Removed the function MAKE-INITIALIZED-SEGMENT

Date: Tue Nov  1 01:23:27 2005
Author: rstrandh

Index: gsharp/buffer.lisp
diff -u gsharp/buffer.lisp:1.18 gsharp/buffer.lisp:1.19
--- gsharp/buffer.lisp:1.18	Mon Oct 31 22:16:03 2005
+++ gsharp/buffer.lisp	Tue Nov  1 01:23:26 2005
@@ -745,19 +745,18 @@
    (buffer :initform nil :initarg :buffer :accessor buffer)
    (layers :initform '() :initarg :layers :accessor layers)))
 
-(defmethod initialize-instance :after ((s segment) &rest args)
+(defmethod initialize-instance :after ((s segment) &rest args &key staff)
   (declare (ignore args))
-  (loop for layer in (layers s)
-	do (setf (segment layer) s)))
+  (with-slots (layers) s
+    (when (null layers)
+      (assert (not (null staff)))
+      (push (make-layer "Default layer" staff) layers))
+    (loop for layer in layers
+	  do (setf (segment layer) s))))
 
 (defmethod print-object :after ((s segment) stream)
   (format stream ":layers ~W " (layers s)))
 
-(defun make-initialized-segment (staff)
-  (let ((segment (make-instance 'segment)))
-    (add-layer (make-layer "Default layer" staff) segment)
-    segment))
-
 (defun read-segment-v3 (stream char n)
   (declare (ignore char n))
   (apply #'make-instance 'segment (read-delimited-list #\] stream t)))
@@ -861,12 +860,9 @@
     (format stream ":staves ~W :segments ~W :min-width ~W :spacing-style ~W :right-edge ~W :left-offset ~W :left-margin ~W "
 	    staves segments min-width spacing-style right-edge left-offset left-margin)))
 
-(defun make-empty-buffer ()
-  (make-instance 'buffer))
-
 (defun make-initialized-buffer ()
-  (let ((buffer (make-empty-buffer)))
-    (add-segment (make-initialized-segment (car (staves buffer))) buffer 0)
+  (let ((buffer (make-instance 'buffer)))
+    (add-segment (make-instance 'segment :staff (car (staves buffer))) buffer 0)
     buffer))
 
 (defun read-buffer-v3 (stream char n)
@@ -911,7 +907,7 @@
       (setf segments (delete segment segments :test #'eq))
       ;; make sure there is one segment left
       (unless segments
-	(add-segment (make-initialized-segment (car (staves buffer))) buffer 0)))
+	(add-segment (make-instance 'segment :staff (car (staves buffer))) buffer 0)))
     (setf buffer nil)))
 
 (define-condition staff-already-in-buffer (gsharp-condition) ()


Index: gsharp/gui.lisp
diff -u gsharp/gui.lisp:1.34 gsharp/gui.lisp:1.35
--- gsharp/gui.lisp:1.34	Mon Oct 31 22:16:04 2005
+++ gsharp/gui.lisp	Tue Nov  1 01:23:26 2005
@@ -367,13 +367,13 @@
 
 (define-gsharp-command (com-insert-segment-before :name t) ()
   (let ((cursor (cursor *application-frame*)))
-    (insert-segment-before (make-initialized-segment (car (staves (buffer *application-frame*))))
+    (insert-segment-before (make-instance 'segment :staff (car (staves (buffer *application-frame*))))
 			   cursor)
     (backward-segment cursor)))
 
 (define-gsharp-command (com-insert-segment-after :name t) ()
   (let ((cursor (cursor *application-frame*)))
-    (insert-segment-after (make-initialized-segment (car (staves (buffer *application-frame*))))
+    (insert-segment-after (make-instance 'segment :staff (car (staves (buffer *application-frame*))))
 			  cursor)
     (forward-segment cursor)))
 


Index: gsharp/packages.lisp
diff -u gsharp/packages.lisp:1.20 gsharp/packages.lisp:1.21
--- gsharp/packages.lisp:1.20	Mon Oct 31 22:16:04 2005
+++ gsharp/packages.lisp	Tue Nov  1 01:23:26 2005
@@ -55,10 +55,9 @@
 	   #:slice
 	   #:segment #:slices #:sliceno
 	   #:head #:body #:tail #:make-layer #:buffer
-	   #:make-empty-buffer #:make-initialized-buffer 
+	   #:make-initialized-buffer 
 	   #:layers #:nb-layers #:layerno
 	   #:add-layer #:remove-layer #:segment
-	   #:make-initialized-segment
 	   #:segments #:nb-segments #:segmentno #:staves
 	   #:find-staff #:add-segment #:remove-segment
 	   #:add-staff-before-staff #:add-staff-after-staff




More information about the Gsharp-cvs mailing list