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

Robert Strandh rstrandh at common-lisp.net
Mon Oct 31 19:55:31 UTC 2005


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

Modified Files:
	buffer.lisp gui.lisp packages.lisp 
Log Message:
Removed MAKE-CLEF in favor of MAKE-INSTANCE 'CLEF 

Date: Mon Oct 31 20:55:30 2005
Author: rstrandh

Index: gsharp/buffer.lisp
diff -u gsharp/buffer.lisp:1.13 gsharp/buffer.lisp:1.14
--- gsharp/buffer.lisp:1.13	Mon Oct 31 20:01:16 2005
+++ gsharp/buffer.lisp	Mon Oct 31 20:55:30 2005
@@ -35,23 +35,24 @@
 
 (defclass clef (gsharp-object name-mixin)
   ((print-character :allocation :class :initform #\K)
-   (lineno :reader lineno :initarg :lineno :initform nil)))
+   (lineno :reader lineno :initarg :lineno
+	   :type (or (integer 2 6) null))))
 
+(defmethod initialize-instance :after ((c clef) &rest args)
+  (declare (ignore args))
+  (with-slots (lineno name) c
+    (check-type name (member :treble :bass :c :percussion))
+    (unless (slot-boundp c 'lineno)
+      (setf lineno
+	    (ecase name
+	      (:treble 2)
+	      (:bass 6)
+	      (:c 4)
+	      (:percussion 3))))))
+  
 (defmethod print-object :after ((c clef) stream)
   (format stream ":lineno ~W " (lineno c)))
 
-(defun make-clef (name &optional lineno)
-  (declare (type (member :treble :bass :c :percussion) name)
-	   (type (or (integer 2 6) null) lineno))
-  (make-instance 'clef
-		 :name name
-		 :lineno (or lineno
-			     (ecase name
-			       (:treble 2)
-			       (:bass 6)
-			       (:c 4)
-			       (:percussion 3)))))
-
 (defun read-clef-v3 (stream char n)
   (declare (ignore char n))
   (apply #'make-instance 'clef (read-delimited-list #\] stream t)))
@@ -81,7 +82,7 @@
 (defmethod print-object :after ((s fiveline-staff) stream)
   (format stream ":clef ~W :keysig ~W " (clef s) (keysig s)))
 
-(defun make-fiveline-staff (name &optional (clef (make-clef :treble)))
+(defun make-fiveline-staff (name &optional (clef (make-instance 'clef :name :treble)))
   (make-instance 'fiveline-staff :name name :clef clef))
 
 (defun read-fiveline-staff-v3 (stream char n)


Index: gsharp/gui.lisp
diff -u gsharp/gui.lisp:1.29 gsharp/gui.lisp:1.30
--- gsharp/gui.lisp:1.29	Mon Oct 31 19:24:39 2005
+++ gsharp/gui.lisp	Mon Oct 31 20:55:30 2005
@@ -923,7 +923,7 @@
   (let ((staff (accept 'score-pane:fiveline-staff :prompt "Set clef of staff"))
 	(type (accept 'clef-type :prompt "Type of clef"))
 	(line (accept 'integer :prompt "Line of clef")))
-    (setf (clef staff) (make-clef type line))))
+    (setf (clef staff) (make-instance 'clef :name type :lineno line))))
 
 (define-gsharp-command com-higher ()
   (incf (last-note (input-state *application-frame*)) 7))
@@ -1052,7 +1052,7 @@
     (ecase (accept 'staff-type :prompt "Type")
       (:fiveline (let ((clef (accept 'clef-type :prompt "Clef type of new staff"))
 		       (line (accept 'integer :prompt "Line of clef")))
-		   (make-fiveline-staff name (make-clef clef line))))
+		   (make-fiveline-staff name (make-instance 'clef :name clef :lineno line))))
       (:lyrics (make-lyrics-staff name)))))
 
 (define-gsharp-command (com-insert-staff-before :name t) ()


Index: gsharp/packages.lisp
diff -u gsharp/packages.lisp:1.15 gsharp/packages.lisp:1.16
--- gsharp/packages.lisp:1.15	Mon Oct 31 19:24:39 2005
+++ gsharp/packages.lisp	Mon Oct 31 20:55:30 2005
@@ -36,7 +36,7 @@
 (defpackage :gsharp-buffer
   (:use :common-lisp :gsharp-utilities)
   (:shadow #:rest)
-  (:export #:clef #:make-clef #:name #:lineno
+  (:export #:clef #:name #:lineno
 	   #:staff #:fiveline-staff #:make-fiveline-staff
 	   #:lyrics-staff #:make-lyrics-staff
 	   #:gsharp-condition




More information about the Gsharp-cvs mailing list